# What does Update Rate control?

I have an SDF file, in which i have the following snippet:

<physics type='ode'>
<max_step_size>0.001000</max_step_size>
<real_time_factor>1.000000</real_time_factor>
<real_time_update_rate>1000.000000</real_time_update_rate>
<gravity>0.000000 0.000000 -9.800000</gravity>
</physics>


Here what does the realtimeupdate_rate parameter do ? Does 1000 mean it updates 1000 time per simulation second or a real world second ? If I want to control the update rate : i.e I have a controller that controls my model. This controller basically controls the position of a joint. But I want it to move at the rate I want it to. say for ex : I want to move 1 radian per second. and I do only a .1 radian increment in my plugin. Which means I need only 10 increments per real world second. So can this be achieved by settin the parameter as

  <real_time_update_rate>10.00000000</real_time_update_rate>


Does that mean my plugin runs only 10 times/ REAL WORLD SECOND ?

edit retag close merge delete

Sort by » oldest newest most voted

The real_time_update_rate controls the update rate of the physics engine. The product of real_time_update_rate and max_time_step determine the target real time factor, though for computationally demanding simulations, the target real-time update rate may not be achieved. If you set the real_time_update_rate to 10.0, with a max_step_size of 0.001, then your simulation will run in slow motion, at about 1% real time factor.

If your plugin uses an update function (for example using the ConnectWorldUpdateBegin event), then it will run after every physics update. If you want to throttle it's actions, then you can make a variable to keep track of the last time the plugin was updated and wait until a certain time has passed before updating further. The Sensor::Update function has some logic like that.

more

Hi,

Yes it means per real world second. According to the SDF documentation:

Description: Rate at which to update the physics engine (UpdatePhysics calls per real-time second). (was physics.sdf's update_rate).

As for the 1 rad/second thing, you could set the speed of the joint only once to 1 rad/sec and it will stay that way. Setting the update rate so low will cause large computational errors in the simulation.

Cheers, Andrei

more