Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile kbot on mac #5

Merged
merged 2 commits into from
Nov 15, 2024
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: 0 additions & 2 deletions daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion platforms/kbot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ eyre = "0.6"
tracing = "0.1"
async-trait = "0.1"
robstride = "0.2.8"
imu = "0.1.4"

[target.'cfg(target_os = "linux")'.dependencies]
imu = "0.1.4"
29 changes: 28 additions & 1 deletion platforms/kbot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -48,6 +52,7 @@ impl Platform for KbotPlatform {
&self,
operations_service: Arc<OperationsServiceImpl>,
) -> Result<Vec<ServiceEnum>> {
#[cfg(target_os = "linux")]
Ok(vec![
ServiceEnum::Imu(ImuServiceServer::new(IMUServiceImpl::new(Arc::new(
KBotIMU::new(operations_service.clone(), "can0", 1, 1)
Expand All @@ -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<()> {
Expand Down
Loading