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

Fix scale application on FW throttle baro compensation #9099

Merged
merged 1 commit into from
Mar 19, 2018
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
2 changes: 1 addition & 1 deletion src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ FixedwingPositionControl::tecs_update_pitch_throttle(float alt_sp, float airspee
if (PX4_ISFINITE(baro.pressure) && PX4_ISFINITE(_parameters.throttle_alt_scale)) {
// scale throttle as a function of sqrt(p0/p) (~ EAS -> TAS at low speeds and altitudes ignoring temperature)
const float eas2tas = sqrtf(MSL_PRESSURE_MILLIBAR / baro.pressure);
const float scale = constrain(eas2tas * _parameters.throttle_alt_scale, 0.9f, 2.0f);
const float scale = constrain((eas2tas - 1.0f) * _parameters.throttle_alt_scale + 1.0f, 1.0f, 2.0f);

throttle_max = constrain(throttle_max * scale, throttle_min, 1.0f);
throttle_cruise = constrain(throttle_cruise * scale, throttle_min + 0.01f, throttle_max - 0.01f);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/fw_pos_control_l1/fw_pos_control_l1_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ PARAM_DEFINE_FLOAT(FW_THR_CRUISE, 0.6f);
* The default value of 0 will disable scaling.
*
* @min 0.0
* @max 2.0
* @max 10.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 10? Even 2 was questionable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this changes the scale to be applied only on the amount of change the factor required is significantly higher. In our case approximately 3 is required

* @decimal 1
* @increment 0.1
* @group FW L1 Control
Expand Down