|Oct 13, 2011, 09:31 AM|
Netherlands, ZH, Zoetermeer
Joined Mar 2011
MegaPirate PId tuning
In this mini 'how to' I try to show how to tune the behavior of a MegaPirate multicopter. This 'how to' is based on the excellent OpenPilot instructions.
Because the MegaPirate is suitable for a wide selection of frames, controllers and multi sensor the defaults in the code needs to be tuned for your specific platform.
Most MegaPirate users, or (it's parent code) the ArduCopter users concentrate on the stable mode only. I tend to take another approach because of the nature of the PId loop.
First the inner loop or rate is used and when in stable the outer loop will kick in. In this picture you can see the structure.
Because of that, I like to tune the rate (acro mode) and make it as flyable and stable as possible. It will however not level, thats the stable mode.
Rate (acro) mode tuning
Rate will only use the gyro.
In the first step, concentrate solely on the rate 'P', 'P' is the rotation value to counter external rotation effects caused by influences like wind for example. The gyro will detect such rotations and feed the control loop.
High frequency oscillations will occur when 'P' is to high, if is feels to sluggish or it is not flyable at all (see vid) it is to low.
The rate 'I' value is normally not used, but as I explained, I like to tune the rate as good as possible so the next step is tuning the rate 'I'
The 'I' in rate is used for angle hold, if it is 0 or close to 0 the copter will never hold an angle and swing around it's axis. Increase the 'I' to a level that you feel comfortable with and the copter holds its angle.
Ok, an instruct able video; (open in hd full screen)
Now that rate (acro mode) is actually flyable it will influence the stable mode PId as well. In general you can lower the 'P' because the Rate 'P' is now more prominent.
Stable mode tuning
Stable mode uses the Gyro and accelerometers. Accelerometers will detect the direction of the acceleration. With some coding the accelerometers can measure the angle and use it to level the copter.
In the stable mode again first concentrate on the 'P' value. 'P' is the power for the motor to achieve the angle. A to high 'P' will also introduce oscillations but in a different frequency than the rate 'P'.
A to low 'P' will not hold level.
I is the time needed to reach the maximum 'P'.
And ... if 'I' feels good, try to decent rapidly.
If it wobbles :
Further increasing 'I' will try to eliminate the vortex effect (strong wobble) when descending rapidly with quads.
(open in hd full screen)
Be careful with tuning, keep it safe and keep lots of usable area round your multicopter.
If nothing helps getting the platform stable:
- Is the IMU (sensors) located in the center of gravity?
- Mounted on anti vibration isolation (gyro foam, rubber / silicone mounts)
- Experiment with different props, maybe a smaller prop diameter.
- Larger props = lower P, Smaller props = higher P.
- Vibrations: remove the props, speed up the motors and feel if any vibrations originate from the motors.
- Balance the props, motor bells and prop adapters.
|Oct 14, 2011, 04:35 PM|
Joined Aug 2011
Fantastic!! Exactly what I was looking for to get me started on PID tuning including vids to actually show the behaviors and how they change - previously I was just changing them and not really knowing what the effect would be!
You sir deserve a pint of fine ale!
|Oct 18, 2011, 08:07 PM|
Canada, ON, Toronto
Joined Jan 2008
Here here, I raise a pint and challenge others who agee to raise a pint as well,
Cheers and thank you from myself and Many others.
Paul and friends
|Nov 30, 2011, 04:28 PM|
Deutschland, HE, Kassel
Joined Sep 2005
@joebarteam - many thx for your post - that was I was looking for - hopefully I get more understanding after studying this
|Dec 10, 2011, 12:26 AM|
United States, KS, Pratt
Joined Jan 2009
I now feel confident that I have my PID settings correct.
The video's are great!!
Many bottles of ale to you,
|Dec 14, 2011, 02:02 PM|
Thanks joebarteam, this is also the information I was looking for. I have my custom frame all built and my Wii motion plus, arduino pro mini, and NK already to go, just waiting on motors and esc's. Great job!!
|Dec 21, 2011, 03:03 PM|
Canada, ON, Toronto
Joined Jan 2008
one of the banners that popped up on the site was
an idiots guide to PID tuning. ( not that we are idiots but )
Though it may also be useful forr a lot of us here
Hope it helps someone
|Mar 14, 2012, 01:31 AM|
Joined Aug 2010
I hope you can help me. I installed on Black Vortex board the mega version 2.049. My quad not fly stable.
Did the P value of 0.3 and it's a bit better. I value and IMAX values are still default.
I've replaced landing gear. Engines and propellers are balanced. The gas paths from the controllers are not programmed. Is this the problem?
Sorry for my English.
Hope you can help me.
|Thread||Thread Starter||Forum||Replies||Last Post|
|Discussion First Quad build and maiden complete. PID tuning help needed||ScooterInVegas||Multirotor Talk||8||Oct 09, 2011 10:16 PM|
|Discussion automatic PID loop tuning...?||davidbuzz||Multirotor Talk||19||Jan 25, 2011 06:14 AM|
|Question PID tuning question||OBH||Multirotor Talk||1||Apr 07, 2010 02:48 PM|