forked from ArduPilot/ardupilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathafs_rover.cpp
37 lines (31 loc) · 906 Bytes
/
afs_rover.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Rover specific AP_AdvancedFailsafe class
*/
#include "Rover.h"
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
/*
Setup radio_out values for all channels to termination values
*/
void AP_AdvancedFailsafe_Rover::terminate_vehicle(void)
{
// disarm as well
AP::arming().disarm(AP_Arming::Method::AFS);
// Set to HOLD mode
rover.set_mode(rover.mode_hold, ModeReason::CRASH_FAILSAFE);
}
/*
Return an AFS_MODE for current control mode
*/
AP_AdvancedFailsafe::control_mode AP_AdvancedFailsafe_Rover::afs_mode(void)
{
if (rover.control_mode->is_autopilot_mode()) {
return AP_AdvancedFailsafe::AFS_AUTO;
}
return AP_AdvancedFailsafe::AFS_STABILIZED;
}
//to force entering auto mode when datalink loss
void AP_AdvancedFailsafe_Rover::set_mode_auto(void)
{
rover.set_mode(rover.mode_auto,ModeReason::GCS_FAILSAFE);
}
#endif // AP_ROVER_ADVANCED_FAILSAFE_ENABLED