Skip to content

Commit d1cad1b

Browse files
authored
Clean up examples + readme (#8)
1 parent eeb5a13 commit d1cad1b

8 files changed

Lines changed: 32 additions & 69 deletions

File tree

Cargo.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
[workspace]
2-
members = [
3-
"booster_sdk",
4-
"booster_sdk_py",
5-
"examples/rust/locomotion",
6-
"examples/rust/look_around",
7-
]
2+
members = ["booster_sdk", "booster_sdk_py", "examples/rust/*"]
83
resolver = "2"
94

105
[workspace.package]

README.md

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,18 @@ In addition to the Rust crate, this repository also provides Python bindings bui
1414

1515
This library is currently in active development and has been tested on a real robot.
1616

17-
## API Examples
18-
19-
### High-Level Locomotion Control
20-
21-
```rust
22-
use booster_sdk::client::BoosterClient;
23-
use booster_sdk::types::{RobotMode, Hand};
24-
25-
#[tokio::main]
26-
async fn main() -> Result<(), Box<dyn std::error::Error>> {
27-
// Initialize and create client
28-
let client = BoosterClient::new()?;
29-
30-
// Change to walking mode
31-
client.change_mode(RobotMode::Walking).await?;
32-
33-
// Move forward
34-
client.move_robot(0.5, 0.0, 0.0).await?;
35-
36-
// Wave hand
37-
// Publish gripper commands if needed (DDS topic-based control)
38-
client.publish_gripper_command(&booster_sdk::client::GripperCommand::open(Hand::Right))?;
39-
40-
// Lie down when done
41-
client.lie_down().await?;
42-
43-
Ok(())
44-
}
45-
```
46-
47-
## Experimental Python Bindings
17+
## Installation
4818

4919
Python wheels are available on [PyPI](https://pypi.org/project/booster-sdk/):
5020

5121
```bash
5222
pip install booster-sdk
5323
```
5424

55-
### Python API Example
25+
## API Example
5626

5727
```python
58-
from booster_sdk.client.booster import BoosterClient, GripperCommand, Hand, RobotMode
28+
from booster_sdk.client.booster import BoosterClient, RobotMode
5929

6030
client = BoosterClient()
6131

@@ -65,11 +35,9 @@ client.change_mode(RobotMode.WALKING)
6535
# Move forward
6636
client.move_robot(0.5, 0.0, 0.0)
6737

68-
# Open right gripper
69-
client.publish_gripper_command(GripperCommand.open(Hand.RIGHT))
7038
```
7139

72-
The Python bindings currently cover core control flows, including locomotion, gripper control, AI/LUI RPC calls, vision RPC calls, and X5 camera RPC calls.
40+
The Python bindings cover core control flows, including locomotion, gripper control, AI/LUI RPC calls, vision RPC calls, and X5 camera RPC calls.
7341

7442
## Contributing
7543

booster_sdk/examples/gripper_control.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use tracing_subscriber::EnvFilter;
1111
#[tokio::main]
1212
async fn main() -> Result<(), Box<dyn std::error::Error>> {
1313
// Initialize logging
14-
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
14+
let env_filter = EnvFilter::new("off,booster_sdk=debug");
1515
tracing_subscriber::fmt().with_env_filter(env_filter).init();
1616

1717
tracing::info!("Starting gripper control example");

examples/rust/locomotion/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "booster_example_locomotion"
2+
name = "locomotion"
33
version = "0.1.0"
44
edition = "2024"
55

examples/rust/locomotion/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! High-level locomotion control example.
22
//!
33
//! Run with:
4-
//! `cargo run --manifest-path examples/rust/locomotion/Cargo.toml`
4+
//! `cargo run -p locomotion`
55
66
use booster_sdk::client::loco::BoosterClient;
77
use booster_sdk::types::RobotMode;
@@ -10,7 +10,7 @@ use tracing_subscriber::EnvFilter;
1010

1111
#[tokio::main]
1212
async fn main() -> Result<(), Box<dyn std::error::Error>> {
13-
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
13+
let env_filter = EnvFilter::new("off,booster_sdk=debug");
1414
tracing_subscriber::fmt().with_env_filter(env_filter).init();
1515

1616
tracing::info!("Starting locomotion control example");

examples/rust/look_around/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "booster_example_look_around"
2+
name = "look_around"
33
version = "0.1.0"
44
edition = "2024"
55

examples/rust/look_around/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//! Motion state subscription example.
22
//!
33
//! Run with:
4-
//! `cargo run --manifest-path examples/rust/look_around/Cargo.toml`
4+
//! `cargo run -p look_around`
55
66
use booster_sdk::client::loco::BoosterClient;
77
use tokio::time::Duration;
88
use tracing_subscriber::EnvFilter;
99

1010
#[tokio::main]
1111
async fn main() -> Result<(), Box<dyn std::error::Error>> {
12-
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
12+
let env_filter = EnvFilter::new("off,booster_sdk=debug");
1313
tracing_subscriber::fmt().with_env_filter(env_filter).init();
1414

1515
tracing::info!("Starting motion state subscription example");

0 commit comments

Comments
 (0)