|
楼主 |
发表于 2010-8-8 13:54:05
|
显示全部楼层
These gyros spit out the rate of angular change. What this means is that (in terms of a PID control, see http://www.embedded.com/2000/0010/0010feat3.htm and http://en.wikipedia.org/wiki/PID_controller for starting info on PID controlers) that Gyro-P is the proportional factor of the gyro rate of change or ‘D’ in the PID control of the MK angle. Now, if you take the integral of the rate of angular change you get the angel, so that Gyro-I is then ‘P’ in the PID control of the MK angle. What does that mean? Well, think of a pendulum as an analogy (from kilagreg’s explanation about GPS-P/D) ‘P’ is the force that tries to move the pendulum back to the center. The further away it is the stronger the force to move it back. When the pendulum gets to the center position the force exerted on it is zero but momentum carries it on and past center only to create a force in the opposite direction again to try and move it back. And a swing in created. If you increase ‘P’ [Gyro-I] you are essentially increasing the force to move the MK back to the correct orientation. If ‘P’ is too big it is like pushing someone on a swing and if you push too much the swinging just gets bigger and bigger [MK would oscillate]. If ‘P’ is too little it would be like turning down gravity and you would swing slowly [MK would correct slowly]. . So ‘P’ is the return force.
Having a MK swing/tilt back and forth like a pendulum would not be a good thing. What you would need is some friction. That’s where ‘D’ [Gyro-P] comes in. ‘D’ is trying to adjust for the rate of change of the angle and provide a force in the opposite direction to try and slow it down if it is approaching the center two fast. ‘D’ is trying to be more predictive. For the pendulum it is like adding friction. That way, as the pendulum swings to the center it is being slowed down and the oscillation die down quickly or don’t happen at all. If ‘D’ is two large its like having the friction to large and the pendulum just stops before it even gets to the center and it resists disturbances or is hard to push [MK tends to hold on to tilts]. If ‘D’ is too small the pendulum just swings back an forth [MK just oscillates for a while] So ‘D’ is like a friction force.
Now what happens if winds blows a pendulum? Well, it would tend (even at rest) to be tilted. For a MK that would also not be good. What is needed is something that accounts for the long term error (average amount away from center) and provides a force to correct. This is the ‘I’ in the PID control. It is the integral of ‘P’. What is ‘I’ in the MK, it is the Hauptregler I-Anteil. So ‘I’ is an adjustment for the average offset error.
If your MK has a lot of vibration noise, what happens? Well for the ‘I’ portion since it is the average, any noise just gets average out. The ‘P’ porting simply just passes the noise on (so this is like having the angle reading jump around from 1, 4, 2, -1, 3, 1, -3,etc). For ‘D’ it’s a different story. ‘D’ is the rate of change of the angel so the jumping around from ‘P’ would mean that to ‘D’ it looks like it is moving one way then the other, slow then fast,etc. For ‘D’ the noise gets amplified. The MK would be jerky.
The goal is to have the pendulum very quickly swing back to center and then just stick.
You can imagine that there are trade offs for all of these setting and changing one effects the others. Add to that the fact that the MK properties of YOUR MK affect this as well. How fast the motors can change RPM, the max thrust, the mass of the arm, the center of gravity, the efficiency of the drive system, sensitivity of the sensors, the wind resistance of the frame etc. You change these things and it’s like changing a portion of the PID control. Something as miniscule as changing the stiffness of the propeller would change the efficiency at various RPM and would then require a tweak on probably P (only then to be followed by checking the others).
Now the gyros are not that accurate/stable (so error can accumulate especially in the integral) so the accelerometers are used to adjust/correct gyro Integral errors thru the ACC/Gyro Comp. parameter. This essentially determines how fast the gyros get brought back in line with the accelerometer readings.
The Stick parameters and how the stick feels in terms of MK control is also related to how the MK PID control is set up. If the PID is very ‘hard’ then you would need a lot of stick amplification to move the MK. If the MK is set up ‘soft’ and you didn’t change the Stick settings the MK would feel very twitchy. All these things are interrelated. Even the GPS parameters.
Setting the PID Parameters
I have continued working on the parameters. First I trimmed my MK so it would not drift one way or the other and I set Stick-D to 0. To set Gyro-I (like P) and Gyro-P (like D), I started with Gyro-P at zero and Gyro-I at 60 with both on Potis and then took off. (The Gyro spits out a voltage that is proportional to the rate of angular change. So Gyro-P (rate of angular change) is really D in a PD controller. If you take the integral of the rate of angular change you get the angle (approximately). This means that the Gyro-I is really P. You have PD control not PI) The MK will be sensitive to the controls and wobbly. I would give little taps to the sick and observe the behavior. In my case the MK would wobble once or twice and then be steady. I then cranked up Gyro-I until the MK almost continuously oscillated after the stick tap then moved Gyro-I down a notch. Don’t let the oscillations bother you, you can still control the MK (as long as you don’t get Gyro-I too big). I then started cranking up Gyro-P. This quickly started settling out the wobbles. I would increase Gyro-P and tap the stick to see how it would respond. If Gyro-P gets to big, you start to notice that the MK doesn’t really level itself out after the stick tap. If Gyro-P is too little it will wobble a little after the stick tap but it will level quickly. The goal is to not have any wobbles while still having the MK return quickly to level after the stick input. When I tap my stick (roll) I give it a good amount of input (especially once I start getting closer to what I think it should be see http://www.rcgroups.com/forums/showa...mentid=1845769). Just play with it,.the better it is set up the bigger the stick tap you can give and have the MK quickly level and start to slow back down. It will also start to feel solid, just don’t let it get to solid or it wont correct quickly enough. I ended up with Gyro_P=67 and Gyro-I=147. Hauptregler I-Anteil: is the ‘I’ for the PID of the Roll and Nick controller. I played with that as well (although not as much) and eventually landed on about 28. It will affect the other parameters so if you play with Hauptregler I-Anteil you will have to go back and re-adjust Gyro-P and Gyro-I. I only tried a couple setting here so no real feel here other that when I had it above 35 I didn’t like how the MK was flying. Acc/Gyro-Comp (or in the code is ‘GyroAccTrim’) controls how fast the difference between ACC and Gyro gets corrected. In the code it reads ‘CorrectionPitch = IntegralErrorPitch / ParamSet.GyroAccTrim’ where the IntegralErroPitch is the difference between the MeanIntegralPitch (gyro) and the InegralAccPitch, so it is the difference between the calculated angle (roughly) between the two. Big numbers in Acc/Gyro-Comp, it appears, diminishes the impact of the Acc on the correction. I played some (moved it around to some extremes) and ended up with Acc/Gyro-Comp=25 although I would say that this is closer for me but I think it needs more study. Once I got something I liked I transferred the values (using LCD Menu 9 to read off the Poti values) to the actual parameters and remapped the Poti to something else.
--------------------------------------------------------------------------------------------------------
GPS: (Note, this is for the killagreg older code using Conrad GPS. Although the parameters for NaviCtr for GPS-PID are similar, it would appear that most people are having great success using the std H&I GPS parameters while using the NaviCtr and MK-GPS. The MK must be very stable for the GPS to work well)
Explanation of GPS Parameters: (tranlation from killegreg)
The P-parameter defines the strength of the control for the position hold; therefore, our virtual GPS-helper-pilot steers more strongly towards the target when this factor increases. You can understand this by thinking of a pendulum. The further the pendulum is away from the center (the further the MK is away from the target), the stronger the force is to pull it back to the center. Increasing P would be like increasing gravity or the force to push it back to the center. It so happens that the pendulum accelerates in the direction toward the center. At the moment the center is reached, there is no applied force to move the pendulum in any direction. The pendulum though, would still have some velocity (momentum) at this point and the pendulum would then swing away from the center in the opposite direction (the MK would shoot past the target). Without any friction to dampen the swinging this little game would then continue for ever. The swinging could actually get worse. So, the higher the P-Parameter is the stronger the ‘push’ on the pendulum back towards the center.
This is why we have a D-parameter, it makes sure that it proportionally steers against the over ground speed. This is the ‘friction’ parameter in the control system. It works similarly to friction in a pendulum system. If the friction is too high, then a pendulum that was not at it center would very slowly move back and then just stop when it got close. If the friction is too light, then the pendulum would just swing back and forth for a while.
Now, there is just the right relationship from return-force (P) and friction (D) that would allow a pendulum to quickly swing back to the center and then just stay there. These are the settings that you are trying to find. This is impacted by the reaction of the MK to the virtual GPS-helper-pilot stick movements. This is not impacted by the P and D of the RC-Stick settings but from the Gyro Settings that defines the reaction/behavior of the MK.
On top of this is the fact that the GPS-Position and the over ground speed also changes even for a MK that is stationary. This is because of atmospheric disturbances and start point quality, etc. Putting this is terms of the pendulum example; it would be like the hanging point for the pendulum would also be moving. So for example, trying to hold a pendulum without swinging it at the end of an outreached arm would be very difficult. The pendulum would swing all over the place if the ‘friction’ (D) was not large enough.
Setting GPS Parameters
Set GPS-P (userparam5) to zero
Set GPS-D (userparam6) to a Poti and move the Poti to zero (as seen from the Display-Menu)
Manually hover in one spot
Gradually increase the Poti (GPS-D) until you see some light jittering/wobbling. Then move the Poti back a little
Read the Poti value in MK-Tools (from the Display-Menu) and set GPS-D (userparam6) to that value
Set GPS-P (userparam5) to a Poti and move the Poti to zero (as seen from the Display-Menu)
Again manually hover in one spot
Gradually increase the Poti (GPS-P) until a noticeable position correction is obtained but not too much that the MK strongly over steers.
Read the Poti value in MK-Tools (from the Display-Menu) and set GPS-P (userparam5) to that value
In general, the relationship between GPS D&P has to be correct. If P is too big and D too little the MK will start to swing. If D is too big then the MK will start to jitter/wobble. Finally, you have to be certain that the compass actually points to North (about 350° to 10°) when the front of the MK actually is exactly pointing to the North. If this is not correct, then the GPS control will cause the MK to circle around the set point or the MK will just fly away.
My GPS Settings
Again I set GPS-P and GPS-D on potis and both set to 0. This time I started with GPS-D (as outlined by kilaggreg) and adjusted GPS-D until I could see it moving the MK around and kind of holding but swinging. I then backed it down some and started to crank up GPS-P until I appeared to have a good hold. This was not easy since the GPS position is not stable as well it is hard to get a feel for what is really moving. If you get too much GPS-P you start to swing again, too much GPS-D and you swing… It is kind of a dance. Thinking of the P as the force to push it back and D as the friction, I kind of tweaked until I got something that appeared to hold (4 batteries it took me). I also notice that these setting are very sensitive so go slow and experiment. I finally ended up with GPS-P=26 and GPS-D=112. I now think I have GPS hold working (assuming I get a good GPS lock). It was some what windy and no circle just a good hold… I could walk up to it and push it out of the way and it would move back into position and stop. I could even drag it to a new location and let go and it would gracefully move back and stop. That’s not to say it was always in the same location, the GPS position would move a bit. (my need some shielding to improve my GPS receiver sensitivity) I don’t think my GPS parameters will work for anyone else because they are dependent on the other parameters. Just like I had to go back and tweak my Stick parameters, the GPS gets affected the same way.
I would definitely recommend going back and at least trying to set Gyro-I and Gyro-P correctly for your MK (even if you don’t change any of the others). The beginner settings with Gyro-P at 100 just makes my MK hold that orientation once the stick is released. I am now actually starting to be happy with how this thing is flying and it is also a lot easier to fly.
Richard |
|