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 http://apm.tridgell.net/ for the status of each build run against the SIL sim server.
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.
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.
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 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.
Minor tweaks and cleanup
Made climb rate controller for landing universal for all altitude changes
Updated Loiter controller - Works great in the sim, thanks Afernan.
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.
You know I flew all version, and as long as you are focus on the command and your copter is not out of sight, you can recover from bad situations most of the time.
My strategy when I thinck some regulation is going bad, I switch to ACRO (only 1 regulation) to land safely.
but once again, copter must be in sight.
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...
I´ve been using this same hardware (2 quads and 1 Hexa) since many months ago without a single crash (afortunally, LOL) and tested most of fw versions till then.
I know that it works very well in loiter for other fw´s (I can name you some examples like the 2.0.49, my mod 2.1.0 AF#2 and even ardupirates).
So, I´m trying been as honest as possible while reporting my tests, changing one thing at a time, in this case only the fw. I´d like that this code gets fully perfect.
So, yes: IMHO, I´m pretty sure my hardware is good enough to flight test and give reliable conclussions.
The r6 code is safe enough to be tested by someone with a minimum of experience, in my opinion.
Today, I have done some REAL tests flights of the ArduCopter v2.1.1 R6 in hard wind conditions (very gusty) with my quadcopter and I can say that its OK for me. The stabilization and the Loiter performances are really improved Vs the previous versions.
Unfortunately Acro is not usable for tradhelis. My bailout is Stabilize. So that has to work.
Angel, I'm just trying to figure out how come some people (like Jean-Louis) have good luck with some, but not others.
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.
Yes Robert, you have set the tx/rx built-in failsafe like me, but if your receiver fail (power off) all the output channel go to zero, and in this condition APM engage the internal failsafe.
You can found info about this inside the documentation of ArduPPM.
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.
I followed your tut step by step. The problem is that the quad keeps sticking to the ground and flipping in the x plane sim. The few time it lifts a bit, only roll and pitch seem to work. Throttle doesn't react. In the MP I can see all the sticks move.
What missing is the D (PID) which is the dumper we all miss.
This is exactly my problem as well.
As i write before the hardware can do it!! i did it with the ardupirate (PID controlller) with the same APM. so its possible and its defiantly software problem.