AP_Landing: correct compilation when GCS library not available

This commit is contained in:
Peter Barker 2023-12-08 13:10:37 +11:00 committed by Andrew Tridgell
parent 87c0543d9f
commit 6df3f18440
3 changed files with 22 additions and 22 deletions

View File

@ -253,7 +253,7 @@ bool AP_Landing::verify_land(const Location &prev_WP_loc, Location &next_WP_loc,
default: default:
// returning TRUE while executing verify_land() will increment the // returning TRUE while executing verify_land() will increment the
// mission index which in many cases will trigger an RTL for end-of-mission // mission index which in many cases will trigger an RTL for end-of-mission
gcs().send_text(MAV_SEVERITY_CRITICAL, "Landing configuration error, invalid LAND_TYPE"); GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "Landing configuration error, invalid LAND_TYPE");
success = true; success = true;
break; break;
} }
@ -486,14 +486,14 @@ bool AP_Landing::restart_landing_sequence()
mission.set_current_cmd(current_index+1)) mission.set_current_cmd(current_index+1))
{ {
// if the next immediate command is MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT to climb, do it // if the next immediate command is MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT to climb, do it
gcs().send_text(MAV_SEVERITY_NOTICE, "Restarted landing sequence. Climbing to %dm", (signed)cmd.content.location.alt/100); GCS_SEND_TEXT(MAV_SEVERITY_NOTICE, "Restarted landing sequence. Climbing to %dm", (signed)cmd.content.location.alt/100);
success = true; success = true;
} }
else if (do_land_start_index != 0 && else if (do_land_start_index != 0 &&
mission.set_current_cmd(do_land_start_index)) mission.set_current_cmd(do_land_start_index))
{ {
// look for a DO_LAND_START and use that index // look for a DO_LAND_START and use that index
gcs().send_text(MAV_SEVERITY_NOTICE, "Restarted landing via DO_LAND_START: %d",do_land_start_index); GCS_SEND_TEXT(MAV_SEVERITY_NOTICE, "Restarted landing via DO_LAND_START: %d",do_land_start_index);
success = true; success = true;
} }
else if (prev_cmd_with_wp_index != AP_MISSION_CMD_INDEX_NONE && else if (prev_cmd_with_wp_index != AP_MISSION_CMD_INDEX_NONE &&
@ -501,10 +501,10 @@ bool AP_Landing::restart_landing_sequence()
{ {
// if a suitable navigation waypoint was just executed, one that contains lat/lng/alt, then // if a suitable navigation waypoint was just executed, one that contains lat/lng/alt, then
// repeat that cmd to restart the landing from the top of approach to repeat intended glide slope // repeat that cmd to restart the landing from the top of approach to repeat intended glide slope
gcs().send_text(MAV_SEVERITY_NOTICE, "Restarted landing sequence at waypoint %d", prev_cmd_with_wp_index); GCS_SEND_TEXT(MAV_SEVERITY_NOTICE, "Restarted landing sequence at waypoint %d", prev_cmd_with_wp_index);
success = true; success = true;
} else { } else {
gcs().send_text(MAV_SEVERITY_WARNING, "Unable to restart landing sequence"); GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "Unable to restart landing sequence");
success = false; success = false;
} }

View File

@ -345,7 +345,7 @@ bool AP_Landing_Deepstall::override_servos(void)
if (elevator == nullptr) { if (elevator == nullptr) {
// deepstalls are impossible without these channels, abort the process // deepstalls are impossible without these channels, abort the process
gcs().send_text(MAV_SEVERITY_CRITICAL, "Deepstall: Unable to find the elevator channels"); GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "Deepstall: Unable to find the elevator channels");
request_go_around(); request_go_around();
return false; return false;
} }
@ -533,17 +533,17 @@ void AP_Landing_Deepstall::build_approach_path(bool use_current_heading)
#ifdef DEBUG_PRINTS #ifdef DEBUG_PRINTS
// TODO: Send this information via a MAVLink packet // TODO: Send this information via a MAVLink packet
gcs().send_text(MAV_SEVERITY_INFO, "Arc: %3.8f %3.8f", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Arc: %3.8f %3.8f",
(double)(arc.lat / 1e7),(double)( arc.lng / 1e7)); (double)(arc.lat / 1e7),(double)( arc.lng / 1e7));
gcs().send_text(MAV_SEVERITY_INFO, "Loiter en: %3.8f %3.8f", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Loiter en: %3.8f %3.8f",
(double)(arc_entry.lat / 1e7), (double)(arc_entry.lng / 1e7)); (double)(arc_entry.lat / 1e7), (double)(arc_entry.lng / 1e7));
gcs().send_text(MAV_SEVERITY_INFO, "Loiter ex: %3.8f %3.8f", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Loiter ex: %3.8f %3.8f",
(double)(arc_exit.lat / 1e7), (double)(arc_exit.lng / 1e7)); (double)(arc_exit.lat / 1e7), (double)(arc_exit.lng / 1e7));
gcs().send_text(MAV_SEVERITY_INFO, "Extended: %3.8f %3.8f", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Extended: %3.8f %3.8f",
(double)(extended_approach.lat / 1e7), (double)(extended_approach.lng / 1e7)); (double)(extended_approach.lat / 1e7), (double)(extended_approach.lng / 1e7));
gcs().send_text(MAV_SEVERITY_INFO, "Extended by: %f (%f)", (double)approach_extension_m, GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Extended by: %f (%f)", (double)approach_extension_m,
(double)expected_travel_distance); (double)expected_travel_distance);
gcs().send_text(MAV_SEVERITY_INFO, "Target Heading: %3.1f", (double)target_heading_deg); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Target Heading: %3.1f", (double)target_heading_deg);
#endif // DEBUG_PRINTS #endif // DEBUG_PRINTS
} }
@ -590,7 +590,7 @@ float AP_Landing_Deepstall::predict_travel_distance(const Vector3f wind, const f
if(print) { if(print) {
// allow printing the travel distances on the final entry as its used for tuning // allow printing the travel distances on the final entry as its used for tuning
gcs().send_text(MAV_SEVERITY_INFO, "Deepstall: Entry: %0.1f (m) Travel: %0.1f (m)", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Deepstall: Entry: %0.1f (m) Travel: %0.1f (m)",
(double)stall_distance, (double)predicted_travel_distance); (double)stall_distance, (double)predicted_travel_distance);
} }
@ -620,7 +620,7 @@ float AP_Landing_Deepstall::update_steering()
// panic if no position source is available // panic if no position source is available
// continue the stall but target just holding the wings held level as deepstall should be a minimal // continue the stall but target just holding the wings held level as deepstall should be a minimal
// energy configuration on the aircraft, and if a position isn't available aborting would be worse // energy configuration on the aircraft, and if a position isn't available aborting would be worse
gcs().send_text(MAV_SEVERITY_CRITICAL, "Deepstall: Invalid data from AHRS. Holding level"); GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "Deepstall: Invalid data from AHRS. Holding level");
hold_level = true; hold_level = true;
} }
@ -652,7 +652,7 @@ float AP_Landing_Deepstall::update_steering()
float error = wrap_PI(constrain_float(desired_change, -yaw_rate_limit_rps, yaw_rate_limit_rps) - yaw_rate); float error = wrap_PI(constrain_float(desired_change, -yaw_rate_limit_rps, yaw_rate_limit_rps) - yaw_rate);
#ifdef DEBUG_PRINTS #ifdef DEBUG_PRINTS
gcs().send_text(MAV_SEVERITY_INFO, "x: %f e: %f r: %f d: %f", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "x: %f e: %f r: %f d: %f",
(double)crosstrack_error, (double)crosstrack_error,
(double)error, (double)error,
(double)degrees(yaw_rate), (double)degrees(yaw_rate),

View File

@ -38,7 +38,7 @@ void AP_Landing::type_slope_do_land(const AP_Mission::Mission_Command& cmd, cons
type_slope_flags.post_stats = false; type_slope_flags.post_stats = false;
type_slope_stage = SlopeStage::NORMAL; type_slope_stage = SlopeStage::NORMAL;
gcs().send_text(MAV_SEVERITY_INFO, "Landing approach start at %.1fm", (double)relative_altitude); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Landing approach start at %.1fm", (double)relative_altitude);
} }
void AP_Landing::type_slope_verify_abort_landing(const Location &prev_WP_loc, Location &next_WP_loc, bool &throttle_suppressed) void AP_Landing::type_slope_verify_abort_landing(const Location &prev_WP_loc, Location &next_WP_loc, bool &throttle_suppressed)
@ -106,9 +106,9 @@ bool AP_Landing::type_slope_verify_land(const Location &prev_WP_loc, Location &n
if (type_slope_stage != SlopeStage::FINAL) { if (type_slope_stage != SlopeStage::FINAL) {
type_slope_flags.post_stats = true; type_slope_flags.post_stats = true;
if (is_flying && (AP_HAL::millis()-last_flying_ms) > 3000) { if (is_flying && (AP_HAL::millis()-last_flying_ms) > 3000) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "Flare crash detected: speed=%.1f", (double)gps.ground_speed()); GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "Flare crash detected: speed=%.1f", (double)gps.ground_speed());
} else { } else {
gcs().send_text(MAV_SEVERITY_INFO, "Flare %.1fm sink=%.2f speed=%.1f dist=%.1f", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Flare %.1fm sink=%.2f speed=%.1f dist=%.1f",
(double)height, (double)sink_rate, (double)height, (double)sink_rate,
(double)gps.ground_speed(), (double)gps.ground_speed(),
(double)current_loc.get_distance(next_WP_loc)); (double)current_loc.get_distance(next_WP_loc));
@ -122,7 +122,7 @@ bool AP_Landing::type_slope_verify_land(const Location &prev_WP_loc, Location &n
AP_LandingGear *LG_inst = AP_LandingGear::get_singleton(); AP_LandingGear *LG_inst = AP_LandingGear::get_singleton();
if (LG_inst != nullptr && !LG_inst->check_before_land()) { if (LG_inst != nullptr && !LG_inst->check_before_land()) {
type_slope_request_go_around(); type_slope_request_go_around();
gcs().send_text(MAV_SEVERITY_CRITICAL, "Landing gear was not deployed"); GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "Landing gear was not deployed");
} }
#endif #endif
} }
@ -158,7 +158,7 @@ bool AP_Landing::type_slope_verify_land(const Location &prev_WP_loc, Location &n
// this is done before disarm_if_autoland_complete() so that it happens on the next loop after the disarm // this is done before disarm_if_autoland_complete() so that it happens on the next loop after the disarm
if (type_slope_flags.post_stats && !is_armed) { if (type_slope_flags.post_stats && !is_armed) {
type_slope_flags.post_stats = false; type_slope_flags.post_stats = false;
gcs().send_text(MAV_SEVERITY_INFO, "Distance from LAND point=%.2fm", (double)current_loc.get_distance(next_WP_loc)); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Distance from LAND point=%.2fm", (double)current_loc.get_distance(next_WP_loc));
} }
// check if we should auto-disarm after a confirmed landing // check if we should auto-disarm after a confirmed landing
@ -226,7 +226,7 @@ void AP_Landing::type_slope_adjust_landing_slope_for_rangefinder_bump(AP_FixedWi
// is projected slope too steep? // is projected slope too steep?
if (new_slope_deg - initial_slope_deg > slope_recalc_steep_threshold_to_abort) { if (new_slope_deg - initial_slope_deg > slope_recalc_steep_threshold_to_abort) {
gcs().send_text(MAV_SEVERITY_INFO, "Landing slope too steep, aborting (%.0fm %.1fdeg)", GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Landing slope too steep, aborting (%.0fm %.1fdeg)",
(double)rangefinder_state.correction, (double)(new_slope_deg - initial_slope_deg)); (double)rangefinder_state.correction, (double)(new_slope_deg - initial_slope_deg));
alt_offset = rangefinder_state.correction; alt_offset = rangefinder_state.correction;
flags.commanded_go_around = true; flags.commanded_go_around = true;
@ -319,7 +319,7 @@ void AP_Landing::type_slope_setup_landing_glide_slope(const Location &prev_WP_lo
bool is_first_calc = is_zero(slope); bool is_first_calc = is_zero(slope);
slope = (sink_height - aim_height) / (total_distance - flare_distance); slope = (sink_height - aim_height) / (total_distance - flare_distance);
if (is_first_calc) { if (is_first_calc) {
gcs().send_text(MAV_SEVERITY_INFO, "Landing glide slope %.1f degrees", (double)degrees(atanf(slope))); GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Landing glide slope %.1f degrees", (double)degrees(atanf(slope)));
} }
// calculate point along that slope 500m ahead // calculate point along that slope 500m ahead