diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/joint/rope_joint.rs | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/dynamics/joint/rope_joint.rs b/src/dynamics/joint/rope_joint.rs index cb68860..3b7317c 100644 --- a/src/dynamics/joint/rope_joint.rs +++ b/src/dynamics/joint/rope_joint.rs @@ -88,13 +88,16 @@ impl RopeJoint { /// The motor affecting the joint’s translational degree of freedom. #[must_use] - pub fn motor(&self) -> Option<&JointMotor> { - self.data.motor(JointAxis::X) + pub fn motor(&self, axis: JointAxis) -> Option<&JointMotor> { + self.data.motor(axis) } /// Set the spring-like model used by the motor to reach the desired target velocity and position. pub fn set_motor_model(&mut self, model: MotorModel) -> &mut Self { self.data.set_motor_model(JointAxis::X, model); + self.data.set_motor_model(JointAxis::Y, model); + #[cfg(feature = "dim3")] + self.data.set_motor_model(JointAxis::Z, model); self } @@ -102,6 +105,11 @@ impl RopeJoint { pub fn set_motor_velocity(&mut self, target_vel: Real, factor: Real) -> &mut Self { self.data .set_motor_velocity(JointAxis::X, target_vel, factor); + self.data + .set_motor_velocity(JointAxis::Y, target_vel, factor); + #[cfg(feature = "dim3")] + self.data + .set_motor_velocity(JointAxis::Z, target_vel, factor); self } @@ -114,6 +122,11 @@ impl RopeJoint { ) -> &mut Self { self.data .set_motor_position(JointAxis::X, target_pos, stiffness, damping); + self.data + .set_motor_position(JointAxis::Y, target_pos, stiffness, damping); + #[cfg(feature = "dim3")] + self.data + .set_motor_position(JointAxis::Z, target_pos, stiffness, damping); self } @@ -127,12 +140,20 @@ impl RopeJoint { ) -> &mut Self { self.data .set_motor(JointAxis::X, target_pos, target_vel, stiffness, damping); + self.data + .set_motor(JointAxis::Y, target_pos, target_vel, stiffness, damping); + #[cfg(feature = "dim3")] + self.data + .set_motor(JointAxis::Y, target_pos, target_vel, stiffness, damping); self } /// Sets the maximum force the motor can deliver. pub fn set_motor_max_force(&mut self, max_force: Real) -> &mut Self { self.data.set_motor_max_force(JointAxis::X, max_force); + self.data.set_motor_max_force(JointAxis::Y, max_force); + #[cfg(feature = "dim3")] + self.data.set_motor_max_force(JointAxis::Z, max_force); self } @@ -146,6 +167,8 @@ impl RopeJoint { pub fn set_limits(&mut self, limits: [Real; 2]) -> &mut Self { self.data.set_limits(JointAxis::X, limits); self.data.set_limits(JointAxis::Y, limits); + #[cfg(feature = "dim3")] + self.data.set_limits(JointAxis::Z, limits); self } } |
