duburcqa / jiminy

Jiminy: a fast and portable Python/C++ simulator of poly-articulated robots with OpenAI Gym interface for reinforcement learning
https://duburcqa.github.io/jiminy
MIT License
221 stars 26 forks source link

Constraint solver leads to non-consistent integration #778

Closed matthieuvigne closed 4 months ago

matthieuvigne commented 4 months ago

Strangely, activating the engine_options['contacts']['model'] = "constraint" option leads to non-consistent integration result for some systems - where the velocity is not the integral of the acceleration!

This happens for instance in the following example script, which simulates a double pendulum (servoed to be horizontal) with backlash. Backlash is needed to actually create a constraint (the pendulum, being horizontal, rests on the backlash bounds). The system has fixed base, and is thus basically a simple chain of 4 pivot joints, 2 with motors, 2 unactuated (backlash).

When simulating with constraint option, one obtains the following plot showing acceleration (top) and velocity (bottom)

image

We can see that though the velocity is zero, the acceleration is not - and that remains true forever, which is clearly inconsistent. Here are some further comments:

duburcqa commented 4 months ago

Thank you for your thorough analysis of the problem ! I will have a look at it ASAP !

duburcqa commented 4 months ago

Fixed by #779