Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plane: update throttle mix uses filtered accelerations #13723

Merged
merged 1 commit into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ArduPlane/quadplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3160,6 +3160,11 @@ float QuadPlane::stopping_distance(void)

void QuadPlane::update_throttle_mix(void)
{
// update filtered acceleration
Vector3f accel_ef = ahrs.get_accel_ef_blended();
accel_ef.z += GRAVITY_MSS;
throttle_mix_accel_ef_filter.apply(accel_ef, plane.scheduler.get_loop_period_s());

// transition will directly manage the mix
if (in_transition()) {
return;
Expand Down Expand Up @@ -3190,9 +3195,7 @@ void QuadPlane::update_throttle_mix(void)
bool large_angle_error = (angle_error > LAND_CHECK_ANGLE_ERROR_DEG);

// check for large acceleration - falling or high turbulence
Vector3f accel_ef = plane.ahrs.get_accel_ef_blended();
accel_ef.z += GRAVITY_MSS;
bool accel_moving = (accel_ef.length() > LAND_CHECK_ACCEL_MOVING);
bool accel_moving = (throttle_mix_accel_ef_filter.get().length() > LAND_CHECK_ACCEL_MOVING);

// check for requested decent
bool descent_not_demanded = pos_control->get_desired_velocity().z >= 0.0f;
Expand Down
3 changes: 3 additions & 0 deletions ArduPlane/quadplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ class QuadPlane
float vpos_start_m;
} landing_detect;

// throttle mix acceleration filter
LowPassFilterVector3f throttle_mix_accel_ef_filter = LowPassFilterVector3f(1.0f);

// time we last set the loiter target
uint32_t last_loiter_ms;

Expand Down