Line data Source code
1 : #include "Rover.h"
2 :
3 : #include <AP_Beacon/AP_Beacon.h>
4 : #include <AP_Gripper/AP_Gripper.h>
5 :
6 : /*
7 : Rover parameter definitions
8 : */
9 :
10 : const AP_Param::Info Rover::var_info[] = {
11 : // @Param: FORMAT_VERSION
12 : // @DisplayName: Eeprom format version number
13 : // @Description: This value is incremented when changes are made to the eeprom format
14 : // @User: Advanced
15 : GSCALAR(format_version, "FORMAT_VERSION", 1),
16 :
17 : // @Param: LOG_BITMASK
18 : // @DisplayName: Log bitmask
19 : // @Description: Bitmap of what log types to enable in on-board logger. This value is made up of the sum of each of the log types you want to be saved. On boards supporting microSD cards or other large block-storage devices it is usually best just to enable all basic log types by setting this to 65535.
20 : // @Bitmask: 0:Fast Attitude,1:Medium Attitude,2:GPS,3:System Performance,4:Throttle,5:Navigation Tuning,7:IMU,8:Mission Commands,9:Battery Monitor,10:Rangefinder,11:Compass,12:Camera,13:Steering,14:RC Input-Output,19:Raw IMU,20:Video Stabilization,21:Optical Flow
21 : // @User: Advanced
22 : GSCALAR(log_bitmask, "LOG_BITMASK", DEFAULT_LOG_BITMASK),
23 :
24 : // RST_SWITCH_CH was here
25 :
26 : // @Param: INITIAL_MODE
27 : // @DisplayName: Initial driving mode
28 : // @Description: This selects the mode to start in on boot. This is useful for when you want to start in AUTO mode on boot without a receiver. Usually used in combination with when AUTO_TRIGGER_PIN or AUTO_KICKSTART.
29 : // @CopyValuesFrom: MODE1
30 : // @User: Advanced
31 : GSCALAR(initial_mode, "INITIAL_MODE", (int8_t)Mode::Number::MANUAL),
32 :
33 : // SYSID_THISMAV was here
34 :
35 : // SYSID_MYGCS was here
36 :
37 : // TELEM_DELAY was here
38 :
39 : // @Param: GCS_PID_MASK
40 : // @DisplayName: GCS PID tuning mask
41 : // @Description: bitmask of PIDs to send MAVLink PID_TUNING messages for
42 : // @User: Advanced
43 : // @Bitmask: 0:Steering,1:Throttle,2:Pitch,3:Left Wheel,4:Right Wheel,5:Sailboat Heel,6:Velocity North,7:Velocity East
44 : GSCALAR(gcs_pid_mask, "GCS_PID_MASK", 0),
45 :
46 : // @Param: AUTO_TRIGGER_PIN
47 : // @DisplayName: Auto mode trigger pin
48 : // @Description: pin number to use to enable the throttle in auto mode. If set to -1 then don't use a trigger, otherwise this is a pin number which if held low in auto mode will enable the motor to run. If the switch is released while in AUTO then the motor will stop again. This can be used in combination with INITIAL_MODE to give a 'press button to start' rover with no receiver.
49 : // @Values: -1:Disabled,0:APM TriggerPin0,1:APM TriggerPin1,2:APM TriggerPin2,3:APM TriggerPin3,4:APM TriggerPin4,5:APM TriggerPin5,6:APM TriggerPin6,7:APM TriggerPin7,8:APM TriggerPin8,50:AUX1,51:AUX2,52:AUX3,53:AUX4,54:AUX5,55:AUX6
50 : // @Range: -1 127
51 : // @User: Standard
52 : GSCALAR(auto_trigger_pin, "AUTO_TRIGGER_PIN", -1),
53 :
54 : // @Param: AUTO_KICKSTART
55 : // @DisplayName: Auto mode trigger kickstart acceleration
56 : // @Description: X acceleration in meters/second/second to use to trigger the motor start in auto mode. If set to zero then auto throttle starts immediately when the mode switch happens, otherwise the rover waits for the X acceleration to go above this value before it will start the motor
57 : // @Units: m/s/s
58 : // @Range: 0 20
59 : // @Increment: 0.1
60 : // @User: Standard
61 : GSCALAR(auto_kickstart, "AUTO_KICKSTART", 0.0f),
62 :
63 : // @Param: CRUISE_SPEED
64 : // @DisplayName: Target cruise speed in auto modes
65 : // @Description: The target speed in auto missions.
66 : // @Units: m/s
67 : // @Range: 0 100
68 : // @Increment: 0.1
69 : // @User: Standard
70 : GSCALAR(speed_cruise, "CRUISE_SPEED", CRUISE_SPEED),
71 :
72 :
73 : // @Param: CRUISE_THROTTLE
74 : // @DisplayName: Base throttle percentage in auto
75 : // @Description: The base throttle percentage to use in auto mode. The CRUISE_SPEED parameter controls the target speed, but the rover starts with the CRUISE_THROTTLE setting as the initial estimate for how much throttle is needed to achieve that speed. It then adjusts the throttle based on how fast the rover is actually going.
76 : // @Units: %
77 : // @Range: 0 100
78 : // @Increment: 1
79 : // @User: Standard
80 : GSCALAR(throttle_cruise, "CRUISE_THROTTLE", 50),
81 :
82 : // @Param: PILOT_STEER_TYPE
83 : // @DisplayName: Pilot input steering type
84 : // @Description: Pilot RC input interpretation
85 : // @Values: 0:Default,1:Two Paddles Input,2:Direction reversed when backing up,3:Direction unchanged when backing up
86 : // @User: Standard
87 : GSCALAR(pilot_steer_type, "PILOT_STEER_TYPE", 0),
88 :
89 : // @Param: FS_ACTION
90 : // @DisplayName: Failsafe Action
91 : // @Description: What to do on a failsafe event
92 : // @Values: 0:Nothing,1:RTL,2:Hold,3:SmartRTL or RTL,4:SmartRTL or Hold,5:Terminate,6:Loiter or Hold
93 : // @User: Standard
94 : GSCALAR(fs_action, "FS_ACTION", (int8_t)FailsafeAction::Hold),
95 :
96 : // @Param: FS_TIMEOUT
97 : // @DisplayName: Failsafe timeout
98 : // @Description: The time in seconds that a failsafe condition must persist before the failsafe action is triggered
99 : // @Units: s
100 : // @Range: 1 100
101 : // @Increment: 0.5
102 : // @User: Standard
103 : GSCALAR(fs_timeout, "FS_TIMEOUT", 1.5),
104 :
105 : // @Param: FS_THR_ENABLE
106 : // @DisplayName: Throttle Failsafe Enable
107 : // @Description: The throttle failsafe allows you to configure a software failsafe activated by a setting on the throttle input channel to a low value. This can be used to detect the RC transmitter going out of range. Failsafe will be triggered when the throttle channel goes below the FS_THR_VALUE for FS_TIMEOUT seconds.
108 : // @Values: 0:Disabled,1:Enabled,2:Enabled Continue with Mission in Auto
109 : // @User: Standard
110 : GSCALAR(fs_throttle_enabled, "FS_THR_ENABLE", FS_THR_ENABLED),
111 :
112 : // @Param: FS_THR_VALUE
113 : // @DisplayName: Throttle Failsafe Value
114 : // @Description: The PWM level on the throttle channel below which throttle failsafe triggers.
115 : // @Range: 910 1100
116 : // @Increment: 1
117 : // @User: Standard
118 : GSCALAR(fs_throttle_value, "FS_THR_VALUE", 910),
119 :
120 : // @Param: FS_GCS_ENABLE
121 : // @DisplayName: GCS failsafe enable
122 : // @Description: Enable ground control station telemetry failsafe. When enabled the Rover will execute the FS_ACTION when it fails to receive MAVLink heartbeat packets for FS_TIMEOUT seconds.
123 : // @Values: 0:Disabled,1:Enabled,2:Enabled Continue with Mission in Auto
124 : // @User: Standard
125 : GSCALAR(fs_gcs_enabled, "FS_GCS_ENABLE", FS_GCS_DISABLED),
126 :
127 : // @Param: FS_CRASH_CHECK
128 : // @DisplayName: Crash check action
129 : // @Description: What to do on a crash event. When enabled the rover will go to hold if a crash is detected.
130 : // @Values: 0:Disabled,1:Hold,2:HoldAndDisarm
131 : // @User: Standard
132 : GSCALAR(fs_crash_check, "FS_CRASH_CHECK", FS_CRASH_DISABLE),
133 :
134 : // @Param: FS_EKF_ACTION
135 : // @DisplayName: EKF Failsafe Action
136 : // @Description: Controls the action that will be taken when an EKF failsafe is invoked
137 : // @Values: 0:Disabled,1:Hold,2:ReportOnly
138 : // @User: Advanced
139 : GSCALAR(fs_ekf_action, "FS_EKF_ACTION", FS_EKF_HOLD),
140 :
141 : // @Param: FS_EKF_THRESH
142 : // @DisplayName: EKF failsafe variance threshold
143 : // @Description: Allows setting the maximum acceptable compass and velocity variance
144 : // @Values: 0.6:Strict, 0.8:Default, 1.0:Relaxed
145 : // @User: Advanced
146 : GSCALAR(fs_ekf_thresh, "FS_EKF_THRESH", 0.8f),
147 :
148 : // @Param: MODE_CH
149 : // @DisplayName: Mode channel
150 : // @Description: RC Channel to use for driving mode control
151 : // @User: Advanced
152 : GSCALAR(mode_channel, "MODE_CH", MODE_CHANNEL),
153 :
154 : // @Param: MODE1
155 : // @DisplayName: Mode1
156 : // @Values: 0:Manual,1:Acro,3:Steering,4:Hold,5:Loiter,6:Follow,7:Simple,8:Dock,9:Circle,10:Auto,11:RTL,12:SmartRTL,15:Guided
157 : // @User: Standard
158 : // @Description: Driving mode for switch position 1 (910 to 1230 and above 2049)
159 : GARRAY(modes, 0, "MODE1", (int8_t)Mode::Number::MANUAL),
160 :
161 : // @Param: MODE2
162 : // @DisplayName: Mode2
163 : // @Description: Driving mode for switch position 2 (1231 to 1360)
164 : // @CopyValuesFrom: MODE1
165 : // @User: Standard
166 : GARRAY(modes, 1, "MODE2", (int8_t)Mode::Number::MANUAL),
167 :
168 : // @Param: MODE3
169 : // @CopyFieldsFrom: MODE1
170 : // @DisplayName: Mode3
171 : // @Description: Driving mode for switch position 3 (1361 to 1490)
172 : GARRAY(modes, 2, "MODE3", (int8_t)Mode::Number::MANUAL),
173 :
174 : // @Param: MODE4
175 : // @CopyFieldsFrom: MODE1
176 : // @DisplayName: Mode4
177 : // @Description: Driving mode for switch position 4 (1491 to 1620)
178 : GARRAY(modes, 3, "MODE4", (int8_t)Mode::Number::MANUAL),
179 :
180 : // @Param: MODE5
181 : // @CopyFieldsFrom: MODE1
182 : // @DisplayName: Mode5
183 : // @Description: Driving mode for switch position 5 (1621 to 1749)
184 : GARRAY(modes, 4, "MODE5", (int8_t)Mode::Number::MANUAL),
185 :
186 : // @Param: MODE6
187 : // @CopyFieldsFrom: MODE1
188 : // @DisplayName: Mode6
189 : // @Description: Driving mode for switch position 6 (1750 to 2049)
190 : GARRAY(modes, 5, "MODE6", (int8_t)Mode::Number::MANUAL),
191 :
192 : // variables not in the g class which contain EEPROM saved variables
193 :
194 : // @Group: COMPASS_
195 : // @Path: ../libraries/AP_Compass/AP_Compass.cpp
196 : GOBJECT(compass, "COMPASS_", Compass),
197 :
198 : // @Group: SCHED_
199 : // @Path: ../libraries/AP_Scheduler/AP_Scheduler.cpp
200 : GOBJECT(scheduler, "SCHED_", AP_Scheduler),
201 :
202 : // @Group: BARO
203 : // @Path: ../libraries/AP_Baro/AP_Baro.cpp
204 : GOBJECT(barometer, "BARO", AP_Baro),
205 :
206 : #if AP_RELAY_ENABLED
207 : // @Group: RELAY
208 : // @Path: ../libraries/AP_Relay/AP_Relay.cpp
209 : GOBJECT(relay, "RELAY", AP_Relay),
210 : #endif
211 :
212 : // @Group: RCMAP_
213 : // @Path: ../libraries/AP_RCMapper/AP_RCMapper.cpp
214 : GOBJECT(rcmap, "RCMAP_", RCMapper),
215 :
216 : // SR0 through SR6 were here
217 :
218 : // AP_SerialManager was here
219 :
220 : #if AP_RANGEFINDER_ENABLED
221 : // @Group: RNGFND
222 : // @Path: ../libraries/AP_RangeFinder/AP_RangeFinder.cpp
223 : GOBJECT(rangefinder, "RNGFND", RangeFinder),
224 : #endif
225 :
226 : // @Group: INS
227 : // @Path: ../libraries/AP_InertialSensor/AP_InertialSensor.cpp
228 : GOBJECT(ins, "INS", AP_InertialSensor),
229 :
230 : #if AP_SIM_ENABLED
231 : // @Group: SIM_
232 : // @Path: ../libraries/SITL/SITL.cpp
233 : GOBJECT(sitl, "SIM_", SITL::SIM),
234 : #endif
235 :
236 : // @Group: AHRS_
237 : // @Path: ../libraries/AP_AHRS/AP_AHRS.cpp
238 : GOBJECT(ahrs, "AHRS_", AP_AHRS),
239 :
240 : #if AP_CAMERA_ENABLED
241 : // @Group: CAM
242 : // @Path: ../libraries/AP_Camera/AP_Camera.cpp
243 : GOBJECT(camera, "CAM", AP_Camera),
244 : #endif
245 :
246 : #if AC_PRECLAND_ENABLED
247 : // @Group: PLND_
248 : // @Path: ../libraries/AC_PrecLand/AC_PrecLand.cpp
249 : GOBJECT(precland, "PLND_", AC_PrecLand),
250 : #endif
251 :
252 : #if HAL_MOUNT_ENABLED
253 : // @Group: MNT
254 : // @Path: ../libraries/AP_Mount/AP_Mount.cpp
255 : GOBJECT(camera_mount, "MNT", AP_Mount),
256 : #endif
257 :
258 : // @Group: ARMING_
259 : // @Path: ../libraries/AP_Arming/AP_Arming.cpp
260 : GOBJECT(arming, "ARMING_", AP_Arming),
261 :
262 : // @Group: BATT
263 : // @Path: ../libraries/AP_BattMonitor/AP_BattMonitor.cpp
264 : GOBJECT(battery, "BATT", AP_BattMonitor),
265 :
266 : // @Group: BRD_
267 : // @Path: ../libraries/AP_BoardConfig/AP_BoardConfig.cpp
268 : GOBJECT(BoardConfig, "BRD_", AP_BoardConfig),
269 :
270 : #if HAL_MAX_CAN_PROTOCOL_DRIVERS
271 : // @Group: CAN_
272 : // @Path: ../libraries/AP_CANManager/AP_CANManager.cpp
273 : GOBJECT(can_mgr, "CAN_", AP_CANManager),
274 : #endif
275 :
276 : // GPS driver
277 : // @Group: GPS
278 : // @Path: ../libraries/AP_GPS/AP_GPS.cpp
279 : GOBJECT(gps, "GPS", AP_GPS),
280 :
281 : #if HAL_NAVEKF2_AVAILABLE
282 : // @Group: EK2_
283 : // @Path: ../libraries/AP_NavEKF2/AP_NavEKF2.cpp
284 : GOBJECTN(ahrs.ekf2.EKF2, NavEKF2, "EK2_", NavEKF2),
285 : #endif
286 :
287 : #if HAL_NAVEKF3_AVAILABLE
288 : // @Group: EK3_
289 : // @Path: ../libraries/AP_NavEKF3/AP_NavEKF3.cpp
290 : GOBJECTN(ahrs.ekf3.EKF3, NavEKF3, "EK3_", NavEKF3),
291 : #endif
292 :
293 : // @Group: MIS_
294 : // @Path: ../libraries/AP_Mission/AP_Mission.cpp
295 : GOBJECTN(mode_auto.mission, mission, "MIS_", AP_Mission),
296 :
297 : #if AP_RSSI_ENABLED
298 : // @Group: RSSI_
299 : // @Path: ../libraries/AP_RSSI/AP_RSSI.cpp
300 : GOBJECT(rssi, "RSSI_", AP_RSSI),
301 : #endif
302 :
303 : // @Group: NTF_
304 : // @Path: ../libraries/AP_Notify/AP_Notify.cpp
305 : GOBJECT(notify, "NTF_", AP_Notify),
306 :
307 : #if HAL_BUTTON_ENABLED
308 : // @Group: BTN_
309 : // @Path: ../libraries/AP_Button/AP_Button.cpp
310 : GOBJECT(button, "BTN_", AP_Button),
311 : #endif
312 :
313 : // @Group:
314 : // @Path: Parameters.cpp
315 : GOBJECT(g2, "", ParametersG2),
316 :
317 : #if OSD_ENABLED || OSD_PARAM_ENABLED
318 : // @Group: OSD
319 : // @Path: ../libraries/AP_OSD/AP_OSD.cpp
320 : GOBJECT(osd, "OSD", AP_OSD),
321 : #endif
322 :
323 : #if AP_OPTICALFLOW_ENABLED
324 : // @Group: FLOW
325 : // @Path: ../libraries/AP_OpticalFlow/AP_OpticalFlow.cpp
326 : GOBJECT(optflow, "FLOW", AP_OpticalFlow),
327 : #endif
328 :
329 : // @Group:
330 : // @Path: ../libraries/AP_Vehicle/AP_Vehicle.cpp
331 : PARAM_VEHICLE_INFO,
332 :
333 : #if HAL_GCS_ENABLED
334 : // @Group: MAV
335 : // @Path: ../libraries/GCS_MAVLink/GCS.cpp
336 : GOBJECT(_gcs, "MAV", GCS),
337 : #endif
338 :
339 : AP_VAREND
340 : };
341 :
342 : /*
343 : 2nd group of parameters
344 : */
345 : const AP_Param::GroupInfo ParametersG2::var_info[] = {
346 : // 1 was AP_Stats
347 :
348 : // 2 was SYSID_ENFORCE
349 :
350 : // @Group: SERVO
351 : // @Path: ../libraries/SRV_Channel/SRV_Channels.cpp
352 : AP_SUBGROUPINFO(servo_channels, "SERVO", 3, ParametersG2, SRV_Channels),
353 :
354 : // @Group: RC
355 : // @Path: ../libraries/RC_Channel/RC_Channels_VarInfo.h
356 : AP_SUBGROUPINFO(rc_channels, "RC", 4, ParametersG2, RC_Channels_Rover),
357 :
358 : #if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
359 : // @Group: AFS_
360 : // @Path: ../libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp
361 : AP_SUBGROUPINFO(afs, "AFS_", 5, ParametersG2, AP_AdvancedFailsafe),
362 : #endif
363 :
364 : // 6 was AP_Beacon
365 :
366 : // 7 was used by AP_VisualOdometry
367 :
368 : // @Group: MOT_
369 : // @Path: ../libraries/AR_Motors/AP_MotorsUGV.cpp
370 : AP_SUBGROUPINFO(motors, "MOT_", 8, ParametersG2, AP_MotorsUGV),
371 :
372 : // @Group: WENC
373 : // @Path: ../libraries/AP_WheelEncoder/AP_WheelEncoder.cpp
374 : AP_SUBGROUPINFO(wheel_encoder, "WENC", 9, ParametersG2, AP_WheelEncoder),
375 :
376 : // @Group: ATC
377 : // @Path: ../libraries/APM_Control/AR_AttitudeControl.cpp
378 : AP_SUBGROUPINFO(attitude_control, "ATC", 10, ParametersG2, AR_AttitudeControl),
379 :
380 : // @Param: TURN_RADIUS
381 : // @DisplayName: Turn radius of vehicle
382 : // @Description: Turn radius of vehicle in meters while at low speeds. Lower values produce tighter turns in steering mode
383 : // @Units: m
384 : // @Range: 0 10
385 : // @Increment: 0.1
386 : // @User: Standard
387 : AP_GROUPINFO("TURN_RADIUS", 11, ParametersG2, turn_radius, 0.9),
388 :
389 : // @Param: ACRO_TURN_RATE
390 : // @DisplayName: Acro mode turn rate maximum
391 : // @Description: Acro mode turn rate maximum
392 : // @Units: deg/s
393 : // @Range: 0 360
394 : // @Increment: 1
395 : // @User: Standard
396 : AP_GROUPINFO("ACRO_TURN_RATE", 12, ParametersG2, acro_turn_rate, 180.0f),
397 :
398 : // @Group: SRTL_
399 : // @Path: ../libraries/AP_SmartRTL/AP_SmartRTL.cpp
400 : AP_SUBGROUPINFO(smart_rtl, "SRTL_", 13, ParametersG2, AP_SmartRTL),
401 :
402 : // 14 was WP_SPEED and should not be re-used
403 :
404 : // @Param: RTL_SPEED
405 : // @DisplayName: Return-to-Launch speed default
406 : // @Description: Return-to-Launch speed default. If zero use WP_SPEED or CRUISE_SPEED.
407 : // @Units: m/s
408 : // @Range: 0 100
409 : // @Increment: 0.1
410 : // @User: Standard
411 : AP_GROUPINFO("RTL_SPEED", 15, ParametersG2, rtl_speed, 0.0f),
412 :
413 : // @Param: FRAME_CLASS
414 : // @DisplayName: Frame Class
415 : // @Description: Frame Class
416 : // @Values: 0:Undefined,1:Rover,2:Boat,3:BalanceBot
417 : // @User: Standard
418 : AP_GROUPINFO("FRAME_CLASS", 16, ParametersG2, frame_class, 1),
419 :
420 : #if HAL_PROXIMITY_ENABLED
421 : // @Group: PRX
422 : // @Path: ../libraries/AP_Proximity/AP_Proximity.cpp
423 : AP_SUBGROUPINFO(proximity, "PRX", 18, ParametersG2, AP_Proximity),
424 : #endif
425 :
426 : #if AP_AVOIDANCE_ENABLED
427 : // @Group: AVOID_
428 : // @Path: ../libraries/AC_Avoidance/AC_Avoid.cpp
429 : AP_SUBGROUPINFO(avoid, "AVOID_", 19, ParametersG2, AC_Avoid),
430 : #endif
431 :
432 : // 20 was PIVOT_TURN_RATE and should not be re-used
433 :
434 : // @Param: BAL_PITCH_MAX
435 : // @DisplayName: BalanceBot Maximum Pitch
436 : // @Description: Pitch angle in degrees at 100% throttle
437 : // @Units: deg
438 : // @Range: 0 15
439 : // @Increment: 0.1
440 : // @User: Standard
441 : AP_GROUPINFO("BAL_PITCH_MAX", 21, ParametersG2, bal_pitch_max, 10),
442 :
443 : // @Param: CRASH_ANGLE
444 : // @DisplayName: Crash Angle
445 : // @Description: Pitch/Roll angle limit in degrees for crash check. Zero disables check
446 : // @Units: deg
447 : // @Range: 0 60
448 : // @Increment: 1
449 : // @User: Standard
450 : AP_GROUPINFO("CRASH_ANGLE", 22, ParametersG2, crash_angle, 0),
451 :
452 : #if AP_FOLLOW_ENABLED
453 : // @Group: FOLL
454 : // @Path: ../libraries/AP_Follow/AP_Follow.cpp
455 : AP_SUBGROUPINFO(follow, "FOLL", 23, ParametersG2, AP_Follow),
456 : #endif
457 :
458 : // @Param: FRAME_TYPE
459 : // @DisplayName: Frame Type
460 : // @Description: Frame Type
461 : // @Values: 0:Default,1:Omni3,2:OmniX,3:OmniPlus,4:Omni3Mecanum
462 : // @User: Standard
463 : // @RebootRequired: True
464 : AP_GROUPINFO("FRAME_TYPE", 24, ParametersG2, frame_type, 0),
465 :
466 : // @Param: LOIT_TYPE
467 : // @DisplayName: Loiter type
468 : // @Description: Loiter behaviour when moving to the target point
469 : // @Values: 0:Forward or reverse to target point,1:Always face bow towards target point,2:Always face stern towards target point
470 : // @User: Standard
471 : AP_GROUPINFO("LOIT_TYPE", 25, ParametersG2, loit_type, 0),
472 :
473 : #if HAL_SPRAYER_ENABLED
474 : // @Group: SPRAY_
475 : // @Path: ../libraries/AC_Sprayer/AC_Sprayer.cpp
476 : AP_SUBGROUPINFO(sprayer, "SPRAY_", 26, ParametersG2, AC_Sprayer),
477 : #endif
478 :
479 : // @Group: WRC
480 : // @Path: ../libraries/AP_WheelEncoder/AP_WheelRateControl.cpp
481 : AP_SUBGROUPINFO(wheel_rate_control, "WRC", 27, ParametersG2, AP_WheelRateControl),
482 :
483 : #if HAL_RALLY_ENABLED
484 : // @Group: RALLY_
485 : // @Path: AP_Rally.cpp,../libraries/AP_Rally/AP_Rally.cpp
486 : AP_SUBGROUPINFO(rally, "RALLY_", 28, ParametersG2, AP_Rally_Rover),
487 : #endif
488 :
489 : // @Param: SIMPLE_TYPE
490 : // @DisplayName: Simple_Type
491 : // @Description: Simple mode types
492 : // @Values: 0:InitialHeading,1:CardinalDirections
493 : // @User: Standard
494 : // @RebootRequired: True
495 : AP_GROUPINFO("SIMPLE_TYPE", 29, ParametersG2, simple_type, 0),
496 :
497 : // @Param: LOIT_RADIUS
498 : // @DisplayName: Loiter radius
499 : // @Description: Vehicle will drift when within this distance of the target position
500 : // @Units: m
501 : // @Range: 0 20
502 : // @Increment: 1
503 : // @User: Standard
504 : AP_GROUPINFO("LOIT_RADIUS", 30, ParametersG2, loit_radius, 2),
505 :
506 : // @Group: WNDVN_
507 : // @Path: ../libraries/AP_WindVane/AP_WindVane.cpp
508 : AP_SUBGROUPINFO(windvane, "WNDVN_", 31, ParametersG2, AP_WindVane),
509 :
510 : // 32 to 36 were old sailboat params
511 :
512 : // 37 was airspeed
513 :
514 : // @Param: MIS_DONE_BEHAVE
515 : // @DisplayName: Mission done behave
516 : // @Description: Behaviour after mission completes
517 : // @Values: 0:Hold in Auto Mode,1:Loiter in Auto Mode,2:Acro Mode,3:Manual Mode
518 : // @User: Standard
519 : AP_GROUPINFO("MIS_DONE_BEHAVE", 38, ParametersG2, mis_done_behave, 0),
520 :
521 : // 39 was AP_Gripper
522 :
523 : // @Param: BAL_PITCH_TRIM
524 : // @DisplayName: Balance Bot pitch trim angle
525 : // @Description: Balance Bot pitch trim for balancing. This offsets the tilt of the center of mass.
526 : // @Units: deg
527 : // @Range: -2 2
528 : // @Increment: 0.1
529 : // @User: Standard
530 : AP_GROUPINFO("BAL_PITCH_TRIM", 40, ParametersG2, bal_pitch_trim, 0),
531 :
532 : // 41 was Scripting
533 :
534 : // @Param: STICK_MIXING
535 : // @DisplayName: Stick Mixing
536 : // @Description: When enabled, this adds steering user stick input in auto modes, allowing the user to have some degree of control without changing modes.
537 : // @Values: 0:Disabled,1:Enabled
538 : // @User: Advanced
539 : AP_GROUPINFO("STICK_MIXING", 42, ParametersG2, stick_mixing, 0),
540 :
541 : // @Group: WP_
542 : // @Path: ../libraries/AR_WPNav/AR_WPNav.cpp
543 : AP_SUBGROUPINFO(wp_nav, "WP_", 43, ParametersG2, AR_WPNav_OA),
544 :
545 : // @Group: SAIL_
546 : // @Path: sailboat.cpp
547 : AP_SUBGROUPINFO(sailboat, "SAIL_", 44, ParametersG2, Sailboat),
548 :
549 : #if AP_OAPATHPLANNER_ENABLED
550 : // @Group: OA_
551 : // @Path: ../libraries/AC_Avoidance/AP_OAPathPlanner.cpp
552 : AP_SUBGROUPINFO(oa, "OA_", 45, ParametersG2, AP_OAPathPlanner),
553 : #endif
554 :
555 : // @Param: SPEED_MAX
556 : // @DisplayName: Speed maximum
557 : // @Description: Maximum speed vehicle can obtain at full throttle. If 0, it will be estimated based on CRUISE_SPEED and CRUISE_THROTTLE.
558 : // @Units: m/s
559 : // @Range: 0 30
560 : // @Increment: 0.1
561 : // @User: Advanced
562 : AP_GROUPINFO("SPEED_MAX", 46, ParametersG2, speed_max, 0.0f),
563 :
564 : // @Param: LOIT_SPEED_GAIN
565 : // @DisplayName: Loiter speed gain
566 : // @Description: Determines how aggressively LOITER tries to correct for drift from loiter point. Higher is faster but default should be acceptable.
567 : // @Range: 0 5
568 : // @Increment: 0.01
569 : // @User: Advanced
570 : AP_GROUPINFO("LOIT_SPEED_GAIN", 47, ParametersG2, loiter_speed_gain, 0.5f),
571 :
572 : // @Param: FS_OPTIONS
573 : // @DisplayName: Failsafe Options
574 : // @Description: Bitmask to enable failsafe options
575 : // @Bitmask: 0:Failsafe enabled in Hold mode
576 : // @User: Advanced
577 : AP_GROUPINFO("FS_OPTIONS", 48, ParametersG2, fs_options, 0),
578 :
579 : #if HAL_TORQEEDO_ENABLED
580 : // @Group: TRQ
581 : // @Path: ../libraries/AP_Torqeedo/AP_Torqeedo.cpp
582 : AP_SUBGROUPINFO(torqeedo, "TRQ", 49, ParametersG2, AP_Torqeedo),
583 : #endif
584 :
585 : // @Group: PSC
586 : // @Path: ../libraries/APM_Control/AR_PosControl.cpp
587 : AP_SUBGROUPINFO(pos_control, "PSC", 51, ParametersG2, AR_PosControl),
588 :
589 : // @Param: GUID_OPTIONS
590 : // @DisplayName: Guided mode options
591 : // @Description: Options that can be applied to change guided mode behaviour
592 : // @Bitmask: 6:SCurves used for navigation
593 : // @User: Advanced
594 : AP_GROUPINFO("GUID_OPTIONS", 52, ParametersG2, guided_options, 0),
595 :
596 : // @Param: MANUAL_OPTIONS
597 : // @DisplayName: Manual mode options
598 : // @Description: Manual mode specific options
599 : // @Bitmask: 0:Enable steering speed scaling
600 : // @User: Advanced
601 : AP_GROUPINFO("MANUAL_OPTIONS", 53, ParametersG2, manual_options, 0),
602 :
603 : #if MODE_DOCK_ENABLED
604 : // @Group: DOCK
605 : // @Path: mode_dock.cpp
606 : AP_SUBGROUPPTR(mode_dock_ptr, "DOCK", 54, ParametersG2, ModeDock),
607 : #endif
608 :
609 : // @Param: MANUAL_STR_EXPO
610 : // @DisplayName: Manual Steering Expo
611 : // @Description: Manual steering expo to allow faster steering when stick at edges
612 : // @Values: 0:Disabled,0.1:Very Low,0.2:Low,0.3:Medium,0.4:High,0.5:Very High
613 : // @Range: -0.5 0.95
614 : // @User: Advanced
615 : AP_GROUPINFO("MANUAL_STR_EXPO", 55, ParametersG2, manual_steering_expo, 0),
616 :
617 : // @Param: FS_GCS_TIMEOUT
618 : // @DisplayName: GCS failsafe timeout
619 : // @Description: Timeout before triggering the GCS failsafe
620 : // @Units: s
621 : // @Range: 2 120
622 : // @Increment: 1
623 : // @User: Standard
624 : AP_GROUPINFO("FS_GCS_TIMEOUT", 56, ParametersG2, fs_gcs_timeout, 5),
625 :
626 : // @Group: CIRC
627 : // @Path: mode_circle.cpp
628 : AP_SUBGROUPINFO(mode_circle, "CIRC", 57, ParametersG2, ModeCircle),
629 :
630 : // @Param: CRASH_THR_MIN
631 : // @DisplayName: Crash throttle minimum
632 : // @Description: Throttle above this threshold accompanied by a low speed condition triggers crash detection. Zero disables velocity and turn rate checks.
633 : // @Units: %
634 : // @Range: 0 100
635 : // @Increment: 1
636 : // @User: Advanced
637 : AP_GROUPINFO("CRASH_THR_MIN", 58, ParametersG2, crash_thr_min, 5),
638 :
639 : // @Param: CRASH_VEL_MIN
640 : // @DisplayName: Crash velocity minimum
641 : // @Description: Velocity below this threshold with accompanying throttle demand triggers crash detection. Zero disables velocity check.
642 : // @Units: m/s
643 : // @Range: 0 60
644 : // @Increment: 0.1
645 : // @User: Advanced
646 : AP_GROUPINFO("CRASH_VEL_MIN", 59, ParametersG2, crash_vel_min, 0.08),
647 :
648 : // @Param: CRASH_TRAT_MIN
649 : // @DisplayName: Crash turn rate minimum
650 : // @Description: Turn rate below this threshold with accompanying throttle demand triggers crash detection. Zero disables turn rate check.
651 : // @Units: deg/s
652 : // @Range: 0 360
653 : // @Increment: 1
654 : // @User: Advanced
655 : AP_GROUPINFO("CRASH_TRAT_MIN", 60, ParametersG2, crash_turn_rate_min, 10.0),
656 :
657 : // @Param: CRASH_TIMEOUT
658 : // @DisplayName: Crash timeout
659 : // @Description: Crash conditions persisting for this duration trigger crash detection.
660 : // @Units: s
661 : // @Range: 0 60
662 : // @Increment: 0.5
663 : // @User: Advanced
664 : AP_GROUPINFO("CRASH_TIMEOUT", 61, ParametersG2, crash_timeout, 2.0),
665 :
666 : // @Param: GUID_TIMEOUT
667 : // @DisplayName: Guided mode timeout
668 : // @Description: Guided mode timeout after which vehicle will stop if no updates are received from caller. Only applicable during velocity, throttle, heading or turn rate control
669 : // @Units: s
670 : // @Range: 0.1 5
671 : // @User: Advanced
672 : AP_GROUPINFO("GUID_TIMEOUT", 62, ParametersG2, guided_timeout, 3.0),
673 :
674 : AP_GROUPEND
675 : };
676 :
677 285 : ParametersG2::ParametersG2(void)
678 : :
679 : #if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
680 : afs(),
681 : #endif
682 285 : wheel_rate_control(wheel_encoder),
683 285 : motors(wheel_rate_control),
684 285 : attitude_control(),
685 285 : smart_rtl(),
686 : #if HAL_PROXIMITY_ENABLED
687 285 : proximity(),
688 : #endif
689 : #if MODE_DOCK_ENABLED
690 285 : mode_dock_ptr(&rover.mode_dock),
691 : #endif
692 : #if AP_AVOIDANCE_ENABLED
693 285 : avoid(),
694 : #endif
695 : #if AP_FOLLOW_ENABLED
696 285 : follow(),
697 : #endif
698 285 : windvane(),
699 285 : wp_nav(attitude_control, pos_control),
700 285 : sailboat(),
701 1995 : pos_control(attitude_control)
702 : {
703 285 : AP_Param::setup_object_defaults(this, var_info);
704 285 : }
705 :
706 :
707 : /*
708 : This is a conversion table from old parameter values to new
709 : parameter names. The startup code looks for saved values of the old
710 : parameters and will copy them across to the new parameters if the
711 : new parameter does not yet have a saved value. It then saves the new
712 : value.
713 :
714 : Note that this works even if the old parameter has been removed. It
715 : relies on the old k_param index not being removed
716 :
717 : The second column below is the index in the var_info[] table for the
718 : old object. This should be zero for top level parameters.
719 : */
720 : const AP_Param::ConversionInfo conversion_table[] = {
721 : // PARAMETER_CONVERSION - Added: May-2024 for Rover-4.6
722 : { Parameters::k_param_g2, 113, AP_PARAM_INT8, "TRQ1_TYPE" },
723 : { Parameters::k_param_g2, 177, AP_PARAM_INT8, "TRQ1_ONOFF_PIN" },
724 : { Parameters::k_param_g2, 241, AP_PARAM_INT8, "TRQ1_DE_PIN" },
725 : { Parameters::k_param_g2, 305, AP_PARAM_INT16, "TRQ1_OPTIONS" },
726 : { Parameters::k_param_g2, 369, AP_PARAM_INT8, "TRQ1_POWER" },
727 : { Parameters::k_param_g2, 433, AP_PARAM_FLOAT, "TRQ1_SLEW_TIME" },
728 : { Parameters::k_param_g2, 497, AP_PARAM_FLOAT, "TRQ1_DIR_DELAY" },
729 : };
730 :
731 :
732 285 : void Rover::load_parameters(void)
733 : {
734 285 : AP_Vehicle::load_parameters(g.format_version, Parameters::k_format_version);
735 :
736 285 : AP_Param::convert_old_parameters(&conversion_table[0], ARRAY_SIZE(conversion_table));
737 :
738 285 : AP_Param::set_frame_type_flags(AP_PARAM_FRAME_ROVER);
739 :
740 285 : SRV_Channels::set_default_function(CH_1, SRV_Channel::k_steering);
741 285 : SRV_Channels::set_default_function(CH_3, SRV_Channel::k_throttle);
742 :
743 285 : if (is_balancebot()) {
744 32 : g2.crash_angle.set_default(30);
745 : }
746 :
747 : // configure safety switch to allow stopping the motors while armed
748 : #if HAL_HAVE_SAFETY_SWITCH
749 285 : AP_Param::set_default_by_name("BRD_SAFETYOPTION", AP_BoardConfig::BOARD_SAFETY_OPTION_BUTTON_ACTIVE_SAFETY_OFF|
750 : AP_BoardConfig::BOARD_SAFETY_OPTION_BUTTON_ACTIVE_SAFETY_ON|
751 : AP_BoardConfig::BOARD_SAFETY_OPTION_BUTTON_ACTIVE_ARMED);
752 : #endif
753 :
754 : static const AP_Param::G2ObjectConversion g2_conversions[] {
755 : #if AP_STATS_ENABLED
756 : // PARAMETER_CONVERSION - Added: Jan-2024 for Rover-4.6
757 285 : { &stats, stats.var_info, 1 },
758 : #endif
759 : #if AP_SCRIPTING_ENABLED
760 : // PARAMETER_CONVERSION - Added: Jan-2024 for Rover-4.6
761 285 : { &scripting, scripting.var_info, 41 },
762 : #endif
763 : #if AP_GRIPPER_ENABLED
764 : // PARAMETER_CONVERSION - Added: Feb-2024 for Copter-4.6
765 285 : { &gripper, gripper.var_info, 39 },
766 : #endif
767 : #if AP_BEACON_ENABLED
768 : // PARAMETER_CONVERSION - Added: Jun-2026 for Rover-4.8
769 285 : { &beacon, beacon.var_info, 6 },
770 : #endif // AP_BEACON_ENABLED
771 285 : };
772 :
773 285 : AP_Param::convert_g2_objects(&g2, g2_conversions, ARRAY_SIZE(g2_conversions));
774 :
775 : // PARAMETER_CONVERSION - Added: Feb-2024 for Rover-4.6
776 : #if HAL_LOGGING_ENABLED
777 285 : AP_Param::convert_class(g.k_param_logger, &logger, logger.var_info, 0, true);
778 : #endif
779 :
780 : // PARAMETER_CONVERSION - Added: Jul-2025 for ArduPilot-4.7
781 : #if AP_RPM_ENABLED
782 285 : AP_Param::convert_class(g.k_param_rpm_sensor_old, &rpm_sensor, rpm_sensor.var_info, 0, true, true);
783 : #endif
784 :
785 : static const AP_Param::TopLevelObjectConversion toplevel_conversions[] {
786 : #if AP_SERIALMANAGER_ENABLED
787 : // PARAMETER_CONVERSION - Added: Feb-2024 for Rover-4.6
788 285 : { &serial_manager, serial_manager.var_info, Parameters::k_param_serial_manager_old },
789 : #endif
790 285 : };
791 :
792 285 : AP_Param::convert_toplevel_objects(toplevel_conversions, ARRAY_SIZE(toplevel_conversions));
793 :
794 : #if HAL_GCS_ENABLED
795 : // Move parameters into new MAV_ parameter namespace
796 : // PARAMETER_CONVERSION - Added: Mar-2025 for ArduPilot-4.7
797 : {
798 : static const AP_Param::ConversionInfo gcs_conversion_info[] {
799 : { Parameters::k_param_sysid_this_mav_old, 0, AP_PARAM_INT16, "MAV_SYSID" },
800 : { Parameters::k_param_sysid_my_gcs_old, 0, AP_PARAM_INT16, "MAV_GCS_SYSID" },
801 : { Parameters::k_param_g2, 2, AP_PARAM_INT8, "MAV_OPTIONS" },
802 : { Parameters::k_param_telem_delay_old, 0, AP_PARAM_INT8, "MAV_TELEM_DELAY" },
803 : };
804 285 : AP_Param::convert_old_parameters(&gcs_conversion_info[0], ARRAY_SIZE(gcs_conversion_info));
805 : }
806 : #endif // HAL_GCS_ENABLED
807 :
808 285 : }
|