Sandro Tognana and myself are pleased to present you this new flight mode.
Currently called Hybrid (unprecise name for some), this mode is between Alt_Hold and Loiter.
Our aim was to create something that looks like the easy-to-fly "DJI-GPS" flight mode for our favorite Arducopter project.
During 3 months, we've made a lot of tests and tryed different models before getting something we liked. Now, our last code is stable and ready to be tested/analysed by the dev team.
Thanks to Marco Robustini who had the feeling and noticed several times Arducopter needed such flight mode. Thanks again to Leonard Hall for the live support he's provided us when needed.
Marco has done a great presentation video that I suggest you to watch before reading more :
http://www.diydrones.com/profiles/blogs/hybrid-flight-mode-what-was-missing-in-apm-copter-now-is-realityWell, now let's see the details:
How is it working?
Actualy, this hybrid mode is mainly a special roll/pitch mode. Throttle is Throttle_hold and yaw is yaw_hold.
There are 3 submodes :
-
When you move roll or pitch stick, it's like Alt_hold. So, contrarly to loiter, we've direct commands on stick input.
- When your release pitch or roll to neutral position, a braking phasis will smoothly lower the copter's velocity of this roll/pitch axis.
-
Once global velocity is near 0 (vel_total<10 cm/s), we switch
from brake to loiter and the copter now maintains its position (std
loiter mode). => Hybrid requires GPS FIX.
Finally, there's an indirect and special yaw behaviour that looks like the drift one. I.e.: you can drive using only pitch
and turn with yaw like a car, I love that :) But it's also possible to keep the standard alt_hold behaviour by keeping a very little roll command (roll > deadband that is arround 1°).
So, this mode is not a controller-based mode like loiter
(that is delayed, slow and too rigid imo). It's a manual-like commands
(for manual and braking) and we've worked to get smooth manual-to-brake and
brake-to-loiter transitions... this way, the flight seems natural, just like a smooth manual stop.
But, it's important to recall we're using the current loiter code on the position hold phasis and I want to congratulate developpers who made this code because it's giving great results on position hold, sometimes better than the DJI GPS in windy and gusty conditions.
To smooth hard stick release, we've implemented a stick
filter that is working almost like an exponential command but only for (hard) commands and only at stick release. Whatever your radio configuration (linear, exp), there
will be no difference. Only if you release stick too sharply, the
stick_filter will try to limit the copter's overshoot.
e.g : instead of changing roll command from 4000 to 0, it will set 4000 then 2000, then 1000, 500... but if you change roll from 4500 to -1000, it will be direct!
We've also implemented a wind_compensation that is basically a sliding average of loiter commands when we are in loiter (position_hold) state. On stick input, we exit this state and compute a wind_offset we add to manual/brake
commands in order to get angle continuity with loiter and help the brake
to compensate the wind (as it is a manual-like command and not a
controller command).
So, the best way for getting a good wind_comp is to
start the copter, take off, climb at decent altitude (> 2m) and let
the copter loiter some seconds (e.g: 5) before flying. BTW, this
wind_offset will be updated each time the copter loiters more than
3s.
Tests were done with no wind, slow wind and extreme wind and have always given great results while we've let the copter loiter and learn during these few seconds.
We could lower some timer to make this learn shorter but if we lower for example the 3s, the copter may be in an unstable position that corrupts the offset average.
At hybrid starting, we are in loiter state, so you can arm and push throttle up just like a std loiter.
Well, enough read, now it's time to fly!
We wait for your feedback to make eventual changes in the code if you notice weird behaviours (hope not) or things to change.
You can get the code here, we've cleaned it up, just compile and transfert it to your APM.
https://github.com/Ju1ien/ArdupilotST-JDYou'll see opticalflow disabled, it's required to get a sketch size <242kB for APM.
The arducopter code basis is 3 months old. So, for pixhawk that benefit great safety improvements since (with 3.1 release), we suggest you to integrate our code to the current master.
Here are the differencies to copy/paste only our changes into master
https://github.com/Ju1ien/ArdupilotST-JD/compare/DIY-Ardupilot-Ref...masterFor VRBrain V4.5, Roberto Navoni has already done it (thanks a lot), just contact him to get the code.
About params and logs :
Params and the logged data we've added are kept for the moment to debug things but they could be deleted later.
Once code loaded, mind to check Hyrbid params. For best performance, these values should be used :
WPNAV_BR_MAX_ANG = 3000
WPNAV_BR_RATE = 8
WPNAV_BR_SPEED_0 = 10
WPNAV_LOIT_DB = 70
WPNAV_STICK_SMTH = 5
You'll find significations in the code but I suggest you not to change them for first flight.
From the different flights we've done on different copters, the best values for these params were always the same (these one)... so we could simply fix them hard in code (if fitting to everybody) and make this way the tuning even easier (no param!)
Sandro and I can provide more explanations, matlab graphs, logs and/or log screenshots if needed for a better understanding.
We really hope this flight mode will please the people and our code integrated to next arducopter release.
Enjoy :)
Sandro, Julien.