diff --git a/rmf_site_format/Cargo.toml b/rmf_site_format/Cargo.toml index 0de63d22..9f1dc908 100644 --- a/rmf_site_format/Cargo.toml +++ b/rmf_site_format/Cargo.toml @@ -16,14 +16,17 @@ thiserror = "*" glam = { version = "0.24", features = ["serde"] } uuid = { version = "1.1", features = ["v4", "serde"] } # add features=["bevy"] to a dependent Cargo.toml to get the bevy-related features -# We depend on a bugfix released specifically in 0.7.3 bevy = { version = "0.12", optional = true } sdformat_rs = { git = "https://github.com/open-rmf/sdf_rust_experimental", rev = "9fc35f2"} yaserde = "0.7" -urdf-rs = "0.7.3" +# We depend on a bugfix released specifically in 0.7.3 +urdf-rs = { version = "0.7.3", optional = true } # Used for lazy initialization of static variable when they are non const once_cell = "1" pathdiff = "*" [dev-dependencies] float_eq = "1.0" + +[features] +urdf = ["dep:urdf-rs"] diff --git a/rmf_site_format/src/misc.rs b/rmf_site_format/src/misc.rs index 53de412f..cc6bfa1e 100644 --- a/rmf_site_format/src/misc.rs +++ b/rmf_site_format/src/misc.rs @@ -18,7 +18,7 @@ use crate::RefTrait; #[cfg(feature = "bevy")] use bevy::prelude::*; -use glam::{EulerRot, Quat, Vec2, Vec3}; +use glam::{Quat, Vec2, Vec3}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -353,6 +353,7 @@ impl Default for Pose { } } +#[cfg(feature = "urdf")] impl From for urdf_rs::Pose { fn from(pose: Pose) -> Self { urdf_rs::Pose { @@ -360,7 +361,7 @@ impl From for urdf_rs::Pose { Rotation::EulerExtrinsicXYZ(arr) => urdf_rs::Vec3(arr.map(|v| v.radians().into())), Rotation::Yaw(v) => urdf_rs::Vec3([0.0, 0.0, v.radians().into()]), Rotation::Quat([x, y, z, w]) => { - let (z, y, x) = glam::quat(x, y, z, w).to_euler(EulerRot::ZYX); + let (z, y, x) = glam::quat(x, y, z, w).to_euler(glam::EulerRot::ZYX); urdf_rs::Vec3([x as f64, y as f64, z as f64]) } }, @@ -369,6 +370,7 @@ impl From for urdf_rs::Pose { } } +#[cfg(feature = "urdf")] impl From<&urdf_rs::Pose> for Pose { fn from(pose: &urdf_rs::Pose) -> Self { Pose {