diff --git a/Cargo.lock b/Cargo.lock index b7be6cb..1ab1c2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,26 +44,6 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" -[[package]] -name = "booster_example_locomotion" -version = "0.1.0" -dependencies = [ - "booster_sdk", - "tokio", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "booster_example_look_around" -version = "0.1.0" -dependencies = [ - "booster_sdk", - "tokio", - "tracing", - "tracing-subscriber", -] - [[package]] name = "booster_sdk" version = "0.1.0-alpha.11" @@ -595,12 +575,32 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "locomotion" +version = "0.1.0" +dependencies = [ + "booster_sdk", + "tokio", + "tracing", + "tracing-subscriber", +] + [[package]] name = "log" version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "look_around" +version = "0.1.0" +dependencies = [ + "booster_sdk", + "tokio", + "tracing", + "tracing-subscriber", +] + [[package]] name = "matchers" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index d4ee42a..376dc54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,5 @@ [workspace] -members = [ - "booster_sdk", - "booster_sdk_py", - "examples/rust/locomotion", - "examples/rust/look_around", -] +members = ["booster_sdk", "booster_sdk_py", "examples/rust/*"] resolver = "2" [workspace.package] diff --git a/README.md b/README.md index c457c69..4f03197 100644 --- a/README.md +++ b/README.md @@ -14,37 +14,7 @@ In addition to the Rust crate, this repository also provides Python bindings bui This library is currently in active development and has been tested on a real robot. -## API Examples - -### High-Level Locomotion Control - -```rust -use booster_sdk::client::BoosterClient; -use booster_sdk::types::{RobotMode, Hand}; - -#[tokio::main] -async fn main() -> Result<(), Box> { - // Initialize and create client - let client = BoosterClient::new()?; - - // Change to walking mode - client.change_mode(RobotMode::Walking).await?; - - // Move forward - client.move_robot(0.5, 0.0, 0.0).await?; - - // Wave hand - // Publish gripper commands if needed (DDS topic-based control) - client.publish_gripper_command(&booster_sdk::client::GripperCommand::open(Hand::Right))?; - - // Lie down when done - client.lie_down().await?; - - Ok(()) -} -``` - -## Experimental Python Bindings +## Installation Python wheels are available on [PyPI](https://pypi.org/project/booster-sdk/): @@ -52,10 +22,10 @@ Python wheels are available on [PyPI](https://pypi.org/project/booster-sdk/): pip install booster-sdk ``` -### Python API Example +## API Example ```python -from booster_sdk.client.booster import BoosterClient, GripperCommand, Hand, RobotMode +from booster_sdk.client.booster import BoosterClient, RobotMode client = BoosterClient() @@ -65,11 +35,9 @@ client.change_mode(RobotMode.WALKING) # Move forward client.move_robot(0.5, 0.0, 0.0) -# Open right gripper -client.publish_gripper_command(GripperCommand.open(Hand.RIGHT)) ``` -The Python bindings currently cover core control flows, including locomotion, gripper control, AI/LUI RPC calls, vision RPC calls, and X5 camera RPC calls. +The Python bindings cover core control flows, including locomotion, gripper control, AI/LUI RPC calls, vision RPC calls, and X5 camera RPC calls. ## Contributing diff --git a/booster_sdk/examples/gripper_control.rs b/booster_sdk/examples/gripper_control.rs index f88a2fc..d2af80e 100644 --- a/booster_sdk/examples/gripper_control.rs +++ b/booster_sdk/examples/gripper_control.rs @@ -11,7 +11,7 @@ use tracing_subscriber::EnvFilter; #[tokio::main] async fn main() -> Result<(), Box> { // Initialize logging - let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")); + let env_filter = EnvFilter::new("off,booster_sdk=debug"); tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing::info!("Starting gripper control example"); diff --git a/examples/rust/locomotion/Cargo.toml b/examples/rust/locomotion/Cargo.toml index a7d7654..5622332 100644 --- a/examples/rust/locomotion/Cargo.toml +++ b/examples/rust/locomotion/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "booster_example_locomotion" +name = "locomotion" version = "0.1.0" edition = "2024" diff --git a/examples/rust/locomotion/src/main.rs b/examples/rust/locomotion/src/main.rs index 1895339..4e6545d 100644 --- a/examples/rust/locomotion/src/main.rs +++ b/examples/rust/locomotion/src/main.rs @@ -1,7 +1,7 @@ //! High-level locomotion control example. //! //! Run with: -//! `cargo run --manifest-path examples/rust/locomotion/Cargo.toml` +//! `cargo run -p locomotion` use booster_sdk::client::loco::BoosterClient; use booster_sdk::types::RobotMode; @@ -10,7 +10,7 @@ use tracing_subscriber::EnvFilter; #[tokio::main] async fn main() -> Result<(), Box> { - let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")); + let env_filter = EnvFilter::new("off,booster_sdk=debug"); tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing::info!("Starting locomotion control example"); diff --git a/examples/rust/look_around/Cargo.toml b/examples/rust/look_around/Cargo.toml index 8e7f827..7477318 100644 --- a/examples/rust/look_around/Cargo.toml +++ b/examples/rust/look_around/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "booster_example_look_around" +name = "look_around" version = "0.1.0" edition = "2024" diff --git a/examples/rust/look_around/src/main.rs b/examples/rust/look_around/src/main.rs index 4bbbf06..296301b 100644 --- a/examples/rust/look_around/src/main.rs +++ b/examples/rust/look_around/src/main.rs @@ -1,7 +1,7 @@ //! Motion state subscription example. //! //! Run with: -//! `cargo run --manifest-path examples/rust/look_around/Cargo.toml` +//! `cargo run -p look_around` use booster_sdk::client::loco::BoosterClient; use tokio::time::Duration; @@ -9,7 +9,7 @@ use tracing_subscriber::EnvFilter; #[tokio::main] async fn main() -> Result<(), Box> { - let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")); + let env_filter = EnvFilter::new("off,booster_sdk=debug"); tracing_subscriber::fmt().with_env_filter(env_filter).init(); tracing::info!("Starting motion state subscription example");