Skip to content

Fix locked axes in gyro torque#486

Merged
Jondolf merged 2 commits into
avianphysics:mainfrom
unpairedbracket:fix_gyro
Aug 19, 2024
Merged

Fix locked axes in gyro torque#486
Jondolf merged 2 commits into
avianphysics:mainfrom
unpairedbracket:fix_gyro

Conversation

@unpairedbracket

Copy link
Copy Markdown
Contributor

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

Zeroing out columns of the inertia tensor makes it singular, so the inverse results in all NaNs
@Jondolf Jondolf linked an issue Aug 19, 2024 that may be closed by this pull request
@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 19, 2024
@Jondolf Jondolf enabled auto-merge (squash) August 19, 2024 20:44
@Jondolf Jondolf merged commit f2dec36 into avianphysics:main Aug 19, 2024
@unpairedbracket unpairedbracket deleted the fix_gyro branch August 20, 2024 19:21
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.

LockedAxes break ExternalTorque

2 participants