2017-01-30 10:21:55 -04:00
|
|
|
/*
|
|
|
|
Rover specific AP_AdvancedFailsafe class
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Rover.h"
|
|
|
|
|
|
|
|
#if ADVANCED_FAILSAFE == ENABLED
|
|
|
|
|
|
|
|
// Constructor
|
2018-05-05 05:28:48 -03:00
|
|
|
AP_AdvancedFailsafe_Rover::AP_AdvancedFailsafe_Rover(AP_Mission &_mission, const AP_GPS &_gps) :
|
|
|
|
AP_AdvancedFailsafe(_mission, _gps)
|
2017-01-30 10:21:55 -04:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Setup radio_out values for all channels to termination values
|
|
|
|
*/
|
|
|
|
void AP_AdvancedFailsafe_Rover::terminate_vehicle(void)
|
|
|
|
{
|
|
|
|
// disarm as well
|
|
|
|
rover.disarm_motors();
|
|
|
|
|
|
|
|
// Set to HOLD mode
|
2017-07-24 14:05:59 -03:00
|
|
|
rover.set_mode(rover.mode_hold, MODE_REASON_CRASH_FAILSAFE);
|
2017-01-30 10:21:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Return an AFS_MODE for current control mode
|
|
|
|
*/
|
|
|
|
AP_AdvancedFailsafe::control_mode AP_AdvancedFailsafe_Rover::afs_mode(void)
|
|
|
|
{
|
2017-07-19 01:34:04 -03:00
|
|
|
if (rover.control_mode->is_autopilot_mode()) {
|
2017-01-30 10:21:55 -04:00
|
|
|
return AP_AdvancedFailsafe::AFS_AUTO;
|
|
|
|
}
|
|
|
|
return AP_AdvancedFailsafe::AFS_STABILIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // ADVANCED_FAILSAFE
|