Whilst learning how to fly an electric RC training aircraft I found most of my effort was spent trying to counter the effects of wind gusts, and that this is an inherent problem because this type of model tends to have a low wing loading in order to fly slow enough for novice pilots to respond. I therefore concluded that adding some form of active damping might allow me to concentrate more on the aircrafts longer-term flight path. The following code is my first attempt at an elevator control circuit that could be duplicated for the rudder and ailerons. Pulses from the decoder’s elevator output are mixed with motion feedback from a pitch axis gyro and correction pulses issued to the elevator servo. Unlike an active stability system, complex PID control should not be necessary for gust damping because model trainers have a high degree of aerodynamic stability. With the correct sensor orientation and servo linkage the models response to dynamic pitch changes seems to make sense (e.g., nose pitched down results in up elevator movement) but before moving on from the bench testing stage I thought the basic approach should be submitted for comment. For example, is the gain setting too course and could some form of fail-safe be included?
#PICAXE 08M
symbol gain = 3
symbol offset = 22
symbol centre = 40
setfreq m8
start:
pulsin 3,1,w0 '1-2mS input command pulse
w0=w0-180 'Apply 1mS offset to command pulse
readadc10 4, w1 '0-3.3v input from gyro
w1=w1/ gain + offset 'Sets rate gyro input gain and offset
w2=w0 + w1 'Sum of gyro and command inputs
w2=w2 + centre max 420 min 180 'Centre servo and set define end-stops
pulsout 1,w2 'Output comman pulse to servo
goto start
#PICAXE 08M
symbol gain = 3
symbol offset = 22
symbol centre = 40
setfreq m8
start:
pulsin 3,1,w0 '1-2mS input command pulse
w0=w0-180 'Apply 1mS offset to command pulse
readadc10 4, w1 '0-3.3v input from gyro
w1=w1/ gain + offset 'Sets rate gyro input gain and offset
w2=w0 + w1 'Sum of gyro and command inputs
w2=w2 + centre max 420 min 180 'Centre servo and set define end-stops
pulsout 1,w2 'Output comman pulse to servo
goto start