diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index fd8160341d..28149ef820 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -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);