Page 1 of 17

Airplane mode RTH

Posted: Sat Sep 15, 2012 5:23 pm
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?

Re: Airplane mode RTH

Posted: Sat Sep 15, 2012 11:50 pm
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?

Re: Airplane mode RTH

Posted: Thu Sep 20, 2012 1:35 pm
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.

Re: Airplane mode RTH

Posted: Thu Sep 20, 2012 3:37 pm
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 :)

Re: Airplane mode RTH

Posted: Thu Sep 20, 2012 3:42 pm
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.

Re: Airplane mode RTH

Posted: Thu Sep 20, 2012 4:34 pm
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?

Re: Airplane mode RTH

Posted: Thu Sep 20, 2012 5:11 pm
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!

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 9:49 am
by msev
Patrik did you make any more tests?

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 10:02 am
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.

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 10:12 am
by msev
Do you use a baro? Maybe you could modify mahowiks alt.hold code for our purposes?

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 2:57 pm
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 ..

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 3:01 pm
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!

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 4:04 pm
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 ;-)

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 4:33 pm
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.

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 8:42 pm
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.

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 8:58 pm
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!

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 9:10 pm
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..

Re: Airplane mode RTH

Posted: Fri Sep 28, 2012 9:40 pm
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.

Re: Airplane mode RTH

Posted: Wed Oct 17, 2012 6:17 pm
by msev
Patrik any news :D ?

Re: Airplane mode RTH

Posted: Sat Oct 20, 2012 11:52 am
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 ;-)

Re: Airplane mode RTH

Posted: Sat Oct 20, 2012 12:33 pm
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 :).

Re: Airplane mode RTH

Posted: Sat Oct 20, 2012 4:49 pm
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:

Re: Airplane mode RTH

Posted: Sat Oct 20, 2012 4:57 pm
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:

Re: Airplane mode RTH

Posted: Sat Oct 20, 2012 6:55 pm
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?

Re: Airplane mode RTH

Posted: Sat Oct 20, 2012 7:14 pm
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!... ;)

Re: Airplane mode RTH

Posted: Sun Oct 21, 2012 4:14 am
by PatrikE
Read the Textfile in the rar file for instrutions
MultiWii_FW_NAV_TEST.rar

Re: Airplane mode RTH

Posted: Sun Oct 21, 2012 2:05 pm
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 ;-)

Re: Airplane mode RTH

Posted: Sun Oct 21, 2012 3:30 pm
by PatrikE
I made a change in the RAR file.
Download again.
MultiWii_FW_NAV_TEST.rar

Re: Airplane mode RTH

Posted: Sun Oct 21, 2012 4:53 pm
by msev
Maybe this would be useful as an added function: http://www.rcgroups.com/forums/showthread.php?t=1741164

Re: Airplane mode RTH

Posted: Tue Nov 06, 2012 11:38 pm
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

Re: Airplane mode RTH

Posted: Fri Dec 07, 2012 8:57 pm
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

Re: Airplane mode RTH

Posted: Sat Dec 08, 2012 9:46 pm
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..:(

Re: Airplane mode RTH

Posted: Thu Jan 24, 2013 10:32 pm
by tasospap
Patrike what hapen .Did you test your plane ?

Re: Airplane mode RTH

Posted: Sat Jan 26, 2013 5:25 pm
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.

Re: Airplane mode RTH

Posted: Sat Jan 26, 2013 8:41 pm
by Sebbi
I agree, lets get this working. It should get warmer and less wet in february ;-)

Re: Airplane mode RTH

Posted: Sat Jan 26, 2013 11:34 pm
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.... :-(

Re: Airplane mode RTH

Posted: Sun Jan 27, 2013 8:09 pm
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).

Re: Airplane mode RTH

Posted: Sun Jan 27, 2013 10:53 pm
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.

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 1:50 am
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 ;-)

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 2:13 pm
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

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 4:23 pm
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).

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 4:36 pm
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.

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 7:25 pm
by Kayle
Thanks Sebbi and PatrikE for your help.

Kay

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 7:35 pm
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!... :?

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 7:38 pm
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) ;-)

Re: Airplane mode RTH

Posted: Mon Jan 28, 2013 8:13 pm
by PatrikE
Maybe It should be hard coded in defines for fixed wing?

Re: Airplane mode RTH

Posted: Sat Mar 02, 2013 12:27 am
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

Re: Airplane mode RTH

Posted: Sat Mar 02, 2013 4:03 pm
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.

Re: Airplane mode RTH

Posted: Sun Mar 03, 2013 12:07 am
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.

Re: Airplane mode RTH

Posted: Sun Mar 03, 2013 2:25 pm
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.