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

  • Yes - poking at this some more, it seems under load the voltage drop due to current can take the curve out of the thrust profile. Instead of looking quadratic, it's more cubic with a mostly linear region through the middle. I guess I'll look into what Randy did for the throttle curve and adjust my min/max values to see if that helps with my low throttle wobbles. 

  • Developer

    Nice pickup Bob,

    This has already been handled though. The way we do it is we scale each motor output to make them more approximately linear. (this was a feature added by Randy) 

    The response isn't perfectly quadratic because of the way the ESC and motors interact. Randy tested a bunch of ESC's/Motor/Prop combinations and came up with a curve that was a good compromise.

    I have kept this in mind with my tuning and always compare the stability of my tune at low throttle and near maximum throttle. Randy's throttle curve seems to keep everything pretty well right as I don't see any change in stability.

  • Hey Leonard, 

    Have you or Randy ever experimented with dynamic rate controller scaling based on throttle position?

    Here's what I'm thinking:

      - Thrust vs Throttle (PWM) is quadratic in nature and we generally tune our rate controllers to behave properly at hover throttle.

      -  When the throttle moves away from hover, the slope (dThrust/dThrottle) changes, effectively changing the gain of the rate controllers. So at 20% throttle, we have detuned the rate controller by about 2.5x assuming a perfect quadratic thrust curve and a hover point at 50%. 

     So what I'm thinking is taking the output of the rate controller and multiplying it by a factor like (THR_MID/throttle)  to compensate for the non-linear thrust curve. To avoid the singularity at zero and to make it variable I was considering the form::

    Gcomp = ((1-CompF) + ((THR_MID/ThComp)*CompF))

    Where ThComp is some limited range version of the current throttle: e.g.  max(min(throttle, 80%), 20%),

    CompF is a tuning factor to go from no compensation (0.0) to full compensation (1.0)

    and Gcomp is then used to boost/cut the rate controller outputs (Pitch/Roll only?)

    I'm hoping this would reduce the vertical descent wobbles by giving the controllers more authority at low throttle and also carry over into acro maneuvers where the throttle is reduced during flips and rolls.

    Any thoughts?

  • Developer

    Nice. I think like you that Sport mode would be useful for filming. The most important for filming is not accurate positioning and banking angles, but smooth stabilization without wobble even in gusty wind situations. It is important to have angle limits because obviously we don't want to flip with a multi k$ camera under the frame...

  • Developer

    I talked to Randy about this today and our plan is to have two modes ACRO and SPORT. ACRO will make use of the three position switch to change between no levelling, levelling, and levelling + angle limit.

    SPORT mode will be also be able to use SIMPLE but I don't know if it will have any other options. I was thinking that SPORT mode won't be capable of rolls or flips but we may be able to set the maximum angle. I see SPORT mode being great for fpv, filming, and racing.

    It would be great to get feedback and ideas on this.

  • Developer

    Leonard, we have now 3 positions switches support for CH7 and CH8. Could be enough to select between 3 differents acro modes ?

    I think that if we propose two or three sets of 3 modes, available on CH7 or Ch8 the users would be happy.

    And add a parameter for mode selection so that we can choose the right mode if CH7 or CH8 are not used.

    Another possibility would be to add a five positions detector for CH7 / CH8 but this seems overkill to me.

    Olivier.

  • Developer

    Yeh sorry, I forgot to change the label.

  • Developer

    Hi all,

    I have got the next version of the ACRO code ready to test:

    https://github.com/lthall/ardupilot_ACRO/tree/ACRO2

    This hasn't got any fancy mode setting in it yet. Randy will sort that out before the release but what I am thinking is:

    1. Stabilised ACRO, no leveling

    2. Stabilised ACRO, leveling

    3. Stabilised ACRO, leveling and angle limited

    4. Sport Mode (earth frame acro)

    5. Sport Mode with simple.

    The problem is how to set this up with the mode switch and ch7 and ch8 switches. I am thinking we have two modes, ACRO and Sport. Then we use ch7 and ch8 to switch in leveling and angle limiting in ACRO. Sport will have simple mode but ACRO won't.

    Well, I think we are getting there!

    Thanks Bob for the limiting suggestion. I did something similar to this but not quiet the same. I also scaled the leveling based on all three inputs.

  • Leonard - let me know when you have the new code ready and I will give another test.

    Thanks :)

  • Developer

    Hey Bob, I get what you did with the limit. Very good, I will put it in!!!!!!

This reply was deleted.