SITL: add param in SIM_Precland to enable return dist to target

This commit is contained in:
Shiv Tyagi 2022-07-28 15:25:41 +05:30 committed by Peter Barker
parent 27e7042377
commit 8411b2ec03
2 changed files with 17 additions and 0 deletions

View File

@ -105,6 +105,13 @@ const AP_Param::GroupInfo SIM_Precland::var_info[] = {
// @User: Advanced
AP_GROUPINFO("ORIENT", 9, SIM_Precland, _orient, ROTATION_PITCH_90),
// @Param: OPTIONS
// @DisplayName: SIM_Precland extra options
// @Description: SIM_Precland extra options
// @Bitmask: 0: Enable target distance
// @User: Advanced
AP_GROUPINFO("OPTIONS", 10, SIM_Precland, _options, 0),
AP_GROUPEND
};

View File

@ -41,6 +41,11 @@ public:
void set_default_location(float lat, float lon, int16_t yaw);
static const struct AP_Param::GroupInfo var_info[];
// enum for SIM_PLD_OPTIONS parameter
enum class Option : uint8_t {
ENABLE_TARGET_DISTANCE = (1U << 0),
};
AP_Int8 _enable;
AP_Float _device_lat;
AP_Float _device_lon;
@ -51,6 +56,7 @@ public:
AP_Float _alt_limit;
AP_Float _dist_limit;
AP_Int8 _orient;
AP_Enum<Option> _options;
bool _over_precland_base;
enum PreclandType {
@ -58,6 +64,10 @@ public:
PRECLAND_TYPE_CONE = 1,
PRECLAND_TYPE_SPHERE = 2,
};
bool option_enabled(Option option) const {
return (_options & uint8_t(option)) != 0;
}
private:
uint32_t _last_update_ms;
bool _healthy;