Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/target

examples/rust/**/target

.ruff_cache/
.mypy_cache/

Expand Down
25 changes: 23 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[workspace]
members = ["booster_sdk", "booster_sdk_py"]
members = [
"booster_sdk",
"booster_sdk_py",
"examples/rust/locomotion",
"examples/rust/look_around",
]
resolver = "2"

[workspace.package]
version = "0.1.0-alpha.10"
version = "0.1.0-alpha.11"
edition = "2024"
authors = ["Team whIRLwind"]
license = "MIT OR Apache-2.0"
Expand All @@ -25,6 +30,7 @@ pedantic = { level = "warn", priority = -1 }
booster_sdk = { path = "booster_sdk" }

tokio = { version = "1.42", features = ["full"] }
futures = "0.3"
rustdds = "0.11.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
1 change: 1 addition & 0 deletions booster_sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ readme.workspace = true

[dependencies]
tokio = { workspace = true }
futures = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
Expand Down
4 changes: 3 additions & 1 deletion booster_sdk/examples/gripper_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

use booster_sdk::client::loco::{BoosterClient, GripperCommand};
use booster_sdk::types::{Hand, RobotMode};
use tracing_subscriber::EnvFilter;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize logging
tracing_subscriber::fmt().with_env_filter("info").init();
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
tracing_subscriber::fmt().with_env_filter(env_filter).init();

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

Expand Down
8 changes: 6 additions & 2 deletions booster_sdk/src/client/ai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ impl AiClient {

/// Create an AI client with a custom startup wait before first RPC.
pub fn with_startup_wait(startup_wait: Duration) -> Result<Self> {
Self::with_options(RpcClientOptions::for_service(AI_API_TOPIC).with_startup_wait(startup_wait))
Self::with_options(
RpcClientOptions::for_service(AI_API_TOPIC).with_startup_wait(startup_wait),
)
}

/// Create an AI client with custom RPC options.
Expand Down Expand Up @@ -175,7 +177,9 @@ impl LuiClient {

/// Create a LUI client with a custom startup wait before first RPC.
pub fn with_startup_wait(startup_wait: Duration) -> Result<Self> {
Self::with_options(RpcClientOptions::for_service(LUI_API_TOPIC).with_startup_wait(startup_wait))
Self::with_options(
RpcClientOptions::for_service(LUI_API_TOPIC).with_startup_wait(startup_wait),
)
}

/// Create a LUI client with custom RPC options.
Expand Down
9 changes: 1 addition & 8 deletions booster_sdk/src/client/loco.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ use serde::{Deserialize, Serialize};
use serde_json::json;
use typed_builder::TypedBuilder;

// The controller may send an intermediate pending status (-1) before the
// final success response. Mode transitions (especially PREPARE) can take
// several seconds.
const CHANGE_MODE_TIMEOUT: Duration = Duration::from_secs(30);

/// High-level client for B1 locomotion control and telemetry.
pub struct BoosterClient {
rpc: RpcClient,
Expand Down Expand Up @@ -68,9 +63,7 @@ impl BoosterClient {
/// Change the robot mode.
pub async fn change_mode(&self, mode: RobotMode) -> Result<()> {
let param = json!({ "mode": i32::from(mode) }).to_string();
self.rpc
.call_void_with_timeout(LocoApiId::ChangeMode, param, Some(CHANGE_MODE_TIMEOUT))
.await
self.rpc.call_void(LocoApiId::ChangeMode, param).await
}

/// Get the current robot mode.
Expand Down
Loading