# Revision history [back]

### ConnectWorldUpdateBegin vs. ConnectWorldUpdateEnd in model plugins?

As documented in many tutorials and answers.gazebosim.org posts (e.g. this one) model plugins should connect to the WorldUpdateBegin event by registering an update callback using event::Events::ConnectWorldUpdateBegin(...).

As there is also a ConnectWorldUpdateEnd(...) method and from looking at the implementation details in the World::Update() function in World.cc:613 I wonder if it might be better for some model plugins to run at the end of the world update instead of at the beginning? This is especially the case for model plugins that simulate sensors, like the IMU or P3D plugin in the gazebo_plugins package for ROS.

If I understand the implementation of the world update correctly it basically

If this is true then plugins like the gazebo_ros_imu plugin should run after the physics update and have access to the updated model data valid for the current time step to not introduce an delay. It all depends if the physics update at time step t_k integrates over time interval t_(k-1) to t_k or t_k to t_(k+1).