diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index 2978ada..775b0c6 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -21,8 +21,6 @@ tower = "0.5" kos-sim = { version = "0.1.0", path = "../platforms/sim", optional = true } kos-stub = { version = "0.1.0", path = "../platforms/stub", optional = true } kos-zeroth-01 = { version = "0.1.0", path = "../platforms/zeroth-01", optional = true } - -[target.'cfg(target_os = "linux")'.dependencies] kos-kbot = { version = "0.1.0", path = "../platforms/kbot", optional = true } [features] diff --git a/platforms/kbot/Cargo.toml b/platforms/kbot/Cargo.toml index 0bcf292..e5859e4 100644 --- a/platforms/kbot/Cargo.toml +++ b/platforms/kbot/Cargo.toml @@ -13,4 +13,6 @@ eyre = "0.6" tracing = "0.1" async-trait = "0.1" robstride = "0.2.8" -imu = "0.1.4" \ No newline at end of file + +[target.'cfg(target_os = "linux")'.dependencies] +imu = "0.1.4" diff --git a/platforms/kbot/src/lib.rs b/platforms/kbot/src/lib.rs index d32ed3c..a855d4d 100644 --- a/platforms/kbot/src/lib.rs +++ b/platforms/kbot/src/lib.rs @@ -1,7 +1,11 @@ mod actuator; + +#[cfg(target_os = "linux")] mod hexmove; pub use actuator::*; + +#[cfg(target_os = "linux")] pub use hexmove::*; use eyre::{Result, WrapErr}; @@ -48,6 +52,7 @@ impl Platform for KbotPlatform { &self, operations_service: Arc, ) -> Result> { + #[cfg(target_os = "linux")] Ok(vec![ ServiceEnum::Imu(ImuServiceServer::new(IMUServiceImpl::new(Arc::new( KBotIMU::new(operations_service.clone(), "can0", 1, 1) @@ -73,7 +78,29 @@ impl Platform for KbotPlatform { .wrap_err("Failed to create actuator")?, ), ))), - ]) + ]); + + #[cfg(not(target_os = "linux"))] + Ok(vec![ServiceEnum::Actuator(ActuatorServiceServer::new( + ActuatorServiceImpl::new(Arc::new( + KBotActuator::new( + operations_service, + "/dev/ttyCH341USB0", + HashMap::from([ + (1, MotorType::Type04), + (2, MotorType::Type04), + (3, MotorType::Type04), + (4, MotorType::Type04), + (5, MotorType::Type04), + (6, MotorType::Type01), + ]), + None, + None, + None, + ) + .wrap_err("Failed to create actuator")?, + )), + ))]) } fn shutdown(&mut self) -> eyre::Result<()> {