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!)
Robotics Stack Exchange is a question and answer site for professional robotic engineers, hobbyists, researchers and students. It only takes a minute to sign up.
Sign up to join this communityThere are several ways to increase the simulation speed:
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.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.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.castShadows
field of light nodes: PointLight
, SpotLight
, or
DirectionalLight
.Physics
nodes. Avoid
using Solid
nodes when a Transform
or a Shape
node can be used
instead.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.<none>
for any Robot
node that doesn't
need to be controlled, instead of using the <generic>
controller.