rohanpsingh / mc_mujoco

MuJoCo interface for mc-rtc
https://arxiv.org/abs/2209.00274
BSD 2-Clause "Simplified" License
77 stars 18 forks source link

Fix step-by-step from GUI #20

Closed rohanpsingh closed 2 years ago

rohanpsingh commented 2 years ago

Without this patch, pressing the "+{}ms" in the GUI will only cause one simulation step to be executed, in step-by-step mode.
So if mc-rtc timestep is 5ms and the simulation timestep is 1ms, the "+5ms" button was needed to be pressed 5 times for one controller::run() to be executed. The expected behaviour is that if the +5ms button is pressed once, that should call the controller::run() once.
If the +25ms button is pressed once, that should lead to controller::run() being called 5 times... and so on.

If my understanding is correct, is this is the best way to fix this? I added some comments too make it clearer.

rohanpsingh commented 2 years ago

Thanks for pointing out the errors!