mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:38:52 +08:00
Drivers: Distance Sensors: Add proper device IDs
Add new DeviceBusType_SERIAL to Device::DeviceId union Add DRV_DIST_DEVTYPE's for all distance sensors Change distance_sensor_s.id to distance_sensor_s.device_id Modify all distance_sensor drivers to apply 'proper' device_id
This commit is contained in:
committed by
Daniel Agar
parent
adf2d2f73a
commit
85796fbd84
@@ -313,6 +313,10 @@ PX4FLOW::collect()
|
||||
/* publish to the distance_sensor topic as well */
|
||||
if (_distance_sensor_topic.get_instance() == 0) {
|
||||
distance_sensor_s distance_report{};
|
||||
DeviceId device_id;
|
||||
device_id.devid = get_device_id();
|
||||
device_id.devid_s.devtype = DRV_DIST_DEVTYPE_PX4FLOW;
|
||||
|
||||
distance_report.timestamp = report.timestamp;
|
||||
distance_report.min_distance = PX4FLOW_MIN_DISTANCE;
|
||||
distance_report.max_distance = PX4FLOW_MAX_DISTANCE;
|
||||
@@ -320,8 +324,7 @@ PX4FLOW::collect()
|
||||
distance_report.variance = 0.0f;
|
||||
distance_report.signal_quality = -1;
|
||||
distance_report.type = distance_sensor_s::MAV_DISTANCE_SENSOR_ULTRASOUND;
|
||||
/* TODO: the ID needs to be properly set */
|
||||
distance_report.id = 0;
|
||||
distance_report.device_id = device_id.devid;
|
||||
distance_report.orientation = _sonar_rotation;
|
||||
|
||||
_distance_sensor_topic.publish(distance_report);
|
||||
|
||||
Reference in New Issue
Block a user