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/ArduCopter/Parameters.h
Views: 1798
1
#pragma once
2
3
#define AP_PARAM_VEHICLE_NAME copter
4
5
#include <AP_Common/AP_Common.h>
6
#include "RC_Channel_Copter.h"
7
#include <AP_Proximity/AP_Proximity.h>
8
9
#if MODE_FOLLOW_ENABLED
10
# include <AP_Follow/AP_Follow.h>
11
#endif
12
#if WEATHERVANE_ENABLED
13
#include <AC_AttitudeControl/AC_WeatherVane.h>
14
#endif
15
16
// Global parameter class.
17
//
18
class Parameters {
19
public:
20
// The version of the layout as described by the parameter enum.
21
//
22
// When changing the parameter enum in an incompatible fashion, this
23
// value should be incremented by one.
24
//
25
// The increment will prevent old parameters from being used incorrectly
26
// by newer code.
27
//
28
static const uint16_t k_format_version = 120;
29
30
// Parameter identities.
31
//
32
// The enumeration defined here is used to ensure that every parameter
33
// or parameter group has a unique ID number. This number is used by
34
// AP_Param to store and locate parameters in EEPROM.
35
//
36
// Note that entries without a number are assigned the next number after
37
// the entry preceding them. When adding new entries, ensure that they
38
// don't overlap.
39
//
40
// Try to group related variables together, and assign them a set
41
// range in the enumeration. Place these groups in numerical order
42
// at the end of the enumeration.
43
//
44
// WARNING: Care should be taken when editing this enumeration as the
45
// AP_Param load/save code depends on the values here to identify
46
// variables saved in EEPROM.
47
//
48
//
49
enum {
50
// Layout version number, always key zero.
51
//
52
k_param_format_version = 0,
53
k_param_software_type, // deprecated
54
k_param_ins_old, // *** Deprecated, remove with next eeprom number change
55
k_param_ins, // libraries/AP_InertialSensor variables
56
k_param_NavEKF2_old, // deprecated - remove
57
k_param_NavEKF2,
58
k_param_g2, // 2nd block of parameters
59
k_param_NavEKF3,
60
k_param_can_mgr,
61
k_param_osd,
62
63
// simulation
64
k_param_sitl = 10,
65
66
// barometer object (needed for SITL)
67
k_param_barometer,
68
69
// scheduler object (for debugging)
70
k_param_scheduler,
71
72
// relay object
73
k_param_relay,
74
75
// (old) EPM object
76
k_param_epm_unused,
77
78
// BoardConfig object
79
k_param_BoardConfig,
80
81
// GPS object
82
k_param_gps,
83
84
// Parachute object
85
k_param_parachute,
86
87
// Landing gear object
88
k_param_landinggear, // 18
89
90
// Input Management object
91
k_param_input_manager, // 19
92
93
// Misc
94
//
95
k_param_log_bitmask_old = 20, // Deprecated
96
k_param_log_last_filenumber, // *** Deprecated - remove
97
// with next eeprom number
98
// change
99
k_param_toy_yaw_rate, // deprecated - remove
100
k_param_crosstrack_min_distance, // deprecated - remove with next eeprom number change
101
k_param_rssi_pin, // unused, replaced by rssi_ library parameters
102
k_param_throttle_accel_enabled, // deprecated - remove
103
k_param_wp_yaw_behavior,
104
k_param_acro_trainer,
105
k_param_pilot_speed_up, // renamed from k_param_pilot_velocity_z_max
106
k_param_circle_rate, // deprecated - remove
107
k_param_rangefinder_gain, // deprecated - remove
108
k_param_ch8_option_old, // deprecated
109
k_param_arming_check_old, // deprecated - remove
110
k_param_sprayer,
111
k_param_angle_max,
112
k_param_gps_hdop_good,
113
k_param_battery,
114
k_param_fs_batt_mah, // unused - moved to AP_BattMonitor
115
k_param_angle_rate_max, // remove
116
k_param_rssi_range, // unused, replaced by rssi_ library parameters
117
k_param_rc_feel_rp, // deprecated
118
k_param_NavEKF, // deprecated - remove
119
k_param_mission, // mission library
120
k_param_rc_13_old,
121
k_param_rc_14_old,
122
k_param_rally,
123
k_param_poshold_brake_rate,
124
k_param_poshold_brake_angle_max,
125
k_param_pilot_accel_z,
126
k_param_serial0_baud, // deprecated - remove
127
k_param_serial1_baud, // deprecated - remove
128
k_param_serial2_baud, // deprecated - remove
129
k_param_land_repositioning,
130
k_param_rangefinder, // rangefinder object
131
k_param_fs_ekf_thresh,
132
k_param_terrain,
133
k_param_acro_rp_expo, // deprecated - remove
134
k_param_throttle_deadzone,
135
k_param_optflow,
136
k_param_dcmcheck_thresh, // deprecated - remove
137
k_param_log_bitmask,
138
k_param_cli_enabled_old, // deprecated - remove
139
k_param_throttle_filt,
140
k_param_throttle_behavior,
141
k_param_pilot_takeoff_alt, // 64
142
143
// 65: AP_Limits Library
144
k_param_limits = 65, // deprecated - remove
145
k_param_gpslock_limit, // deprecated - remove
146
k_param_geofence_limit, // deprecated - remove
147
k_param_altitude_limit, // deprecated - remove
148
k_param_fence_old, // only used for conversion
149
k_param_gps_glitch, // deprecated
150
k_param_baro_glitch, // 71 - deprecated
151
152
// AP_ADSB Library
153
k_param_adsb, // 72
154
k_param_notify, // 73
155
156
// 74: precision landing object
157
k_param_precland = 74,
158
159
//
160
// 75: Singlecopter, CoaxCopter
161
//
162
k_param_single_servo_1 = 75, // remove
163
k_param_single_servo_2, // remove
164
k_param_single_servo_3, // remove
165
k_param_single_servo_4, // 78 - remove
166
167
//
168
// 80: Heli
169
//
170
k_param_heli_servo_1 = 80, // remove
171
k_param_heli_servo_2, // remove
172
k_param_heli_servo_3, // remove
173
k_param_heli_servo_4, // remove
174
k_param_heli_pitch_ff, // remove
175
k_param_heli_roll_ff, // remove
176
k_param_heli_yaw_ff, // remove
177
k_param_heli_stab_col_min, // remove
178
k_param_heli_stab_col_max, // remove
179
k_param_heli_servo_rsc, // 89 = full! - remove
180
181
//
182
// 90: misc2
183
//
184
k_param_motors = 90,
185
k_param_disarm_delay,
186
k_param_fs_crash_check,
187
k_param_throw_motor_start,
188
k_param_rtl_alt_type,
189
k_param_avoid,
190
k_param_avoidance_adsb,
191
192
// 97: RSSI
193
k_param_rssi = 97,
194
195
//
196
// 100: Inertial Nav
197
//
198
k_param_inertial_nav = 100, // deprecated
199
k_param_wp_nav,
200
k_param_attitude_control,
201
k_param_pos_control,
202
k_param_circle_nav,
203
k_param_loiter_nav, // 105
204
k_param_custom_control,
205
206
// 110: Telemetry control
207
//
208
k_param_gcs0 = 110,
209
k_param_gcs1,
210
k_param_sysid_this_mav,
211
k_param_sysid_my_gcs,
212
k_param_serial1_baud_old, // deprecated
213
k_param_telem_delay,
214
k_param_gcs2,
215
k_param_serial2_baud_old, // deprecated
216
k_param_serial2_protocol, // deprecated
217
k_param_serial_manager_old,
218
k_param_ch9_option_old,
219
k_param_ch10_option_old,
220
k_param_ch11_option_old,
221
k_param_ch12_option_old,
222
k_param_takeoff_trigger_dz_old,
223
k_param_gcs3,
224
k_param_gcs_pid_mask, // 126
225
k_param_gcs4,
226
k_param_gcs5,
227
k_param_gcs6,
228
229
//
230
// 135 : reserved for Solo until features merged with master
231
//
232
k_param_rtl_speed_cms = 135,
233
k_param_fs_batt_curr_rtl,
234
k_param_rtl_cone_slope, // 137
235
236
//
237
// 140: Sensor parameters
238
//
239
k_param_imu = 140, // deprecated - can be deleted
240
k_param_battery_monitoring = 141, // deprecated - can be deleted
241
k_param_volt_div_ratio, // deprecated - can be deleted
242
k_param_curr_amp_per_volt, // deprecated - can be deleted
243
k_param_input_voltage, // deprecated - can be deleted
244
k_param_pack_capacity, // deprecated - can be deleted
245
k_param_compass_enabled_deprecated,
246
k_param_compass,
247
k_param_rangefinder_enabled_old, // deprecated
248
k_param_frame_type,
249
k_param_optflow_enabled, // deprecated
250
k_param_fs_batt_voltage, // unused - moved to AP_BattMonitor
251
k_param_ch7_option_old,
252
k_param_auto_slew_rate, // deprecated - can be deleted
253
k_param_rangefinder_type_old, // deprecated
254
k_param_super_simple = 155,
255
k_param_axis_enabled = 157, // deprecated - remove with next eeprom number change
256
k_param_copter_leds_mode, // deprecated - remove with next eeprom number change
257
k_param_ahrs, // AHRS group // 159
258
259
//
260
// 160: Navigation parameters
261
//
262
k_param_rtl_altitude = 160,
263
k_param_crosstrack_gain, // deprecated - remove with next eeprom number change
264
k_param_rtl_loiter_time,
265
k_param_rtl_alt_final,
266
k_param_tilt_comp, // 164 deprecated - remove with next eeprom number change
267
268
269
//
270
// Camera and mount parameters
271
//
272
k_param_camera = 165,
273
k_param_camera_mount,
274
k_param_camera_mount2, // deprecated
275
276
//
277
// Battery monitoring parameters
278
//
279
k_param_battery_volt_pin = 168, // deprecated - can be deleted
280
k_param_battery_curr_pin, // 169 deprecated - can be deleted
281
282
//
283
// 170: Radio settings
284
//
285
k_param_rc_1_old = 170,
286
k_param_rc_2_old,
287
k_param_rc_3_old,
288
k_param_rc_4_old,
289
k_param_rc_5_old,
290
k_param_rc_6_old,
291
k_param_rc_7_old,
292
k_param_rc_8_old,
293
k_param_rc_10_old,
294
k_param_rc_11_old,
295
k_param_throttle_min, // remove
296
k_param_throttle_max, // remove
297
k_param_failsafe_throttle,
298
k_param_throttle_fs_action, // remove
299
k_param_failsafe_throttle_value,
300
k_param_throttle_trim, // remove
301
k_param_esc_calibrate,
302
k_param_radio_tuning,
303
k_param_radio_tuning_high_old, // unused
304
k_param_radio_tuning_low_old, // unused
305
k_param_rc_speed = 192,
306
k_param_failsafe_battery_enabled, // unused - moved to AP_BattMonitor
307
k_param_throttle_mid, // remove
308
k_param_failsafe_gps_enabled, // remove
309
k_param_rc_9_old,
310
k_param_rc_12_old,
311
k_param_failsafe_gcs,
312
k_param_rcmap, // 199
313
314
//
315
// 200: flight modes
316
//
317
k_param_flight_mode1 = 200,
318
k_param_flight_mode2,
319
k_param_flight_mode3,
320
k_param_flight_mode4,
321
k_param_flight_mode5,
322
k_param_flight_mode6,
323
k_param_simple_modes,
324
k_param_flight_mode_chan,
325
k_param_initial_mode,
326
327
//
328
// 210: Waypoint data
329
//
330
k_param_waypoint_mode = 210, // remove
331
k_param_command_total, // remove
332
k_param_command_index, // remove
333
k_param_command_nav_index, // remove
334
k_param_waypoint_radius, // remove
335
k_param_circle_radius, // remove
336
k_param_waypoint_speed_max, // remove
337
k_param_land_speed,
338
k_param_auto_velocity_z_min, // remove
339
k_param_auto_velocity_z_max, // remove - 219
340
k_param_land_speed_high,
341
342
//
343
// 220: PI/D Controllers
344
//
345
k_param_acro_rp_p = 221, // remove
346
k_param_axis_lock_p, // remove
347
k_param_pid_rate_roll, // remove
348
k_param_pid_rate_pitch, // remove
349
k_param_pid_rate_yaw, // remove
350
k_param_p_stabilize_roll, // remove
351
k_param_p_stabilize_pitch, // remove
352
k_param_p_stabilize_yaw, // remove
353
k_param_p_pos_xy, // remove
354
k_param_p_loiter_lon, // remove
355
k_param_pid_loiter_rate_lat, // remove
356
k_param_pid_loiter_rate_lon, // remove
357
k_param_pid_nav_lat, // remove
358
k_param_pid_nav_lon, // remove
359
k_param_p_alt_hold, // remove
360
k_param_p_vel_z, // remove
361
k_param_pid_optflow_roll, // remove
362
k_param_pid_optflow_pitch, // remove
363
k_param_acro_balance_roll_old, // remove
364
k_param_acro_balance_pitch_old, // remove
365
k_param_pid_accel_z, // remove
366
k_param_acro_balance_roll,
367
k_param_acro_balance_pitch,
368
k_param_acro_yaw_p, // remove
369
k_param_autotune_axis_bitmask, // remove
370
k_param_autotune_aggressiveness, // remove
371
k_param_pi_vel_xy, // remove
372
k_param_fs_ekf_action,
373
k_param_rtl_climb_min,
374
k_param_rpm_sensor,
375
k_param_autotune_min_d, // remove
376
k_param_arming, // 252 - AP_Arming
377
k_param_logger = 253, // 253 - Logging Group
378
379
// 254,255: reserved
380
381
k_param_vehicle = 257, // vehicle common block of parameters
382
k_param_throw_altitude_min,
383
k_param_throw_altitude_max,
384
385
// the k_param_* space is 9-bits in size
386
// 511: reserved
387
};
388
389
AP_Int16 format_version;
390
391
// Telemetry control
392
//
393
AP_Int16 sysid_this_mav;
394
AP_Int16 sysid_my_gcs;
395
AP_Int8 telem_delay;
396
397
AP_Float throttle_filt;
398
AP_Int16 throttle_behavior;
399
AP_Float pilot_takeoff_alt;
400
401
#if MODE_RTL_ENABLED
402
AP_Int32 rtl_altitude;
403
AP_Int16 rtl_speed_cms;
404
AP_Float rtl_cone_slope;
405
AP_Int16 rtl_alt_final;
406
AP_Int16 rtl_climb_min; // rtl minimum climb in cm
407
AP_Int32 rtl_loiter_time;
408
AP_Enum<ModeRTL::RTLAltType> rtl_alt_type;
409
#endif
410
411
AP_Int8 failsafe_gcs; // ground station failsafe behavior
412
AP_Int16 gps_hdop_good; // GPS Hdop value at or below this value represent a good position
413
414
AP_Int8 super_simple;
415
416
AP_Int8 wp_yaw_behavior; // controls how the autopilot controls yaw during missions
417
418
#if MODE_POSHOLD_ENABLED
419
AP_Int16 poshold_brake_rate; // PosHold flight mode's rotation rate during braking in deg/sec
420
AP_Int16 poshold_brake_angle_max; // PosHold flight mode's max lean angle during braking in centi-degrees
421
#endif
422
423
// Waypoints
424
//
425
AP_Int16 land_speed;
426
AP_Int16 land_speed_high;
427
AP_Int16 pilot_speed_up; // maximum vertical ascending velocity the pilot may request
428
AP_Int16 pilot_accel_z; // vertical acceleration the pilot may request
429
430
// Throttle
431
//
432
AP_Int8 failsafe_throttle;
433
AP_Int16 failsafe_throttle_value;
434
AP_Int16 throttle_deadzone;
435
436
// Flight modes
437
//
438
AP_Int8 flight_mode1;
439
AP_Int8 flight_mode2;
440
AP_Int8 flight_mode3;
441
AP_Int8 flight_mode4;
442
AP_Int8 flight_mode5;
443
AP_Int8 flight_mode6;
444
AP_Int8 simple_modes;
445
AP_Int8 flight_mode_chan;
446
AP_Int8 initial_mode;
447
448
// Misc
449
//
450
AP_Int32 log_bitmask;
451
AP_Int8 esc_calibrate;
452
AP_Int8 radio_tuning;
453
AP_Int8 frame_type;
454
AP_Int8 disarm_delay;
455
456
AP_Int8 land_repositioning;
457
AP_Int8 fs_ekf_action;
458
AP_Int8 fs_crash_check;
459
AP_Float fs_ekf_thresh;
460
AP_Int16 gcs_pid_mask;
461
462
#if MODE_THROW_ENABLED
463
AP_Enum<ModeThrow::PreThrowMotorState> throw_motor_start;
464
AP_Int16 throw_altitude_min; // minimum altitude in m above which a throw can be detected
465
AP_Int16 throw_altitude_max; // maximum altitude in m below which a throw can be detected
466
#endif
467
468
AP_Int16 rc_speed; // speed of fast RC Channels in Hz
469
470
#if MODE_ACRO_ENABLED || MODE_SPORT_ENABLED
471
// Acro parameters
472
AP_Float acro_balance_roll;
473
AP_Float acro_balance_pitch;
474
#endif
475
476
#if MODE_ACRO_ENABLED
477
// Acro parameters
478
AP_Int8 acro_trainer;
479
#endif
480
481
// Note: keep initializers here in the same order as they are declared
482
// above.
483
Parameters()
484
{
485
}
486
};
487
488
/*
489
2nd block of parameters, to avoid going past 256 top level keys
490
*/
491
class ParametersG2 {
492
public:
493
ParametersG2(void);
494
495
// var_info for holding Parameter information
496
static const struct AP_Param::GroupInfo var_info[];
497
static const struct AP_Param::GroupInfo var_info2[];
498
499
// altitude at which nav control can start in takeoff
500
AP_Float wp_navalt_min;
501
502
// unused_integer simply exists so that the constructor for
503
// ParametersG2 can be created with a relatively easy syntax in
504
// the face of many #ifs:
505
uint8_t unused_integer;
506
507
// button checking
508
#if HAL_BUTTON_ENABLED
509
AP_Button *button_ptr;
510
#endif
511
512
#if MODE_THROW_ENABLED
513
// Throw mode parameters
514
AP_Int8 throw_nextmode;
515
AP_Enum<ModeThrow::ThrowType> throw_type;
516
#endif
517
518
// ground effect compensation enable/disable
519
AP_Int8 gndeffect_comp_enabled;
520
521
#if AP_TEMPCALIBRATION_ENABLED
522
// temperature calibration handling
523
AP_TempCalibration temp_calibration;
524
#endif
525
526
#if AP_BEACON_ENABLED
527
// beacon (non-GPS positioning) library
528
AP_Beacon beacon;
529
#endif
530
531
#if HAL_PROXIMITY_ENABLED
532
// proximity (aka object avoidance) library
533
AP_Proximity proximity;
534
#endif
535
536
// whether to enforce acceptance of packets only from sysid_my_gcs
537
AP_Int8 sysid_enforce;
538
539
#if AP_COPTER_ADVANCED_FAILSAFE_ENABLED
540
// advanced failsafe library
541
AP_AdvancedFailsafe_Copter afs;
542
#endif
543
544
// developer options
545
AP_Int32 dev_options;
546
547
#if MODE_ACRO_ENABLED
548
AP_Float acro_thr_mid;
549
#endif
550
551
// frame class
552
AP_Int8 frame_class;
553
554
// RC input channels
555
RC_Channels_Copter rc_channels;
556
557
// control over servo output ranges
558
SRV_Channels servo_channels;
559
560
#if MODE_SMARTRTL_ENABLED
561
// Safe RTL library
562
AP_SmartRTL smart_rtl;
563
#endif
564
565
// wheel encoder and winch
566
#if AP_WINCH_ENABLED
567
AP_Winch winch;
568
#endif
569
570
// Additional pilot velocity items
571
AP_Int16 pilot_speed_dn;
572
573
// Land alt final stage
574
AP_Int16 land_alt_low;
575
576
#if TOY_MODE_ENABLED
577
ToyMode toy_mode;
578
#endif
579
580
#if MODE_FLOWHOLD_ENABLED
581
// we need a pointer to the mode for the G2 table
582
void *mode_flowhold_ptr;
583
#endif
584
585
#if MODE_FOLLOW_ENABLED
586
// follow
587
AP_Follow follow;
588
#endif
589
590
#if USER_PARAMS_ENABLED
591
// User custom parameters
592
UserParameters user_parameters;
593
#endif
594
595
#if AUTOTUNE_ENABLED
596
// we need a pointer to autotune for the G2 table
597
void *autotune_ptr;
598
#endif
599
600
AP_Float tuning_min;
601
AP_Float tuning_max;
602
603
#if AP_OAPATHPLANNER_ENABLED
604
// object avoidance path planning
605
AP_OAPathPlanner oa;
606
#endif
607
608
#if MODE_SYSTEMID_ENABLED
609
// we need a pointer to the mode for the G2 table
610
void *mode_systemid_ptr;
611
#endif
612
613
// vibration failsafe enable/disable
614
AP_Int8 fs_vibe_enabled;
615
616
// Failsafe options bitmask #36
617
AP_Int32 fs_options;
618
619
#if MODE_AUTOROTATE_ENABLED
620
// Autonmous autorotation
621
AC_Autorotation arot;
622
#endif
623
624
#if MODE_ZIGZAG_ENABLED
625
// we need a pointer to the mode for the G2 table
626
void *mode_zigzag_ptr;
627
#endif
628
629
// command model parameters
630
#if MODE_ACRO_ENABLED || MODE_SPORT_ENABLED
631
AC_CommandModel command_model_acro_rp;
632
#endif
633
634
#if MODE_ACRO_ENABLED || MODE_DRIFT_ENABLED
635
AC_CommandModel command_model_acro_y;
636
#endif
637
638
AC_CommandModel command_model_pilot;
639
640
#if MODE_ACRO_ENABLED
641
AP_Int8 acro_options;
642
#endif
643
644
#if MODE_AUTO_ENABLED
645
AP_Int32 auto_options;
646
#endif
647
648
#if MODE_GUIDED_ENABLED
649
AP_Int32 guided_options;
650
#endif
651
652
AP_Float fs_gcs_timeout;
653
654
#if MODE_RTL_ENABLED
655
AP_Int32 rtl_options;
656
#endif
657
658
AP_Int32 flight_options;
659
660
#if AP_RANGEFINDER_ENABLED
661
AP_Float rangefinder_filt;
662
#endif
663
664
#if MODE_GUIDED_ENABLED
665
AP_Float guided_timeout;
666
#endif
667
668
AP_Int8 surftrak_mode;
669
AP_Int8 failsafe_dr_enable;
670
AP_Int16 failsafe_dr_timeout;
671
AP_Float surftrak_tc;
672
673
// ramp time of throttle during take-off
674
AP_Float takeoff_throttle_slew_time;
675
AP_Float takeoff_throttle_max;
676
#if HAL_WITH_ESC_TELEM && FRAME_CONFIG != HELI_FRAME
677
AP_Int16 takeoff_rpm_min;
678
AP_Int16 takeoff_rpm_max;
679
#endif
680
681
// EKF variance filter cutoff
682
AP_Float fs_ekf_filt_hz;
683
684
#if WEATHERVANE_ENABLED
685
AC_WeatherVane weathervane;
686
#endif
687
688
// payload place parameters
689
AP_Float pldp_thrust_placed_fraction;
690
AP_Float pldp_range_finder_maximum_m;
691
AP_Float pldp_delay_s;
692
AP_Float pldp_descent_speed_ms;
693
694
AP_Int8 att_enable;
695
AP_Int8 att_decimation;
696
};
697
698
extern const AP_Param::Info var_info[];
699
700