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

Expose the spherical joint’s local frames more explicitly. #473

Merged
merged 3 commits into from
Mar 26, 2023
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## Unlereased
### Added
- Add `SphericalJoint::local_frame1/2`, `::set_local_frame1/2`, and `SphericalJointBuilder::local_frame1/2` to set both
the joint’s anchor and reference orientation.
- Add `EffectiveCharacterMovement::is_sliding_down_slope` to indicate if the character controlled by the kinematic
character controller is sliding on a slope that is too steep.
- Add `Wheel::side_friction_stiffness` to customize the side friction applied to the vehicle controller’s wheel.

### Modified
- Make `Wheel::friction_slip` public to customize the front friction applied to the vehicle controller’s wheels.

## v0.17.2 (26 Feb. 2023)
### Fix
- Fix issue with convex polyhedron jitter due to missing contacts.
Expand Down
49 changes: 47 additions & 2 deletions src/dynamics/joint/spherical_joint.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::dynamics::joint::{GenericJoint, GenericJointBuilder, JointAxesMask};
use crate::dynamics::{JointAxis, JointMotor, MotorModel};
use crate::math::{Point, Real};
use crate::math::{Isometry, Point, Real};

use super::JointLimits;

Expand Down Expand Up @@ -66,6 +66,34 @@ impl SphericalJoint {
self
}

/// Gets both the joint anchor and the joint’s reference orientation relative to the first
/// rigid-body’s local-space.
#[must_use]
pub fn local_frame1(&self) -> &Isometry<Real> {
&self.data.local_frame1
}

/// Sets both the joint anchor and the joint’s reference orientation relative to the first
/// rigid-body’s 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 joint’s reference orientation relative to the second
/// rigid-body’s local-space.
#[must_use]
pub fn local_frame2(&self) -> &Isometry<Real> {
&self.data.local_frame2
}

/// Sets both the joint anchor and the joint’s reference orientation relative to the second
/// rigid-body’s 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 joint’s rotational degree of freedom along the specified axis.
#[must_use]
pub fn motor(&self, axis: JointAxis) -> Option<&JointMotor> {
Expand Down Expand Up @@ -128,7 +156,8 @@ impl SphericalJoint {
self.data.limits(axis)
}

/// Sets the `[min,max]` limit angles attached bodies can translate along the joint’s principal axis.
/// Sets the `[min,max]` limit angles attached bodies can translate along the joint’s principal
/// axis.
pub fn set_limits(&mut self, axis: JointAxis, limits: [Real; 2]) -> &mut Self {
self.data.set_limits(axis, limits);
self
Expand Down Expand Up @@ -179,6 +208,22 @@ impl SphericalJointBuilder {
self
}

/// Sets both the joint anchor and the joint’s reference orientation relative to the first
/// rigid-body’s 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 joint’s reference orientation relative to the second
/// rigid-body’s 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 {
Expand Down