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/ArduSub/defines.h
Views: 1798
1
#pragma once
2
3
#include <AP_HAL/AP_HAL_Boards.h>
4
5
#define BOTTOM_DETECTOR_TRIGGER_SEC 1.0
6
#define SURFACE_DETECTOR_TRIGGER_SEC 1.0
7
8
enum AutoSurfaceState {
9
AUTO_SURFACE_STATE_GO_TO_LOCATION,
10
AUTO_SURFACE_STATE_ASCEND
11
};
12
13
// Autopilot Yaw Mode enumeration
14
enum autopilot_yaw_mode {
15
AUTO_YAW_HOLD = 0, // pilot controls the heading
16
AUTO_YAW_LOOK_AT_NEXT_WP = 1, // point towards next waypoint (no pilot input accepted)
17
AUTO_YAW_ROI = 2, // point towards a location held in roi_WP (no pilot input accepted)
18
AUTO_YAW_LOOK_AT_HEADING = 3, // point towards a particular angle (not pilot input accepted)
19
AUTO_YAW_LOOK_AHEAD = 4, // point in the direction the vehicle is moving
20
AUTO_YAW_RESETTOARMEDYAW = 5, // point towards heading at time motors were armed
21
AUTO_YAW_CORRECT_XTRACK = 6, // steer the sub in order to correct for crosstrack error during line following
22
AUTO_YAW_RATE = 7 // steer the sub with the desired yaw rate
23
};
24
25
// Acro Trainer types
26
#define ACRO_TRAINER_DISABLED 0
27
#define ACRO_TRAINER_LEVELING 1
28
#define ACRO_TRAINER_LIMITED 2
29
30
// Yaw behaviours during missions - possible values for WP_YAW_BEHAVIOR parameter
31
#define WP_YAW_BEHAVIOR_NONE 0 // auto pilot will never control yaw during missions or rtl (except for DO_CONDITIONAL_YAW command received)
32
#define WP_YAW_BEHAVIOR_LOOK_AT_NEXT_WP 1 // auto pilot will face next waypoint or home during rtl
33
#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
34
#define WP_YAW_BEHAVIOR_LOOK_AHEAD 3 // auto pilot will look ahead during missions and rtl (primarily meant for traditional helicopters)
35
#define WP_YAW_BEHAVIOR_CORRECT_XTRACK 4 // point towards intermediate position target during line following
36
37
38
39
// Logging parameters - only 32 messages are available to the vehicle here.
40
enum LoggingParameters {
41
LOG_CONTROL_TUNING_MSG,
42
LOG_DATA_INT16_MSG,
43
LOG_DATA_UINT16_MSG,
44
LOG_DATA_INT32_MSG,
45
LOG_DATA_UINT32_MSG,
46
LOG_DATA_FLOAT_MSG,
47
LOG_GUIDEDTARGET_MSG
48
};
49
50
#define MASK_LOG_ATTITUDE_FAST (1<<0)
51
#define MASK_LOG_ATTITUDE_MED (1<<1)
52
#define MASK_LOG_GPS (1<<2)
53
#define MASK_LOG_PM (1<<3)
54
#define MASK_LOG_CTUN (1<<4)
55
#define MASK_LOG_NTUN (1<<5)
56
#define MASK_LOG_RCIN (1<<6)
57
#define MASK_LOG_IMU (1<<7)
58
#define MASK_LOG_CMD (1<<8)
59
#define MASK_LOG_CURRENT (1<<9)
60
#define MASK_LOG_RCOUT (1<<10)
61
#define MASK_LOG_OPTFLOW (1<<11)
62
#define MASK_LOG_PID (1<<12)
63
#define MASK_LOG_COMPASS (1<<13)
64
#define MASK_LOG_CAMERA (1<<15)
65
#define MASK_LOG_MOTBATT (1UL<<17)
66
#define MASK_LOG_IMU_FAST (1UL<<18)
67
#define MASK_LOG_IMU_RAW (1UL<<19)
68
#define MASK_LOG_ANY 0xFFFF
69
70
// GCS failsafe
71
#ifndef FS_GCS
72
# define FS_GCS 0
73
#endif
74
#ifndef FS_GCS_TIMEOUT_S
75
# define FS_GCS_TIMEOUT_S 5.0 // gcs failsafe triggers after this number of seconds with no GCS heartbeat
76
#endif
77
78
// missing terrain data failsafe
79
#ifndef FS_TERRAIN_TIMEOUT_MS
80
#define FS_TERRAIN_TIMEOUT_MS 1000 // 1 second of unhealthy rangefinder and/or missing terrain data will trigger failsafe
81
#endif
82
83
//////////////////////////////////////////////////////////////////////////////
84
// EKF Failsafe
85
// EKF failsafe definitions (FS_EKF_ENABLE parameter)
86
#define FS_EKF_ACTION_DISABLED 0 // Disabled
87
#define FS_EKF_ACTION_WARN_ONLY 1 // Send warning to gcs
88
#define FS_EKF_ACTION_DISARM 2 // Disarm
89
90
91
#ifndef FS_EKF_ACTION_DEFAULT
92
# define FS_EKF_ACTION_DEFAULT FS_EKF_ACTION_DISABLED // EKF failsafe
93
#endif
94
95
#ifndef FS_EKF_THRESHOLD_DEFAULT
96
# define FS_EKF_THRESHOLD_DEFAULT 0.8f // EKF failsafe's default compass and velocity variance threshold above which the EKF failsafe will be triggered
97
#endif
98
99
// GCS failsafe definitions (FS_GCS_ENABLE parameter)
100
#define FS_GCS_DISABLED 0 // Disabled
101
#define FS_GCS_WARN_ONLY 1 // Only send warning to gcs (only useful with multiple gcs links)
102
#define FS_GCS_DISARM 2 // Disarm
103
#define FS_GCS_HOLD 3 // Switch depth hold mode or poshold mode if available
104
#define FS_GCS_SURFACE 4 // Switch to surface mode
105
106
// Leak failsafe definitions (FS_LEAK_ENABLE parameter)
107
#define FS_LEAK_DISABLED 0 // Disabled
108
#define FS_LEAK_WARN_ONLY 1 // Only send warning to gcs
109
#define FS_LEAK_SURFACE 2 // Switch to surface mode
110
111
// Internal pressure failsafe threshold (FS_PRESS_MAX parameter)
112
#define FS_PRESS_MAX_DEFAULT 105000 // Maximum internal pressure in pascal before failsafe is triggered
113
// Internal pressure failsafe definitions (FS_PRESS_ENABLE parameter)
114
#define FS_PRESS_DISABLED 0
115
#define FS_PRESS_WARN_ONLY 1
116
117
// Internal temperature failsafe threshold (FS_TEMP_MAX parameter)
118
#define FS_TEMP_MAX_DEFAULT 62 // Maximum internal pressure in degrees C before failsafe is triggered
119
// Internal temperature failsafe definitions (FS_TEMP_ENABLE parameter)
120
#define FS_TEMP_DISABLED 0
121
#define FS_TEMP_WARN_ONLY 1
122
123
// Crash failsafe options
124
#define FS_CRASH_DISABLED 0
125
#define FS_CRASH_WARN_ONLY 1
126
#define FS_CRASH_DISARM 2
127
128
// Terrain failsafe actions for AUTO mode
129
#define FS_TERRAIN_DISARM 0
130
#define FS_TERRAIN_HOLD 1
131
#define FS_TERRAIN_SURFACE 2
132
133
// Pilot input failsafe actions
134
#define FS_PILOT_INPUT_DISABLED 0
135
#define FS_PILOT_INPUT_WARN_ONLY 1
136
#define FS_PILOT_INPUT_DISARM 2
137
138
// Amount of time to attempt recovery of valid rangefinder data before
139
// initiating terrain failsafe action
140
#define FS_TERRAIN_RECOVER_TIMEOUT_MS 10000
141
142
// for mavlink SET_POSITION_TARGET messages
143
#define MAVLINK_SET_POS_TYPE_MASK_Z_IGNORE (1<<2)
144
#define MAVLINK_SET_POS_TYPE_MASK_POS_IGNORE ((1<<0) | (1<<1) | (1<<2))
145
#define MAVLINK_SET_POS_TYPE_MASK_VEL_IGNORE ((1<<3) | (1<<4) | (1<<5))
146
#define MAVLINK_SET_POS_TYPE_MASK_ACC_IGNORE ((1<<6) | (1<<7) | (1<<8))
147
#define MAVLINK_SET_POS_TYPE_MASK_FORCE (1<<9)
148
#define MAVLINK_SET_POS_TYPE_MASK_YAW_IGNORE (1<<10)
149
#define MAVLINK_SET_POS_TYPE_MASK_YAW_RATE_IGNORE (1<<11)
150
151
152