Developer

ACRO for ArduPilot 3.1

3689532793?profile=original

Hi all,

My motivation to get involved in the development team was to bring a good ACRO mode to ArduCopter. Three or four months ago Robert Lefebvre suggested that we could integrate the rate error and use it to correct the platform in the body frame. He went on to demonstrate this on Heli's. We have since learned that MultiWii use a similar approach and code was developed by Bob Dorion based on MultiWii and discussed here http://www.diydrones.com/forum/topics/flipping-arducopter.

I have taken Robert's approach and integrated it with the current ACRO trainer aids with the help of Robert and Bob. Here is the result:

ArduCopterACRO.zip

This code is based on ArduCopter 3.01rc1 so if you haven't got this flying yet, don't bother with this code.

Changes:

Replace Earth Frame ACRO with Body Frame ACRO

Reduce the dead band on the roll and pitch inputs

In the same way as you could before you can disable all trainer functions by setting
ACRO_BAL_PITCH,0
ACRO_BAL_ROLL,0
ACRO_TRAINER,0

For my flight testing I have been using:
ACRO_BAL_PITCH,50
ACRO_BAL_ROLL,50
ACRO_P,4.5
ACRO_TRAINER,0

Things to discuss are:

Is the performance acceptable?

What additional features are needed? (switched trainer functions, zero throttle doesn't stop motors)

Is there a better algorithm?

Do you see any problems with the code?

How does the performance and feel compare with other systems? (please only comment if you have flown those systems and this system on a well set up copter, anything less is a waist of every bodies time)

I have spent at least 20 minutes doing nothing but flips and rolls of various combinations and mixtures and a similar amount of time doing yank and bank maneuvers. I have not found a problem or any bad habits.

I look forward to your feedback and ideas.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • No problem, it was only what I observed on the bench. I'll be testing it today on a heli so I'll get back to you on that :)

  • Developer

    Hi Bob,

    Not a bad solution. I didn't quiet get what you meant by "An interesting side effect is that at stick = 45%, the rate is zero." though. I need to think about this a little more. I also haven't put your leaky I term in with a time constant of around 2 seconds so that it settles down when landing on an uneven surface. I am very hesitant to do this because it will also let the copter's angle drift and we already reset the error each time we move the throttle to zero. Is this really necessary do you think? (and why)

    Hi Joly,

    I don't think this does what you think it does. There is no recording of angle, just angle error. So the worst that can happen is that you are performing a very dynamic maneuver that has resulted in your angle error increasing to 10 degrees. If you change to stabilize at this time you could notice a twitch when you switch back to acro. I may have missed something though.

  • Hey leonard, nice work on the acro code, I'm loving it :) I've observed something while bench testing, not sure if this has been covered.

    When changing from Acro to Stab while flying at a given attitude, that angle is the target while changing back into acro again for the second time. That means if I was flying upside down, changed to stab, then went back into acro, the aircraft would invert.

    It should clear the target when changing into Acro, so it starts from level each time Acro in engaged.

  • Hey Leonard, I've got an idea to improve the acro flying when leveling is enabled. One thing that has been bugging me is that when I try and do a slower than full rate roll, the first half of the roll is fine, but then the rate jumps up when doing the inverted side of the roll.

    What's happening is that during the first half of the roll, the leveling holding back the acro rate but for the flipside it adds to it. For example, with StabKp=6.5 (292.5deg/s @ > 45 degrees from level), AcroKp = 8 (360deg/s at 100%), Balance at 100% and the stick at 50%, the first half rolls at (360-292.5)*0.5 = 33.75 deg/s and the inverted half increases to (360+292.5)*0.5 = 326.5 deg/s. 

    Here's a surface plot of that effect:

    horizontal is roll degrees (showing 2 complete revolutions), vertical is stick deflection, color is roll rate

    3692771680?profile=original

    What you see here is that the only place the rate stays constant throughout the loop is at stick = 100%.

    After much pondering, I decided to place a limit on the rate generated from adding acro and level together, so that when you pass the 180 degree mark, the rate doesn't increase. The formula is limit=abs(abs(acro)-maxlevel), where maxlevel = level rate assuming you are 45 degrees from level. 

    Here's a plot of what that looks like:

    3692771709?profile=originalSo at stick deflections > 50%, the rate is constant all the way through the loop. An interesting side effect is that at stick = 45%, the rate is zero.

    What do you think? I'm going out tonight to try this and I'll report back how it feels. 

  • I meant a bit jumpy. I asked my daughter to try and do some closeups but I was buzzing around pretty fast.

    Decided to build a small testing quad so this is a 330 size quad with 1040kv motors and 8 inch props.

    Its very nimble. Need to do some more PID tuning to see if I can get it more locked in.

    It seems to respond better to quick power out of the flips. If I bring the power up to slow it I find it washes out the flips but if I burst the power at the end it locks in - same for fast turns.

  • This is a big jumpy but you get the idea.

    http://youtu.be/QbC8EJPW_vY

  • Dummy I term? Did you find a way users do not need to adjust it any more?

    I tried with my MultiWii Quad yesterday (Alex Khoroshko says that PID Loops are pretty similar to ArduCopter now) and definitely reduced I term there a lot as well. But I could not go to abolute zero and higher values quickly caused distinct oszillations.

  • Developer

    That is what I wanted to hear! Thanks mate.

  • Changed my mind and tried different I term settings this afternoon. Modified in flight via Ch6 knob from zero to 0,2. Funny thing, there isn´t almost any difference at all! Even with zero fast forward flight is without the slightest tendency to pitch up, and with 0,2 I could not provoke any wobble even though I tried pretty hard!

  • Developer

    Ok Philipp, thanks for your feedback!

This reply was deleted.