AC_PrecLand: Change parameter to bitmask

This commit is contained in:
Rishabh 2022-01-31 16:54:31 +05:30 committed by Randy Mackay
parent 7907fd5729
commit 89cd6ab006
2 changed files with 12 additions and 7 deletions

View File

@ -162,12 +162,12 @@ const AP_Param::GroupInfo AC_PrecLand::var_info[] = {
// @Units: m
AP_GROUPINFO("ALT_MAX", 16, AC_PrecLand, _sensor_max_alt, 8),
// @Param: MOVING
// @DisplayName: Precision Landing Target stationary/moving
// @Description: Precision Landing Target stationary/moving
// @Values: 0:Stationary, 1:Moving
// @Param: OPTIONS
// @DisplayName: Precision Landing Extra Options
// @Description: Precision Landing Extra Options
// @Bitmask: 0: Moving Landing Target
// @User: Advanced
AP_GROUPINFO("MOVING", 17, AC_PrecLand, _moving, 0),
AP_GROUPINFO("OPTIONS", 17, AC_PrecLand, _options, 0),
AP_GROUPEND
};
@ -422,7 +422,7 @@ bool AC_PrecLand::get_target_velocity_relative_cms(Vector2f& ret)
// get the absolute velocity of the vehicle
void AC_PrecLand::get_target_velocity_cms(const Vector2f& vehicle_velocity_cms, Vector2f& target_vel_cms)
{
if (!_moving) {
if (!(_options & PLND_OPTION_MOVING_TARGET)) {
// the target should not be moving
target_vel_cms.zero();
return;

View File

@ -125,6 +125,11 @@ private:
SITL = 4,
};
enum PLndOptions {
PLND_OPTION_DISABLED = 0,
PLND_OPTION_MOVING_TARGET = (1 << 0),
};
// check the status of the target
void check_target_status(float rangefinder_alt_m, bool rangefinder_alt_valid);
@ -168,7 +173,7 @@ private:
AP_Int8 _retry_behave; // Action to do when trying a landing retry
AP_Float _sensor_min_alt; // PrecLand minimum height required for detecting target
AP_Float _sensor_max_alt; // PrecLand maximum height the sensor can detect target
AP_Int8 _moving; // True if the landing target is moving (non-stationary)
AP_Int16 _options; // Bitmask for extra options
uint32_t _last_update_ms; // system time in millisecond when update was last called
bool _target_acquired; // true if target has been seen recently after estimator is initialized