United States, CA, Sunnyvale
Joined Dec 2006
Control System Characterization (Continued)
The KK2 board does have an accelerometer chip, and I believe it is a 3 axis accelerometer, but I am effectively not using it so I can’t speak much to how it works. The KK2 board does have self level settings that are based on the ACC (accelerometer) and if I were flying a standard quadcopter I would probably use them, but I am afraid of what they would do in forward flight mode, so I have them all set to zero.
The KK2 board also has “Height Dampening” which I believe uses the Z axes accelerometer to try and make it easier to hold a constant altitude in a hover. This might be a nice feature for a standard quadcopter but I suspect it would be a problem in forward flight mode so I have it set to zero.
Most of the P, all of the I, and if necessary any D, that I need in a hover comes from the Eagletree Guardian. It has gyros and accelerometers just like the KK2, and the same basic concepts apply, but the Guardian is designed for use by fixed wing pilots so the terminology they use is very different.
The Guardian has 3 pots for roll pitch and yaw, which allow you to set the feedback gain and polarity. It is not clear to what extent these pots control the individual feedback values of P, I, D, and acceleration in the X Y and Z as they don’t give you that kind of detailed control. The feedback proportions also depend on the specific flight mode and whether we are talking about roll, pitch, or yaw.
I won’t attempt to describe all of the flight mode options. You would be better served to read the Guardian users manual for that. I will say that I use just two flight modes. For forward flight I use a “Pass Through” mode. This is the “middle input” position (1.5ms pulse width) into the “Mod” input of the Guardian. In Pass Through mode it is like the Guardian isn’t there.
For hovering and slow forward flight I use the Guardian “2D” mode. I gather they call it 2D mode because they want to imply a more sedate style of flying like you might do with a trainer plane while teaching a student. The 3D mode, which I don’t use, is more for aerobatics, hovering, and aggressive fixed wing flying.
I do have the gear switch on my TX set up to drive the Guardian into 3D mode but I never use it in the air. It is only used on the ground to switch between 2D mode and 3D mode and back again. This sequence of inputs is used to initialize the Guardian in the “level” position, and also to zero out any TX trim changes. Once again, read the Guardian users manual for all the details.
In 2D mode the Guardian is using a combination of P, possibly some I, and a little D to provide stabilization. It is also using the 3 axes accelerometer to provide auto leveling. It is somewhat more difficult to reverse engineer the Guardian based on how it reacts as compared to the KK2. They also don’t give you as much direct control over the flight parameters. I think most people would be put off by all the technical details, and too many options would give too many ways to screw up, so it is probably wise that they did what they did. I can, however, partially show you how it works.
Assume we have the plane set up in hover mode with all of the various Guardian and KK2 settings as published in previous posts. In brief, this means the Guardian is in 2D mode with maximum gains on all 3 pots, and the KK2 is set to 20 P and zero I on all 3 axes.
We will start by looking at the control surfaces and leaving the throttle off, both because it is safer, and because the servo’s are only driven by the Guardian. The KK2 has nothing to do with the servo’s or the control surfaces.
If you force the plane to roll left 20 degrees you will see the ailerons move to fight the roll. If you hold the aircraft at 20 degrees you will see the ailerons fight the roll indefinitely with no obvious drift. This is the result of the accelerometer (ACC) detecting that the aircraft is not level. There is no drift because the ACC is continuously measuring the “local gravity vector”. I like to imagine the local gravity vector as a weight hanging from a rubber band under the aircraft. When the aircraft is tilted the weight hangs to one side, relative to the aircraft, and the ACC knows that the aircraft is not level. It also knows that the aircraft is not pulling any G’s because the rubber band isn’t any more stretched than usual.
If you quickly force the aircraft back to level in roll you may be able to see the ailerons overshoot before moving back to level. This is hard to see, and it could be coming from a number of places. It could be that the servo is just a tiny bit slow. Or it could be the P gain from the Guardian. It could also be from the Guardian D gain, but that would be very hard to see.
Now hold the plane in a 20 degree left bank and then apply left aileron stick input until the ailerons come back to neutral. Now bank the plane 40 degrees and note that it takes more stick input to bring the ailerons back to neutral. In 2D mode when you tilt the stick it tilts the plane by some proportional amount. This is fundamentally different than flying a regular plane. For most aircraft, when you tilt the stick it results in a certain rate of role. If you hold the stick tilted the plane will keep rolling until it is upside down, and eventually upright again. This confuses the heck out of beginner pilots and increases the workload for experienced pilots slightly. Our brains are very adaptable when it comes to this stuff but this mode of flight is still easier except when it gets in the way.
You can do all the same things in pitch and watch the effect on the elevator.
You can force the aircraft to yaw but the effect on the rudder is somewhat different. It will move to fight the yaw, but only while the plane is actually yawing. This looks to be pure P. There is no I, and probably not much D though it is hard to tell just by watching the rudder. The Guardian is not providing yaw stability but only yaw dampening. True yaw stability on an airplane would be a bad thing because unlike a quad copter, airplanes don’t fly sideways let alone backwards. They need to weathervane into the relative wind, and true stability like a heading hold gyro would be a problem. A rate gyro, on the other hand just smooth’s things out and is a good thing.
There is also no impact on yaw from the accelerometers, nor is any possible. The gravity vector doesn’t tell you if you are pointing north or south. You would need a magnetometer for that and we don’t have one.
The accelerometers do, however, affect the rudder in a different way. If you force the aircraft to roll left 20 degrees and hold it there you will see the rudder move to the left. This is the automatic turn coordination in action. Full scale pilots call this “stepping on the ball”. They have a slip indicator that is nothing more than a little ball inside a fluid filled glass tube that is shaped like a smile. If the plane is slipping to the left then the little ball will move to the left indicating that the local gravity vector isn’t straight down relative to the plane. They fix the problem by pushing on the left rudder pedal which brings the plane into a properly coordinated turn. The Guardian does this for you by turning the rudder towards the low wing. This is especially handy in slow flight mode where the airflow over the vertical stabilizer might not be enough to keep the tail in back where it belongs. As the pilot, you can help it along by moving the rudder and ailerons together, but it isn’t entirely necessary as the Guardian will mostly do it for you.
The automatic turn coordination gain is not so high that you can’t fly sideways or even backwards in a hover. You can, but not very fast. The faster you move the more the vertical stabilizer and the automatic turn coordination will try to turn the nose into the relative wind.
All of these roll, pitch, and yaw outputs from the Guardian, that you can see in the control surfaces, are also inputs to the KK2. The KK2 applies the additional P stabilization and of course mixes the roll pitch and yaw inputs as necessary to control the motors.
You might wonder why the KK2, or copter controllers in general, don’t make more use off the 3 axes accelerometers to provide true flight stabilization more like the Guardian. Why bother with I and all the long term drift issues when you have accelerometers that don’t drift (much)? The answer is that they do, to some degree, but more importantly it is because an aircraft in flight is not as simple as an aircraft held in your hands.
If you have a quadcopter in a perfect hover, and then something comes along, like a pushy finger, and causes it to tilt 5 degrees to the left, the accelerometer will not immediately be able to tell. The aircraft will immediately begin translating sideways to the left and the net result will be that the local gravity vector will remain in line with the aircraft. It won’t be straight down relative to the earth any more, but it will be tilted by the same amount as the aircraft.
As the aircraft accelerates sideways it will begin to develop drag and at some point, if the tilt angle remains the same, it will reach some terminal horizontal velocity. At that point the local gravity vector will be straight down relative to the earth and the accelerometer will easily see that the aircraft must be tilted. Long before terminal velocity is reached the local gravity vector will begin tilting and some stabilizing feedback is possible.
So, going back to a perfect hover… At the point of upset the P will be fighting strongly to prevent the upset from ever happening. Once the upsetting force is gone, so is the pushback from P. At this point, if P didn’t entirely win the battle then I can see that the aircraft is tilted and will try to push it back to level and pretty much never give up, but I has long term drift issues. If I doesn’t bring things back to level, It may be a few seconds later before the local gravity vector gets tilted enough for the accelerometer to notice and help straighten things out, and by then the aircraft will have translated horizontally a considerable distance. You can see all this play out when flying indoors with no wind if you have enough room to let the aircraft do what it wants, and everything is perfectly trimmed.
None of this helps you with wind. The aircraft has no way to know where it is relative to a spot on the ground, except via feedback from you, the pilot. Left to its own devices it will go with the flow like a hot air balloon. To solve that problem we need something like GPS, at which point you really are unnecessary. On the other hand, the aircraft has no concept of having fun, so you still have to do that part yourself. I would work on teaching the aircraft how to have fun, but therein lies the path to Skynet.