mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-28 13:06:36 +08:00
Fix max-hagl restriction to position/altitude control (#23667)
* fix max-hagl restriction to position/altitude control * max hagl vel restriction in ManAcc position mode * use interpolate func, change naming * simplyfied vertical vel limitation * move velocity-constraint adjustment to StickAccelXY
This commit is contained in:
@@ -327,13 +327,15 @@ void Ekf::get_ekf_vel_accuracy(float *ekf_evh, float *ekf_evv) const
|
||||
*ekf_evv = sqrtf(P(State::vel.idx + 2, State::vel.idx + 2));
|
||||
}
|
||||
|
||||
void Ekf::get_ekf_ctrl_limits(float *vxy_max, float *vz_max, float *hagl_min, float *hagl_max) const
|
||||
void Ekf::get_ekf_ctrl_limits(float *vxy_max, float *vz_max, float *hagl_min, float *hagl_max_z,
|
||||
float *hagl_max_xy) const
|
||||
{
|
||||
// Do not require limiting by default
|
||||
*vxy_max = NAN;
|
||||
*vz_max = NAN;
|
||||
*hagl_min = NAN;
|
||||
*hagl_max = NAN;
|
||||
*hagl_max_z = NAN;
|
||||
*hagl_max_xy = NAN;
|
||||
|
||||
#if defined(CONFIG_EKF2_RANGE_FINDER)
|
||||
// Calculate range finder limits
|
||||
@@ -347,7 +349,7 @@ void Ekf::get_ekf_ctrl_limits(float *vxy_max, float *vz_max, float *hagl_min, fl
|
||||
|
||||
if (relying_on_rangefinder) {
|
||||
*hagl_min = rangefinder_hagl_min;
|
||||
*hagl_max = rangefinder_hagl_max;
|
||||
*hagl_max_z = rangefinder_hagl_max;
|
||||
}
|
||||
|
||||
# if defined(CONFIG_EKF2_OPTICAL_FLOW)
|
||||
@@ -370,11 +372,12 @@ void Ekf::get_ekf_ctrl_limits(float *vxy_max, float *vz_max, float *hagl_min, fl
|
||||
const float flow_constrained_height = math::constrain(getHagl(), flow_hagl_min, flow_hagl_max);
|
||||
|
||||
// Allow ground relative velocity to use 50% of available flow sensor range to allow for angular motion
|
||||
const float flow_vxy_max = 0.5f * _flow_max_rate * flow_constrained_height;
|
||||
float flow_vxy_max = 0.5f * _flow_max_rate * flow_constrained_height;
|
||||
flow_hagl_max = math::max(flow_hagl_max * 0.9f, flow_hagl_max - 1.0f);
|
||||
|
||||
*vxy_max = flow_vxy_max;
|
||||
*hagl_min = flow_hagl_min;
|
||||
*hagl_max = flow_hagl_max;
|
||||
*hagl_max_xy = flow_hagl_max;
|
||||
}
|
||||
|
||||
# endif // CONFIG_EKF2_OPTICAL_FLOW
|
||||
|
||||
Reference in New Issue
Block a user