Add methods to customize a SphericalJoint’s local reference frames.

This commit is contained in:
Sébastien Crozet
2023-03-26 15:44:59 +02:00
parent cf6b6d20b6
commit 7cca677523

View File

@@ -66,6 +66,34 @@ impl SphericalJoint {
self
}
/// Gets both the joint anchor and the joints reference orientation relative to the first
/// rigid-bodys local-space.
#[must_use]
pub fn local_frame1(&self) -> &Isometry<Real> {
&self.data.local_frame1
}
/// Sets both the joint anchor and the joints reference orientation relative to the first
/// rigid-bodys local-space.
pub fn set_local_frame1(&mut self, local_frame: Isometry<Real>) -> &mut Self {
self.data.set_local_frame1(local_frame);
self
}
/// Gets both the joint anchor and the joints reference orientation relative to the second
/// rigid-bodys local-space.
#[must_use]
pub fn local_frame2(&self) -> &Isometry<Real> {
&self.data.local_frame2
}
/// Sets both the joint anchor and the joints reference orientation relative to the second
/// rigid-bodys local-space.
pub fn set_local_frame2(&mut self, local_frame: Isometry<Real>) -> &mut Self {
self.data.set_local_frame2(local_frame);
self
}
/// The motor affecting the joints rotational degree of freedom along the specified axis.
#[must_use]
pub fn motor(&self, axis: JointAxis) -> Option<&JointMotor> {
@@ -128,7 +156,8 @@ impl SphericalJoint {
self.data.limits(axis)
}
/// Sets the `[min,max]` limit angles attached bodies can translate along the joints principal axis.
/// Sets the `[min,max]` limit angles attached bodies can translate along the joints principal
/// axis.
pub fn set_limits(&mut self, axis: JointAxis, limits: [Real; 2]) -> &mut Self {
self.data.set_limits(axis, limits);
self
@@ -179,6 +208,22 @@ impl SphericalJointBuilder {
self
}
/// Sets both the joint anchor and the joints reference orientation relative to the first
/// rigid-bodys local-space.
#[must_use]
pub fn local_frame1(mut self, frame1: Isometry<Real>) -> Self {
self.0.set_local_frame1(frame1);
self
}
/// Sets both the joint anchor and the joints reference orientation relative to the second
/// rigid-bodys local-space.
#[must_use]
pub fn local_frame2(mut self, frame2: Isometry<Real>) -> Self {
self.0.set_local_frame2(frame2);
self
}
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
#[must_use]
pub fn motor_model(mut self, axis: JointAxis, model: MotorModel) -> Self {