cyberbotics / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
3.19k stars 1.68k forks source link

Robot stops at very low velocity #6137

Closed ThorbenCarl closed 1 year ago

ThorbenCarl commented 1 year ago

Bug? Description Hello everyone,

we have built a robot (track.wbt) and would like to make it drive straight ahead with a very low speed (my_controller.cpp). maxVelocity of the two LinearMotors of the tracks are limited to 0.0036 m/s. If we enter a speed of trackLeft->setVelocity(0.0036); trackRight->setVelocity(0.0036); for both drives, the robot drives for approx 1s and then moves on the spot. The animations are still moving and we also get a speed, but the position doesn't change. The problem does not occur if we set the maxVelocity to 0.02 m/s and control both drives at 0.02 m/s. The problem also does not occur if the difference between the two drives is large enough, e.g. left -0.0036 and right 0.0036 or left 0.0036 and right 0.0025.

We are currently calling setVelocity cyclically to allow the robot to drive straight, but this is rather unpleasant for performance reasons.

What are we doing wrong? Is it a friction or force problem, but why the robot not stops and return a velocity of 0? We have already reduced the size of the robot's shield to make sure it doesn't touch the ground, but it had no effect. Can you reproduce the problem? Neither Google nor ChatGPT could help us :D

Steps to Reproduce zumo_sim.zip

  1. Load World/Robot
  2. Choose my_Controller for the Robot(Zumo)
  3. Build controller
  4. Start simulation
  5. and see Robot stopping
  6. Change velocities in controller
  7. Build controller again
  8. Start simulation
  9. and see Robot stopping or not

Expected behavior Robot should drive straight.

System @ThorbenCarl

dsiev commented 1 year ago

Same here, no idea why.

System:

omichel commented 1 year ago

Because the motion is so slow and the collisions are not changing much at such a low speed, Webots considers the robot is not moving and thus disables the corresponding bodies, causing the motion to completely stop. To fix this, you can simply decrease the values of WorldInfo.physicsDisableLinearThreshold and WorldInfo.physicsDisableAngularThreshold. Setting them to 0.001 (instead of their default value of 0.01) should fix the problem. Alternatively, setting WorldInfo.physicsDisableTime to -1 will also fix the problem in a less optimal way. See the documentation about these parameters here.

Please let me know if that resolves the issue for you guys.

ThorbenCarl commented 1 year ago

Thank you very much for the quick reply! We have reduced WorldInfo.physicsDisableLinearThreshold and WorldInfo.physicsDisableAngularThreshold accordingly and it works well for lower speeds.

And once again reading documentation would have helped....

Thank you very much!