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

Fix angular locked axes in gyroscopic torque computation #485

Merged
merged 1 commit into from
Aug 10, 2024

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Aug 10, 2024

Objective

Fixes #474.

The angular locked axes are applied to the inertia instead of the inverse inertia in gyroscopic torque computations introduced in #420, causing incorrect behavior.

Solution

Apply the locked axes correctly.

@Jondolf Jondolf added C-Bug Something isn't working A-Dynamics Relates to rigid body dynamics: motion, mass, constraint solving, joints, CCD, and so on labels Aug 10, 2024
@Jondolf Jondolf enabled auto-merge (squash) August 10, 2024 18:04
@Jondolf Jondolf merged commit 3dee0c0 into main Aug 10, 2024
4 checks passed
@Jondolf Jondolf deleted the fix-locked-axes-inertia branch August 10, 2024 18:17
Jondolf pushed a commit that referenced this pull request Aug 19, 2024
# Objective

I think that #485 wasn't quite the right fix for #474 - applying locked axes to an inertia tensor zeros out one or more of its rows, making the matrix singular - taking the inverse then results in a matrix that's all NaNs, making the delta_ang_vel also all NaNs, which causes the angular momentum to be unaffected by anything that timestep (including applied torques!).

The problem with the status quo ante seems to be that a similar thing happened - rather than trying to invert the (singular) locked inverse inertia, the calculated Jacobian was (near-)singular in a lot of cases when axes were locked, and depending on round-off errors you'd either get NaNs or just an outright cancellation of the angular velocity

## Solution

Calculating the delta-ω from gyroscopic effects with an unconstrained inertia matrix and *then* applying the locked axes to that angular velocity increment should be more reliable, and should avoid undesirable NaN values showing up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Dynamics Relates to rigid body dynamics: motion, mass, constraint solving, joints, CCD, and so on C-Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected behavior with LockedAxes and rotations after upgrading from 0.1.0 to 0.1.1
1 participant