Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/ArduSub/config.h
9673 views
1
#pragma once
2
3
#include "defines.h"
4
5
//////////////////////////////////////////////////////////////////////////////
6
//////////////////////////////////////////////////////////////////////////////
7
// HARDWARE CONFIGURATION AND CONNECTIONS
8
//////////////////////////////////////////////////////////////////////////////
9
//////////////////////////////////////////////////////////////////////////////
10
11
#ifndef CONFIG_HAL_BOARD
12
#error CONFIG_HAL_BOARD must be defined to build ArduSub
13
#endif
14
15
// run at 400Hz on all systems
16
# define MAIN_LOOP_RATE 400
17
18
#ifndef SURFACE_DEPTH_DEFAULT
19
# define SURFACE_DEPTH_DEFAULT -10.0f // pressure sensor reading 10cm depth means craft is considered surfaced
20
#endif
21
22
//////////////////////////////////////////////////////////////////////////////
23
// PWM control
24
// default RC speed in Hz
25
#ifndef RC_SPEED_DEFAULT
26
# define RC_SPEED_DEFAULT 200
27
#endif
28
29
//////////////////////////////////////////////////////////////////////////////
30
// Circle Nav parameters
31
//
32
33
#ifndef CIRCLE_NAV_ENABLED
34
# define CIRCLE_NAV_ENABLED 1
35
#endif
36
37
//////////////////////////////////////////////////////////////////////////////
38
// RC
39
//
40
41
#ifndef AP_SUB_RC_ENABLED
42
# define AP_SUB_RC_ENABLED 1
43
#endif
44
#ifndef RCMAP_ENABLED
45
# define RCMAP_ENABLED AP_SUB_RC_ENABLED
46
#endif
47
48
//////////////////////////////////////////////////////////////////////////////
49
// Throttle Failsafe
50
//
51
#ifndef FS_THR_VALUE_DEFAULT
52
# define FS_THR_VALUE_DEFAULT 975
53
#endif
54
55
56
//////////////////////////////////////////////////////////////////////////////
57
// Rangefinder
58
//
59
60
#ifndef RANGEFINDER_HEALTH_MAX
61
# define RANGEFINDER_HEALTH_MAX 3 // number of good reads that indicates a healthy rangefinder
62
#endif
63
64
#ifndef RANGEFINDER_TIMEOUT_MS
65
# define RANGEFINDER_TIMEOUT_MS 1000 // desired rangefinder alt will reset to current rangefinder alt after this many milliseconds without a good rangefinder alt
66
#endif
67
68
#ifndef RANGEFINDER_WPNAV_FILT_HZ
69
# define RANGEFINDER_WPNAV_FILT_HZ 0.25f // filter frequency for rangefinder altitude provided to waypoint navigation class
70
#endif
71
72
#ifndef RANGEFINDER_TILT_CORRECTION // by disable tilt correction for use of range finder data by EKF
73
# define RANGEFINDER_TILT_CORRECTION 0
74
#endif
75
76
#ifndef RANGEFINDER_SIGNAL_MIN_DEFAULT
77
# define RANGEFINDER_SIGNAL_MIN_DEFAULT 90 // rangefinder readings with signal quality below this value are ignored
78
#endif
79
80
#ifndef SURFTRAK_DEPTH_DEFAULT
81
# define SURFTRAK_DEPTH_DEFAULT -50.0f // surftrak will try to keep the sub below this depth
82
#endif
83
84
// Avoidance (relies on Proximity and Fence)
85
#ifndef AVOIDANCE_ENABLED
86
# define AVOIDANCE_ENABLED 0
87
#endif
88
89
#if AVOIDANCE_ENABLED // Avoidance Library relies on Fence
90
# define FENCE_ENABLED 1
91
#endif
92
93
#ifndef MAV_SYSTEM_ID
94
# define MAV_SYSTEM_ID 1
95
#endif
96
97
//////////////////////////////////////////////////////////////////////////////
98
// Nav-Guided - allows external nav computer to control vehicle
99
#ifndef NAV_GUIDED
100
# define NAV_GUIDED 1
101
#endif
102
103
//////////////////////////////////////////////////////////////////////////////
104
// Flight mode definitions
105
//
106
107
// Acro Mode
108
#ifndef ACRO_RP_P
109
# define ACRO_RP_P 4.5f
110
#endif
111
112
#ifndef ACRO_YAW_P
113
# define ACRO_YAW_P 3.375f
114
#endif
115
116
#ifndef ACRO_LEVEL_MAX_ANGLE
117
# define ACRO_LEVEL_MAX_ANGLE 3000
118
#endif
119
120
#ifndef ACRO_BALANCE_ROLL
121
#define ACRO_BALANCE_ROLL 1.0f
122
#endif
123
124
#ifndef ACRO_BALANCE_PITCH
125
#define ACRO_BALANCE_PITCH 1.0f
126
#endif
127
128
#ifndef ACRO_EXPO_DEFAULT
129
#define ACRO_EXPO_DEFAULT 0.3f
130
#endif
131
132
// AUTO Mode
133
#ifndef WP_YAW_BEHAVIOR_DEFAULT
134
# define WP_YAW_BEHAVIOR_DEFAULT WP_YAW_BEHAVIOR_CORRECT_XTRACK
135
#endif
136
137
#ifndef AUTO_YAW_SLEW_RATE
138
# define AUTO_YAW_SLEW_RATE 60 // degrees/sec
139
#endif
140
141
#ifndef YAW_LOOK_AHEAD_MIN_SPEED
142
# define YAW_LOOK_AHEAD_MIN_SPEED 100 // minimum ground speed in cm/s required before vehicle is aimed at ground course
143
#endif
144
145
//////////////////////////////////////////////////////////////////////////////
146
// Stabilize Rate Control
147
//
148
#ifndef ROLL_PITCH_INPUT_MAX
149
# define ROLL_PITCH_INPUT_MAX 4500 // roll, pitch input range
150
#endif
151
#ifndef DEFAULT_ANGLE_MAX
152
# define DEFAULT_ANGLE_MAX 4500 // ANGLE_MAX parameters default value
153
#endif
154
155
//////////////////////////////////////////////////////////////////////////////
156
// Loiter position control gains
157
//
158
#ifndef POS_XY_P
159
# define POS_XY_P 1.0f
160
#endif
161
162
//////////////////////////////////////////////////////////////////////////////
163
// PosHold parameter defaults
164
//
165
#ifndef POSHOLD_ENABLED
166
# define POSHOLD_ENABLED 1 // PosHold flight mode enabled by default
167
#endif
168
169
//////////////////////////////////////////////////////////////////////////////
170
// Throttle control gains
171
//
172
173
#ifndef THR_DZ_DEFAULT
174
# define THR_DZ_DEFAULT 100 // the deadzone above and below mid throttle while in althold or loiter
175
#endif
176
177
// default maximum velocities and acceleration the pilot may request
178
#ifndef PILOT_VELZ_MAX
179
# define PILOT_VELZ_MAX 500 // maximum vertical velocity in cm/s
180
#endif
181
#ifndef PILOT_SPEED_DEFAULT
182
# define PILOT_SPEED_DEFAULT 200 // maximum horizontal velocity in cm/s while under pilot control
183
#endif
184
#ifndef PILOT_ACCEL_Z_DEFAULT
185
# define PILOT_ACCEL_Z_DEFAULT 100 // vertical acceleration in cm/s/s while altitude is under pilot control
186
#endif
187
188
#ifndef AUTO_DISARMING_DELAY
189
# define AUTO_DISARMING_DELAY 0
190
#endif
191
192
#ifndef NEUTRAL_THROTTLE
193
# define NEUTRAL_THROTTLE (0.5f) // Throttle output for "no vertical thrust"
194
#endif
195
196
//////////////////////////////////////////////////////////////////////////////
197
// Logging control
198
//
199
200
// Default logging bitmask
201
#ifndef DEFAULT_LOG_BITMASK
202
# define DEFAULT_LOG_BITMASK \
203
MASK_LOG_ATTITUDE_MED | \
204
MASK_LOG_GPS | \
205
MASK_LOG_PM | \
206
MASK_LOG_CTUN | \
207
MASK_LOG_NTUN | \
208
MASK_LOG_RCIN | \
209
MASK_LOG_IMU | \
210
MASK_LOG_CMD | \
211
MASK_LOG_CURRENT | \
212
MASK_LOG_RCOUT | \
213
MASK_LOG_OPTFLOW | \
214
MASK_LOG_COMPASS | \
215
MASK_LOG_CAMERA | \
216
MASK_LOG_MOTBATT
217
#endif
218
219
//Default flight modes
220
#ifndef FLIGHT_MODE_1
221
# define FLIGHT_MODE_1 Mode::Number::MANUAL
222
#endif
223
#ifndef FLIGHT_MODE_2
224
# define FLIGHT_MODE_2 Mode::Number::MANUAL
225
#endif
226
#ifndef FLIGHT_MODE_3
227
# define FLIGHT_MODE_3 Mode::Number::STABILIZE
228
#endif
229
#ifndef FLIGHT_MODE_4
230
# define FLIGHT_MODE_4 Mode::Number::STABILIZE
231
#endif
232
#ifndef FLIGHT_MODE_5
233
# define FLIGHT_MODE_5 Mode::Number::SURFACE
234
#endif
235
#ifndef FLIGHT_MODE_6
236
# define FLIGHT_MODE_6 Mode::Number::SURFACE
237
#endif
238
239
240