raisimTech / raisimLib

Visit www.raisim.com
http://www.raisim.com
Other
341 stars 91 forks source link

How to use getAngularMomentum() correctly? #431

Closed Penguuuuin closed 1 year ago

Penguuuuin commented 1 year ago

I need to calculate the angular momentum of a walking humanoid robot and find out the function getAngularMomentum(), but it seems doesn't get a reasonable result when I directly call it like this: code2 and the pic of angular momentum data gathered like this. The value of the data fluctuates and increases and it's impossible for a stable walking robot. ang_no_mat

Then I find that if calls getMassMatrix() before getAngularMomentum(), the gathered data become reasonable. code ang_with_mat

Why it happens? Is getMassMatrix() calls other function to update any internal value? Or if I need to call any other functions such as updateMassInfo() to manually update something?

jhwangbo commented 1 year ago

This seems like a bug introduced after v1.1. There was a big change in the computation pipeline and probably some variables needed to compute the angular momentum are not computed. I'll push a fix to this soon

Penguuuuin commented 1 year ago

Thanks for you prompt reply! So do I calculate angular momentum right?

jhwangbo commented 1 year ago

Yes, that looks correct. The angular momentum function is unit-tested (but only after the massMatrix call)