jaspreeth / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Eliminate incorrect use of fixed STANDARD_SPEED #define #407

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In config.h please remove the define for

STANDARD_SPEED (see below)
STANDARD_SPEED_SQUARED (no other reference to it)
THROTTLE_CRUISE_SQUARED (no other reference to it)

In the code base, where (STANDARD_SPEED * 100.0) is used, replace with 
(g.airspeed_cruise) which is already x 100.0

Rationale:
If current ground speed differs markedly from STANDARD_SPEED (eg wind) then the 
calculated attitude of the plane is modified by multiplication of a number 
around 1.0 (1.0 if ground speed == STANDARD_SPEED)

Since STANDARD_SPEED was fixed to 15.0 and not changeable with parameters, this 
means that for a plane with parameters setting of AIRSPEED_CRUISE_CM that was 
*not* 1500.0, behavior may be less than optimal, regardless of wind (head wind 
or tail wind).

Further point: if throttle speed nudge is used (where pilot leaves throttle in 
top half of range to suggest to autopilot a faster cruise), then the use of 
ground speed to pre-set airpseed_cruise to modify attitude becomes erroneous.

Original issue reported on code.google.com by justinbe...@gmail.com on 6 Sep 2011 at 4:56

GoogleCodeExporter commented 8 years ago
Your suggestion to replace STANDARD_SPEED with g.airspeed_cruise misunderstands 
the purpose of STANDARD_SPEED.  STANDARD_SPEED is used to calculate speed 
compensation of the servo loop gains.  Control surface effectiveness increases 
with airspeed, so the gain values need to be adjusted to work well at a variety 
of speeds.  STANDARD_SPEED is the reference speed used for scaling.  Replacing 
STANDARD_SPEED with g.airspeed_cruise would break this functionality.

Original comment by dewei...@gmail.com on 7 Sep 2011 at 7:01