diff --git a/actuator/bindings/src/lib.rs b/actuator/bindings/src/lib.rs index ce7fc4a..44b09cb 100644 --- a/actuator/bindings/src/lib.rs +++ b/actuator/bindings/src/lib.rs @@ -474,20 +474,23 @@ impl PartialEq for PyRobstrideMotorType { #[pymethods] impl PyRobstrideMotorType { #[classattr] - const TYPE01: Self = PyRobstrideMotorType { value: 0 }; + const TYPE00: Self = PyRobstrideMotorType { value: 0 }; #[classattr] - const TYPE02: Self = PyRobstrideMotorType { value: 1 }; + const TYPE01: Self = PyRobstrideMotorType { value: 1 }; #[classattr] - const TYPE03: Self = PyRobstrideMotorType { value: 2 }; + const TYPE02: Self = PyRobstrideMotorType { value: 2 }; #[classattr] - const TYPE04: Self = PyRobstrideMotorType { value: 3 }; + const TYPE03: Self = PyRobstrideMotorType { value: 3 }; + #[classattr] + const TYPE04: Self = PyRobstrideMotorType { value: 4 }; fn __repr__(&self) -> PyResult { let type_name = match self.value { - 0 => "TYPE01", - 1 => "TYPE02", - 2 => "TYPE03", - 3 => "TYPE04", + 0 => "TYPE00", + 1 => "TYPE01", + 2 => "TYPE02", + 3 => "TYPE03", + 4 => "TYPE04", _ => "Unknown", }; Ok(format!("PyRobstrideMotorType::{}", type_name)) @@ -515,6 +518,7 @@ impl PyRobstrideMotorType { impl From for PyRobstrideMotorType { fn from(motor_type: RobstrideMotorType) -> Self { match motor_type { + RobstrideMotorType::Type00 => PyRobstrideMotorType::TYPE00, RobstrideMotorType::Type01 => PyRobstrideMotorType::TYPE01, RobstrideMotorType::Type02 => PyRobstrideMotorType::TYPE02, RobstrideMotorType::Type03 => PyRobstrideMotorType::TYPE03, @@ -526,10 +530,11 @@ impl From for PyRobstrideMotorType { impl From for RobstrideMotorType { fn from(py_motor_type: PyRobstrideMotorType) -> Self { match py_motor_type.value { - 0 => RobstrideMotorType::Type01, - 1 => RobstrideMotorType::Type02, - 2 => RobstrideMotorType::Type03, - 3 => RobstrideMotorType::Type04, + 0 => RobstrideMotorType::Type00, + 1 => RobstrideMotorType::Type01, + 2 => RobstrideMotorType::Type02, + 3 => RobstrideMotorType::Type03, + 4 => RobstrideMotorType::Type04, _ => RobstrideMotorType::Type04, } } diff --git a/actuator/robstride/src/lib.rs b/actuator/robstride/src/lib.rs index bb6a8a3..a944b84 100644 --- a/actuator/robstride/src/lib.rs +++ b/actuator/robstride/src/lib.rs @@ -46,6 +46,24 @@ pub struct MotorConfig { lazy_static! { pub static ref ROBSTRIDE_CONFIGS: HashMap = { let mut m = HashMap::new(); + m.insert( + MotorType::Type00, + MotorConfig { + p_min: -12.5, + p_max: 12.5, + v_min: -33.0, + v_max: 33.0, + kp_min: 0.0, + kp_max: 500.0, + kd_min: 0.0, + kd_max: 5.0, + t_min: -14.0, + t_max: 14.0, + zero_on_init: false, + can_timeout_command: 0x200b, // Unchecked + can_timeout_factor: 12000.0, // Unchecked + }, + ); m.insert( MotorType::Type01, MotorConfig { @@ -64,7 +82,6 @@ lazy_static! { can_timeout_factor: 12000.0, }, ); - // This is probably not correct, the Type02 is not released yet. m.insert( MotorType::Type02, MotorConfig { @@ -79,8 +96,8 @@ lazy_static! { t_min: -12.0, t_max: 12.0, zero_on_init: false, - can_timeout_command: 0x200b, - can_timeout_factor: 12000.0, + can_timeout_command: 0x200b, // Unchecked + can_timeout_factor: 12000.0, // Unchecked }, ); m.insert( @@ -387,6 +404,7 @@ fn unpack_raw_feedback(pack: &CanPack) -> MotorFeedbackRaw { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum MotorType { + Type00, Type01, Type02, Type03, @@ -408,6 +426,7 @@ pub fn motor_mode_from_str(s: &str) -> Result { pub fn motor_type_from_str(s: &str) -> Result { match s { + "00" => Ok(MotorType::Type00), "01" => Ok(MotorType::Type01), "02" => Ok(MotorType::Type02), "03" => Ok(MotorType::Type03),