mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 02:43:33 +08:00
mavlink: adapted to change in distance_sensor msg
This commit is contained in:
@@ -2228,7 +2228,10 @@ protected:
|
||||
|
||||
mavlink_distance_sensor_t msg;
|
||||
|
||||
msg.time_boot_ms = dist_sensor.time_boot_ms;
|
||||
msg.time_boot_ms = dist_sensor.timestamp / 1000; /* us to ms */
|
||||
|
||||
/* TODO: use correct ID here */
|
||||
msg.id = 0;
|
||||
|
||||
switch (dist_sensor.type) {
|
||||
case MAV_DISTANCE_SENSOR_ULTRASOUND:
|
||||
@@ -2248,11 +2251,10 @@ protected:
|
||||
break;
|
||||
}
|
||||
|
||||
msg.id = dist_sensor.id;
|
||||
msg.orientation = dist_sensor.orientation;
|
||||
msg.min_distance = dist_sensor.min_distance;
|
||||
msg.max_distance = dist_sensor.max_distance;
|
||||
msg.current_distance = dist_sensor.current_distance;
|
||||
msg.min_distance = dist_sensor.min_distance * 100.0f; /* m to cm */
|
||||
msg.max_distance = dist_sensor.max_distance * 100.0f; /* m to cm */
|
||||
msg.current_distance = dist_sensor.current_distance * 100.0f; /* m to cm */
|
||||
msg.covariance = dist_sensor.covariance;
|
||||
|
||||
_mavlink->send_message(MAVLINK_MSG_ID_DISTANCE_SENSOR, &msg);
|
||||
|
||||
@@ -420,10 +420,10 @@ MavlinkReceiver::handle_message_optical_flow_rad(mavlink_message_t *msg)
|
||||
struct distance_sensor_s d;
|
||||
memset(&d, 0, sizeof(d));
|
||||
|
||||
d.time_boot_ms = hrt_absolute_time();
|
||||
d.timestamp = hrt_absolute_time();
|
||||
d.min_distance = 0.3f;
|
||||
d.max_distance = 5.0f;
|
||||
d.current_distance = flow.distance;
|
||||
d.current_distance = flow.distance; /* both are in m */
|
||||
d.type = 1;
|
||||
d.id = 0;
|
||||
d.orientation = 8;
|
||||
@@ -470,10 +470,10 @@ MavlinkReceiver::handle_message_hil_optical_flow(mavlink_message_t *msg)
|
||||
struct distance_sensor_s d;
|
||||
memset(&d, 0, sizeof(d));
|
||||
|
||||
d.time_boot_ms = hrt_absolute_time();
|
||||
d.timestamp = hrt_absolute_time();
|
||||
d.min_distance = 0.3f;
|
||||
d.max_distance = 5.0f;
|
||||
d.current_distance = flow.distance;
|
||||
d.current_distance = flow.distance; /* both are in m */
|
||||
d.type = 1;
|
||||
d.id = 0;
|
||||
d.orientation = 8;
|
||||
@@ -530,10 +530,10 @@ MavlinkReceiver::handle_message_distance_sensor(mavlink_message_t *msg)
|
||||
struct distance_sensor_s d;
|
||||
memset(&d, 0, sizeof(d));
|
||||
|
||||
d.time_boot_ms = dist_sensor.time_boot_ms;
|
||||
d.min_distance = dist_sensor.min_distance;
|
||||
d.max_distance = dist_sensor.max_distance;
|
||||
d.current_distance = dist_sensor.current_distance;
|
||||
d.timestamp = dist_sensor.time_boot_ms * 1000; /* ms to us */
|
||||
d.min_distance = float(dist_sensor.min_distance) * 1e-2f; /* cm to m */
|
||||
d.max_distance = float(dist_sensor.max_distance) * 1e-2f; /* cm to m */
|
||||
d.current_distance = float(dist_sensor.current_distance) * 1e-2f; /* cm to m */
|
||||
d.type = dist_sensor.type;
|
||||
d.id = dist_sensor.id;
|
||||
d.orientation = dist_sensor.orientation;
|
||||
|
||||
Reference in New Issue
Block a user