I am writing a simulator for a robot on wheels.
I modeled it with a multibody with a cuboid in the middle and four revolute joints with spheres attached as wheels (it seems I could not use cylinders as colliders).
I can then control the motors on the joints, and it works, until one of these two things happens:
- I leave the car stopped for a few seconds, or
- (maybe, I should test this more) there are fast collisions with walls
At that point the system is “stuck”, and activating the motors does not move it anymore.
I have tried the following:
- use shorter time steps in the simulation (up to virtually 500Hz)
- use larger collider margins
- increase the space between the wheels and the car body
- generally increase every integration parameter I could find
- use 64 bits instead of 32 in the simulation
but nothing changed.
I see that there is a way to make rigid bodies sleep, I thought that could be the issue but I could not find the setting on multibody and multibody parts.
If you want to test it, you should clone this:
and just do
cargo run at the root.
Then, if you quickly press the “manual” button and play with the control, you can move the car.
If you wait too much it freezes.
It is also possible to visualize the simulation using the testbed instead of using my UI, just invoke
main_testbed instead of
main_full inside the main function.
Sorry if the workspace is large and messy, this is part of a much larger project for a robotic competition and I did not want to open it before the competition… this repo is just a code dump if somebody wants to test it to solve this issue.