diff --git a/msg/analog_measurement.msg b/msg/analog_measurement.msg index 6ade42abd0..388f0e5113 100644 --- a/msg/analog_measurement.msg +++ b/msg/analog_measurement.msg @@ -1,4 +1,5 @@ uint64 timestamp # time since system start (microseconds) +int32 id # Source node ID uint8[4] unit_type # Units: mV, mA, Kelvin*10 uint16[4] values # mV, mA, Kelvin*10 diff --git a/src/drivers/uavcan/sensors/analog_measurement.cpp b/src/drivers/uavcan/sensors/analog_measurement.cpp index e6b32ca781..1539e61378 100644 --- a/src/drivers/uavcan/sensors/analog_measurement.cpp +++ b/src/drivers/uavcan/sensors/analog_measurement.cpp @@ -64,12 +64,15 @@ UavcanAnalogMeasurementBridge::analog_measurement_sub_cb(const uavcan::ReceivedDataStructure &msg) { analog_measurement_s report{}; - int numIndices = msg.values.size(); + int node_id = msg.getSrcNodeID().get(); + report.id = node_id; + + int numIndices = msg.values.size(); for (int i = 0; i < numIndices; i++) { report.values[i] = msg.values[i]; report.unit_type[i] = msg.unit_type[i]; } - publish(msg.getSrcNodeID().get(), &report); + publish(node_id, &report); }