0
$\begingroup$

My simulation is running correctly but is slow. How can I speed it up?

(I am part of the development team of Webots and we often get this question so I hope it will help some people!)

$\endgroup$

1 Answer 1

0
$\begingroup$

There are several ways to increase the simulation speed:

  1. Use the Run button. This button runs the simulation as fast as possible using all the available CPU power. Otherwise, using the Real-Time running mode, Webots may not use all the available CPU power in order to slow down the simulation to match the real time.
  2. Increase the value of WorldInfo.basicTimeStep. This field sets the granularity of the physics simulation. With a higher WorldInfo.basicTimeStep, the simulation becomes faster but less accurate. With a lower WorldInfo.basicTimeStep, the simulation becomes slower but more accurate. There is an additional restriction: WorldInfo.basicTimeStep must be chosen such as to be an integer divisor of the control step which is the value passed as a parameter to the wb_robot_step (or equivalent) function.
  3. Decrease the value of WorldInfo.FPS. This field represents the maximum rate at which the 3D display of the main windows is refreshed. With a lower value, the simulation becomes faster but more flickering. With a higher value, the simulation becomes slower but less flickering.
  4. Try changing the value of WorldInfo.optimalThreadCount. This field specifies how many threads are used to simulate the physics of the world. Depending on the world you can get a better performance by reducing or increasing this value. In general it is better to have a low number of threads for simple worlds and a bigger number of threads for complex worlds that include several robots physically independent from each other.
  5. Disable unnecessary shadows. Webots uses a lot of CPU/GPU power to compute how and where the objects shadows are cast. But shadows are irrelevant for most simulation unless they should explicitly be seen by cameras. Unnecessary shadows can be disabled by unchecking the castShadows field of light nodes: PointLight, SpotLight, or DirectionalLight.
  6. Simplify your simulation by removing unnecessary objects. In particular, try to minimize the number of Physics nodes. Avoid using Solid nodes when a Transform or a Shape node can be used instead.
  7. Simplify the bounding objects to increase the speed of the collision detection. Replace complex primitives, like IndexedFaceSet, Mesh, ElevationGrid or Cylinder by simpler primitives, like Sphere, Capsule, Box and Plane. Avoid using a composition of primitives (in a Group or a Transform) when a single primitive would do the trick.
  8. Set controller field to <none> for any Robot node that doesn't need to be controlled, instead of using the <generic> controller.
$\endgroup$
4
  • $\begingroup$ Welcome to Robotics BenjaminD. The way this was written, it looks like you may be associated with the product being promoted, so please read What kind of behavior is expected of users? and How not to be a spammer. The community here tends to vote down overt self-promotion and flag it as spam, but if you post good, relevant answers, then even if some (but not all) happen to be about your product, website or company, that’s okay. However, you must disclose any affiliation in your answers. $\endgroup$
    – Chuck
    Nov 29, 2022 at 14:13
  • $\begingroup$ You mention Webots by name in a question with very few details and then immediately give a long, detailed answer. If you work for Webots that's fine, iRobot and ROS representatives are offering tech support here as well, but please add your relationship to your profile and also disclose that information here. $\endgroup$
    – Chuck
    Nov 29, 2022 at 14:16
  • $\begingroup$ Thanks for the clarification, I have made the appropriate changes. We often get this question in DM or on our discord. I am posting it here so that it is better indexed and people can find the answer more easily. $\endgroup$
    – BenjaminD
    Nov 29, 2022 at 14:48
  • $\begingroup$ Thanks @BenjaminD, and welcome to Robotics. You may want to check out Olivier Michel's profile for a good example of what a full disclosure profile looks like. $\endgroup$
    – Mark Booth
    Dec 1, 2022 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.