-
Notifications
You must be signed in to change notification settings - Fork 276
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
Custom sensor system example ignoring sdf's update rate #2290
Comments
In general, I believe that our sensor systems are guarded with logic like this: Lines 154 to 166 in c158287
There has been discussion of a set of system callbacks that could fire at particular rates, but there are some intricacies to consider with the potential of rewinding or jumps in time. |
Probably it's two approaches as the following call includes the same check (if forcing=False, the sensor will update itself only if it's time), the sensor's implementation is very similar to the guard in the system: Line 171 in c158287
Regardless, the way OdometerSystem is implemented right now is incorrect because there is neither System level check or call to Sensor's class Update function that would check if it's time to update. Right now the direct Update implementation is being called, which results in Custom Sensor's update being called at the simulation rate. |
Description
In the implementation of a system for the custom sensor, the sensor is updated calling custom sensor's Update() method:
gz-sim/examples/plugin/custom_sensor_system/OdometerSystem.cc
Line 103 in c158287
This will result in sensor update for at each simulation step and the system will ignore the sdf's update_rate attribute.
To avoid it the parent (gz::sensors::Sensor) Update() function should be called that executes the update at given update_rate (if force flag is false). For instance:
sensor->gz::sensors::Sensor::Update(_info.simTime, false);
The text was updated successfully, but these errors were encountered: