Browse Source

Plane: implement VTOL landing for AFS termination

this allows for vertical landing as an AFS_TERM_ACTION
master
Andrew Tridgell 6 years ago
parent
commit
7751352a86
  1. 6
      ArduPlane/afs_plane.cpp
  2. 2
      ArduPlane/failsafe.cpp
  3. 6
      ArduPlane/quadplane.cpp
  4. 2
      ArduPlane/servos.cpp

6
ArduPlane/afs_plane.cpp

@ -16,6 +16,12 @@ AP_AdvancedFailsafe_Plane::AP_AdvancedFailsafe_Plane(AP_Mission &_mission) : @@ -16,6 +16,12 @@ AP_AdvancedFailsafe_Plane::AP_AdvancedFailsafe_Plane(AP_Mission &_mission) :
*/
void AP_AdvancedFailsafe_Plane::terminate_vehicle(void)
{
if (plane.quadplane.available() && _terminate_action == TERMINATE_ACTION_LAND) {
// perform a VTOL landing
plane.set_mode(plane.mode_qland, MODE_REASON_FENCE_BREACH);
return;
}
plane.g2.servo_channels.disable_passthrough(true);
if (_terminate_action == TERMINATE_ACTION_LAND) {

2
ArduPlane/failsafe.cpp

@ -86,8 +86,10 @@ void Plane::failsafe_check(void) @@ -86,8 +86,10 @@ void Plane::failsafe_check(void)
#if ADVANCED_FAILSAFE == ENABLED
if (afs.should_crash_vehicle()) {
afs.terminate_vehicle();
if (!afs.terminating_vehicle_via_landing()) {
return;
}
}
#endif
// setup secondary output channels that do have

6
ArduPlane/quadplane.cpp

@ -1653,7 +1653,7 @@ void QuadPlane::update(void) @@ -1653,7 +1653,7 @@ void QuadPlane::update(void)
}
#if ADVANCED_FAILSAFE == ENABLED
if (plane.afs.should_crash_vehicle()) {
if (plane.afs.should_crash_vehicle() && !plane.afs.terminating_vehicle_via_landing()) {
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::SHUT_DOWN);
motors->output();
return;
@ -1845,7 +1845,9 @@ void QuadPlane::motors_output(bool run_rate_controller) @@ -1845,7 +1845,9 @@ void QuadPlane::motors_output(bool run_rate_controller)
}
#if ADVANCED_FAILSAFE == ENABLED
if (!hal.util->get_soft_armed() || plane.afs.should_crash_vehicle() || SRV_Channels::get_emergency_stop()) {
if (!hal.util->get_soft_armed() ||
(plane.afs.should_crash_vehicle() && !plane.afs.terminating_vehicle_via_landing()) ||
SRV_Channels::get_emergency_stop()) {
#else
if (!hal.util->get_soft_armed() || SRV_Channels::get_emergency_stop()) {
#endif

2
ArduPlane/servos.cpp

@ -672,8 +672,10 @@ void Plane::set_servos(void) @@ -672,8 +672,10 @@ void Plane::set_servos(void)
#if ADVANCED_FAILSAFE == ENABLED
if (afs.should_crash_vehicle()) {
afs.terminate_vehicle();
if (!afs.terminating_vehicle_via_landing()) {
return;
}
}
#endif
// do any transition updates for quadplane

Loading…
Cancel
Save