2016-02-17 21:26:00 -04:00
# pragma once
2011-10-11 06:12:37 -03:00
2015-08-11 03:28:40 -03:00
# include <AP_HAL/AP_HAL_Boards.h>
2012-12-13 20:32:36 -04:00
2011-06-01 02:50:17 -03:00
// Just so that it's completely clear...
2012-08-16 21:50:03 -03:00
# define ENABLED 1
# define DISABLED 0
2011-02-24 01:56:59 -04:00
2012-03-07 03:40:04 -04:00
// this avoids a very common config error
# define ENABLE ENABLED
# define DISABLE DISABLED
2011-09-04 21:15:36 -03:00
2015-03-25 14:58:46 -03:00
// Autopilot Yaw Mode enumeration
enum autopilot_yaw_mode {
AUTO_YAW_HOLD = 0 , // pilot controls the heading
AUTO_YAW_LOOK_AT_NEXT_WP = 1 , // point towards next waypoint (no pilot input accepted)
2017-12-26 00:35:46 -04:00
AUTO_YAW_ROI = 2 , // point towards a location held in roi (no pilot input accepted)
2017-12-25 23:55:42 -04:00
AUTO_YAW_FIXED = 3 , // point towards a particular angle (no pilot input accepted)
2015-03-25 14:58:46 -03:00
AUTO_YAW_LOOK_AHEAD = 4 , // point in the direction the copter is moving
AUTO_YAW_RESETTOARMEDYAW = 5 , // point towards heading at time motors were armed
2017-07-10 09:51:43 -03:00
AUTO_YAW_RATE = 6 , // turn at a specified rate (held in auto_yaw_rate)
2015-03-25 14:58:46 -03:00
} ;
2014-01-23 01:16:06 -04:00
2015-03-10 15:21:31 -03:00
// Ch6... Ch12 aux switch control
2013-07-29 04:28:04 -03:00
# define AUX_SWITCH_PWM_TRIGGER_HIGH 1800 // pwm value above which the ch7 or ch8 option will be invoked
# define AUX_SWITCH_PWM_TRIGGER_LOW 1200 // pwm value below which the ch7 or ch8 option will be disabled
2013-05-17 02:42:28 -03:00
2013-07-29 04:28:04 -03:00
// values used by the ap.ch7_opt and ap.ch8_opt flags
2015-10-13 16:19:05 -03:00
# define AUX_SWITCH_LOW 0 // indicates auxiliary switch is in the low position (pwm <1200)
# define AUX_SWITCH_MIDDLE 1 // indicates auxiliary switch is in the middle position (pwm >1200, <1800)
# define AUX_SWITCH_HIGH 2 // indicates auxiliary switch is in the high position (pwm >1800)
2012-12-19 12:08:59 -04:00
2015-03-17 09:06:45 -03:00
// Aux Switch enumeration
enum aux_sw_func {
2015-04-22 15:18:34 -03:00
AUXSW_DO_NOTHING = 0 , // aux switch disabled
AUXSW_FLIP = 2 , // flip
AUXSW_SIMPLE_MODE = 3 , // change to simple mode
AUXSW_RTL = 4 , // change to RTL flight mode
AUXSW_SAVE_TRIM = 5 , // save current position as level
AUXSW_SAVE_WP = 7 , // save mission waypoint or RTL if in auto mode
AUXSW_CAMERA_TRIGGER = 9 , // trigger camera servo or relay
2016-04-27 08:37:04 -03:00
AUXSW_RANGEFINDER = 10 , // allow enabling or disabling rangefinder in flight which helps avoid surface tracking when you are far above the ground
2015-04-22 15:18:34 -03:00
AUXSW_FENCE = 11 , // allow enabling or disabling fence in flight
2017-08-24 02:27:29 -03:00
AUXSW_RESETTOARMEDYAW = 12 , // UNUSED
2015-04-22 15:18:34 -03:00
AUXSW_SUPERSIMPLE_MODE = 13 , // change to simple mode in middle, super simple at top
AUXSW_ACRO_TRAINER = 14 , // low = disabled, middle = leveled, high = leveled and limited
AUXSW_SPRAYER = 15 , // enable/disable the crop sprayer
AUXSW_AUTO = 16 , // change to auto flight mode
AUXSW_AUTOTUNE = 17 , // auto tune
AUXSW_LAND = 18 , // change to LAND flight mode
2016-10-29 08:01:29 -03:00
AUXSW_GRIPPER = 19 , // Operate cargo grippers low=off, middle=neutral, high=on
2015-04-22 15:18:34 -03:00
AUXSW_PARACHUTE_ENABLE = 21 , // Parachute enable/disable
AUXSW_PARACHUTE_RELEASE = 22 , // Parachute release
AUXSW_PARACHUTE_3POS = 23 , // Parachute disable, enable, release with 3 position switch
AUXSW_MISSION_RESET = 24 , // Reset auto mission to start from first command
AUXSW_ATTCON_FEEDFWD = 25 , // enable/disable the roll and pitch rate feed forward
AUXSW_ATTCON_ACCEL_LIM = 26 , // enable/disable the roll, pitch and yaw accel limiting
AUXSW_RETRACT_MOUNT = 27 , // Retract Mount
AUXSW_RELAY = 28 , // Relay pin on/off (only supports first relay)
AUXSW_LANDING_GEAR = 29 , // Landing gear controller
AUXSW_LOST_COPTER_SOUND = 30 , // Play lost copter sound
AUXSW_MOTOR_ESTOP = 31 , // Emergency Stop Switch
2015-05-17 00:22:47 -03:00
AUXSW_MOTOR_INTERLOCK = 32 , // Motor On/Off switch
2016-01-04 22:54:05 -04:00
AUXSW_BRAKE = 33 , // Brake flight mode
AUXSW_RELAY2 = 34 , // Relay2 pin on/off (in Mission planner set CH8_OPT = 34)
AUXSW_RELAY3 = 35 , // Relay3 pin on/off (in Mission planner set CH9_OPT = 35)
2016-03-03 02:27:55 -04:00
AUXSW_RELAY4 = 36 , // Relay4 pin on/off (in Mission planner set CH10_OPT = 36)
2016-07-21 09:44:09 -03:00
AUXSW_THROW = 37 , // change to THROW flight mode
AUXSW_AVOID_ADSB = 38 , // enable AP_Avoidance library
2016-11-16 21:40:49 -04:00
AUXSW_PRECISION_LOITER = 39 , // enable precision loiter
2016-12-18 23:15:17 -04:00
AUXSW_AVOID_PROXIMITY = 40 , // enable object avoidance using proximity sensors (ie. horizontal lidar)
2017-02-06 02:28:52 -04:00
AUXSW_ARMDISARM = 41 , // arm or disarm vehicle
2017-09-14 10:21:33 -03:00
AUXSW_SMART_RTL = 42 , // change to SmartRTL flight mode
2017-08-27 20:51:49 -03:00
AUXSW_INVERTED = 43 , // enable inverted flight
2017-10-04 23:21:23 -03:00
AUXSW_WINCH_ENABLE = 44 , // winch enable/disable
AUXSW_WINCH_CONTROL = 45 , // winch control
2018-01-23 08:54:27 -04:00
AUXSW_RC_OVERRIDE_ENABLE = 46 , // enable RC Override
2016-09-23 03:41:10 -03:00
AUXSW_SWITCH_MAX ,
2015-03-17 09:06:45 -03:00
} ;
2011-02-24 01:56:59 -04:00
// Frame types
2013-09-09 03:57:54 -03:00
# define UNDEFINED_FRAME 0
2017-01-09 05:54:18 -04:00
# define MULTICOPTER_FRAME 1
# define HELI_FRAME 2
2011-05-18 20:38:24 -03:00
2011-02-19 03:44:44 -04:00
// HIL enumerations
2012-11-10 01:55:51 -04:00
# define HIL_MODE_DISABLED 0
2014-01-02 01:28:50 -04:00
# define HIL_MODE_SENSORS 1
2011-02-19 03:44:44 -04:00
2015-03-24 18:10:03 -03:00
// Auto Pilot Modes enumeration
2016-01-25 17:26:20 -04:00
enum control_mode_t {
2015-05-02 01:23:50 -03:00
STABILIZE = 0 , // manual airframe angle with manual throttle
ACRO = 1 , // manual body-frame angular rate with manual throttle
ALT_HOLD = 2 , // manual airframe angle with automatic throttle
AUTO = 3 , // fully automatic waypoint control using mission commands
GUIDED = 4 , // fully automatic fly to coordinate or fly at velocity/direction using GCS immediate commands
LOITER = 5 , // automatic horizontal acceleration with automatic throttle
RTL = 6 , // automatic return to launching point
CIRCLE = 7 , // automatic circular flight with automatic throttle
LAND = 9 , // automatic landing with horizontal position control
DRIFT = 11 , // semi-automous position, yaw and throttle control
SPORT = 13 , // manual earth-frame angular rate control with manual throttle
FLIP = 14 , // automatically flip the vehicle on the roll axis
AUTOTUNE = 15 , // automatically tune the vehicle's roll and pitch gains
POSHOLD = 16 , // automatic position hold with manual override, with automatic throttle
2015-12-18 05:46:56 -04:00
BRAKE = 17 , // full-brake using inertial/GPS system, no pilot input
2016-07-21 09:44:09 -03:00
THROW = 18 , // throw to launch mode using inertial/GPS system, no pilot input
AVOID_ADSB = 19 , // automatic avoidance of obstacles in the macro scale - e.g. full-sized aircraft
2016-08-01 05:44:12 -03:00
GUIDED_NOGPS = 20 , // guided mode but only accepts attitude and altitude
2017-09-08 23:45:31 -03:00
SMART_RTL = 21 , // SMART_RTL returns to home by retracing its steps
2018-01-18 02:12:29 -04:00
FLOWHOLD = 22 , // FLOWHOLD holds position with optical flow without rangefinder
2018-02-05 22:44:05 -04:00
FOLLOW = 23 , // follow attempts to follow another vehicle or ground station
2015-03-24 18:10:03 -03:00
} ;
2013-10-29 01:28:27 -03:00
2016-01-25 19:40:41 -04:00
enum mode_reason_t {
MODE_REASON_UNKNOWN = 0 ,
MODE_REASON_TX_COMMAND ,
MODE_REASON_GCS_COMMAND ,
MODE_REASON_RADIO_FAILSAFE ,
MODE_REASON_BATTERY_FAILSAFE ,
MODE_REASON_GCS_FAILSAFE ,
MODE_REASON_EKF_FAILSAFE ,
MODE_REASON_GPS_GLITCH ,
MODE_REASON_MISSION_END ,
MODE_REASON_THROTTLE_LAND_ESCAPE ,
2016-04-22 08:37:48 -03:00
MODE_REASON_FENCE_BREACH ,
2016-05-12 23:39:37 -03:00
MODE_REASON_TERRAIN_FAILSAFE ,
2016-05-25 04:15:18 -03:00
MODE_REASON_BRAKE_TIMEOUT ,
2016-07-21 09:44:09 -03:00
MODE_REASON_FLIP_COMPLETE ,
MODE_REASON_AVOIDANCE ,
MODE_REASON_AVOIDANCE_RECOVERY ,
2016-08-01 09:42:09 -03:00
MODE_REASON_THROW_COMPLETE ,
2017-08-30 16:32:00 -03:00
MODE_REASON_TERMINATE ,
2018-01-18 02:49:20 -04:00
MODE_REASON_TMODE ,
2016-01-25 19:40:41 -04:00
} ;
2015-03-24 17:43:58 -03:00
// Tuning enumeration
enum tuning_func {
2015-04-22 15:10:10 -03:00
TUNING_NONE = 0 , //
TUNING_STABILIZE_ROLL_PITCH_KP = 1 , // stabilize roll/pitch angle controller's P term
TUNING_STABILIZE_YAW_KP = 3 , // stabilize yaw heading controller's P term
TUNING_RATE_ROLL_PITCH_KP = 4 , // body frame roll/pitch rate controller's P term
TUNING_RATE_ROLL_PITCH_KI = 5 , // body frame roll/pitch rate controller's I term
TUNING_YAW_RATE_KP = 6 , // body frame yaw rate controller's P term
TUNING_THROTTLE_RATE_KP = 7 , // throttle rate controller's P term (desired rate to acceleration or motor output)
TUNING_WP_SPEED = 10 , // maximum speed to next way point (0 to 10m/s)
TUNING_LOITER_POSITION_KP = 12 , // loiter distance controller's P term (position error to speed)
TUNING_HELI_EXTERNAL_GYRO = 13 , // TradHeli specific external tail gyro gain
TUNING_ALTITUDE_HOLD_KP = 14 , // altitude hold controller's P term (alt error to desired rate)
TUNING_RATE_ROLL_PITCH_KD = 21 , // body frame roll/pitch rate controller's D term
TUNING_VEL_XY_KP = 22 , // loiter rate controller's P term (speed error to tilt angle)
TUNING_ACRO_RP_KP = 25 , // acro controller's P term. converts pilot input to a desired roll, pitch or yaw rate
TUNING_YAW_RATE_KD = 26 , // body frame yaw rate controller's D term
TUNING_VEL_XY_KI = 28 , // loiter rate controller's I term (speed error to tilt angle)
TUNING_AHRS_YAW_KP = 30 , // ahrs's compass effect on yaw angle (0 = very low, 1 = very high)
TUNING_AHRS_KP = 31 , // accelerometer effect on roll/pitch angle (0=low)
TUNING_ACCEL_Z_KP = 34 , // accel based throttle controller's P term
TUNING_ACCEL_Z_KI = 35 , // accel based throttle controller's I term
TUNING_ACCEL_Z_KD = 36 , // accel based throttle controller's D term
TUNING_DECLINATION = 38 , // compass declination in radians
TUNING_CIRCLE_RATE = 39 , // circle turn rate in degrees (hard coded to about 45 degrees in either direction)
TUNING_ACRO_YAW_KP = 40 , // acro controller's P term. converts pilot input to a desired roll, pitch or yaw rate
2016-04-27 08:37:04 -03:00
TUNING_RANGEFINDER_GAIN = 41 , // rangefinder gain
2015-04-22 15:10:10 -03:00
TUNING_EKF_VERTICAL_POS = 42 , // EKF's baro vs accel (higher rely on accels more, baro impact is reduced). Range should be 0.2 ~ 4.0? 2.0 is default
TUNING_EKF_HORIZONTAL_POS = 43 , // EKF's gps vs accel (higher rely on accels more, gps impact is reduced). Range should be 1.0 ~ 3.0? 1.5 is default
TUNING_EKF_ACCEL_NOISE = 44 , // EKF's accel noise (lower means trust accels more, gps & baro less). Range should be 0.02 ~ 0.5 0.5 is default (but very robust at that level)
TUNING_RC_FEEL_RP = 45 , // roll-pitch input smoothing
TUNING_RATE_PITCH_KP = 46 , // body frame pitch rate controller's P term
TUNING_RATE_PITCH_KI = 47 , // body frame pitch rate controller's I term
TUNING_RATE_PITCH_KD = 48 , // body frame pitch rate controller's D term
TUNING_RATE_ROLL_KP = 49 , // body frame roll rate controller's P term
TUNING_RATE_ROLL_KI = 50 , // body frame roll rate controller's I term
TUNING_RATE_ROLL_KD = 51 , // body frame roll rate controller's D term
TUNING_RATE_PITCH_FF = 52 , // body frame pitch rate controller FF term
TUNING_RATE_ROLL_FF = 53 , // body frame roll rate controller FF term
TUNING_RATE_YAW_FF = 54 , // body frame yaw rate controller FF term
TUNING_RATE_MOT_YAW_HEADROOM = 55 , // motors yaw headroom minimum
2017-10-04 23:21:23 -03:00
TUNING_RATE_YAW_FILT = 56 , // yaw rate input filter
TUNING_WINCH = 57 // winch control (not actually a value to be tuned)
2015-03-24 17:43:58 -03:00
} ;
2011-11-20 09:30:42 -04:00
2013-08-04 06:14:07 -03:00
// Acro Trainer types
# define ACRO_TRAINER_DISABLED 0
# define ACRO_TRAINER_LEVELING 1
# define ACRO_TRAINER_LIMITED 2
2011-03-05 00:56:58 -04:00
2013-04-18 03:30:18 -03:00
// Yaw behaviours during missions - possible values for WP_YAW_BEHAVIOR parameter
# define WP_YAW_BEHAVIOR_NONE 0 // auto pilot will never control yaw during missions or rtl (except for DO_CONDITIONAL_YAW command received)
# define WP_YAW_BEHAVIOR_LOOK_AT_NEXT_WP 1 // auto pilot will face next waypoint or home during rtl
2013-11-13 13:57:48 -04:00
# define WP_YAW_BEHAVIOR_LOOK_AT_NEXT_WP_EXCEPT_RTL 2 // auto pilot will face next waypoint except when doing RTL at which time it will stay in it's last
2013-04-20 03:36:24 -03:00
# define WP_YAW_BEHAVIOR_LOOK_AHEAD 3 // auto pilot will look ahead during missions and rtl (primarily meant for traditional helicotpers)
2012-12-09 05:04:31 -04:00
2014-01-27 23:21:16 -04:00
// Auto modes
enum AutoMode {
Auto_TakeOff ,
Auto_WP ,
Auto_Land ,
Auto_RTL ,
2014-04-16 04:23:24 -03:00
Auto_CircleMoveToEdge ,
2014-03-22 00:48:54 -03:00
Auto_Circle ,
2014-05-23 02:29:08 -03:00
Auto_Spline ,
2014-10-12 05:06:51 -03:00
Auto_NavGuided ,
2016-11-17 01:19:22 -04:00
Auto_Loiter ,
Auto_NavPayloadPlace ,
2014-01-27 23:21:16 -04:00
} ;
2014-06-02 06:06:11 -03:00
// Guided modes
enum GuidedMode {
2014-08-04 11:08:46 -03:00
Guided_TakeOff ,
2014-06-02 06:06:11 -03:00
Guided_WP ,
2014-11-14 17:26:45 -04:00
Guided_Velocity ,
2015-10-08 08:13:53 -03:00
Guided_PosVel ,
Guided_Angle ,
2014-06-02 06:06:11 -03:00
} ;
2014-01-25 04:24:43 -04:00
// RTL states
enum RTLState {
2015-05-17 22:37:32 -03:00
RTL_InitialClimb ,
RTL_ReturnHome ,
RTL_LoiterAtHome ,
RTL_FinalDescent ,
RTL_Land
2014-01-25 04:24:43 -04:00
} ;
2012-11-29 08:08:19 -04:00
2017-07-26 14:14:40 -03:00
// Safe RTL states
2017-09-14 10:21:33 -03:00
enum SmartRTLState {
SmartRTL_WaitForPathCleanup ,
SmartRTL_PathFollow ,
SmartRTL_PreLandPosition ,
SmartRTL_Descend ,
SmartRTL_Land
2017-07-26 14:14:40 -03:00
} ;
2015-06-09 21:06:33 -03:00
// Alt_Hold states
enum AltHoldModeState {
2016-05-05 09:51:56 -03:00
AltHold_MotorStopped ,
2015-06-09 21:06:33 -03:00
AltHold_Takeoff ,
AltHold_Flying ,
AltHold_Landed
} ;
2015-06-24 22:31:06 -03:00
// Loiter states
enum LoiterModeState {
2016-05-05 09:59:43 -03:00
Loiter_MotorStopped ,
2015-06-24 22:31:06 -03:00
Loiter_Takeoff ,
Loiter_Flying ,
Loiter_Landed
} ;
2016-07-31 22:49:44 -03:00
// Sport states
enum SportModeState {
Sport_MotorStopped ,
Sport_Takeoff ,
Sport_Flying ,
Sport_Landed
} ;
2014-01-31 00:55:08 -04:00
// Flip states
enum FlipState {
Flip_Start ,
Flip_Roll ,
2014-04-23 02:32:03 -03:00
Flip_Pitch_A ,
Flip_Pitch_B ,
2014-01-31 00:55:08 -04:00
Flip_Recover ,
Flip_Abandon
} ;
2016-08-08 01:27:39 -03:00
enum LandStateType {
LandStateType_FlyToLocation = 0 ,
LandStateType_Descending = 1
} ;
2013-05-10 10:37:15 -03:00
2016-11-17 01:19:22 -04:00
enum PayloadPlaceStateType {
PayloadPlaceStateType_FlyToLocation ,
PayloadPlaceStateType_Calibrating_Hover_Start ,
PayloadPlaceStateType_Calibrating_Hover ,
PayloadPlaceStateType_Descending_Start ,
PayloadPlaceStateType_Descending ,
PayloadPlaceStateType_Releasing_Start ,
PayloadPlaceStateType_Releasing ,
PayloadPlaceStateType_Released ,
PayloadPlaceStateType_Ascending_Start ,
PayloadPlaceStateType_Ascending ,
PayloadPlaceStateType_Done ,
} ;
2016-09-12 03:23:53 -03:00
// bit options for DEV_OPTIONS parameter
enum DevOptions {
DevOptionADSBMAVLink = 1 ,
} ;
2010-12-19 12:40:33 -04:00
// Logging parameters
2018-03-12 13:32:28 -03:00
enum LoggingParameters {
TYPE_AIRSTART_MSG ,
TYPE_GROUNDSTART_MSG ,
LOG_CONTROL_TUNING_MSG ,
LOG_OPTFLOW_MSG ,
LOG_EVENT_MSG ,
LOG_ERROR_MSG ,
LOG_DATA_INT16_MSG ,
LOG_DATA_UINT16_MSG ,
LOG_DATA_INT32_MSG ,
LOG_DATA_UINT32_MSG ,
LOG_DATA_FLOAT_MSG ,
LOG_AUTOTUNE_MSG ,
LOG_AUTOTUNEDETAILS_MSG ,
LOG_MOTBATT_MSG ,
LOG_PARAMTUNE_MSG ,
LOG_HELI_MSG ,
LOG_PRECLAND_MSG ,
LOG_GUIDEDTARGET_MSG ,
} ;
2012-08-16 21:50:03 -03:00
2012-11-10 01:55:51 -04:00
# define MASK_LOG_ATTITUDE_FAST (1<<0)
# define MASK_LOG_ATTITUDE_MED (1<<1)
2012-08-16 21:50:03 -03:00
# define MASK_LOG_GPS (1<<2)
# define MASK_LOG_PM (1<<3)
# define MASK_LOG_CTUN (1<<4)
# define MASK_LOG_NTUN (1<<5)
2013-11-27 03:46:25 -04:00
# define MASK_LOG_RCIN (1<<6)
2013-01-12 11:17:44 -04:00
# define MASK_LOG_IMU (1<<7)
2012-08-16 21:50:03 -03:00
# define MASK_LOG_CMD (1<<8)
2013-01-26 04:20:41 -04:00
# define MASK_LOG_CURRENT (1<<9)
2013-11-27 07:17:16 -04:00
# define MASK_LOG_RCOUT (1<<10)
2012-08-16 21:50:03 -03:00
# define MASK_LOG_OPTFLOW (1<<11)
2015-05-27 01:32:05 -03:00
# define MASK_LOG_PID (1<<12)
2013-02-09 02:24:02 -04:00
# define MASK_LOG_COMPASS (1<<13)
2014-01-13 09:00:11 -04:00
# define MASK_LOG_INAV (1<<14) // deprecated
2012-12-06 11:57:08 -04:00
# define MASK_LOG_CAMERA (1<<15)
2015-03-18 09:08:30 -03:00
# define MASK_LOG_MOTBATT (1UL<<17)
2015-04-19 23:40:04 -03:00
# define MASK_LOG_IMU_FAST (1UL<<18)
2015-05-06 23:09:00 -03:00
# define MASK_LOG_IMU_RAW (1UL<<19)
2014-10-16 21:37:49 -03:00
# define MASK_LOG_ANY 0xFFFF
2012-11-10 01:55:51 -04:00
// DATA - event logging
2015-04-22 15:36:59 -03:00
# define DATA_AP_STATE 7
2018-03-09 12:14:51 -04:00
// 8 was DATA_SYSTEM_TIME_SET
2015-04-22 15:36:59 -03:00
# define DATA_INIT_SIMPLE_BEARING 9
# define DATA_ARMED 10
# define DATA_DISARMED 11
# define DATA_AUTO_ARMED 15
# define DATA_LAND_COMPLETE_MAYBE 17
# define DATA_LAND_COMPLETE 18
# define DATA_NOT_LANDED 28
# define DATA_LOST_GPS 19
# define DATA_FLIP_START 21
# define DATA_FLIP_END 22
# define DATA_SET_HOME 25
# define DATA_SET_SIMPLE_ON 26
# define DATA_SET_SIMPLE_OFF 27
# define DATA_SET_SUPERSIMPLE_ON 29
# define DATA_AUTOTUNE_INITIALISED 30
# define DATA_AUTOTUNE_OFF 31
# define DATA_AUTOTUNE_RESTART 32
# define DATA_AUTOTUNE_SUCCESS 33
# define DATA_AUTOTUNE_FAILED 34
# define DATA_AUTOTUNE_REACHED_LIMIT 35
# define DATA_AUTOTUNE_PILOT_TESTING 36
# define DATA_AUTOTUNE_SAVEDGAINS 37
# define DATA_SAVE_TRIM 38
# define DATA_SAVEWP_ADD_WP 39
# define DATA_FENCE_ENABLE 41
# define DATA_FENCE_DISABLE 42
# define DATA_ACRO_TRAINER_DISABLED 43
# define DATA_ACRO_TRAINER_LEVELING 44
# define DATA_ACRO_TRAINER_LIMITED 45
2016-10-29 08:01:29 -03:00
# define DATA_GRIPPER_GRAB 46
# define DATA_GRIPPER_RELEASE 47
2015-04-22 15:36:59 -03:00
# define DATA_PARACHUTE_DISABLED 49
# define DATA_PARACHUTE_ENABLED 50
# define DATA_PARACHUTE_RELEASED 51
# define DATA_LANDING_GEAR_DEPLOYED 52
# define DATA_LANDING_GEAR_RETRACTED 53
# define DATA_MOTORS_EMERGENCY_STOPPED 54
# define DATA_MOTORS_EMERGENCY_STOP_CLEARED 55
# define DATA_MOTORS_INTERLOCK_DISABLED 56
# define DATA_MOTORS_INTERLOCK_ENABLED 57
2015-06-16 23:00:48 -03:00
# define DATA_ROTOR_RUNUP_COMPLETE 58 // Heli only
2015-06-18 20:39:58 -03:00
# define DATA_ROTOR_SPEED_BELOW_CRITICAL 59 // Heli only
2015-07-05 05:38:04 -03:00
# define DATA_EKF_ALT_RESET 60
2016-01-14 01:47:26 -04:00
# define DATA_LAND_CANCELLED_BY_PILOT 61
2016-06-24 06:12:30 -03:00
# define DATA_EKF_YAW_RESET 62
2016-07-21 09:44:09 -03:00
# define DATA_AVOIDANCE_ADSB_ENABLE 63
# define DATA_AVOIDANCE_ADSB_DISABLE 64
2016-12-18 23:15:17 -04:00
# define DATA_AVOIDANCE_PROXIMITY_ENABLE 65
# define DATA_AVOIDANCE_PROXIMITY_DISABLE 66
2017-03-08 20:16:25 -04:00
# define DATA_GPS_PRIMARY_CHANGED 67
2017-10-04 23:21:23 -03:00
# define DATA_WINCH_RELAXED 68
# define DATA_WINCH_LENGTH_CONTROL 69
# define DATA_WINCH_RATE_CONTROL 70
2014-01-26 00:41:14 -04:00
2012-12-29 23:08:25 -04:00
// Error message sub systems and error codes
# define ERROR_SUBSYSTEM_MAIN 1
# define ERROR_SUBSYSTEM_RADIO 2
# define ERROR_SUBSYSTEM_COMPASS 3
# define ERROR_SUBSYSTEM_OPTFLOW 4
2013-03-16 05:14:21 -03:00
# define ERROR_SUBSYSTEM_FAILSAFE_RADIO 5
# define ERROR_SUBSYSTEM_FAILSAFE_BATT 6
2015-03-12 23:05:30 -03:00
# define ERROR_SUBSYSTEM_FAILSAFE_GPS 7 // not used
2013-04-29 09:30:22 -03:00
# define ERROR_SUBSYSTEM_FAILSAFE_GCS 8
# define ERROR_SUBSYSTEM_FAILSAFE_FENCE 9
2013-09-24 08:47:54 -03:00
# define ERROR_SUBSYSTEM_FLIGHT_MODE 10
2017-07-25 08:41:18 -03:00
# define ERROR_SUBSYSTEM_GPS 11
2013-10-29 10:11:48 -03:00
# define ERROR_SUBSYSTEM_CRASH_CHECK 12
2014-01-31 00:55:08 -04:00
# define ERROR_SUBSYSTEM_FLIP 13
2014-02-02 03:58:36 -04:00
# define ERROR_SUBSYSTEM_AUTOTUNE 14
2014-04-03 05:55:34 -03:00
# define ERROR_SUBSYSTEM_PARACHUTE 15
2015-03-27 03:23:17 -03:00
# define ERROR_SUBSYSTEM_EKFCHECK 16
2014-08-06 12:59:19 -03:00
# define ERROR_SUBSYSTEM_FAILSAFE_EKFINAV 17
2014-07-28 05:38:32 -03:00
# define ERROR_SUBSYSTEM_BARO 18
2014-10-30 01:23:09 -03:00
# define ERROR_SUBSYSTEM_CPU 19
2015-11-27 00:54:00 -04:00
# define ERROR_SUBSYSTEM_FAILSAFE_ADSB 20
2016-03-19 03:41:02 -03:00
# define ERROR_SUBSYSTEM_TERRAIN 21
# define ERROR_SUBSYSTEM_NAVIGATION 22
2016-04-22 08:37:48 -03:00
# define ERROR_SUBSYSTEM_FAILSAFE_TERRAIN 23
2016-10-10 03:44:11 -03:00
# define ERROR_SUBSYSTEM_EKF_PRIMARY 24
2012-12-29 23:08:25 -04:00
// general error codes
# define ERROR_CODE_ERROR_RESOLVED 0
# define ERROR_CODE_FAILED_TO_INITIALISE 1
2015-07-12 10:06:21 -03:00
# define ERROR_CODE_UNHEALTHY 4
2012-12-29 23:08:25 -04:00
// subsystem specific error codes -- radio
# define ERROR_CODE_RADIO_LATE_FRAME 2
2013-03-16 05:14:21 -03:00
// subsystem specific error codes -- failsafe_thr, batt, gps
# define ERROR_CODE_FAILSAFE_RESOLVED 0
# define ERROR_CODE_FAILSAFE_OCCURRED 1
2013-05-13 06:01:30 -03:00
// subsystem specific error codes -- compass
# define ERROR_CODE_COMPASS_FAILED_TO_READ 2
2013-10-08 03:30:43 -03:00
// subsystem specific error codes -- main
2013-10-29 10:11:48 -03:00
# define ERROR_CODE_MAIN_INS_DELAY 1
// subsystem specific error codes -- crash checker
# define ERROR_CODE_CRASH_CHECK_CRASH 1
2014-04-03 05:55:34 -03:00
# define ERROR_CODE_CRASH_CHECK_LOSS_OF_CONTROL 2
2014-01-31 00:55:08 -04:00
// subsystem specific error codes -- flip
# define ERROR_CODE_FLIP_ABANDONED 2
2016-03-19 03:41:02 -03:00
// subsystem specific error codes -- terrain
# define ERROR_CODE_MISSING_TERRAIN_DATA 2
// subsystem specific error codes -- navigation
# define ERROR_CODE_FAILED_TO_SET_DESTINATION 2
2016-04-22 08:44:57 -03:00
# define ERROR_CODE_RESTARTED_RTL 3
2016-04-28 21:47:34 -03:00
# define ERROR_CODE_FAILED_CIRCLE_INIT 4
2016-05-19 05:35:44 -03:00
# define ERROR_CODE_DEST_OUTSIDE_FENCE 5
2015-06-05 05:38:25 -03:00
2015-05-12 09:54:07 -03:00
// parachute failed to deploy because of low altitude or landed
2014-04-03 05:55:34 -03:00
# define ERROR_CODE_PARACHUTE_TOO_LOW 2
2015-05-12 09:54:07 -03:00
# define ERROR_CODE_PARACHUTE_LANDED 3
2014-07-21 07:12:17 -03:00
// EKF check definitions
2015-03-27 03:23:17 -03:00
# define ERROR_CODE_EKFCHECK_BAD_VARIANCE 2
# define ERROR_CODE_EKFCHECK_VARIANCE_CLEARED 0
2014-07-28 05:38:32 -03:00
// Baro specific error codes
# define ERROR_CODE_BARO_GLITCH 2
2017-07-25 08:41:18 -03:00
// GPS specific error coces
# define ERROR_CODE_GPS_GLITCH 2
2012-12-29 23:08:25 -04:00
2013-11-16 00:55:59 -04:00
// Radio failsafe definitions (FS_THR parameter)
2018-01-19 09:44:02 -04:00
# define FS_THR_DISABLED 0
# define FS_THR_ENABLED_ALWAYS_RTL 1
# define FS_THR_ENABLED_CONTINUE_MISSION 2
# define FS_THR_ENABLED_ALWAYS_LAND 3
# define FS_THR_ENABLED_ALWAYS_SMARTRTL_OR_RTL 4
# define FS_THR_ENABLED_ALWAYS_SMARTRTL_OR_LAND 5
2013-11-16 00:55:59 -04:00
2016-01-25 19:18:38 -04:00
// GCS failsafe definitions (FS_GCS_ENABLE parameter)
2018-01-19 09:44:02 -04:00
# define FS_GCS_DISABLED 0
# define FS_GCS_ENABLED_ALWAYS_RTL 1
# define FS_GCS_ENABLED_CONTINUE_MISSION 2
# define FS_GCS_ENABLED_ALWAYS_SMARTRTL_OR_RTL 3
# define FS_GCS_ENABLED_ALWAYS_SMARTRTL_OR_LAND 4
2016-01-25 19:18:38 -04:00
2015-06-09 23:39:06 -03:00
// EKF failsafe definitions (FS_EKF_ACTION parameter)
# define FS_EKF_ACTION_LAND 1 // switch to LAND mode on EKF failsafe
# define FS_EKF_ACTION_ALTHOLD 2 // switch to ALTHOLD mode on EKF failsafe
# define FS_EKF_ACTION_LAND_EVEN_STABILIZE 3 // switch to Land mode on EKF failsafe even if in a manual flight mode like stabilize
2014-11-14 21:18:17 -04:00
// for mavlink SET_POSITION_TARGET messages
# define MAVLINK_SET_POS_TYPE_MASK_POS_IGNORE ((1<<0) | (1<<1) | (1<<2))
# define MAVLINK_SET_POS_TYPE_MASK_VEL_IGNORE ((1<<3) | (1<<4) | (1<<5))
# define MAVLINK_SET_POS_TYPE_MASK_ACC_IGNORE ((1<<6) | (1<<7) | (1<<8))
2015-04-10 23:57:41 -03:00
# define MAVLINK_SET_POS_TYPE_MASK_FORCE (1<<9)
# define MAVLINK_SET_POS_TYPE_MASK_YAW_IGNORE (1<<10)
# define MAVLINK_SET_POS_TYPE_MASK_YAW_RATE_IGNORE (1<<11)
2014-07-28 19:25:40 -03:00
2015-04-30 03:06:55 -03:00
// for PILOT_THR_BHV parameter
# define THR_BEHAVE_FEEDBACK_FROM_MID_STICK (1<<0)
2016-01-06 17:39:36 -04:00
# define THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND (1<<1)
2016-01-11 19:59:42 -04:00
# define THR_BEHAVE_DISARM_ON_LAND_DETECT (1<<2)