Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sensor update rate throttling when new sensors are spawned #2784

Merged
merged 4 commits into from
Jul 13, 2020

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Jul 10, 2020

There is an issue with sensor manager's update loop throttling. When a world is loaded, the sensor manager figures out the max update rate from all the sensors in the world. However, when a new sensor is spawned after the world is loaded, this max update rate is never updated. This causes a problem for example when later spawning a sensor with an update rate higher than all the existing sensors in the world, this new sensor would never hit its target update rate.

This PR adds a flag (global variable, g_sensorsDirty, to avoid breaking ABI) to detect when sensors are added or removed, and recalcuates the sensor manager's max update rate when the flag is dirty.

The bug only affects non-rendering sensors, e.g. imu, ray sensor, etc

To manually test this, you can:

  1. download the hokuyo model from gazebo model database, e.g. by inserting it from gazebo's Insert tab on the left
  2. create a copy with higher update rate, e.g. copy the model ~/.gazebo/models/hokuyo to ~/.gazebo/models/hokuyo_new and change the update rate in model.sdf and also remember to give it a new name in model.config
  3. launch gazebo and insert the original hokuyo model -> check update rate, e.g. Ctrl + T and select the corresponding laser scan topic under LaserStamped msg type
  4. insert the new hokuyo model with higher update rate -> check update rate using the same way as before. Verify that the new model is able to reach the target update rate with the changes in this PR.

Signed-off-by: Ian Chen ichen@osrfoundation.org

Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
gazebo/rendering/Visual.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just remove the changes in gazebo/rendering/Visual.cc. i will open a PR to fix it separately

Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed brackets #2784

@iche033 iche033 merged commit fbf99a2 into gazebo9 Jul 13, 2020
@iche033 iche033 deleted the sensor_update_rate branch July 13, 2020 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants