mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-06 06:43:21 +08:00
MAVLink app: Use proper C99 NaN define
This commit is contained in:
@@ -2890,19 +2890,17 @@ protected:
|
||||
|
||||
msg.time_usec = hrt_absolute_time();
|
||||
|
||||
static constexpr float NAN_VAL = 0.0f / 0.0f;
|
||||
|
||||
msg.altitude_monotonic = (_sensor_time > 0) ? sensor.baro_alt_meter[0] : NAN_VAL;
|
||||
msg.altitude_amsl = (_global_pos_time > 0) ? global_pos.alt : NAN_VAL;
|
||||
msg.altitude_local = (_local_pos_time > 0) ? -local_pos.z : NAN_VAL;
|
||||
msg.altitude_relative = (_home_time > 0) ? (global_pos.alt - home.alt) : NAN_VAL;
|
||||
msg.altitude_monotonic = (_sensor_time > 0) ? sensor.baro_alt_meter[0] : NAN;
|
||||
msg.altitude_amsl = (_global_pos_time > 0) ? global_pos.alt : NAN;
|
||||
msg.altitude_local = (_local_pos_time > 0) ? -local_pos.z : NAN;
|
||||
msg.altitude_relative = (_home_time > 0) ? (global_pos.alt - home.alt) : NAN;
|
||||
|
||||
if (global_pos.terrain_alt_valid) {
|
||||
msg.altitude_terrain = global_pos.terrain_alt;
|
||||
msg.bottom_clearance = global_pos.alt - global_pos.terrain_alt;
|
||||
} else {
|
||||
msg.altitude_terrain = NAN_VAL;
|
||||
msg.bottom_clearance = NAN_VAL;
|
||||
msg.altitude_terrain = NAN;
|
||||
msg.bottom_clearance = NAN;
|
||||
}
|
||||
|
||||
_mavlink->send_message(MAVLINK_MSG_ID_ALTITUDE, &msg);
|
||||
|
||||
Reference in New Issue
Block a user