Browse Source

Plane: added auto fence enable on VTOL takeoff

fixes issue#724
master
Andrew Tridgell 9 years ago
parent
commit
33f17588b2
  1. 1
      ArduPlane/Plane.h
  2. 10
      ArduPlane/commands_logic.cpp
  3. 3
      ArduPlane/quadplane.cpp
  4. 16
      ArduPlane/takeoff.cpp

1
ArduPlane/Plane.h

@ -1012,6 +1012,7 @@ private: @@ -1012,6 +1012,7 @@ private:
void takeoff_calc_pitch(void);
int8_t takeoff_tail_hold(void);
int16_t get_takeoff_pitch_min_cd(void);
void complete_auto_takeoff(void);
void print_hit_enter();
void ahrs_update();
void update_speed_height(void);

10
ArduPlane/commands_logic.cpp

@ -548,15 +548,7 @@ bool Plane::verify_takeoff() @@ -548,15 +548,7 @@ bool Plane::verify_takeoff()
auto_state.takeoff_complete = true;
next_WP_loc = prev_WP_loc = current_loc;
#if GEOFENCE_ENABLED == ENABLED
if (g.fence_autoenable > 0) {
if (! geofence_set_enabled(true, AUTO_TOGGLED)) {
gcs_send_text(MAV_SEVERITY_NOTICE, "Enable fence failed (cannot autoenable");
} else {
gcs_send_text(MAV_SEVERITY_INFO, "Fence enabled (autoenabled)");
}
}
#endif
plane.complete_auto_takeoff();
// don't cross-track on completion of takeoff, as otherwise we
// can end up doing too sharp a turn

3
ArduPlane/quadplane.cpp

@ -1684,6 +1684,9 @@ bool QuadPlane::verify_vtol_takeoff(const AP_Mission::Mission_Command &cmd) @@ -1684,6 +1684,9 @@ bool QuadPlane::verify_vtol_takeoff(const AP_Mission::Mission_Command &cmd)
}
transition_state = TRANSITION_AIRSPEED_WAIT;
plane.TECS_controller.set_pitch_max_limit(transition_pitch_max);
plane.complete_auto_takeoff();
return true;
}

16
ArduPlane/takeoff.cpp

@ -225,3 +225,19 @@ return_zero: @@ -225,3 +225,19 @@ return_zero:
return 0;
}
/*
called when an auto-takeoff is complete
*/
void Plane::complete_auto_takeoff(void)
{
#if GEOFENCE_ENABLED == ENABLED
if (g.fence_autoenable > 0) {
if (! geofence_set_enabled(true, AUTO_TOGGLED)) {
gcs_send_text(MAV_SEVERITY_NOTICE, "Enable fence failed (cannot autoenable");
} else {
gcs_send_text(MAV_SEVERITY_INFO, "Fence enabled (autoenabled)");
}
}
#endif
}

Loading…
Cancel
Save