How do I create a custom sensor?

asked 2021-12-20 11:36:52 -0500

rgov gravatar image

Unanswered similar question: Can I create custom sensor 'types'?

I am implementing a custom sensor that will publish a measurement every 1Hz. I can do so by subclassing SensorPlugin, listening for the "world update begin" event, and publishing messages at the right frequency from the event handler.

However, the instance of Sensor to which my SensorPlugin is attached has its own behavior and will also be firing its Sensor::UpdateImpl() method, which might publish its own messages, on its own topics, etc.

There does not appear to be a "null sensor" that does nothing. If you do not provide a sensor type, the SensorManager does not instantiate the sensor, so the plugin would not be loaded.

Otherwise I'm not entirely sure what the value of a SensorPlugin is, since it cannot override behavior of a Sensor. Maybe it is only limited to calling SetPose or SetActive?

edit retag flag offensive close merge delete