LCOV - code coverage report
Current view: top level - home/pbarker/rc/ardupilot/Rover - Parameters.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 1 1 100.0 %
Date: 2026-09-09 11:02:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <AP_Common/AP_Common.h>
       4             : 
       5             : #include "RC_Channel_Rover.h"
       6             : #include <AC_Avoidance/AC_Avoid.h>
       7             : #include "AC_Sprayer/AC_Sprayer.h"
       8             : #include <AP_AIS/AP_AIS.h>
       9             : #include <AP_Follow/AP_Follow.h>
      10             : #include <AP_Proximity/AP_Proximity.h>
      11             : #include "AP_Rally.h"
      12             : #include <AP_SmartRTL/AP_SmartRTL.h>
      13             : #include <AP_Stats/AP_Stats.h>
      14             : #include "AP_Torqeedo/AP_Torqeedo.h"
      15             : #include <AP_WindVane/AP_WindVane.h>
      16             : 
      17             : #define AP_PARAM_VEHICLE_NAME rover
      18             : 
      19             : // Global parameter class.
      20             : //
      21             : class Parameters {
      22             : public:
      23             :     // The version of the layout as described by the parameter enum.
      24             :     //
      25             :     // When changing the parameter enum in an incompatible fashion, this
      26             :     // value should be incremented by one.
      27             :     //
      28             :     // The increment will prevent old parameters from being used incorrectly
      29             :     // by newer code.
      30             :     //
      31             :     static const uint16_t k_format_version = 16;
      32             : 
      33             :     enum {
      34             :         // Layout version number, always key zero.
      35             :         //
      36             :         k_param_format_version = 0,
      37             :         k_param_software_type, // unused
      38             :         k_param_can_mgr,
      39             : 
      40             :         // Misc
      41             :         //
      42             :         k_param_log_bitmask_old = 10,  // unused
      43             :         k_param_num_resets_old,         // unused
      44             :         k_param_reset_switch_chan,  // unused
      45             :         k_param_initial_mode,
      46             :         k_param_scheduler,
      47             :         k_param_relay,
      48             :         k_param_BoardConfig,
      49             :         k_param_pivot_turn_angle_old,   // unused
      50             :         k_param_rc_13_old,  // unused
      51             :         k_param_rc_14_old,  // unused
      52             : 
      53             :         // IO pins
      54             :         k_param_rssi_pin = 20,  // unused, replaced by rssi_ library parameters
      55             :         k_param_battery_volt_pin,
      56             :         k_param_battery_curr_pin,
      57             : 
      58             :         k_param_precland = 24,
      59             : 
      60             :         // braking
      61             :         k_param_braking_percent_old = 30,   // unused
      62             :         k_param_braking_speederr_old,       // unused
      63             : 
      64             :         // misc2
      65             :         k_param_log_bitmask = 40,
      66             :         k_param_gps,
      67             :         k_param_serial0_baud,   // deprecated, can be deleted
      68             :         k_param_serial1_baud,   // deprecated, can be deleted
      69             :         k_param_serial2_baud,   // deprecated, can be deleted
      70             : 
      71             :         // 97: RSSI
      72             :         k_param_rssi = 97,
      73             :         k_param_rpm_sensor_old, // unused - moved to vehicle
      74             : 
      75             :         // 100: Arming parameters
      76             :         k_param_arming = 100,
      77             : 
      78             :         // 110: Telemetry control
      79             :         //
      80             :         k_param_gcs0_unused = 110,  // unused in ArduPilot-4.7
      81             :         k_param_gcs1_unused,        // unused in ArduPilot-4.7
      82             :         k_param_sysid_this_mav_old,
      83             :         k_param_sysid_my_gcs_old,
      84             :         k_param_serial0_baud_old,   // unused
      85             :         k_param_serial1_baud_old,   // unused
      86             :         k_param_telem_delay_old,
      87             :         k_param_skip_gyro_cal,      // unused
      88             :         k_param_gcs2_unused,        // unused in ArduPilot-4.7
      89             :         k_param_serial2_baud_old,   // unused
      90             :         k_param_serial2_protocol,   // deprecated, can be deleted
      91             :         k_param_serial_manager_old,     // serial manager library
      92             :         k_param_cli_enabled_old,    // unused
      93             :         k_param_gcs3_unused,        // unused in ArduPilot-4.7
      94             :         k_param_gcs_pid_mask,
      95             :         k_param_gcs4_unused,        // unused in ArduPilot-4.7
      96             :         k_param_gcs5_unused,        // unused in ArduPilot-4.7
      97             :         k_param_gcs6_unused,        // unused in ArduPilot-4.7
      98             : 
      99             :         //
     100             :         // 130: Sensor parameters
     101             :         //
     102             :         k_param_compass_enabled_deprecated = 130,
     103             :         k_param_steering_learn,     // unused
     104             :         k_param_NavEKF,             // deprecated - remove
     105             :         k_param_mission,            // mission library
     106             :         k_param_NavEKF2_old,        // deprecated - remove
     107             :         k_param_NavEKF2,
     108             :         k_param_g2,                 // 2nd block of parameters
     109             :         k_param_NavEKF3,
     110             : 
     111             :         // 140: battery controls
     112             :         k_param_battery_monitoring = 140,   // deprecated, can be deleted
     113             :         k_param_volt_div_ratio,             // deprecated, can be deleted
     114             :         k_param_curr_amp_per_volt,          // deprecated, can be deleted
     115             :         k_param_input_voltage,              // deprecated, can be deleted
     116             :         k_param_pack_capacity,              // deprecated, can be deleted
     117             :         k_param_battery,
     118             : 
     119             :         //
     120             :         // 150: Navigation parameters
     121             :         //
     122             :         k_param_crosstrack_gain = 150,  // unused
     123             :         k_param_crosstrack_entry_angle, // unused
     124             :         k_param_speed_cruise,
     125             :         k_param_speed_turn_gain,    // unused
     126             :         k_param_speed_turn_dist,    // unused
     127             :         k_param_ch7_option,         // unused as a parameter; key retained for the RC7_OPTION conversion
     128             :         k_param_auto_trigger_pin,
     129             :         k_param_auto_kickstart,
     130             :         k_param_turn_circle,  // unused
     131             :         k_param_turn_max_g_old, // unused
     132             : 
     133             :         //
     134             :         // 160: Radio settings
     135             :         //
     136             :         k_param_rc_1_old = 160, // unused
     137             :         k_param_rc_2_old,       // unused
     138             :         k_param_rc_3_old,       // unused
     139             :         k_param_rc_4_old,       // unused
     140             :         k_param_rc_5_old,       // unused
     141             :         k_param_rc_6_old,       // unused
     142             :         k_param_rc_7_old,       // unused
     143             :         k_param_rc_8_old,       // unused
     144             : 
     145             :         // throttle control
     146             :         k_param_throttle_min_old = 170, // unused
     147             :         k_param_throttle_max_old,       // unused
     148             :         k_param_throttle_cruise,
     149             :         k_param_throttle_slewrate_old,  // unused
     150             :         k_param_throttle_reduction,     // unused
     151             :         k_param_pilot_steer_type,
     152             :         k_param_skid_steer_out_old, // unused
     153             : 
     154             :         // failsafe control
     155             :         k_param_fs_action = 180,
     156             :         k_param_fs_timeout,
     157             :         k_param_fs_throttle_enabled,
     158             :         k_param_fs_throttle_value,
     159             :         k_param_fs_gcs_enabled,
     160             :         k_param_fs_crash_check,
     161             :         k_param_fs_ekf_action,
     162             :         k_param_fs_ekf_thresh,  // 187
     163             : 
     164             :         // obstacle control
     165             :         k_param_sonar_enabled = 190,  // deprecated, can be removed
     166             :         k_param_sonar_old,            // unused
     167             :         k_param_rangefinder_trigger_cm, // unused
     168             :         k_param_rangefinder_turn_angle, // unused
     169             :         k_param_rangefinder_turn_time,  // unused
     170             :         k_param_sonar2_old,           // unused
     171             :         k_param_rangefinder_debounce, // unused
     172             :         k_param_rangefinder,          // rangefinder object
     173             : 
     174             :         //
     175             :         // 210: driving modes
     176             :         //
     177             :         k_param_mode_channel = 210,
     178             :         k_param_modes0,
     179             :         k_param_modes1,
     180             :         k_param_modes2,
     181             :         k_param_modes3,
     182             :         k_param_modes4,
     183             :         k_param_modes5,
     184             :         k_param_aux_channel_old,
     185             : 
     186             :         //
     187             :         // 220: Waypoint data
     188             :         //
     189             :         k_param_command_total = 220,    // unused
     190             :         k_param_command_index,          // unused
     191             :         k_param_waypoint_radius_old,    // unused
     192             :         k_param_waypoint_overshoot_old, // unused
     193             : 
     194             :         //
     195             :         // camera control
     196             :         //
     197             :         k_param_camera,
     198             :         k_param_camera_mount,
     199             :         k_param_camera_mount2,          // unused
     200             : 
     201             :         //
     202             :         // 230: PID Controllers
     203             :         k_param_pidNavSteer = 230,
     204             :         k_param_pidServoSteer,  // unused
     205             :         k_param_pidSpeedThrottle_old,   // unused
     206             : 
     207             :         // high RC channels
     208             :         k_param_rc_9_old = 235, // unused
     209             :         k_param_rc_10_old,      // unused
     210             :         k_param_rc_11_old,      // unused
     211             :         k_param_rc_12_old,      // unusedS
     212             : 
     213             :         // other objects
     214             :         k_param_sitl = 240,
     215             :         k_param_ahrs,
     216             :         k_param_ins,
     217             :         k_param_compass,
     218             :         k_param_rcmap,
     219             :         k_param_L1_controller,          // unused
     220             :         k_param_steerController_old,    // unused
     221             :         k_param_barometer,
     222             :         k_param_notify,
     223             :         k_param_button,
     224             :         k_param_osd,
     225             :         k_param_optflow,
     226             : 
     227             :         k_param_logger = 253,  // Logging Group
     228             : 
     229             :         // 254,255: reserved
     230             : 
     231             :         k_param_vehicle = 257, // vehicle common block of parameters
     232             :         k_param__gcs = 258,
     233             :         };
     234             : 
     235             :     AP_Int16    format_version;
     236             : 
     237             :     // Misc
     238             :     //
     239             :     AP_Int32    log_bitmask;
     240             :     AP_Int8     initial_mode;
     241             : 
     242             :     // navigation parameters
     243             :     //
     244             :     AP_Float    speed_cruise;
     245             :     AP_Int8     auto_trigger_pin;
     246             :     AP_Float    auto_kickstart;
     247             :     AP_Int16    gcs_pid_mask;
     248             : 
     249             :     // Throttle
     250             :     //
     251             :     AP_Int8     throttle_cruise;
     252             :     AP_Enum<PilotSteerType>     pilot_steer_type;
     253             : 
     254             :     // failsafe control
     255             :     AP_Int8     fs_action;
     256             :     AP_Float    fs_timeout;
     257             :     AP_Int8     fs_throttle_enabled;
     258             :     AP_Int16    fs_throttle_value;
     259             :     AP_Int8     fs_gcs_enabled;
     260             :     AP_Int8     fs_crash_check;
     261             :     AP_Int8     fs_ekf_action;
     262             :     AP_Float    fs_ekf_thresh;
     263             : 
     264             :     // driving modes
     265             :     //
     266             :     AP_Int8     mode_channel;
     267             :     AP_Int8     modes[6];
     268             : 
     269        1995 :     Parameters() {}
     270             : };
     271             : 
     272             : /*
     273             :   2nd block of parameters, to avoid going past 256 top level keys
     274             :  */
     275             : class ParametersG2 {
     276             : public:
     277             :     ParametersG2(void);
     278             : 
     279             :     // var_info for holding Parameter information
     280             :     static const struct AP_Param::GroupInfo var_info[];
     281             : 
     282             :     // RC input channels
     283             :     RC_Channels_Rover rc_channels;
     284             : 
     285             :     // control over servo output ranges
     286             :     SRV_Channels servo_channels;
     287             : 
     288             : #if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
     289             :     // advanced failsafe library
     290             :     AP_AdvancedFailsafe_Rover afs;
     291             : #endif
     292             : 
     293             :     // wheel encoders
     294             :     AP_WheelEncoder wheel_encoder;
     295             :     AP_WheelRateControl wheel_rate_control;
     296             : 
     297             :     // Motor library
     298             :     AP_MotorsUGV motors;
     299             : 
     300             :     // steering and throttle controller
     301             :     AR_AttitudeControl attitude_control;
     302             : 
     303             :     // turn radius of vehicle (only used in steering mode)
     304             :     AP_Float turn_radius;
     305             : 
     306             :     // acro mode turn rate maximum
     307             :     AP_Float acro_turn_rate;
     308             : 
     309             :     // Safe RTL library
     310             :     AP_SmartRTL smart_rtl;
     311             : 
     312             :     // default speed for rtl
     313             :     AP_Float rtl_speed;
     314             : 
     315             :     // frame class for vehicle
     316             :     AP_Int8 frame_class;
     317             : 
     318             : #if HAL_PROXIMITY_ENABLED
     319             :     // proximity library
     320             :     AP_Proximity proximity;
     321             : #endif
     322             : 
     323             : #if MODE_DOCK_ENABLED
     324             :     // we need a pointer to the mode for the G2 table
     325             :     class ModeDock *mode_dock_ptr;
     326             : #endif
     327             : 
     328             : #if AP_AVOIDANCE_ENABLED
     329             :     // avoidance library
     330             :     AC_Avoid avoid;
     331             : #endif
     332             : 
     333             :     // pitch angle at 100% throttle
     334             :     AP_Float bal_pitch_max;
     335             : 
     336             :     // pitch/roll angle for crash check
     337             :     AP_Int8 crash_angle;
     338             : 
     339             :     // min throttle for crash check
     340             :     AP_Float crash_thr_min;
     341             : 
     342             :     // velocity threshold for crash check
     343             :     AP_Float crash_vel_min;
     344             : 
     345             :     // turn rate threshold for crash check
     346             :     AP_Float crash_turn_rate_min;
     347             : 
     348             :     // crash trigger time in seconds
     349             :     AP_Float crash_timeout;
     350             : 
     351             : #if AP_FOLLOW_ENABLED
     352             :     // follow mode library
     353             :     AP_Follow follow;
     354             : #endif
     355             : 
     356             :     // frame type for vehicle (used for vectored motor vehicles and custom motor configs)
     357             :     AP_Int8 frame_type;
     358             : 
     359             :     // loiter type
     360             :     AP_Int8 loit_type;
     361             :     AP_Float loit_radius;
     362             : 
     363             : #if HAL_SPRAYER_ENABLED
     364             :     // Sprayer
     365             :     AC_Sprayer sprayer;
     366             : #endif
     367             : 
     368             : #if HAL_RALLY_ENABLED
     369             :     // Rally point library
     370             :     AP_Rally_Rover rally;
     371             : #endif
     372             : 
     373             :     // Simple mode types
     374             :     AP_Int8 simple_type;
     375             : 
     376             :     // windvane
     377             :     AP_WindVane windvane;
     378             : 
     379             : #if AP_MISSION_ENABLED
     380             :     // mission behave
     381             :     AP_Enum<ModeAuto::DoneBehaviour> mis_done_behave;
     382             : #endif
     383             : 
     384             :     // balance both pitch trim
     385             :     AP_Float bal_pitch_trim;
     386             : 
     387             :     // stick mixing for auto modes
     388             :     AP_Int8     stick_mixing;
     389             : 
     390             :     // waypoint navigation
     391             :     AR_WPNav_OA wp_nav;
     392             : 
     393             :     // Sailboat functions
     394             :     Sailboat sailboat;
     395             : 
     396             : #if AP_OAPATHPLANNER_ENABLED
     397             :     // object avoidance path planning
     398             :     AP_OAPathPlanner oa;
     399             : #endif
     400             : 
     401             :     // maximum speed for vehicle
     402             :     AP_Float speed_max;
     403             : 
     404             :     // gain for speed of correction in loiter
     405             :     AP_Float loiter_speed_gain;
     406             : 
     407             :     // FS options
     408             :     AP_Int32 fs_options;
     409             : 
     410             : #if HAL_TORQEEDO_ENABLED
     411             :     // torqeedo motor driver
     412             :     AP_Torqeedo torqeedo;
     413             : #endif
     414             : 
     415             :     // position controller
     416             :     AR_PosControl pos_control;
     417             : 
     418             :     // guided options bitmask
     419             :     AP_Int32 guided_options;
     420             : 
     421             :     // manual mode options
     422             :     AP_Int32 manual_options;
     423             : 
     424             :     // manual mode steering expo
     425             :     AP_Float manual_steering_expo;
     426             : 
     427             :     // FS GCS timeout trigger time
     428             :     AP_Float fs_gcs_timeout;
     429             : 
     430             :     // GUIDED mode timeout
     431             :     AP_Float guided_timeout;
     432             : 
     433             :     class ModeCircle mode_circle;
     434             : };
     435             : 
     436             : extern const AP_Param::Info var_info[];

Generated by: LCOV version 1.14