Arducopter 2.1.1 alpha

This is a work in progress. I've tried to address some fine tuning and performance issues.

Denny R. had made a comment about the inertia of bigger props causing issues. I've added a low pass filter to smooth the positive acceleration of the props to see if we can get at this issue. It may require tuning up Rate_P for a few folks, but I saw little issue in multiple flights.

Crosstrack had a small math error that decreased the resolution of it. I've fixed that and upped the default gains to get better tracking. 

Made WP hit radius 1 by default. even 3m is too much for quads. (If you pass a WP you will move on to the next)

The Loiter method is tuned a little better by default, and now uses GPS offsets when flying less than 1.5m/s. Code experimentation will continue on this front. Thanks to Emile and afernan for their help!

A fix in the Z Accel startup was added to get an averaged result.

Added the ability to enter Loiter with Optflow enabled. - still a work in progress, not for everyday use just yet.

This alpha is on GIT now and is for user's who want to test code. As always, you need to use the "relaxpatch" version of Arduino you can find in the downloads section

Update: We've found and patched some small type bugs in the latest and updated some GPS drivers in the Library. Be sure to pull the latest code and check for the status of each build run against the SIL sim server.

Update r3:

I pushed a version on to GIT that addresses a number of issues.

- the low speed GPS XY calculations were incorrect and have been fixed

- Nav_Rate I term has been removed in loiter control - it's too easy to get two iterms working out of phase

- A second derivative has been added to Roll and Pitch. I found it removed wobbles nicely - Can be adjusted in the planner as STAB_D with a default of .25 (just enough)

- Smoothing has been applied to the motor commands in a way that really quiets down the alt hold pulsing without much effect on latency

- Yaw now has a dynamic constraint and I've upped the yaw gain.

- The motors output now have an LP filter on them so that the accelerate just a tad slower than the deceleration. This is a test to see if it helps big Octo's and Hexa's

- The Rate_I term is now zero'd for first five seconds after takeoff to keep balance.

- Loiter gains are lightened up a bit

- Nav_Rate_P is lower to remove back and forth sped related hunting in loiter

- Compass is enabled by default

- New I2C Library now included which should solve I2C related lockouts

- optflow is still a work in progress.

Update R4:

This update is based on flights today in a very windy environment.

It occurred to me that we're handling the WP nav I terms incorrectly and I reworked the WP navigation to share the same I terms from the Loiter. Even though they use different error input, etc, they turn out to both deal with wind in the same way. I have not Flown WPs with this new code, but heavily tested it in the sim and It's really rocking in hard wind. Transitions from Loiter flight and Nav flight are very smooth. Please let me know if you have luck.

Update R5:

This is a quick patch based on a bad crash Marco had. My theory was an I term that built up during wind that needed to be reset, but wasn't. It's a corner case but It bit Marco pretty bad. Please re-pull if you have R4 running to go to R5. And please, please be careful. This is alpha code not for general testing, but for development. Don't fly it on anything you would feel bad about crashing. 


Update R6:

Includes fix for Acro mode reset bug.
I went through all of the global variables and gave them lengthy descriptions. It's worth a read if you want to learn more how the internals work. I'll be doing some more organization like this as we move forward with an architectural redesign for 3.0 \
This version is mostly clean-up, but does include 1 interesting performance enhancement. It's disabled by default because It's fairly untested. The idea is that the wind compensation created by the Iterms for lat and lon in Loiter and Navigation are carried over into Stabilize. This unifies all of the modes so that when you switch modes, you don't get a small, but fast change in pitch or roll. This is only noticeable in high wind environment. 
To get this to work, I look for near zero velocity and start moving the pitch and roll into the wind control items. This takes a  transformation from copter frame to world frame, but the result is the copter will hold the position against the wind with the sticks in the center of the controller. If you fly around the wind compensation will bleed off slowly - about 30 seconds.
Again, this is off by default and needs significant testing, preferably in the HIL sim first.JNL has already started and flown this version for real.
The feature may be off by default for another version or two, but just letting you know it's there.
I think it will go a long way to making the mode changes feel seamless.

Update R7:

Added an auto-land timer for RTL. If you don't change modes for 20s after the copter arrives at home, it will begin to auto-land. If you have failsafe and no GPS, you will immediately begin auto-landing.
Failsafe RTL now goes 10M up as it RTLs to avoid obstructions.
Added SIL test for failsafe. 

Update R8:

Minor tweaks and cleanup

Update R9:

Made climb rate controller for landing universal for all altitude changes

Update R10:

Updated Loiter controller - Works great in the sim, thanks Afernan.



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

Join diydrones

Email me when people reply –


  • Today I did 2 flight with 3S battery and 4S battery, butthe same PID tunning for every thing. I am using the r6 firmware. There was some really thin wind < 5km/h and 1°C

    The distance in GoogleEarth look bigger than I expected, I would says the copter staied in a 4m or 5 square, not the 11m given by google stuff. Anyway  Loiter seems to work pretty weel for both Battery type. 

    3S flight:


    4S Flight:


    Keeping altitude (Sonar) worked also very well once it stabilize. I think there is still someting to do when halthold is triggered from a not so much stable situation. I guess that is because the throttle-cruise takes time to reach a correct value: See following curves:


  • Curious... in a bad way.

    I was shutting down the sim and such, and broke the first rule of RC... turning my Tx off before anything else.

    Running 2.1.1 r7 HIL on Xplane, the copter was on the ground, throttle down, motors armed. Turning the Tx off triggered Auto mode, and the copter took off and hovered at my takeoff altitude from the mission I had loaded. It didn't go anywhere, didn't move to WP2, just seemingly loitered at the takeoff altitude. I confirmed by changing the takeoff altitude, and sure enough, turning the Tx off sends it straight up to whatever alt is in the 1st takeoff command. I let it sit for almost 2 full minutes to see if the auto-land from RTL would kick in, but it just hovered nicely in place.

    It seems like if a failsafe is triggered on the ground, the copter will take off.

  • On my test hexa that I have been using for a while, YAW is suddenly not working with the new build or any past builds. Roll and pitch work fine, testing the IMU itself outputs the correct values and the compass is working fine aswell. All the motors are directly soldered to the board (signal wires). All the props and motor rotations are correct. Any ideas guys?

  • I decided to do some test flying today with r6.

    Here is the video.

    Attached is a zip of the log files done with it.

    This is a custom frame that needed stab gains lowered.

    Attached is a snapshot of the MP configuration.

    In loiter it dropped altitude but recovered well.

    There are subtle wiggles at times.

    Lifting and downward recovery is great.

    I first thought it was due to vibration.

    However in the past vibration to the IMU threw off the copter so much a full x or y on the stick had no control over time.




  • Developer

    About R7 and HIL with AeroSim RC: the autoland it doesn't work here, but dunno if it's only my problem... I've got a 2560 APM1 V1.4 at very low price from a local store, to do the tests with the sim ... :-)
    When the quad is about to hit the ground however remain in hovering at 10/20 cm and does not switch off the engine, don't touch the ground and starts instead to translate laterally towards an unknown destination ... :-)
    For this reason I believe that if the autoland function is active and  the quad move too far from the home point because the autolanding fail should to something else like go back to loiter at a height of more security on the home and maybe retry the landing or other, but not drift out from the radius of the home position, although in that case ath the airfield it would be nice to play to "jump the quad". :P
    For the planner: when the autolanding is engaded you can see in the planner "Unknow" because is not upgraded with this fly mode (LAND).

    EDIT: the "TAKEOFF" in the "Mission Planner" on my system is stranger,  when the Quad takeoff continues to rise indefinitely and never goes to the next waypoint (WP1)... it also happens to others?
    I have not tried with X-Plane for now.

  • Jason, how exactly is Failsafe RTL engaged?  My reciever has failsafe built in, if it loses the radio signal, it will output center sticks and RTL.

  • Developer

    Hello to All,

    I have build a short tutorial for testing yourself the ArduCopter firmware in HIL mode with the X-Plane v9.70. It is now possible to use a script with the APM planner to launch a flight plan without the need of a transmitter/receiver connected to the APM board... This is a really cheap setup...

    You will find the TUTORIAL for the HIL mode testing with X-Plane below:

    Lets me know if all is ok, and if you find some bugs in my tuto...



  • What is the status of the code in r6 currently?  Is it flyable?  I hope I can finally fly tomorrow.  My copter is finally rebuilt, and the weather looks good. But I don't know the status of r6, if it's in the middle of having some changes put in before it's called r7 or something?  I'd like to rewind to the last known good code, that people have flown on.  Maybe even r5 but not use Acro?  I think I have the r5 code that Marco used before the crash.  But I'd rather use r6 if it's... "stable"... which I know isn't a good term to use for anything coming from GIT, but I think you know what I mean.

  • Real flight test on 2.1.1. r6

    I´ve long tested in my two copters (small and medium size). No wind. Started with defaults.

    I´ve concentrated in LOITER, since the rest of modes works pretty well.

    I can summarize the following.

    - There is always a "swing" or "bounce" around LOITER point that I can´t eliminate. It remains between 3-6 m . Sometimes gets smaller, but again start the movement.
    - Increasing the LOITER_P, increase the size and speed of the swing. Default value is the best.
    - LOITER_I increase the size of the  movement but become slower. It must be kept low (<0.1 - 0.05)
    - STAB_B increase doesn´t show a clear improvement (up to 0.4). Back again to deffault (0.2)
    - Reducing LOITER _P = 0.15 and LOITER_I=0.2 eliminate the swing, but LOITER point is not precise (moves in an area of 10m)3692329946?profile=original

    In summary, I miss an effitient damper control component, that let us increase P and I without diverge.

    Comparison with HIL behaviour.
    HIL is almost perfect, but real flighht not. What can we deduce?

    HIL copter and GPS signal are "perfect" versus real hardware.

    We can say that (IMHO):
    1.- the code is correct
    2.- The code is not robust enough under imperfections of the hardware (yet).

    ...see next chapter


  • So I know the feature is brand brand new, as is HIL with x-plane, but I've been running 2.1.1 r6 on there. The disarming of the motors on land is a nice feature, but I think I've missed something. The motors are disarming at about 2-3 meters in the air. Does this somehow look for 0 movement in X, Y and Z axis for a specific length of time before shutting down the motors gradually, or does it just kill them as soon as the land command is assumed to be executed?

    My pre-land waypoint is at 3m, with a 5 second delay to allow any movement to be dampened. Land is at 0 altitude.

This reply was deleted.


DIY Robocars via Twitter
RT @a1k0n: @DanielChiaJH @diyrobocars @circuitlaunch Here's my car's view of that race. About 8.4 second lap times for laps 2 and 3... both…
3 hours ago
DIY Robocars via Twitter
RT @DanielChiaJH: Great racing against @a1k0n today at @diyrobocars! Pretty cool to both break sun-9s at the track today I think I got very…
DIY Robocars via Twitter
Broadcasting the @circuitlaunch race live now at Races begin around 2:00pm PT
DIY Robocars via Twitter
RT @a1k0n: ran a huge number of hyperparameter tuning experiments yesterday; now I can train a new policy, far with better quality, in 15 m…
DIY Robocars via Twitter
RT @a1k0n: Did I get rid of hand-tuned parameters? Yes. Am I still hand-tuning more parameters? Also yes. I have a few knobs to address the…
Sep 26
DIY Robocars via Twitter
RT @a1k0n: I'm not going to spoil it, but (after charging the battery) this works way better than it has any right to. The car is now faste…
Sep 26
DIY Robocars via Twitter
RT @a1k0n: Decided to just see what happens if I run the sim-trained neural net on the car, with some safety rails around max throttle slew…
Sep 26
DIY Robocars via Twitter
Sep 24
DIY Robocars via Twitter
RT @SmallpixelCar: @a1k0n @diyrobocars I learned from this. This is my speed profile. Looks like I am too conservative on the right side of…
Sep 24
DIY Robocars via Twitter
RT @a1k0n: @SmallpixelCar @diyrobocars Dot color is speed; brighter is faster. Yeah, it has less room to explore in the tighter part, and t…
Sep 24
DIY Robocars via Twitter
RT @a1k0n: I'm gonna try to do proper offline reinforcement learning for @diyrobocars and throw away all my manual parameter tuning for the…
Sep 23
DIY Robocars via Twitter
RT @circuitlaunch: DIY Robocars & Brazilian BBQ - Sat 10/1. Our track combines hairpin curves with an intersection for max danger. Take tha…
Sep 22
DIY Robocars via Twitter
RT @SmallpixelCar: Had an great test today on @RAMS_RC_Club track. However the car starts to drift at 40mph. Some experts recommended to ch…
Sep 11
DIY Robocars via Twitter
RT @gclue_akira: 世界最速 チームtamiyaのaiカー
Sep 10
DIY Robocars via Twitter
RT @DanielChiaJH: Always a good time working on my @diyrobocars car at @circuitlaunch. Still got some work to do if I’m to beat @a1k0n howe…
Sep 10
DIY Robocars via Twitter
RT @SmallpixelCar: My new speed profile for @RAMS_RC_Club track
Sep 10