CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Rover/afs_rover.cpp
Views: 1798
1
/*
2
Rover specific AP_AdvancedFailsafe class
3
*/
4
5
#include "Rover.h"
6
7
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
8
9
/*
10
Setup radio_out values for all channels to termination values
11
*/
12
void AP_AdvancedFailsafe_Rover::terminate_vehicle(void)
13
{
14
// disarm as well
15
AP::arming().disarm(AP_Arming::Method::AFS);
16
17
// Set to HOLD mode
18
rover.set_mode(rover.mode_hold, ModeReason::CRASH_FAILSAFE);
19
}
20
21
/*
22
Return an AFS_MODE for current control mode
23
*/
24
AP_AdvancedFailsafe::control_mode AP_AdvancedFailsafe_Rover::afs_mode(void)
25
{
26
if (rover.control_mode->is_autopilot_mode()) {
27
return AP_AdvancedFailsafe::AFS_AUTO;
28
}
29
return AP_AdvancedFailsafe::AFS_STABILIZED;
30
}
31
32
//to force entering auto mode when datalink loss
33
void AP_AdvancedFailsafe_Rover::set_mode_auto(void)
34
{
35
rover.set_mode(rover.mode_auto,ModeReason::GCS_FAILSAFE);
36
}
37
#endif // AP_ROVER_ADVANCED_FAILSAFE_ENABLED
38
39