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

  • whoops sorry - disregard that last comment. I see what you are doing now. 

  • Regarding stabilize at min throttle, wouldn't it be better to have a standardized acro mode as default, then have optional extras that the user can select? Otherwise it will be impossible to satisfy everybody. Multiwii has a matrix-style of mode selection that might be useful to emulate in this case

  • One other thing, shouldn't there be a time factor applied here:

    }else if( rate_targets_frame == BODY_EARTH_FRAME ) {
      // add converted earth frame rates to body frame rates
      roll_axis = roll_rate_target_ef - sin_pitch * yaw_rate_target_ef;
      pitch_axis = cos_roll_x * pitch_rate_target_ef + sin_roll * cos_pitch_x * yaw_rate_target_ef;
      nav_yaw = cos_pitch_x * cos_roll_x * yaw_rate_target_ef - sin_roll * pitch_rate_target_ef;
    }

    Those are angle integrators correct? don't you want to add (rate * dt)?

  • Hey Leonard, couple comments:

    I don't think you want to use G_Dt when integrating the omega vector to calculate the angle error. If you dig around a bit, you'll find the DCM matrix is updated using "omega * ins->get_delta_time()", which may not match the G_Dt variable which is calculated from the fastloop timer for the PIDs. (unless I'm missing something....)

    I also put a slow bleed on the angle error to allow it to 'forget' any angle displacement if I touched down. This one may not strictly be necessary as it can be a source of very slow drift in the air, but it is nice to have the motors stabilize after some number of seconds on touchdown. 

    Overall, I like this implementation better my stolen multiwii idea hack. I have two outer loops creating competing rates that get mixed - breaking both outer loops in a sense. You create a single outer error signal to target so it should perform better. Your pitch leveling using yaw and pitch movements is also the right way to go. 

  • Please understand my being a simple minded pilot, but would somebody be so kind please to post a short how to on installing the ACRO upgrade? Mission Planner does not work I suppose, does it?

    Replacing "libraries" in Arduino directory then starting which file in "ArduCopter" from which version of Arduino (1.0.4 ok?) then uploading?

    Any changes in "config.h" (or anywhere else) required?

    Where is the "nav_yaw = ..." that has to be changed?

    Which settings are required to get the unlimited flip and loop ability, all acro trainer function and other limitations deactivated, just flying with 3 axis heading lock gyros?

  • Developer

    @Dimitri,

         Yes, AC3.0 and onwards works on the PX4.  You can't compile for px4 with arduino though so you should follow the instructions for building with make for px4 here.

  • Developer

    Dimitri: I assume that it will compile for PX4 but I haven't tried to do that myself.

    Martin: That is a good idea to get around the throttle problem!

  • Developer

    My quick test this arvo.

  • Hi Leonard,on my radio a JR XG8 i have it set in accro mode but can have 3 flight position's,so i have my accro mode set to 100 rate 20% expo and the most important the throttle low end at 20% this helps a lot,Marty.

  • Excellent! Unfortunately I don't want to risk my APM quad in acro just yet, but this should compile for PX4 too, correct ?

This reply was deleted.