Browse Source

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

master
Shiv Tyagi 3 years ago committed by Peter Barker
parent
commit
8411b2ec03
  1. 7
      libraries/SITL/SIM_Precland.cpp
  2. 10
      libraries/SITL/SIM_Precland.h

7
libraries/SITL/SIM_Precland.cpp

@ -105,6 +105,13 @@ const AP_Param::GroupInfo SIM_Precland::var_info[] = { @@ -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
};

10
libraries/SITL/SIM_Precland.h

@ -41,6 +41,11 @@ public: @@ -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: @@ -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: @@ -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;

Loading…
Cancel
Save