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.



Views: 42944

Reply to This

Replies to This Discussion

That is the exact definition of "robustness"

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:

The RTL + AUTO LANDING is now working in HIL simulation on X-Plane with the ArduCopter v2.1.1r7b. I have done some importants fix about the auto landing feature. Here a video of the test of the firmware ArduCopter v2.1.1 R7b (JLN updated) about the RTL + AUTO Landing. The test has been done in HIL mode on X-Plane v9.70 through the Mission Planner v1.1.18 with a script.

You may download the firmware v2.1.1r7b with my fix tested in the video above HERE

Please, this an alpha version of the v2.1.1r7b and the RTL + Auto landing has been only tested in HIL mode, not yet in the real world...

@Jason: I sent you directly all the details about my RTL+Landing fix.

Regards, Jean-Louis


So I tried my first Mission, very simple:

  • Take OFF
  • 2 Way points to reach
  • RTL
  • Land

It went pretty well twice. The only things I noticed, but I probably need to dig a little bit in missions planning:

  • I must take off "manually", the copter do not take off automatically, the throttle does not go high enough
  • At first landing, the copter nounced once on the grass and the motor stopped
  • The second time the motors stopped when the copter was still 1m high (no damages)
Here are the mission and the google map:

Thanks JL, just what I was looking for.

FIY, I just come back from a quick test flight of the v2.1.1 r7b in the real world with the same PID than the r6...

The STABILIZE, ALT_HOLD and LOITER works very well as usual. Its still OK for me on my QRO quadcopter.

Need to be tested again in the real world with the v2.1.1r7, RTL, AUTO Landing, AUTO mode.

Regards, Jean-Louis

Hi Jean Louis,

i finish to port the ACopter32 to rev 2.1.1r7 now i check your patch ... i see the script ,too I would test also that feature it's very cool :)

This is my video tutorial , is in italian at the moment , but is simple to understand what i doing :)

So i try Aerosimrc and test all functionality .. only takeoff don't work as i expect

This is the video :

Another questions about acro mode .

I try it but my impression is that work as stabilize mode ... it's true ?



Hello Roberto,

Below the script that I have used for testing the RTL + AUTO land in HIL mode with Xplane v9.70, I think that it will work also with the AeroSim RC and with the v2.1.1 r7. You need only to copy and paste into the script windows of the Mission Planner...

---------------------- start -------------------------------------

print 'Start Script:Take-Off, far away + RTL and Land'  # JLN jan 7, 2011
Script.SendRC(1,1500,True)  # roll
Script.SendRC(2,1500,True)  # pitch
Script.SendRC(3,1000,True)  # throttle
Script.SendRC(4,1500,True)  # yaw
Script.SendRC(5,1933,True)  # mode Stabilize - Mode 6


while == 0:
  print 'Waiting for GPS'
print 'Got GPS'


Script.SendRC(4,2000,True) # yaw right to arm the motors
Script.WaitFor('ARMING MOTORS',30000)
print 'Motors Armed!'


print 'Takeoff'
Script.SendRC(3,1700,True) # throttle up

while cs.alt < 8:

print 'pitch forward'

Script.SendRC(2,1200,True) # pitch forward

print 'pitch 0'
Script.SendRC(2,1500,True) # pitch 0
Script.SendRC(3,1500,True) # throttle up

print 'set mode to RTL'
Script.SendRC(5,1515,True) # set mode to RTL - Mode 3

--------------- end -------------------------------

Happy Simulation,

Regards, Jean-Louis

Not sure if anyone can or tried to reproduce this, but it seems to me like it could be very dangerous. Jean-Louis' corrections seem to improve RTL-autoland while in flight, but not from a 0 throttle ground position.

I've flagged it as issue #477

I have strange error when copy :

error runninf script unindent does don't match any outer identation level.

How i can solve it ?



make sure the first line in the script isn't blank.

My gosh!  I'm getting so frustrated with this system!  The heli is ready to go, batteries charged, code loaded and working, now the damn Xbee won't connect!!!  Just one thing after another!

Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service