Airplane mode RTH

Post Reply
Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Airplane mode RTH

Post by Sebbi »

Hey there,

I did not follow the airplane development of MultiWii until a few days ago ... I now have an Easy Star II with a NanoWii installed and it does work (the plane is mostly stable by itself though) :-)

Since the NanoWii has over 5000 bytes left when GPS_SERIAL is defined I was wondering if a simple RTH function could be implemented. When switched on the plane should turn into the direction of home (using GPS velocity vector instead of compass) and as a bonus keep a certain height (i know, that would probably need airspeed information). Alternatively it should just keep the plane level with a predefined throttle speed that whould work similar to the quadrocopter failsafe throttle. You'd have to experiment with values that wont let your airplane ascent too much.

My ideal setup would be a GPS connected to the NanoWii serial port RX and sending FrSky telemetry on the TX pin. That would make a super cheap FPV stabilizer setup with failsafe RTH. Possible?

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

Would it be enough if the plane would use the rudder to turn itself in the direction that MultiWii says the waypoint (home) is? In absense of a compass it would have to use the direction from the gps, but since it is a plane and not a multicopter that should be acceptable. When the plane reaches the waypoint it would circle around it depending on how good the angle/horizon mode compensates the rudder.

Anybody willing to implement this? I read about planned RTH functionality for planes in the airplane mode thread, but nothing happened so far or am I missing something?

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Hi Sebbi,

Do you have a suitable plane to test with?
I have a test version ready.

Some PID need to be added to get it to fly stright line.
But it seems to return to launch.

Notice when you enable a GPS mode engine will enter a auto mode.
Run at cruice or climb throttle!

All settings is in config
Remove or change my DEBUG Defs.(just a example how to setup!)


Use this for your fingers health!
#define SAFETY_SWITCH AUX4 // Use a Safty switch for AutoThrottle. Must be over 1700µs
But it can be disabled on your own risk.

And if you feel unsecure on the navigation Take over in time!
We dont want a runnaway... :evil:
Passthru disables MWii completly!

I set my switches like this.
Image
AUX3 actually not needed.
Attachments
MultiWii_FWnav 0920.rar
Fiwed wing Navigation test
(248.88 KiB) Downloaded 557 times
FXnav.png
(3.61 KiB) Not downloaded yet

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

Hey PatrikE,

from a quick read of your source code it looks like a working solution. Did you test it already? Is it hard to determine a cruise throttle? I have a suitable airplane, but currently no working GPS module. Will order one and let you know how things turned out.

Thanks for the implementation :)

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

It's tested but needs work with a Pid function.
Check where you hold the throttlestick in suitable speed and check the Gui what value you have.
Or just estimate;-) Det as i did.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

I agree, it probably needs a PID controller for the yaw axis. Does it oversteer a lot in your tests? Can you capture a video? ;-) (sorry, I am a littlebit excited, maybe I'll find some old GPS module for testing this with you)

About the roll axis, when I use the rudder only my airplane is rolling to the side (without using ailerons). As I understand it horizon mode would take care of that (by using the ailerons) and the RTH function would then be responsible for the plane to still roll a littlebit?

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

It files like a snake in the beginning.
I hve only tested it on short distances. ~200meters
On a long return it probably fly more stright line.

My plane is slow in rollplane and need big input to initiate turns even in passthru!
My setup with GPS added later.
I also think that rudder can be more effective than only roll.

Horizon mode will force the plane to do flat turns with rudder.
If you want roll you need to use a little GPS_NAVCORR

Sorry no video... :(
To windy today
1500 cruicethrottle was not enough to fight the headwind!

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Airplane mode RTH

Post by msev »

Patrik did you make any more tests?

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

msev wrote:Patrik did you make any more tests?

Yepp!... :D

Yesterday it performed really good.(Didn't have a camera available.)
I just have some final tests to do.
It's still overshooting some in altitude.
But it's just tuning.

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Airplane mode RTH

Post by msev »

Do you use a baro? Maybe you could modify mahowiks alt.hold code for our purposes?

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

msev wrote:Do you use a baro? Maybe you could modify mahowiks alt.hold code for our purposes?


I don't think using the accelerometer on an airplane would improve altitude holding. Even GPS altitude would be good enough for basic return to me logic (as many commercial OSDs offer) ;-)

P.S.: Still waiting for my GPS module to arrive ..

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Airplane mode RTH

Post by copterrichie »

Sebbi wrote:
I don't think using the accelerometer on an airplane would improve altitude holding. Even GPS altitude would be good enough for basic return to me logic (as many commercial OSDs offer) ;-)

P.S.: Still waiting for my GPS module to arrive ..


Don't say that, you will get flamed for even suggesting that. Ha!

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

Well I suppose with a strong enough motor you could try to let an airplane hover over the same spot (basically turning it into a Helicopter/Unocopter). The Mahowiks code (and thus baro/acc altitude measurements) could come in handy ;-)

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Airplane mode RTH

Post by copterrichie »

The way I see it, anything that is flying above 200 feet, GPS is good enough. Now if we are talking under 50 feet, well that is a totally different story.

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Airplane mode RTH

Post by msev »

Most more advanced OSDs with RTH use baro now for altitude hold, one notable example is RVOSD (which current fpv distance record holder Roberto Montiel uses), among other people...I believe also some other osds use a baro...Basically we would just need a baro code which is accurate about 5m, the more the better of course.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Airplane mode RTH

Post by copterrichie »

I think if my memory is correct, Dennis (Creator of the DIYODS) stated he was getting something like +- 10 meters with his GPS. But again, he also stated, he flies at an altitude of 5000 feet and higher. EEK!
Last edited by copterrichie on Fri Sep 28, 2012 9:14 pm, edited 1 time in total.

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Airplane mode RTH

Post by msev »

I believe the usual estimate about gps accuracy is 30m ,so your estimate on using it on altitudes over 200 feet is about right...I just don't have a feeling about how the altitude value the gps antenna picks up from the satelites fluctuates,...If it fluctuates badly it wouldn't be nice for the aeroplane..

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

From my tests i seems to hold within 5 meters.
It just overcompensates +/- 2m around target alt.(FishTailing)
In a short timespan <5 min..

I need better tuned regulator.

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Airplane mode RTH

Post by msev »

Patrik any news :D ?

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

Got my GPS, but the plane needs repairs after I landed it on a tree and had to shoot it down with bow & arrows ;-)

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Airplane mode RTH

Post by msev »

Sebbi wrote:Got my GPS, but the plane needs repairs after I landed it on a tree and had to shoot it down with bow & arrows ;-)


Great that you got the gps, bad news about the plane .. So soon some more development will come :).

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

I laded on a tree to this summer.
But i called the Firedepartment! 8-)
Image
Image
Image
Only damage was a small scrach under the wing :mrgreen:
Attachments
4.png
(187.89 KiB) Not downloaded yet
5.png
(189.61 KiB) Not downloaded yet
2.png
(191.34 KiB) Not downloaded yet

User avatar
NikTheGreek
Posts: 348
Joined: Thu Dec 08, 2011 4:17 pm
Location: Greece
Contact:

Re: Airplane mode RTH

Post by NikTheGreek »

Sebbi wrote:Got my GPS, but the plane needs repairs after I landed it on a tree and had to shoot it down with bow & arrows ;-)


hunting season is open :!: :?: :!:

:lol: :lol: :lol: :lol: :lol: :lol: :lol:

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

;-) I thought the fire department would be too expensive, so i left it up in the tree over night and shot arrows with kite line up there ... elevator came apart first, then one wing after the other and finally the important part of the plane came down. I glued everything back together (it's a Frankenplane now) and hope it is fit to fly again ;-)

Any progress on your airplane RTH code from last time, PatrikE?

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Speaking of Huntig seasson...
I will be away for ElkHunting next week meaning no flight testing possible..

I will try to sum up a test version for you to experiment with during the week.

I have dicovered that GPS only is not really god for navigating.
It have a lag of almost 5-10 seconds and overshoot severly!(also mentioned in the ArduPilot code)
When i switched to a FC with MAG it all improved a lot!...
The altitude works quite well.

I will work nightshift to night an will try to upload a test dev before bedtime tomorrow morning;)

Don't expect to much without MAG.

ps.
The firedepartment used it as a prctise 8-)
They think this kind of missions it funny in contrast of real dissasters.
You can always ask!... ;)

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Read the Textfile in the rar file for instrutions
MultiWii_FW_NAV_TEST.rar

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

Nice, thank you. I have a spare mag lying aroundand will try to integrate it. But as long a GPS only RTH "kind of returns" the plane that's ok too, i guess ;-)

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

I made a change in the RAR file.
Download again.
MultiWii_FW_NAV_TEST.rar

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Airplane mode RTH

Post by msev »

Maybe this would be useful as an added function: http://www.rcgroups.com/forums/showthread.php?t=1741164

rbirdie001
Posts: 178
Joined: Fri Apr 01, 2011 10:32 pm
Location: Czech Republic, Prague

Re: Airplane mode RTH

Post by rbirdie001 »

Hi all,
it seems to be quite silent here...
Whole summer passed so many tests with plane navigation must have been done from the last post. How were the results with the plane RTH?
I just installed MultiWii stabilisation into one of my planes (thanks to all, namely Patrick)- seems to stabilize very nice so RTH should be the next logical step.
On the multicopter now RTH works fine so I hope for planes it will come as well.
Unfortunately I'm unable to code it alone but I can help testing it.
I played recently with 10Hz GPS and found that position data are refreshed very fast - really each 100ms GPS provides new unique position and course but height data are very lagy - seems to be some way internally filtered. When the copter (where I tested it) changed height, it took usually about 10-20 seconds until the height data stabilised on the new value but I'd say that it didn't fluctuate much when the height was stable. I hope it can be used to keep height e.g. this way: it will keep the last known throttle and measure height each e.g. 5 seconds. If height goes up, it will decrease throttle for e.g. 5% and the opposite, keep it for the next 5s, measure again... This should some way work for a SIMPLE emergency RTH if the height regulation is slow enough and height is above 50m. Fortunately in compare to multicopters planes can glide :-)
Maybe this will help.
Roman

faraz
Posts: 9
Joined: Sun Nov 25, 2012 9:02 am

Re: Airplane mode RTH

Post by faraz »

@ patrik,
Dear, i have Hobbyking Multiwii Board with MPU6050 + HMC5883L + BMP085 Sensors. i want to test your code with RTH function. dear, will it work on Hobbyking board or not?. thanks

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Hi faraz.
The board is supported.
I made some changes in the linked file.
Download it to get the latest changes.

I have -20 degree and can't do any tests atm..:(

tasospap
Posts: 7
Joined: Wed Jul 11, 2012 6:29 pm

Re: Airplane mode RTH

Post by tasospap »

Patrike what hapen .Did you test your plane ?

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Sorry but Winter isn't my flying season.

But @faraz have done some flighttests.

Last i heard from him RTH worked.

A PID regulator is still needed to remove the overstering,
Only the P part is included.
But with smaller compensations it returns quite nice.

Feel free to test.
We need to get this working now.
Attachments
MultiWiiFW_Nav.zip
(135.92 KiB) Downloaded 371 times

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

I agree, lets get this working. It should get warmer and less wet in february ;-)

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Sebbi wrote:I agree, lets get this working. It should get warmer and less wet in february ;-)

HA! I Would you say March-April around here.... :-(

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

I tried the current dev version of MultiWii on my NanoWii board (Arduino Leonardo). 23728 bytes of 28672 bytes used when compiled with I2C_GPS ... I hope 5k will be enough for RTH (and FrSky telemetry).

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

The RTH code is smaller than 0.7K.
Binary sketch size: 24 350 bytes on a Arduino Leonardo compiled with I2C_GPS

I havn't tested FrSky telemetry.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

That's very small, wow!

I testcompiled a version with FrSky telemetry and it makes a difference of 2.3K. I am sure this can be optimised further. I have high hopes we can get both features to a state so it can be included in MultiWii ;-)

Kayle
Posts: 141
Joined: Sun Feb 13, 2011 6:45 pm

Re: Airplane mode RTH

Post by Kayle »

PatrikE wrote:Sorry but Winter isn't my flying season.

But @faraz have done some flighttests.

Last i heard from him RTH worked.

A PID regulator is still needed to remove the overstering,
Only the P part is included.
But with smaller compensations it returns quite nice.

Feel free to test.
We need to get this working now.


Hi PatrikE,

two questions:

- At the Moment only FixedWing Aircrafts ( like Bixler or Easystar ) are supported ?
- Home Point is set when GPS gets fix ?

Thanks
Kayle

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

Home point is set when GPS has a 3D fix, system is armed and it wasn't set before. With the default settings it is set on every arming of the system which might be not desired on airplanes (uncomment DONT_RESET_HOME_AT_ARM in config.h to prevent that).

If you want to reset home without disarming/arming first you can use the gyro calibration stick combination which also resets home (and sets a new ground level altitude when using baro).

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

@Kayle.
From def.h
All airplane models is counted as FixedWing Aircrafts and included in Fixedwing Navigation.

Code: Select all

#if defined (AIRPLANE) || defined(FLYING_WING)|| defined(SINGLECOPTER)|| defined(DUALCOPTER)
  #define FIXEDWING
#endif

DUALCOPTER & SINGLECOPTER Is probobly not suitable for FW-Navigation.

But Planes and Wings is supposed to work.

Kayle
Posts: 141
Joined: Sun Feb 13, 2011 6:45 pm

Re: Airplane mode RTH

Post by Kayle »

Thanks Sebbi and PatrikE for your help.

Kay

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Sebbi wrote: With the default settings it is set on every arming of the system which might be not desired on airplanes (uncomment DONT_RESET_HOME_AT_ARM in config.h to prevent that).

If you want to reset home without disarming/arming first you can use the gyro calibration stick combination which also resets home (and sets a new ground level altitude when using baro).


On Airplane GPS is used for altitude!
If you glide with no throttle one can accidetial Disarm with Yaw or Roll!
A New Home position will be set when it's ReArmed. (Lat,Long,Alt)

Your HomePos can suddenly be 500m away @150m alt.
It's confusing when your debugging!... :twisted:
Don't ask How i know!... :?

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Airplane mode RTH

Post by Sebbi »

That's why I uncomment DONT_RESET_HOME_AT_ARM on MultiWii for my airplane and the arming via the sticks (it's on a switch) ;-)

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Maybe It should be hard coded in defines for fixed wing?

rbirdie001
Posts: 178
Joined: Fri Apr 01, 2011 10:32 pm
Location: Czech Republic, Prague

Re: Airplane mode RTH

Post by rbirdie001 »

Hi!
I just loaded this viewtopic.php?f=7&t=2456&start=30#p29962 fixed wing navigation version into Crius lite 1.0 board to be ready for testing when the weather improves, but I have problem that software wrongly reads throttle channel from the RX.
I'm using 35MHz receiver Corona RP8D1 connected normally via 6 wires to D2,D4-7,D12. I have signal, wiring and enpoints surely OK, with 2.2 pre it reads perfectly. If I load the FW navigation version above, on the GUI all channels except throttle are readed OK, but throttle bar is most of the time stuck on exactly 1500 and sometimes (~once per 2 seconds) for very short moment (~0.1s) jumps to the correct value where really is my throttle stick. Then returns again to 1500. Cycle time is about 3500-3800.
Do you have any idea what's wrong?
Thanks!
Roman

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

Updated with latest dev,

TX shows correct values now.

On my Crius SE compiled size wa to big to fit. :?
Opend def.h and commented the BMP085 to free space.
It's not used on Airplane anyway.

*edit
New file location.
Last edited by PatrikE on Sun Mar 03, 2013 5:10 pm, edited 1 time in total.

rbirdie001
Posts: 178
Joined: Fri Apr 01, 2011 10:32 pm
Location: Czech Republic, Prague

Re: Airplane mode RTH

Post by rbirdie001 »

Hi Patrik,
I just uploaded that version into my board for plane control and with selected only MPU6050 it compiles OK with about 27kB of size, but unfortunately the throttle reading problem is still there (pure r1356 reads it OK.) You can see the problem captured on that video: http://youtu.be/bYFlp-hBSOE
I'm attaching my config and ask you for any advice - unfortunately alone I'm unable to find and correct the problem in the code.
Thanks!
Roman

PatrikE wrote:Updated with latest dev,

TX shows correct values now.

On my Crius SE compiled size wa to big to fit. :?
Opend def.h and commented the BMP085 to free space.
It's not used on Airplane anyway.
Attachments
config.zip
Config I'm using for Crius Lite 1.0 (only MPU6050)
(20.09 KiB) Downloaded 294 times

PatrikE
Posts: 1956
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode RTH

Post by PatrikE »

You have a copy/paste error otherwise your config looks ok.
Check individual sensor orientation and compare with original.

On my setup i have AIRPLANE, GPS_promimi, NMEA, SAFETY_SWITCH and the sensors enabled.
You ave enabled a lot of features in your setup.
FAILSAFE
VBAT
GYROCALIBRATIONFAILSAFE
BUZZER

The only thing that should disturb trottle is FAILSAFE.
Try to enable one function at the time to se where the trouble is caused.

I'll check on my setup and se if i can reproduce the glitches.

Post Reply