mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
RangeFinder: add ground clearance parameter
This commit is contained in:
parent
1c8e3f9444
commit
f1cbd1f03b
@ -95,6 +95,15 @@ const AP_Param::GroupInfo RangeFinder::var_info[] PROGMEM = {
|
||||
// @Range: 0 32767
|
||||
AP_GROUPINFO("_PWRRNG", 10, RangeFinder, _powersave_range, 0),
|
||||
|
||||
// @Param: _GNDCLEAR
|
||||
// @DisplayName: Distance (in cm) from the range finder to the ground
|
||||
// @Description: This parameter sets the expected range measurement(in cm) that the range finder should return when the vehicle is on the ground.
|
||||
// @Units: centimeters
|
||||
// @Range: 0 127
|
||||
// @Increment: 1
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("_GNDCLEAR", 11, RangeFinder, _ground_clearance_cm[0], RANGEFINDER_GROUND_CLEARANCE_CM_DEFAULT),
|
||||
|
||||
// 10..12 left for future expansion
|
||||
|
||||
#if RANGEFINDER_MAX_INSTANCES > 1
|
||||
@ -162,6 +171,15 @@ const AP_Param::GroupInfo RangeFinder::var_info[] PROGMEM = {
|
||||
// @Description: This parameter sets whether an analog rangefinder is ratiometric. Most analog rangefinders are ratiometric, meaning that their output voltage is influenced by the supply voltage. Some analog rangefinders (such as the SF/02) have their own internal voltage regulators so they are not ratiometric.
|
||||
// @Values: 0:No,1:Yes
|
||||
AP_GROUPINFO("2_RMETRIC", 21, RangeFinder, _ratiometric[1], 1),
|
||||
|
||||
// @Param: 2_GNDCLEAR
|
||||
// @DisplayName: Distance (in cm) from the second range finder to the ground
|
||||
// @Description: This parameter sets the expected range measurement(in cm) that the second range finder should return when the vehicle is on the ground.
|
||||
// @Units: centimeters
|
||||
// @Range: 0 127
|
||||
// @Increment: 1
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("2_GNDCLEAR", 22, RangeFinder, _ground_clearance_cm[1], RANGEFINDER_GROUND_CLEARANCE_CM_DEFAULT),
|
||||
#endif
|
||||
|
||||
AP_GROUPEND
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
// Maximum number of range finder instances available on this platform
|
||||
#define RANGEFINDER_MAX_INSTANCES 2
|
||||
#define RANGEFINDER_GROUND_CLEARANCE_CM_DEFAULT 10
|
||||
|
||||
class AP_RangeFinder_Backend;
|
||||
|
||||
@ -75,6 +76,7 @@ public:
|
||||
AP_Int8 _function[RANGEFINDER_MAX_INSTANCES];
|
||||
AP_Int16 _min_distance_cm[RANGEFINDER_MAX_INSTANCES];
|
||||
AP_Int16 _max_distance_cm[RANGEFINDER_MAX_INSTANCES];
|
||||
AP_Int8 _ground_clearance_cm[RANGEFINDER_MAX_INSTANCES];
|
||||
AP_Int16 _powersave_range;
|
||||
|
||||
static const struct AP_Param::GroupInfo var_info[];
|
||||
@ -120,7 +122,13 @@ public:
|
||||
int16_t min_distance_cm() const {
|
||||
return min_distance_cm(primary_instance);
|
||||
}
|
||||
|
||||
int16_t ground_clearance_cm(uint8_t instance) const {
|
||||
return _ground_clearance_cm[instance];
|
||||
}
|
||||
int16_t ground_clearance_cm() const {
|
||||
return _ground_clearance_cm[primary_instance];
|
||||
}
|
||||
|
||||
bool healthy(uint8_t instance) const {
|
||||
return instance < num_instances && _RangeFinder_STATE(instance).healthy;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user