Replies

    • Try getting Rate_D tuned first. I had some setups that needed 4x the default D to become tame enough for Rate_P adjustment.

      • Oh, so I start to increase it from default? By a factor of 2? Or 1.5? Will try tomorrow - honestly, I'm so desperate, that I'd try anything at this point :-).

        Thanks for the tip,

        Mihai

        • Developer

          Manual tune procedure is basically:

          Increase Rate D until you see some oscillation.

          Reduce Rate D untill you don't see oscillation then reduce it a bit further. (about 20%)

          Increase Rate P untill you see oscillation.

          Reduce Rate P untill you don't see oscillation and then reduce it a bit more. (about 20%)

          As I said before though, logs of autotune tell me a lot and I will be able to see why autotune is having trouble. It might be the same reason you are having trouble with manual tune.

          • So, when does the I term come into play? and how does one look for when adjusting that?

            • The I term eliminates steady state/long term error.  Lets say you command the copter to level out by releasing the stick (ie tell it to go to 0 degrees tilt).  It might get to 0.5 degrees which is very close but at that point the influence of the proportional term may be too small to actually do anything.  P gain times a small number equals a small number so the P controller can never close the gap.  The I term adds up this error over time and increases the control signal until the target is met.  This isn't 100% accurate to what the APM is doing but I think it is a decent explanation of the principle.

  • Why does auto tune use a target rate of 90 deg per sec? I'm curious how that value was selected.
    • Developer

      Hi bblatter and Josh,

      We have a couple of factors that come into play here. We want:

      - a large response so any noise or external forces are small in comparison,

      - to ensure that we don't saturate the throttle output, especially near the end of the movement,

      - a small change in attitude to minimise the brown trouser moments,

      - a quick test so we can do it multiple times,

      - to ensure it works on all frame sizes.

      - to approximate a reasonable error that a copter might experience to ensure the copter can recover from any normal flight condition.

      So for the best autotune measurement we want the largest response while not saturating the outputs or pushing them into significantly non-linear region. The maximum output of the roll and pitch loops approximately 4000 after all things are taken into account. So if we say we want to limit ourselves to half this to keep us away from the edges. So with a Rate P of 0.1 we would have a maximum rate request of 20000 centi degrees per second or 200 degrees per second. With a Rate P of 0.25, the maximum autotune allows, we get 8000 centi degrees per second or 80 degrees per second.

      The maximum Rate P was chosen based on what I have seen from helping people tune a range of frames and it has turned out to be a pretty good number. The only person I remember seeing reach it, had a pair of camera tubes and the camera out the front of the first props and batteries hanging out the back.

      So at the maximum allowed Rate P we get 80 degrees per second gives us exactly half throw on the esc outputs, if Rate D is zero. So 90 degrees per second looks like a nice number.

      Now Rate D will also pump the output up and may saturate the outputs at the very beginning. This isn't so bad as it only lasts a fraction of a second and had gone by the time we get to the slow down portion where the test really begins. However, a saturation at the beginning my mess with the results. Soooo...... The initial step input is multiplied by Alpha in the low pass filter before being multiplied by 100, 1/loop time, and then by Rate D. So for 90 degrees we get 9000 x 0.0123 x 100 x Rate_D is the additional output from the Rate_D. Now the maximum Rate D that autotune allows is 0.015. This results in an additional command output of 167. The maximum Rate D was also chosen based on experience and has worked out well so far.

      So with a 90 degree per second rate request we get a maximum command response of 9000 * 0.25 + 167 = 2417. This is ok as it only happens if we get to the absolute maximum tune.

      Ok what about Stab P. Now this will be able to saturate the outputs. So we chose the smallest angle that we thought was reasonable. The most common step input experienced by a copter is a 45 degree step as the pilot lets go of the sticks from full stick input. This is too much, as any overshoot will then result in the copter swinging past 45 degrees, and it is generally too scary. 20 degrees is what we settled on as a reasonable angel command but not so large as to scare the crap out of people. 

      So the initial motor output will look something like this. 2000*Stab_P*Rate_P + 2000*Stab_P*Alpha*100*0.01

      So with all the maximums we can get to 7870 and that will cause the motors to saturate at the beginning of the test. However, this is a very extreme case and will only happen on copters with large weights on long camera poles. Usual test maximums won't go over approximately 4500 (Rate_P = 0.15; Rate_D = 0.01; Stab_P = 14;). and normal flying pids would stay below 2600 on the same test.

      So the numbers are pretty reasonable. Having seen the numbers that Autotune generate I will probably drop the maximum Stab_P to 10 and slightly change the way it does those measurements.

      So we have covered the maths. The next question is the pilot response to the numbers that the maths suggest might be ok. Here I flew it (I probably did 50 autotunes) and I found it was ok. I could even do an autotune in my lounge room (it was raining outside). So I figured the average pilot would feel pretty comfortable outside in a park at 10 to 15 meters up.

      The final thing I should point out is that the autotuned values result in Rate_P values between 2/3 and 1/2 what we would get using manual tuning methods and Stab P values of approximately 2x the manual values. So the overall motor output is quiet similar to our manual tune numbers. However, the copter is MUCH more stable.

      So I hope that was a reasonable explanation. Let me know if you have any questions.

      • Wow, great explanation =)
      • I'm going to massage this into the AutoTune wiki under an "Additional Considerations" headline or something to that effect if you're ok with it..

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @chr1sa: Just a week to go before our next @DIYRobocars race at @circuitlaunch, complete with famous Brazilian BBQ. It's free, fun for k…
Saturday
DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training https://www.youtube.com/watch?v=J5-zHNeNebQ
Nov 28
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Nov 26
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Nov 25
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord: https://discord.gg/EPsZHkg9Nx) https://t.co/PNDewvJdrb
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar https://www.youtube.com/watch?v=9yy7ASttw04
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge https://t.co/nZQTff5…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
Oct 23
More…