Airplane mode RTH

pki
Posts: 12
Joined: Sun May 04, 2014 9:10 am

Re: Airplane mode RTH

Post by pki »

Hi Patrtik.

First i want to thank you for the very good piece of work. I am unsing you code in my fixed wing with fpv now.

I have tested the position hold and rth functions. Seems to work fine. I am not sure how the altitude hold and mag hold should work. In alt hold it's pumping the throttle up and down every few seconds. Should mag-hold work in a fixed wing?

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Airplane mode RTH

Post by crashlander »

MAG and ALT must not be enabled/used on fixed wing!

Regards
Andrej

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

Re: Airplane mode RTH

Post by PatrikE »

Mag hold should work exactly as for copters.
But don't use MagHold in GPS mode.
You will probably get input from both GPS & MAG then.

The throttle pumping have two possible reasons.
Either the plane is flying slower than 5 m/s groundspeed and compensates for that.( Usually when flying Headwind )
Increase CruiceThrottle with 50-100 to increase speed.

Or You have lost some Altitude and it compensate for that.

Cheers
Patrik

pki
Posts: 12
Joined: Sun May 04, 2014 9:10 am

Re: Airplane mode RTH

Post by pki »

PatrikE wrote:Mag hold should work exactly as for copters.
But don't use MagHold in GPS mode.


I will try it on my next fly.

PatrikE wrote:The throttle pumping have two possible reasons.
Either the plane is flying slower than 5 m/s groundspeed and compensates for that.( Usually when flying Headwind )


No, this is not the case, it's about 50-70km/h at cruisethrottle. Even with headwind i sill get about 30-40km/h groundspeed.

PatrikE wrote:Or You have lost some Altitude and it compensate for that.


This may be possible. What is the range for throttle in alt-hold?
I think i have some alt-loss in straight forward flight in horizon/angle mode, sticks centered, 60% throttle. Should i compensate it with the ACC calibration? Can i trim it like a copter (disarmed, throttle full up, pitch up several times)?

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

Re: Airplane mode RTH

Post by PatrikE »

There's adeadspan on +/- 1m on Altitude.
You can Trim Acc like Copters.

"Althold" works best if Acc is trimmed correctly.
Both Roll and AttackAngle Plane should hold a straight path by it self!
Less to compensate with GPS.

Romeo84
Posts: 16
Joined: Wed Aug 21, 2013 8:32 pm

Re: Airplane mode RTH

Post by Romeo84 »

Hi guys. This firmware is awesome. My plane go back home very well, but circle which it rounds above me is little big... and i not try to tune it yet.

Some questions i have got:

First and primary - when i tune servo revers with multiwii conf on my notebook and push button reverse on any servo at first does not any happens.... and i forced to wait from 10 seconds to 5 minutes to is happens. What is it? Magic? :)

How multiwii detect failsafe from my 9xr turnigy reciever? It is not supported failsafe by himself and simply leaves constantly values on each channel.... as i understand.

Second - i tryed to use PID_CONTROLLER 2 and it looks like work worse in level mode.... and when plane goes to home and start to sircle after 3 - 4 turns it yaw down directli to ground so i must intercept control to avoid hit the ground.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Airplane mode RTH

Post by crashlander »

Romeo84 wrote:Second - i tryed to use PID_CONTROLLER 2 and it looks like work worse in level mode.... and when plane goes to home and start to sircle after 3 - 4 turns it yaw down directli to ground so i must intercept control to avoid hit the ground.


AFAIK PID_CONTROLLER 2 is not often used/tested even in multi copter world and I'm almost certain that nobody has tested it for fixed wings planes.
So simple answer do not use it!

Regards
Andrej

denism
Posts: 17
Joined: Fri Feb 21, 2014 7:09 am

Radjet

Post by denism »

Hi Patrik, can you please share your Radjet PIDs (screenshot) and indicate what servos you use?
Rather than going from ground zero in tuning mine I could use your settings as a base.

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

Re: Airplane mode RTH

Post by PatrikE »

Hi Denis,

I have bought the Version with servos and everything...
I only added Receiver and Battery. (And MWii Of Course)
The servos seems to be bigger than 9gr and really fast and Unlabeled.

Quick n Dirty Installation..
Image

Patrik
Attachments
IMG_20140101_143321.jpg
(59.65 KiB) Not downloaded yet
Radjet.png

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

Re: Airplane mode RTH

Post by PatrikE »

@Romeo
Stick to PID_CONTROLLER 1...
I dont like the #2 on copters and haven't tested ti on planes at all...

For failsafe to work the RX need to stop sending pwm or send < 980µs/channel.
Otherwise if it's possible to use the Bind LED some way to indicate FS.
But that's not supported by MWii and needs some code changes.

denism
Posts: 17
Joined: Fri Feb 21, 2014 7:09 am

Re: Airplane mode RTH

Post by denism »

I got it P=2, rest is stock. Thanks. I am getting a kit version for my wife :D

PatrikE wrote:Hi Denis,

I have bought the Version with servos and everything...


Patrik

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

Re: Airplane mode RTH

Post by PatrikE »

I also use to set Level P=6.
It will make it a little "softer" in level modes.

denism
Posts: 17
Joined: Fri Feb 21, 2014 7:09 am

Re: Airplane mode RTH

Post by denism »

Ok. On Polaris I had to put Level P to like 16 to get enough elevator for it to stay level....
PatrikE wrote:I also use to set Level P=6.
It will make it a little "softer" in level modes.

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

Hi. I want to thank Sebbi for starting this thread and PatrikE for all the hard work. I read this whole thread, it took me a week, and my head is spinning. My single goal is to implement a feature to bring a plane back into range that strayed due to lost signal. My plane is 100% stable and will stay in the air with no stick input until battery runs out. Hardware for this project is minimal: mega328, mpu6050, and basic NEO6 gps module. The radio system is only 4 channel. Because of this there is little option for aux modes but rx throttle channel does stop pulses on lost signal.

Is it possible to implement only failsafe type rth with possibility to take control when back in range?

pki
Posts: 12
Joined: Sun May 04, 2014 9:10 am

Re: Airplane mode RTH

Post by pki »

Just enable failsafe in config, it will trigger RTH when lost pulses on throttle.

Arm and disarm via throttle/yaw.

Or, if you don't need the yaw channel you can use it as aux channel.

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

Wow, thanks, that was a fast reply and very helpful hint. Im not an expert with Arduino but have downloaded FW_Nav_1140402 and been examining the config file. Also should mention my NEO6 module has no EEPROM so fixed at default 1hz but is configured via jumpers for 38kbaud. I see in the file where #define GPS_BAUD 57600 can be changed but is it possible the slower update will work with this project? I dont care if the plane ziggzags or takes forever to get back but any idea what will happen with 1hz instead of 5hz?

pki
Posts: 12
Joined: Sun May 04, 2014 9:10 am

Re: Airplane mode RTH

Post by pki »

I'm not expert in ubox gps. if you dont like to change the config of the gps module so just set the baudrate in the config, and the protocol (nmea or ublox). It will work.

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

Thanks again. NEO6 is very generic NMEA so there should be little trouble there. I was just wondering if the slow update would wreak havoc with PID algorithms or lost GPS signal timing. Regarding your comment on "arm and disarm", then Multiwii won't automatically recognize throttle is back and restore stick control?

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

Re: Airplane mode RTH

Post by PatrikE »

I haven't tested Navigation with lower rate than 5hz but it should take the plane home i think.
When the signal is recovered you are in full control again.

You can test to let MWii reprogram the gps at boot.
#define INIT_MTK_GPS

If it works Gps will be set to 5hz and the Baudrate you set in Config.
But to just stear towards home 1hz should work fine.

f3nt
Posts: 5
Joined: Wed Mar 06, 2013 8:48 pm

Re: Airplane mode RTH

Post by f3nt »

hello joseph, i have the crius neo6m v2 from rc timer, i'm not able to save settings on it (when i disconnct it, all settings go back to default value), but you can flash the GPS with a new firmware and enter a new txt hexa config file to have the good baud rate by default on start.

i did it with Ucenter, my GPS was 1hz / 9600 bauds, and now it's configured at 5hz / 38400 bauds, it work fine with multiwii and megapirateng, and i suspect the 3dr txt file implement glonass in the almanac, because i have now a 3D fix in 5 seconds, and in ucenter i do not just see the navstars.


(in the multiwii code, prefer define UBLOX to define NMEA, even if it will work too with NMEA protocol.)

cheers ;)

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

This is working out better than i expected. My situation is the same, no EEPROM so settings go away. 38400 was easy to get by shorting pads but update rate cant be changed that way. On their website theres reference to firmware for LEA6 which is the more expensive module:

http://www.u-blox.com/en/firmware/gps-m ... pdate.html

Do you have a link to the one that you used? Is NMEA at 57k which is the Multiwii default an option?

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

PatrikE wrote:You can test to let MWii reprogram the gps at boot.
#define INIT_MTK_GPS


I thought there was something like that possible but didnt see mention of it in my browsing. Updating firmware would be a better option because its more permanent and im guessing the code will be smaller. Also it may be possible to get a status display too if serial out is not used for GPS? However if there are problems updating the GPS that would be my next line of attack. Its nice to know i have more than one solution.

So Im ready to flash the first Mega328 and could use some advice on what to change in the config. So far this is what I have:

#define AIRPLANE
#define GY_521
#define GPS_PROMINI_SERIAL
#define GPS_BAUD 38400
#define NMEA

Did I forget anything?

Will Multiwii start home on lost signal? Can I regain control by turning the radio back on?
Last edited by Joseph97 on Mon Jun 09, 2014 2:13 pm, edited 3 times in total.

f3nt
Posts: 5
Joined: Wed Mar 06, 2013 8:48 pm

Re: Airplane mode RTH

Post by f3nt »

i downloaded the last firmware for my GPS on UBlox site, it's the version 7.3 if i remember well, after flashing the GPS with the image provided by ublox, i uploaded the txt file for 3dr, i found it on megapirate forums, you can not specify wich baudrate you want, or how many hertz you want, because it's an hexadecimal file, but it worked very well to go 5hz 38400 bauds.
i did this operation on 2 differents neo6M, and both are now working properly.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Airplane mode RTH

Post by crashlander »

Joseph97 wrote:Did I forget anything?

In GPS.h
#define FAILSAFE
Joseph97 wrote:Will Multiwii start home on lost signal? Can i regain control by turning the radio back on?

It works for me (allways)!

Regards
Andrej

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

Thanks Andre. So 2 files need changing. And thanks for all you contributions. I learned a lot from your experiences here.

F3nt, Im a bit confused about the need for 3dr file. This does not change the default update rate for the GPS?

Sorry for all the questions but this is very exciting and I appreciate the help.

f3nt
Posts: 5
Joined: Wed Mar 06, 2013 8:48 pm

Re: Airplane mode RTH

Post by f3nt »

check this out :
http://copter.ardupilot.com/wiki/ublox/

the new baudrate is set by the txt file, the upgrade of the firmware is just done to be compliant with the provided txt file.

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

I understand. Unfortunately it don't look like a new firmware version would behave any different than my current one. It's still necessary to send strings to the GPS every time it is powered up. I can do this now manually from Hyperterminal so it does work. However I have a feeling INIT_MTK_GPS may not work because the strings are probably unique to Mediatek so there may be some coding involved for Ublox. Not my area of expertise. So for now the plan is to try the path of least resistance. Fire up Arduino IDE using parameters mentioned above and see if 1hz works. Fingers crossed.

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

Re: Airplane mode RTH

Post by PatrikE »

INIT_MTK_GPS works fine on my Ublox...
Crius CN-06 V2.

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

Thanks, we have the same module type so that is good to know. Apparently they have standardized on the messages. Unfortunately hooking gps rx up to promini tx prevents use of the gui so that will be a last resort. ATM im going to try the 1hz default. The NEO6 is configured right now for 38kbaud via hardware jumper.

The program compiles and downloads OK for me but there is no sign of life. The acc status LED that indicates level when I download a multicopter file does not do this with the RTH plane file. Also Im a little confused about what pin is for the GPS LED. Promini has one on pin13 (PB5) but there is reference to using pin12 (PB4) in the RTH config.h and no hint which pin is for GPS LED. So i gather we need two LEDs. Can you tell me which pins?

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

Re: Airplane mode RTH

Post by PatrikE »

I don't think there is any GpsLED ON mini boards.

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

Yes, I would like to add one. Can you tell me if the acc level LED is the same as for multicopter? When I load a multicopter image my LED is steady when level and blinks when not but I dont get a similar response with the plane firmware. It would be nice to know if it's a hardware or software problem.

It looks like theres 2 leds on the Crius board on your site. The config file does not seem to have enough hardware info and nothing on the index page here either. Do you know if theres a schematic anywhere showing Mega328 connections for that board?

pki
Posts: 12
Joined: Sun May 04, 2014 9:10 am

Re: Airplane mode RTH

Post by pki »

The LED is the same, you need to enable "only arm when flat", but i think it's not good for a plane.

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

Re: Airplane mode RTH

Post by PatrikE »

I checked and there's no STABLEPIN defined on 328 boards.
STABLEPIN is used as Gps Indicator.

You can add one in def.h
Find the defines for Promini.

Code: Select all

  #define STABLEPIN_PINMODE          ;
  #define STABLEPIN_ON               ;
  #define STABLEPIN_OFF              ;

Replace with

Code: Select all

  #define STABLEPIN_PINMODE pinMode (A2, OUTPUT);
  #define STABLEPIN_ON PORTC |= (1<<2);
  #define STABLEPIN_OFF PORTC &= ~(1<<2);

You will then have a Gps indicator on pin A2

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

Re: Airplane mode RTH

Post by PatrikE »

The board have two LED.
One PowerLED & One StatusLED.

PowerLED is always on when power is connected.
StatusLED is Normal Arduino's StatusLED.

For this Hack you need to connect a LED to Port A2 & Gnd.

It will however collide with Camtrigger if you use it.

Joseph97
Posts: 16
Joined: Sun Jun 08, 2014 8:15 pm
Location: US of A

Re: Airplane mode RTH

Post by Joseph97 »

Yup.. thats what i needed to know. A2. I followed those leads and now im back on track and getting some indications. Thanks.

bubu10
Posts: 7
Joined: Sat Aug 09, 2014 8:08 am

Re: Airplane mode RTH

Post by bubu10 »

Hi sorry for my bad english

I have a little problem with Multiwii 2.3 FlyingWing Mode

My equipment

Teksumo Wing HK
HK Multiwii per flight controller the red one

And have a problem with the servos

I've played the last update of PatrikE on the board and the settings for the board set (GPS and sensors)

If I now the two servos and the ESC to terminal and test runs only one servo and the ESC / motor and other power does not matter.

On the following pins I have the servos and the ESC clamped

D3 ECS / MOTOR

D6 servo the works!
D7 does not work at the servo but also all other pins not give out function only D3 and D6.

Can someone please help a no longer get ahead what I have to change for this board or make it work with it.

Thanks in advance


Greetings Rene

bubu10
Posts: 7
Joined: Sat Aug 09, 2014 8:08 am

Re: Airplane mode RTH

Post by bubu10 »

I have time today but something tried with the last version of PatrikE run on the HK multiwii pro flight controller only D3 Red Esc / motor and servo D6 and D7 is not running no reaction.

But if I use an older version of PatrikE runs everything fine all servos are controlled. With version everything goes well.
MultiWii RTH Airplane - 140204.zip


Does anyone have any idea what I need to adjust so that both servos work?.

Greetings Rene

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

Re: Airplane mode RTH

Post by PatrikE »

To have servos on D6 & D7.
You need to comment
//#define MEGA_HW_PWM_SERVOS


#define MEGA_HW_PWM_SERVOS is uncommented as is default.
I think it's Pin 11 & 12 which isn't pinned out on your controller.

bubu10
Posts: 7
Joined: Sat Aug 09, 2014 8:08 am

Re: Airplane mode RTH

Post by bubu10 »

Which version of you is the now the last I known then times if it goes there.

Is actually already waypoints fly? with your version ?? and which win gui should I use've tried and always comes ne error message.

Greetings Rene

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

Re: Airplane mode RTH

Post by PatrikE »

Only the latest dev's from my branch supports Using D7.
FixedWingNav_Dev branch

FW_Nav_1140402
supports only RTH & PosHold.

MultiWii_FW_EOS_b7_140509
Merged with Fixed wing navigation.
Can fly wayopints but not verry nice.
Needs better PID to fly correct.

You should be able to use V2.3 MWiiConf Gui to my dev.

You can also check out the Howtoo's
Basic setup for Planes
Setup multiwii-gps-airplane

bubu10
Posts: 7
Joined: Sat Aug 09, 2014 8:08 am

Re: Airplane mode RTH

Post by bubu10 »

Patrik many many thanks it now runs so far now I struggle just with the KV Osd;-).

Greetings Rene

bubu10
Posts: 7
Joined: Sat Aug 09, 2014 8:08 am

Re: Airplane mode RTH

Post by bubu10 »

Hi Patrik

WIth this version (MultiWii_FW_EOS_b7_140509) I have the same problem on the D7 is not a servo driven only on D6 and D3 servo esc / motor.

With this version (FW_Nav_1140402) everything goes well outside testing was just RTH, POS. Hold everything works fine.


Why is that? can you tell me where I need to change something so it goes.

Greetings Rene

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

Re: Airplane mode RTH

Post by PatrikE »

In def.h.
Replace Rows 664 - 666
with

Code: Select all

  #define SERVO_4_PINMODE            pinMode (37, OUTPUT);pinMode(7,OUTPUT); // new       - alt TILT_ROLL
  #define SERVO_4_PIN_HIGH           PORTC |= 1<<0;       PORTH |= 1<<4;  // D7 added as new servoPort
  #define SERVO_4_PIN_LOW            PORTC &= ~(1<<0);    PORTH &= ~(1<<4);
This will add D7 as wing servo.

bubu10
Posts: 7
Joined: Sat Aug 09, 2014 8:08 am

Re: Airplane mode RTH

Post by bubu10 »

Patrik thanks

Although I had def.h after already read in but not known exactly where I need to change something.

Will test it tonight and report


Greetings Rene

bubu10
Posts: 7
Joined: Sat Aug 09, 2014 8:08 am

Re: Airplane mode RTH

Post by bubu10 »

Hi Patrik it works Thank you thank you:-) the maiden yesterday was great with the Teksumo everything works.

And I've just tried the version MultiWii_FW_EOS_b7_140509 have a few questions about it.

I have everything set for my board and when I activate the switch for rth or hold the baro is also active you do not turn off the? . Greetings Rene

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

Re: Airplane mode RTH

Post by PatrikE »

bubu10 wrote:I have everything set for my board and when I activate the switch for rth or hold the baro is also active you do not turn off the? . Greetings Rene

MultiWii_FW_EOS_b7_140509 uses MWii Altitude PID functions for altitude in GPS modes.(Experimental)

Just enable HORIZON + GPS mode for navigation.The Code handles Altitude internally.

Some observations i made during testing this dev.
Waypoints work But...
It have a Massive overshoot when navigating to Waypoint.
Navigation needs PID tuning or new PID routine.

Test carefully this is not as well tested as FW_Nav_1140402

/Patrik

brewski
Posts: 483
Joined: Tue Apr 29, 2014 12:04 am
Location: Cleveland Qld Australia

Re: Airplane mode RTH

Post by brewski »

PatrikE wrote:Only the latest dev's from my branch supports Using D7.
FixedWingNav_Dev branch

FW_Nav_1140402
supports only RTH & PosHold.

MultiWii_FW_EOS_b7_140509
Merged with Fixed wing navigation.
Can fly wayopints but not verry nice.
Needs better PID to fly correct.

You should be able to use V2.3 MWiiConf Gui to my dev.

You can also check out the Howtoo's
Basic setup for Planes
Setup multiwii-gps-airplane


Will it work for flying wing (ailerons only) & be able to use GPS for RTH with Crius V2.5 328P board?

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

Re: Airplane mode RTH

Post by PatrikE »

Normal planes (Cessna, Bixler/Easystar)
And
FlyingWings (ex. http://www.flyingwings.co.uk/index.php? ... uct_id=312 )
Or even canard planes
Image
You can also modify the Servo Mixer to suit your model.

ankimo
Posts: 30
Joined: Fri Jan 20, 2012 7:31 am

Re: Airplane mode RTH

Post by ankimo »

Hi PatrikE

I am using NanoWii and i2cGPS.
I want to display an altitude and a direction on OSD.
Where should the following code be added?

Code: Select all

    #define FORCE_ALT_DISPLAY  
    #define FORCE_HEADING_GRAPH


Regards
Kazz

Adrianm1972
Posts: 7
Joined: Mon Sep 23, 2013 10:24 pm

Re: Airplane mode RTH

Post by Adrianm1972 »

Patrik, I don't have my MultiWii plane flying yet but I'd like to know, do the airplane flight modes work like copter flight modes?

I fly Acro most of the time with my copters. After years of flying planes and helis with no stabilization Level and Horizon mode feel very strange to me. I don't like having to hold an input to maintain an attitude.

I don't see an Acro mode for airplanes. Horizon is great for cruising around but its weird for aerobatics.

Post Reply