# Speed scaling is linear but lift equation is exponential? (no airspeed sensor)

Greetings,

I am a relative new comer here however i do have what i believe is an interesting topic for discussion related to the speed scaling of control surface outputs in arduplane. I am working on building a hydrofoil boat with arduplane as the base code and have come across an interesting issue where the speed scaling is completely out of whack without an airspeed (or water speed) sensor. After taking a look at the actual code, I discovered that the scaling equations are actually linear and not exponential. This may work in air where the fluid density is relatively low, but absolutely is an issue in water with 800x density.

The issue is that when the speed_scaler parameter is calculated in the Attitude.cpp without an airspeed senor, the throttle us used as a proxy for speed. However in this bit of code, there is a sqrt taken of the value, which is then squared in the AP_Rollcontrol.cpp function to calculate the factor by which the desired roll rate is determined.

``````else if (hal.util->get_soft_armed()) {
// scale assumed surface movement using throttle output
float throttle_out = MAX(SRV_Channels::get_output_scaled(SRV_Channel::k_throttle), 1);
speed_scaler = sqrtf(THROTTLE_CRUISE / throttle_out);
// This case is constrained tighter as we don't have real speed info
speed_scaler = constrain_float(speed_scaler, 0.6f, 1.67f);
} else {
// no speed estimate and not armed, use a unit scaling
speed_scaler = 1;
``````
`````` // the P and I elements are scaled by sq(scaler). To use an
// unmodified AC_PID object we scale the inputs and calculate FF separately
//
// note that we run AC_PID in radians so that the normal scaling
// range for IMAX in AC_PID applies (usually an IMAX value less than 1.0)
rate_pid.update_all(radians(desired_rate) * scaler * scaler, rate_x * scaler * scaler, limit_I);
``````

I understand that if an airspeed sensor is used, a simple scalar or fraction is taken which is not operated by a sqrt, therefore effectively using the exponential velocity function of the lift equation.

Please let me know if you agree or disagree with my assessment and I would love to make some discussions! Thanks guys! If you are interested in seeing my project let me know and I will post some links.