mirror of https://github.com/ArduPilot/ardupilot
Plane: fixed issue where auto is entered before GPS lock
thanks to Tom Pittenger for noticing this!
This commit is contained in:
parent
98b583bccc
commit
999710d0e1
|
@ -530,8 +530,9 @@ static struct {
|
|||
// denotes if a go-around has been commanded for landing
|
||||
bool commanded_go_around:1;
|
||||
|
||||
// Altitude threshold to complete a takeoff command in autonomous modes. Centimeters
|
||||
int32_t takeoff_altitude_cm;
|
||||
// Altitude threshold to complete a takeoff command in autonomous
|
||||
// modes. Centimeters above home
|
||||
int32_t takeoff_altitude_rel_cm;
|
||||
|
||||
// Minimum pitch to hold during takeoff command execution. Hundredths of a degree
|
||||
int16_t takeoff_pitch_cd;
|
||||
|
@ -566,7 +567,7 @@ static struct {
|
|||
fbwa_tdrag_takeoff_mode : false,
|
||||
checked_for_autoland : false,
|
||||
commanded_go_around : false,
|
||||
takeoff_altitude_cm : 0,
|
||||
takeoff_altitude_rel_cm : 0,
|
||||
takeoff_pitch_cd : 0,
|
||||
highest_airspeed : 0,
|
||||
initial_pitch_cd : 0,
|
||||
|
|
|
@ -414,6 +414,16 @@ static int32_t adjusted_altitude_cm(void)
|
|||
return current_loc.alt - (g.alt_offset*100);
|
||||
}
|
||||
|
||||
/*
|
||||
return home-relative altitude adjusted for ALT_OFFSET This is useful
|
||||
during long flights to account for barometer changes from the GCS,
|
||||
or to adjust the flying height of a long mission
|
||||
*/
|
||||
static int32_t adjusted_relative_altitude_cm(void)
|
||||
{
|
||||
return adjusted_altitude_cm() - home.alt;
|
||||
}
|
||||
|
||||
/*
|
||||
return the height in meters above the next_WP_loc altitude
|
||||
*/
|
||||
|
|
|
@ -300,7 +300,7 @@ static void do_takeoff(const AP_Mission::Mission_Command& cmd)
|
|||
set_next_WP(cmd.content.location);
|
||||
// pitch in deg, airspeed m/s, throttle %, track WP 1 or 0
|
||||
auto_state.takeoff_pitch_cd = (int16_t)cmd.p1 * 100;
|
||||
auto_state.takeoff_altitude_cm = next_WP_loc.alt;
|
||||
auto_state.takeoff_altitude_rel_cm = next_WP_loc.alt - home.alt;
|
||||
next_WP_loc.lat = home.lat + 10;
|
||||
next_WP_loc.lng = home.lng + 10;
|
||||
auto_state.takeoff_speed_time_ms = 0;
|
||||
|
@ -398,7 +398,10 @@ static bool verify_takeoff()
|
|||
}
|
||||
|
||||
// see if we have reached takeoff altitude
|
||||
if (adjusted_altitude_cm() > auto_state.takeoff_altitude_cm) {
|
||||
int32_t relative_alt_cm = adjusted_relative_altitude_cm();
|
||||
if (relative_alt_cm > auto_state.takeoff_altitude_rel_cm) {
|
||||
gcs_send_text_fmt(PSTR("Takeoff complete at %.2fm"),
|
||||
relative_alt_cm*0.01f);
|
||||
steer_state.hold_course_cd = -1;
|
||||
auto_state.takeoff_complete = true;
|
||||
next_WP_loc = prev_WP_loc = current_loc;
|
||||
|
|
Loading…
Reference in New Issue