mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Vehicle: Support set_mode
This commit is contained in:
parent
0f4337b7b1
commit
a44a7f541b
@ -19,6 +19,8 @@
|
|||||||
parameters needed by multiple libraries
|
parameters needed by multiple libraries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "ModeReason.h" // reasons can't be defined in this header due to circular loops
|
||||||
|
|
||||||
#include <AP_Baro/AP_Baro.h>
|
#include <AP_Baro/AP_Baro.h>
|
||||||
#include <AP_BoardConfig/AP_BoardConfig.h> // board configuration library
|
#include <AP_BoardConfig/AP_BoardConfig.h> // board configuration library
|
||||||
#include <AP_BoardConfig/AP_BoardConfig_CAN.h>
|
#include <AP_BoardConfig/AP_BoardConfig_CAN.h>
|
||||||
@ -49,6 +51,8 @@ public:
|
|||||||
|
|
||||||
static AP_Vehicle *get_singleton();
|
static AP_Vehicle *get_singleton();
|
||||||
|
|
||||||
|
bool virtual set_mode(const uint8_t new_mode, const ModeReason reason) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
common parameters for fixed wing aircraft
|
common parameters for fixed wing aircraft
|
||||||
*/
|
*/
|
||||||
|
54
libraries/AP_Vehicle/ModeReason.h
Normal file
54
libraries/AP_Vehicle/ModeReason.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// interface to set the vehicles mode
|
||||||
|
enum class ModeReason : uint8_t {
|
||||||
|
UNKNOWN,
|
||||||
|
RC_COMMAND,
|
||||||
|
GCS_COMMAND,
|
||||||
|
RADIO_FAILSAFE,
|
||||||
|
BATTERY_FAILSAFE,
|
||||||
|
GCS_FAILSAFE,
|
||||||
|
EKF_FAILSAFE,
|
||||||
|
GPS_GLITCH,
|
||||||
|
MISSION_END,
|
||||||
|
THROTTLE_LAND_ESCAPE,
|
||||||
|
FENCE_BREACHED,
|
||||||
|
TERRAIN_FAILSAFE,
|
||||||
|
BRAKE_TIMEOUT,
|
||||||
|
FLIP_COMPLETE,
|
||||||
|
AVOIDANCE,
|
||||||
|
AVOIDANCE_RECOVERY,
|
||||||
|
THROW_COMPLETE,
|
||||||
|
TERMINATE,
|
||||||
|
TOY_MODE,
|
||||||
|
CRASH_FAILSAFE,
|
||||||
|
SOARING_FBW_B_WITH_MOTOR_RUNNING,
|
||||||
|
SOARING_THERMAL_DETECTED,
|
||||||
|
SOARING_THERMAL_ESTIMATE_DETERIORATED,
|
||||||
|
VTOL_FAILED_TRANSITION,
|
||||||
|
VTOL_FAILED_TAKEOFF,
|
||||||
|
FAILSAFE, // general failsafes, prefer specific failsafes over this as much as possible
|
||||||
|
INITIALISED,
|
||||||
|
SURFACE_COMPLETE,
|
||||||
|
BAD_DEPTH,
|
||||||
|
LEAK_FAILSAFE,
|
||||||
|
SERVOTEST,
|
||||||
|
STARTUP,
|
||||||
|
SCRIPTING,
|
||||||
|
UNAVAILABLE,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user