diff --git a/Changelog.md b/Changelog.md
index a63b024193..37a5d4c38a 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,6 +2,9 @@
## Gazebo 9.xx.x (202x-xx-xx)
+1. Fix physics based sensor update rate in lockstep mode
+ * [Pull request #2863](https://github.com/osrf/gazebo/pull/2863)
+
## Gazebo 9.15.0 (2020-09-30)
1. More enhancement for Windows build
diff --git a/gazebo/sensors/Sensor.cc b/gazebo/sensors/Sensor.cc
index 68ca997284..0560646f60 100644
--- a/gazebo/sensors/Sensor.cc
+++ b/gazebo/sensors/Sensor.cc
@@ -174,8 +174,17 @@ void Sensor::Update(const bool _force)
{
if (this->useStrictRate)
{
+ // rendering sensors (IMAGE category) has its own mechanism
+ // for throttling and lockstepping with physics. So throttle just
+ // physics sensors
+ if (this->dataPtr->category != IMAGE && !this->NeedsUpdate() && !_force)
+ return;
+
if (this->UpdateImpl(_force))
+ {
+ this->lastUpdateTime = this->world->SimTime();;
this->dataPtr->updated();
+ }
}
else
{
diff --git a/gazebo/sensors/SensorManager.cc b/gazebo/sensors/SensorManager.cc
index 7f189f04b8..039673c11d 100644
--- a/gazebo/sensors/SensorManager.cc
+++ b/gazebo/sensors/SensorManager.cc
@@ -762,7 +762,7 @@ void SensorManager::SensorContainer::RunLoop()
if (!g_sensorsDirty)
return;
- // Get the minimum update rate from the sensors.
+ // Get the maximum update rate from the sensors.
for (Sensor_V::iterator iter = this->sensors.begin();
iter != this->sensors.end() && !this->stop; ++iter)
{
diff --git a/test/worlds/laser_hit_strict_rate_test.world b/test/worlds/laser_hit_strict_rate_test.world
index 7e9e5baf31..5474a512d9 100644
--- a/test/worlds/laser_hit_strict_rate_test.world
+++ b/test/worlds/laser_hit_strict_rate_test.world
@@ -32,6 +32,32 @@
true
+
+
+
+ 4
+ 1
+ -2.26889
+ 2.268899
+
+
+
+ 0.0
+ 20
+ 0.01
+
+
+ 1
+ 250
+ true
+
+
+
+
+
+ true
+
+
@@ -53,5 +79,6 @@
+