-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Conversation
I'm not following why this is necessary. Can you break it down further? |
Old situation: |
new situation: scale factor 2 while flying AMSL would mean: at altitude |
Ok, I see what you mean. Why did you change the lower bound of the constrain? |
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
I changed the lower bound because i noticed we had instances of flying in 1030 Hpa, when scaling up hard it should probably not lower hard too. Generally makes it safer to tinker with this value. |
@@ -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) * _parameters.throttle_alt_scale + 1, 1.0f, 2.0f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 -> 1.0f
fb8b60d
to
c0fa9cb
Compare
@dagar addressed your comment |
To be honest I'm still not sure if this scale factor is entirely correctly, but it seems workable (and safe). |
Please leave this branch for a few days |
The scale factor intended for the baro compensation was applied to the entire throttle range.
Now only applied to the eas2tas factor effect so it can be tuned properly