Skip to content

Conversation

oystub
Copy link
Contributor

@oystub oystub commented Mar 13, 2024

Solved Problem

BUG: When using multiple DroneCAN GNSS sensors, they all get the same device id, as the id is stored in a variable shared by all sensor_gps channels.

MISSING FEATURE: The previous code always sets the bus_idx of device_id for DroneCAN devices to 0, not taking into account on which CAN bus the device actually is.

Solution

Extend sensor_bridge channels to also consider the CAN bus index and not only the node ID. This involves changing functions for publishing and getting channels.

For GPS, use the node id and bus index from the actual DroneCAN messages, and not a single variable for all GPSes.

Also, make UavcanSensorBridgeBase not inherit from device::Device. We want to remove this, because each sensor bridge represents multiple devices.

Because of this, I also has to update all uavcan sensor types, but it is just minor changes. Don't be scared by number of files changed!

Changelog Entry

For release notes:

Bugfix: publish correct device ID for sensors on multiple buses

Alternatives

This considers two DroneCAN nodes with the same node ID but on different buses as different devices. I think this is the best approach. It could also be possible to consider these cases the same device.

Test coverage

Ground tested on a CubeOrange with two Here4 GPS units.

Context

See that GPSes got the same device id earlier, but now they get different IDs

Before:
before, same ID

After:
after, different IDs

uavcan_status:
uavcan status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants