Skip to content
New issue

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

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

Already on GitHub? # to your account

Update custom sensor system example to make the sensor respect update rate #2817

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Mar 7, 2025

🦟 Bug fix

Fixes #2290

Summary

In the custom sensor example, the sensor calls its own Update function on every PostUpdate callback, which results in the sensor updating and publishing at 1000Hz. This PR updates the call to the base Sensor class's Update function which has logic to throttle the updates.

To test, build the example following the README instructions, run the world with the custom sensor system, and check the topic frequency:

gz sim -v 4 odometer.sdf
gz topic -f -t /world/odometer_world/model/model_with_sensor/link/link/sensor/an_odometer/odometer

It should drop down to 30Hz

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Signed-off-by: Ian Chen <ichen@openrobotics.org>
@iche033 iche033 requested a review from mjcarroll as a code owner March 7, 2025 19:30
@github-actions github-actions bot added the 🏛️ ionic Gazebo Ionic label Mar 7, 2025
@iche033 iche033 changed the title Update custom sensor example to make the sensor respect update rate Update custom sensor system example to make the sensor respect update rate Mar 7, 2025
@iche033 iche033 merged commit 7fbc51c into gz-sim9 Mar 8, 2025
13 checks passed
@iche033 iche033 deleted the custom_sensor_update_rate branch March 8, 2025 01:34
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🏛️ ionic Gazebo Ionic
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Custom sensor system example ignoring sdf's update rate
2 participants