Don't generate sensor data if no one is listening #147
Labels
enhancement
New feature or request
help wanted
Extra attention is needed
performance
Runtime performance
Desired behavior
The most expensive action that rendering sensors take is generating data. So that should only be done when necessary, that is, when someone is listening to that sensor data.
It looks to me that the usual use case if to render the scene even if there are no listeners:
https://github.com/ignitionrobotics/ign-sensors/blob/3e486b404ff29b0a9360be9ce9308edc8cd576d9/src/RgbdCameraSensor.cc#L454-L458
However, Ignition Gazebo uses manual updates, so the scene is updated once for all sensors. Manual update is turned on, and rendering happens here. There's a check to see if it's time to update any sensors (according to their update rate), but I didn't see any checks for whether the sensor actually has subscribers. (did I miss anything?)
Implementation suggestion
My suggestion would be to:
I'm focusing on rendering sensors, but this could be beneficial for other sensors as well.
Alternatives considered
Instead of offering an API so that Gazebo can handle this,
ign-sensors
could handle it internally?The text was updated successfully, but these errors were encountered: