gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
621 stars 251 forks source link

Inconsistency between custom sensor system example and internal sensor systems #2361

Open 5p00kk opened 3 months ago

5p00kk commented 3 months ago

Description

Hi, I have noticed that the implementation of the example custom sensor system (https://github.com/gazebosim/gz-sim/blob/gz-sim8/examples/plugin/custom_sensor_system/OdometerSystem.cc) diverges from the implementation used internally in gazebo (https://github.com/gazebosim/gz-sim/blob/gz-sim8/src/systems/altimeter/Altimeter.cc).

In the example, new sensors are created during PreUpdate (together with the SensorTopic component) and then updated with environmental data during PostUpdate.

In internal systems, sensors are partially created during PostUpdate and then during next PreUpdate all new sensors have SensorTopic component added.

I'm not sure if this is intentional but in my opinion should be either aligned or explained somewhere as it seems quite confusing to determine the correct way.