Add distance sensor id to the the MavlinkStreamDistanceSensor class and format whitespace in mavlink_messages.cpp.

This commit is contained in:
mcsauder 2019-05-30 15:08:25 -06:00 committed by Kabir Mohammed
parent 32fb2bae8c
commit 8966ad59c7
1 changed files with 6 additions and 7 deletions

View File

@ -4183,8 +4183,6 @@ protected:
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:
@ -4204,11 +4202,12 @@ protected:
break;
}
msg.orientation = dist_sensor.orientation;
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.variance * 1e4f; // m^2 to cm^2
msg.current_distance = dist_sensor.current_distance * 1e2f; // m to cm
msg.id = dist_sensor.id;
msg.max_distance = dist_sensor.max_distance * 1e2f; // m to cm
msg.min_distance = dist_sensor.min_distance * 1e2f; // m to cm
msg.orientation = dist_sensor.orientation;
msg.covariance = dist_sensor.variance * 1e4f; // m^2 to cm^2
mavlink_msg_distance_sensor_send_struct(_mavlink->get_channel(), &msg);