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

  • Leonard, I have a bit of a unique situation...I have an AIOP V2 board...the latest stable port to that board from Arducopter is  3.0.1...it flies well and I am NOT using a GPS (an FPV miniquad for bashing!)....

    but...1) I wanted a true ACRO mode...so I ported the code at the beginning of this post into the MPng code...all that was involved was a few minor changes to Arducopter.pde, a new define, and replaced the Attitude.pde code with yours....although I have not extensively tested it...it seems to work great! thanks!..

    2) I love the auto-flip switch! but, I wanted a tumble switch also!!...so I cloned the flip code so it will work on ch7/8...

    and testing it today was a limited success...perhaps you can point in the right direction in the code to fix the anomalous behaviour...

    in STAB or ALTHOLD, the tumble completes but winds up facing 180deg opposite direction...the yaw appears so fast I cant really tell when it occurs...also in ACRO it flips back or forward inverted and hangs until it crashes...at least I wasnt quick enough to flip it back over before mother earth ate it...

    any suggestions....  3.1 is not stable on the AIOP and progress is occuring slowly

    PS I disable logging to avoid cpu cycles...dont know if this really helps or not since its not in the fast loops...

  • Thats excellent information :)

    exactly what I was after.

    Thanks Leonard

  • Developer

    Hi HAK,

    Yes you can change maximum angle with the ANGLE_MAX parameter. This affects the maximum angle in stabilize and sport mode.

    The difference between sports mode and acro mode can be best demonstrated using yaw and pitch as an example. When you have the nose of the copter down at 45 degrees (pitch angle = -45 degrees) and you apply a yaw command.

    In sport mode the nose will rotate around with the nose down at 45 degrees ie. the pitch angle won't change from -45 degrees. Stabilize does this too if you hold the pitch stick forward. So Sport mode is basicly a rate controlled stabilize mode.

    In ACRO mode when you apply a yaw command the pitch angle with initially be -45 degrees. After we have yawed by 90 degrees the pitch angle will be 0 degrees. After yawing by 180 degrees, the pitch angle becomes 45 degrees. After yawing by 270 degrees the pitch angle will be 0 degrees again. And finally after yawing 360 degrees the pitch angle will become -45 degrees again.

    Does that make it clear?

  • Leornard - just wanted to check if there is a way to change max angle. It was mentioned it might be implemented in sports mode?

    What is the real difference (flight characteristic) between sport and acro?

  • Developer

    Sorry 2 helps stop you from going inverted making it easier for a beginner to fly ACRO safely and still get used to rate only control.

  • Developer

    No problem Markus! This is noob code that is why I haven't put anything in the wiki yet.

    When ACRO_TRAINER = 0 it doesn't use ACRO_BAL_PITCH and ACRO_BAL_ROLL at all. The idea is CH7/8 to toggle between 2 (just starting), 1 (rolling and flipping but with some leveling) and 0 (no leveling of any type).

  • Thanks, Leonard! Sorry for adding another noob question: If you set ACRO_TRAINER to 0, does that mean that the values of ACRO_BAL_PITCH and ACRO_BAL_ROLL are irrelevant? Are they "overwritten" by the TRAINER setting? This would be great, so I could set both ACRO_BAL... to 1 and use CH7/8 to toggle between 1 (just starting) and 0 (experienced)...

  • Developer

    Markus:

    Yes we changed them to go from 0 to 3. Initially I had a bit of a brain fart and made it a percentage but all this really does is add a divide by 100 into the code.

    Christoffer:

    You will be able to do flips with ACRO_TRAINER = 0 or 1. When set to 0 it will be like having ACRO_BAL_PITCH and ACRO_BAL_ROLL set to 0.

    If you are an experienced ACRO pilot I would set everything to 0 because you probably don't want anything messing with your ACRO. If you are just starting out I would use settings like this (assuming you still want to do flips)
    ACRO_BAL_PITCH,1
    ACRO_BAL_ROLL,1
    ACRO_TRAINER,1

    You can set a three position switch using ch7 or ch8 to switch between the three trainer modes by setting ch7 or ch8 to 14. This changes the trainer from OFF to slow leveling to angle limiting.

    Just remember that you can always switch to STABILIZE and give it maximum throttle to save yourself.

    ACRO is a great way to crash your multi so make sure you have an escape plan!!

    Good luck and have fun :)

  • Another question: Does the range of ACRO_BAL_ROLL and ACRO_BAL_PITCH go from 0 to 200 (as it is mentioned here: http://copter.ardupilot.com/wiki/acro-mode/) or from 0 to 3 as it says this wiki page: http://copter.ardupilot.com/wiki/arducopter-parameters/#Acro_Balanc...?

  • Developer

    Yep, you should be able to make acro do flips without any problems. The only thing that will stop you if you have the three position switch activated and have set it to limited.

This reply was deleted.