diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index 2978ada..bae3ca2 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -29,7 +29,7 @@ kos-kbot = { version = "0.1.0", path = "../platforms/kbot", optional = true } kos-zeroth-01 = ["dep:kos-zeroth-01"] kos-sim = ["dep:kos-sim"] kos-stub = ["dep:kos-stub"] -default = ["kos-stub"] +default = ["kos-kbot"] [[bin]] name = "kos" diff --git a/daemon/src/main.rs b/daemon/src/main.rs index a579889..93476a8 100644 --- a/daemon/src/main.rs +++ b/daemon/src/main.rs @@ -42,7 +42,7 @@ async fn run_server( platform: &(dyn Platform + Send + Sync), operations_service: Arc, ) -> Result<(), Box> { - let addr = "[::1]:50051".parse()?; + let addr = "0.0.0.0:50051".parse()?; let mut server_builder = Server::builder(); let services = platform.create_services(operations_service.clone())?; diff --git a/platforms/kbot/src/hexmove.rs b/platforms/kbot/src/hexmove.rs index 7290aba..9882d7c 100644 --- a/platforms/kbot/src/hexmove.rs +++ b/platforms/kbot/src/hexmove.rs @@ -17,7 +17,12 @@ pub struct KBotIMU { } impl KBotIMU { - pub fn new(operations_service: Arc, interface: &str, can_id: u32, model: u32) -> Result { + pub fn new( + operations_service: Arc, + interface: &str, + can_id: u32, + model: u32, + ) -> Result { info!( "Initializing KBotIMU with interface: {}, CAN ID: {}, model: {}", interface, can_id, model diff --git a/platforms/kbot/src/lib.rs b/platforms/kbot/src/lib.rs index b9162f5..08255a8 100644 --- a/platforms/kbot/src/lib.rs +++ b/platforms/kbot/src/lib.rs @@ -12,6 +12,7 @@ use kos_core::kos_proto::{ }; use kos_core::services::{ActuatorServiceImpl, IMUServiceImpl}; use kos_core::{services::OperationsServiceImpl, Platform, ServiceEnum}; +use robstride::MotorType; use std::collections::HashMap; use std::sync::Arc; @@ -49,12 +50,24 @@ impl Platform for KbotPlatform { ) -> Result> { Ok(vec![ ServiceEnum::Imu(ImuServiceServer::new(IMUServiceImpl::new(Arc::new( - KBotIMU::new(operations_service.clone(), "can0", 1, 1).wrap_err("Failed to create IMU")?, + KBotIMU::new(operations_service.clone(), "can0", 1, 1) + .wrap_err("Failed to create IMU")?, )))), ServiceEnum::Actuator(ActuatorServiceServer::new(ActuatorServiceImpl::new( Arc::new( - KBotActuator::new(operations_service, "/dev/ttyCH341USB0", HashMap::new(), None, None, None) - .wrap_err("Failed to create actuator")?, + KBotActuator::new( + operations_service, + "/dev/ttyCH341USB0", + HashMap::from([ + (1, MotorType::Type04), + (2, MotorType::Type04), + (3, MotorType::Type04), + ]), + None, + None, + None, + ) + .wrap_err("Failed to create actuator")?, ), ))), ])