New "Hybrid" flight mode, Arducopter has now the DJI-GPS-like feature!

3,401 views
Skip to first unread message

Julien Dubois

unread,
Jan 16, 2014, 4:55:26 PM1/16/14
to drones-...@googlegroups.com
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-reality

Well, 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-JD

You'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...master

For 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.

Marco Robustini

unread,
Jan 16, 2014, 5:03:47 PM1/16/14
to drones-...@googlegroups.com
Hi Julien, you are welcome here! :-)
I hope now the Dev Team give serious consideration this wonderful innovation, that overcomes some limitations of current Loiter.
I know Jason Short was working on such a thing, i hope good ideas can be melt into something functional for everyone.
Let's see how it evolves this thread...

Cheers,

Marco

Marco Robustini

unread,
Jan 16, 2014, 6:25:30 PM1/16/14
to drones-...@googlegroups.com
I'm sorry, Sandro you're welcome too! :P

Marco

Randy Mackay

unread,
Jan 16, 2014, 8:21:41 PM1/16/14
to drones-...@googlegroups.com

 

     Sound promising.  I’m still working on ‘the onion’ so I won’t be able to immediately look into integrating it into master.  B-spline is also ahead in the queue.  Hopefully some other people can give it a try and provide feedback until we can get it into master.

 

-Randy

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jason Short

unread,
Jan 16, 2014, 10:12:29 PM1/16/14
to drones-...@googlegroups.com
Hey, 

Yes, I have my own version of this mapped out in my head. If I had a few spare hours I could get it flying. Maybe next week? My version would really only be a dozen lines of code since it relies on the inertial nav, like Drift does.
I have already produced something called throttle assist which is a hybrid throttle controller. I fly it all the time now. 

Jason

Andrew Chapman

unread,
Jan 16, 2014, 10:33:54 PM1/16/14
to drones-...@googlegroups.com
That sounds great!

We seem to have a lot of new modes proliferating lately, which can be quite confusing for new users. Given this hybrid is so close to the existing LOITER mode, could it be exposed to the user as a parameter influencing the behavior of loiter rather than adding a whole new flight mode? Much the same as simple mode is an option on top of existing flight modes.

AC.

Jason Short

unread,
Jan 16, 2014, 10:34:53 PM1/16/14
to drones-...@googlegroups.com
I had panned on this being a parameter that turns stabilize into a more easy to fly mode. 
Jason
 

Gary McCray

unread,
Jan 16, 2014, 10:42:39 PM1/16/14
to drones-...@googlegroups.com
As I understand it, Drift with throttle assist is a non-GPS mode that does not hold in Wind like Hybrid.

I am very much looking forward to both Drift with throttle assist and to Spline for an almost equivalent auto mode.

The combo should be very nice for setting up photo and video shots as well as FPV.

But this new Hybrid mode actually promises a greatly improved Loiter / Fly capability and should be really worthwhile as well.

Obviously on a Pixhawk or PX4, having a larger variety of even more powerful flight modes would be a real bonus.

I am afraid APM is getting long in tooth for all this new stuff and, of course EKF is also coming.

Best Regards,

Gary

Josh Welsh

unread,
Jan 17, 2014, 12:56:32 AM1/17/14
to drones-...@googlegroups.com

Jason.. would that remove the current “Stabilize” as a selectable option if yours was selected/configured?  Or would “Stab (Legacy)” be a flight mode and “Stab (Jason’s Version)” be another flight mode, both selectable in flight?

 

-josh

Jesus Alvarez

unread,
Jan 17, 2014, 2:06:38 AM1/17/14
to drones-...@googlegroups.com
My vote goes to adding this hybrid mode as a single parameter to current loiter as it happens with simple.
Same could be done for drift.

So we could finish having 5 o 6 basic modes with several checkboxes for options applicable (drift, GPS hold when stopped...)

I would always maintain a legacy Stabilize as it does not require GPS and can be flown in interiors.

Message has been deleted
Message has been deleted

Marco Robustini

unread,
Jan 17, 2014, 3:06:09 AM1/17/14
to drones-...@googlegroups.com
+1
Even for me it would be enough to do this, add the possibility of the current Loiter leave it as is, or to flag an option, something like "flyable" to enable this new way of flying.
I've already done a lot of testing and I have not encountered any problems, any variation on the theme would create something that is not exactly as "Hybrid, which corresponds to the common "flyable position hold" used in other famous closed source like DJI, Mikrokopter, Zero-UAVs etc.
Hybrid
is simply a virtual switch from "Loiter" to "Alt-Hold" and vice versa with wind compensation, i remember ago when i suggested this approach to the dev team because Loiter is unflyable or otherwise this thing would have been the wrong approach, many told me it would not work, well, this is the result and I don't think it doesn't work, in fact, it works better than i wished, my video speaks for itself... :-D
So Team, valued good thing, thank you! :P

- Marco

Marco Robustini

unread,
Jan 17, 2014, 3:08:05 AM1/17/14
to drones-...@googlegroups.com
PS: "Hybrid" thread I opened on DIY Drones now is the second in the ranking of the "Top Content", there will be a valid reason...

- Marco


On Thursday, January 16, 2014 10:55:26 PM UTC+1, Julien Dubois wrote:

Julien Dubois

unread,
Jan 17, 2014, 3:24:39 AM1/17/14
to drones-...@googlegroups.com
Jason, the hybrid throttle was the next step for a global hyrbid flight mode, more reactive as the current throttle_hold is controller-based, delayed and not enough responsive imo when you fly hard alt_hold. Throttle_hold is perfect for loiter because alt disturbances related to flight velocity, wind and accelerations are lower.

I would be pleased to test your throttle assist as it seems great (and joined my idea) and also to include it to the current hybrid mode to see how fine that would be!

Moreover, Sandro has merged our code to the lastest 3.1.1 release and we'll commit it to our repo in 12h (will be ready for the ween end). So pixhawk pilots will be able to test the code safely :)

About special mode or stab/loiter option, I would use at least loiter option because it needs GPS fix contrarly to stab.
After, to say it's closer to loiter or to alt_hold, that's a long discussion and I personnaly think it's rather a safe and assisted alt_hold mode but with GPS fix required!

And, for having tested the different flight modes, I like so much this one to make it an option, I would rather set it as a complete mode (loiter), and set the current loiter as option ("slow accurate loiter")

Randy Mackay

unread,
Jan 17, 2014, 3:36:26 AM1/17/14
to drones-...@googlegroups.com

 

    The joy of open source could be that nobody’s in complete control so if you don’t agree with an opinion you can always do it yourself and prove them wrong!

 

-Randy

--

Marco Robustini

unread,
Jan 17, 2014, 4:04:05 AM1/17/14
to drones-...@googlegroups.com
Randy, i'll answer you in private.

Marco

Emile Castelnuovo

unread,
Jan 17, 2014, 6:30:54 AM1/17/14
to drones-...@googlegroups.com
Jason I would also like to try out your Assisted throttle mode.
Could you please share the code so I can implement it in our VRBRAIN code?

Cheers,
Emile


2014/1/17 Marco Robustini <robusti...@gmail.com>

Jason Short

unread,
Jan 17, 2014, 12:17:54 PM1/17/14
to drones-...@googlegroups.com

Jason Short

unread,
Jan 17, 2014, 12:39:01 PM1/17/14
to drones-...@googlegroups.com
And make sure to set thr_assist to 1 to enable it. 
It enhances manual_throttle_tilt_compensated only.
Jason

 
On Jan 17, 2014, at 3:30 AM, Emile Castelnuovo <emile.ca...@gmail.com> wrote:

Marco Robustini

unread,
Jan 20, 2014, 11:49:22 AM1/20/14
to drones-...@googlegroups.com
Today I did some flights with my Pixhawk and "Hybrid", compiled in line with this commit (thanks Julien), no problem, everything works as it should.

Bests, Marco


On Thursday, January 16, 2014 10:55:26 PM UTC+1, Julien Dubois wrote:

hani alnowairah

unread,
Jan 29, 2015, 11:59:01 AM1/29/15
to drones-...@googlegroups.com
Hi ,Mr.Randy
I have a problem with my copter in loiter mode. I cant find the sweet spot (throttle input) where the copter hovers at a fix altitude. It tends to go either up or down on its self.  Could you please give me any sugestions?

Craig Elder

unread,
Jan 29, 2015, 2:35:12 PM1/29/15
to drones-discuss
Hello Hani

Just a reminder to please post any user support requests to http://ardupilot.com/forum/

Thanks.

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohammed Buti

unread,
Feb 21, 2015, 3:14:47 PM2/21/15
to drones-...@googlegroups.com
hi im having a problem with the new mode i have the old APM 2.6 and i have the mode working with  me but one problem when i go full pich forward and live it will go kip going for some time and after it will com to full stop and start roking back and forth i dont know why pleez help me   im using the latest fermwher 3.2.1

Julien Dubois

unread,
Feb 24, 2015, 3:06:12 AM2/24/15
to drones-...@googlegroups.com
Please post a log. Maybe you should post it on the 3.2.1 topic as the code was completelly reviewed since this initial post.

Mike Klinker

unread,
Mar 5, 2015, 2:23:01 PM3/5/15
to drones-...@googlegroups.com
Can you revise the linked Compare function in Github so we can see what is different and ultimately how to add this mode to the current release?  
Reply all
Reply to author
Forward
0 new messages