-
Notifications
You must be signed in to change notification settings - Fork 497
Fix physics based sensor update rate in lockstep mode #2863
Conversation
Signed-off-by: Ian Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tried it manually, but the logic looks reasonable.
gazebo/sensors/Sensor.cc
Outdated
if (this->UpdateImpl(_force)) | ||
{ | ||
common::Time simTime = this->world->SimTime(); | ||
this->lastUpdateTime = simTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could avoid the temporary object here:
this->lastUpdateTime = simTime; | |
this->lastUpdateTime = this->world->SimTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. 4ab78c5
Signed-off-by: Ian Chen <[email protected]>
This fix is very much needed in Gazebo 11, where it hasn't been ported!!! Without it, gazebo_ros_imu_sensor is broken and never publishes any ROS messages in lockstep mode (and gazebo_ros_block_laser and gazbeo_ros_range as well, as given by the search https://github.com/search?q=repo%3Aros-simulation%2Fgazebo_ros_pkgs%20lastupdatetime&type=code ). When porting the fix, it should also be taken into account that @iche033 Do you want to prepare the forward port or should I? |
closes issue #2861 - see issue on how to reproduce the problem
Problem was that the physics based sensors were all throttled by the max update rate of all sensors in lockstep mode. This PR applies proper throttling to the sensors.
I was also able to reproduce the problem by adding an additional ray sensor with different update rate to the laser strict rate integration test world file and that caused
INTEGRATION_laser
test to fail. Test should be fixed with these changes.