ACRO for ArduPilot 3.1


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

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:

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


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

For my flight testing I have been using:

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


  • Developer

    Hi Juraj,

    I think the acro diagram on the post you point to is incorrectly labelled and should be Sport mode. This takes rate commands in the earth frame.

    Now that I look at it, the diagram above should be labelled 3.1 not 2.9 too, so I have been rather slack with my labels.

    The 3.1 acro uses an integrated rate in each body frame axis to keep track of the error in the body frame. For this reason it doesn't use the earth frame at all for basic stabilisation. The earth frame is only used for the slow levelling portion of the code. I am not sure if this answers your question. If it doesn't can you talk only about the diagram above as ACRO has evolved a great deal over the various releases you are talking about.

    It is worth noting that ACRO is different again in 3.2. ACRO is almost the most complicated flight mode in arducopter now.

  • Thank you again for response! 

    I am talking about first controller =  earth frame controller. On the left side of your PID diagram, this side is the same as by stabilize mode,except some constants according your post( , I know is version 2.9) .  

    So this earth frame P controller is feed by roll and pitch referenced in the body frame? Why is it than called earth frame in your diagram? I checked code, those errors are calculated with ahrs.roll_sensor,ahrs.pitch_sensor which as comment says is Euler angle. It goes directly from DCM matrix so I guess is in earth frame. Or?

    They are here calculated:

    values of pitch_sensor / roll_sensor are just conversation of those values(*rad_to_deg*100).

    So as you said, what i see in code is that Earth Frame controller is feed by Euler angles referenced to body frame. But when controlltheory says me and also the name of controller is that they should be roll/pitch/yaw angles referenced to earth frame. 

    I wold be really thankful for answer on this my confusion. Thank YOU!!!!

  • Developer

    Hi Juraj,

    The angle error and rates are different when referenced in the earth frame compared to the body frame. We initially calculate them in the earth frame then translate them to the body frame before feeding them into the controllers.

  • Thank you for response.  So what you say, is that there is no difference if this earth frame controller is compensating yaw, pitch, roll according to earth frame or body frame?

    When I think about it just like angles,just like numbers. The values are completely different when it is earth frame and when body frame. 

    When there is calculated roll, pitch and yaw from DCM matrix, they are represented as body or earth frame?

    How I understand is:

    The values calculated from DCM matrix, they are in earth frame so as in the animation from youtube, the values are Yaw/Pitch/Roll. From this angles there is calculated error*kP(P controller) and this error is than transformed to body frame. Is this correct?

    I am really thankful for you answer!!!!!!!!!!

  • Developer

    Hi Juraj,

    They can be a series of rotations around the changing body frame axis ordered Yaw, Pitch, Roll. Or a series of rotations around the fixed earth frame axis ordered Roll, Pitch, Yaw. The two result in the same thing.

  • Hi guys! I would love to understand the earth frame controller. There is still one thing which I can not understand properly. 

    I checked code and also all documentation which I could find. There is written  for earth frame controller that they use ROLL,PITCH,YAW, this three angles are extracted from DCM matrix on the line:

    the function name is  "_body_dcm_matrix.to_euler" what I am not sure is completely right. 

    Euler angles are rotations around already rotated axis it means: first rotate yaw around Z axis, than rotate pitch around NEW Y(rotated) axis and roll around NEW X(rotated) axis. 

    ROLL/PITCH/YAW are rotations around earth axis - axis are not changing. 

    Nice animation which shows it really good:

    I read also paper which is linked in code:

    but still I am not sure which interpretation is correct.

    I will summarize my question. The yaw pitch roll angles used for Earth frame controller are rotations around earth frame or around body frame?  (check video i posted here)

    Thank you for any kind of response!

  • Developer

    So what do you want to do or change? You should be able to get flying in stabilize on the defaults.

  • yup , i have connected the APM , and i have opened the flight modes , but i don't know what to do next ! , i am stuck ! , there are the a lot of modes , stabilize mode , Althld mode , etc .. i want to know how to work on the stabilize mode ?! , what does Angle_max means ?! , and how to deal with these parameters ?!

  • Developer

    what don't you get about the flight modes?

    Is your APM plugged in and have you connected to it?

  • i want to ask , i am using an APM and i can't get the flight modes , i don't understand the way to work it out , i have opened the mission planner , but i can't move from there .. any help ?!

This reply was deleted.