Airplane mode

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode

Post by PatrikE »

The Howto guide can now be foud in the respitory as a PDF.

It will be on the blog at.
http://fotoflygarn.blogspot.se/2012/03/how-to-setup-multiwii-airplane-same.html

And the resitory (Will not be updated untill major changes )
http://code.google.com/p/multiwii/source/browse/#svn%2Fbranches%2FPatrikE

/Patrik

User avatar
UndCon
Posts: 293
Joined: Mon Feb 21, 2011 2:10 pm

Re: Airplane mode

Post by UndCon »

Cool - I will add a post on my site as well and link to your blog.

Now back to the Bixler build...motor replaced with a better one.
//UndCon

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Airplane mode

Post by Hamburger »

PatrikE,

we might consolidate Airplane and FlyingWing in the future? If you wanted the aileron control surfaces to become elevons (aileron + elevon), then we were there.

But I do not understand your mixing code.
FlyingWing uses

Code: Select all

       servo[0]  = PITCH_DIRECTION_L * axisPID[PITCH]        + ROLL_DIRECTION_L * axisPID[ROLL];

that is same as for most models (just not using the PIDMIX macro)
But for Airplane you use some other mix

Code: Select all

    servo[3]  =(servoMid[3] + (((axisPID[ROLL]) + (angle[ROLL]  /16)) *servoreverse[3])); //   Right Ail 

Now I am curious. Why do you add the absolute angle into the correction term?
Hamburger

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Airplane mode

Post by Alexinparis »

@PatrikE

I'm merging code.
some remarks:
1) you defined:

Code: Select all

    // To prevent motor to start at reset. atomicServo[7]=5 or 249 if reverseed servo
    volatile uint8_t atomicServo[8] = {125,125,125,125,125,125,125,5};
this can't happen as the servo pulse is software generated => no signal during the reset step. => I suppress it
2) I set MOTOR_NUMBER to 0 (do we really need to handle ESCs at 490Hz in a plane ?)
3) I remove things like USE ALL SERVO and use the convention based on: PRI_SERVO_FROM and PRI_SERVO_TO
4) I move plane servo definition from Multiwii.pde to Output.pde (the place where it should be)

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

Re: Airplane mode

Post by PatrikE »

Hamburger wrote:Why do you add the absolute angle into the correction term?

Your'e right it should work without Asolute angle.
I'll test in the evening.

It would make a easier mix to.

/Patrik

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

Re: Airplane mode

Post by PatrikE »

Hi Alex,

Alexinparis wrote:1) you defined:
CODE: SELECT ALL
    // To prevent motor to start at reset. atomicServo[7]=5 or 249 if reverseed servo
    volatile uint8_t atomicServo[8] = {125,125,125,125,125,125,125,5};
this can't happen as the servo pulse is software generated => no signal during the reset step. => I suppress it
2) I set MOTOR_NUMBER to 0 (do we really need to handle ESCs at 490Hz in a plane ?)
3) I remove things like USE ALL SERVO and use the convention based on: PRI_SERVO_FROM and PRI_SERVO_TO
4) I move plane servo definition from Multiwii.pde to Output.pde (the place where it should be)


1: The problem isn't the reset but the Boot when it will set Half trottle... (Can be scary... I have tested it!)
2: Just a theory i had.....
3: Another Theory i wasnt really plased with.
4: Check the last update i made to day in my branch to day.
I have changed the servo definitions in it already and added the settings to Config.h.

I will also do some rework on the mix as Hamburger made a remark on.
And adust the Howto acording to the new servo definitions.

Happy Coding...
/ Patrik

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

Re: Airplane mode

Post by PatrikE »

I have removed the absolute angle from the mix.
It can explain some problems i had to trim Level mode.

The HowTo is updated.
http://fotoflygarn.blogspot.se/2012/03/ ... -same.html

we might consolidate Airplane and FlyingWing in the future? If you wanted the aileron control surfaces to become elevons (aileron + elevon).

Yes and also Flapperons.. (aileron + flaps)

/Patrik

Exyator
Posts: 6
Joined: Thu Mar 29, 2012 3:39 pm

Re: Airplane mode

Post by Exyator »

Hi all,
I'd like to try airplane mode on my FPV Skywalker. I have the cheapo HK-T6A radio from Hobbyking and i ruined my programming cable, so I'm not able to reverse any channels...
Is it possible to reverse the ELE channel in the multiwii code (without changing the gyro direction)?

Thanks in advance,
Exyator

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

Re: Airplane mode

Post by PatrikE »

It's possible to do...

Rotate the gyro 180 degrees.. CW or CCW( Do Not flip it over... )
It will reverse the Elev.
It will also reverse the ailerions..

If you didn't change the servosettings for reversing.
servo[3] is the same as servo[4] but inverted inverted.

Code: Select all

#define SERVO_DIRECTION  {  1,   1,   1,   -1,  1,   1,   1,   1 } // Invert servos by setting -1 

Code: Select all

    servo[3]  =(servoMid[3] + (axisPID[ROLL]  * servoreverse[3])); //   Wing 1 
    servo[4]  =(servoMid[4] + (axisPID[ROLL]  * servoreverse[4])); //   Wing 2
    servo[5]  =(servoMid[5] + (axisPID[YAW]   * servoreverse[5])); //   Rudder
    servo[6]  =(servoMid[6] + (axisPID[PITCH] * servoreverse[6])); //   Elevator

Then you can move the wingservo to the other wingchannel.
If you use both channels just swap Left and Riht.

Change ditrections in TX To match.

Worth a try...
Otherwise you must get a new cable....

God luck.
/Patrik

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

Re: Airplane mode

Post by PatrikE »

The AriplaneMode is updated with a flapperon function.
Download From Branch.

Updated HowTo Guide.

/Patrik

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

Re: Airplane mode

Post by msev »

When talking about the GPS RTH, we have to take into account the accuracy of gps,...so how much meters is the gps inaccuracy concerning altitude? Its within 20m right.. Will the plane fluctuate in altitude or will the altitude somewhat be smoothed out, I don't know how much the gps altitude value fluctuates...

For a plane magneto and baro aren't strickly needed right?
Patrik you are working on plane rth right, thanks for your work! hope eosbandi will also help with the development...Will it also be like a pid loop style controller?

I asked this in the following thread but didn't get a response so I'll ask here again: "I'm planning to buy a Mega board, which has I think 3 serial ports, can I use multiple serial ports at once? For example I would use one to connect my serial gps, another to connect the osd to arduino and the third one to connect a bluetooth module?"

Thank you guys for all the nice work you are doing! Its great! Really mind-blowing!

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

Re: Airplane mode

Post by PatrikE »

The plans for the day was testing Gps on the plane....
But it's way to windy to test new features... :o

A small update instead...
The navigating will be possible using.
Gyro,Acc & Gps.

Mag is optional and the heading data can be used from it.
Baro Will not be handled.

I'm also making it possible to use GPS_SERIAL on a Pro Mini.
The Gui It will be disabled when Gps is used.
//#define GPS_PROMINI // Will disable Gui!.....


Fly to target:
Find shortest way to the target.

Altitude:
The accuracy of GpsAltitude is a issue.
The plan is to try to stay within 5meters.

Cruise controll:
Try to keep a preset speed and compensate for altiudeCahnges.
A windspeed guage would be better to use than Gps.

I have everyting under controll on the testbench. :D
Time to se what reality say... :o
There's probably lots of tuning to do and.....

Just to se when the weather gets better. (Forecasts don't look promising!)

I feel the need of a RC-Car for testing right now..;) ( Autonomous MWii RC-Car... )

/Patrik

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

Re: Airplane mode

Post by msev »

Great! Hope you have a "hat cam" so yoi can make a video of the testing :D

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

Re: Airplane mode

Post by msev »

Will you make baudrate and refresh-rate for gps selectable? Which will be the default settings? I ask this because I have an arduino lm1881 based osd and it will share gps with multiwii board...

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

Re: Airplane mode

Post by PatrikE »

Only thing i will preset is the serial port if ProMini is selected.
Baudrate is a setting.
I make no changes in gps reading.
For some of the functions it will be update rate to smoothen things a bit.
Otherwise it will read data from gps as it comes.

I have done some test and it do return home now....:-)
Its some tuning left to do.

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

Re: Airplane mode

Post by Kayle »

I have done some test and it do return home now....:-)


That´s awesome. For the "Final Version", do you plan to add "auto circling at home" ?

Kayle

frog32
Posts: 55
Joined: Sun Nov 20, 2011 9:39 pm

Re: Airplane mode

Post by frog32 »

Does it navigate rudder only? Or do you bank the plane? I'm just thinking about flying wings.

Marc

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

Re: Airplane mode

Post by PatrikE »

Current state.
Really simple navigation aim at home pass home aim again untill someome say else or battery run flat...
Basicly fly in loops around homepos.( In theory a flat eight. ) :roll:

I do the tests with a plane without rudder.
So yes there is a setting to select rudder or ailerions for navigation..

Both plane and flying wing will work with this.
Its a Fixed Wing Nav

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

Re: Airplane mode

Post by Kayle »

VOTE for Video :-)

Kayle

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

Re: Airplane mode

Post by PatrikE »

Kayle wrote:VOTE for Video :-)

Kayle

Maby to night... ;)

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

Re: Airplane mode

Post by PatrikE »

Sorry no video.
I tried but it was no god.
A plane flying cirkels 100m up for 10 minutes is no fun.

But I uploaded a Beta in the resp instead.
Download FixedWing_Gps_B1.rar

There's 3 functions.
RTH.
Position hold.
Auto speed controll.

Settings in Gui.
GPS.
P = Amplifier of direction error
I = Set altitude to return to in Km over homePos
D = Limit maximum banking.
Level mode Must be enabled together with gpsmode.
---------------------------------------------

ALT
P = Amplifies altitude correction.
---------------------------------------------

Use CheckBox BARO to enable automatic cruiseControll
On a separate switch or combined with RTH.
VEL Handles speed
P = Delay throttle compenstion.
D = CruiceSpeed to hold.
---------------------------------------------


Setings to change in config.h

Code: Select all

#define MINTHROTTLE 1000  // For FixedWing To stop motor in Armed mode.
#define MAXTHROTTLE 2000  // To reach full throttle
#define MINCOMMAND  1000  // For FixedWing To stop motor.

#define CRUISE_THROTTLE   {1200,1800}  // Limit  Min & Max throttle for Automatic cruise controll.

#define GPS_DIRECTION  { -1, 1, 1}  /* Set zero to disable invert with -1. */


And I added support for Gps with ProMini.

Code: Select all

    //#define GPS_PROMINI_SERIAL    56700 // Overides everything on serial(0)on ProMini!... Will disable all Gui functions!.....
Enable and set baudrate.

Hope You guys try it..
But i warn you....
It's the most boring plane iw'e ever flown.. 8-)
Speaking with my neighbur and the hands in my pockets for 10 minutes looking in the air.

/Patrik

frog32
Posts: 55
Joined: Sun Nov 20, 2011 9:39 pm

Re: Airplane mode

Post by frog32 »

Sounds great for a safety return to home on a fpv plane. What's the needed setup? gyro, accelerometer, gps? or do we need something else?
My flying wing isn't finished and then i need to port this to stm32 because it's what will drive my plane.

Marc

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

Re: Airplane mode

Post by PatrikE »

The bare minimum to fly with Gps is.
Gyro, Accelerometer & Gps.
The system must be able to fly the plane in level.
The Gps only handles the navigation.

If GpsFix is lost the system fall back to level flight.
Atm it will contiue to where the nose points...
Should be Cirkle around untill new GpsFix.

A mag will be used if it's in the system to.
Baro is not handled.

When the Beta is tested and verified..
Some idés on other functions for Fpv could be god to add..
Geofence.. Max range from home ex. 500m
MinAlt.. Lowest altitude allowed in FpvMode
Bail out.. Climb fast to to rth alt before rth.
Scout.. Hold altitude and cruiseSpeed automaticly and just fly around using rudder.
AutoFlaps.. Automatic flaps based on speed and the need to gain altitude.

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

Re: Airplane mode

Post by Kayle »

Hi Patrik,

Thanks for the beta. I will test it with a diy imu itg3205, adxl345 and a flytron gps modul + arduino pro mini. I see i don't have to use i2c gps ? I can use serial gps instead of the gui?

Kayle

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

Re: Airplane mode

Post by PatrikE »

Kayle wrote:Hi Patrik,

Thanks for the beta. I will test it with a diy imu itg3205, adxl345 and a flytron gps modul + arduino pro mini. I see i don't have to use i2c gps ? I can use serial gps instead of the gui?

Kayle

Correct. ProMini with Gps on serial.

BUT
You will loose possibility to debug with Gui.. :(
But i have done all testing usuing.
#define GPS_PROMINI_SERIAL
And lots of trial & error.. :?

To change settings in gui.
1: Comment #define GPS_PROMINI_SERIAL
2: Upload
3: Make changes in gui
4: Uncomment
5: Upload and test...

Not optimal but it's a QuickFix

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

Re: Airplane mode

Post by msev »

Awesome man! Which gps do you use Patrik? And at what baud and refresh rate?
I'm thinking for Bail out, if plane would be above that altitude it should maintain that higher altitude not go on that set altitude, there should be an exception made.

Next stop, waypoints hehe :D

Patrik I have a hipotetical question for you, maybe you could test it out...If you just use only leveling (without gps) and cut the throttle to zero, will accelerometer maintain the plane level till it touches the ground, or will it bank because it stalls?

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

Re: Airplane mode

Post by Kayle »

@patrik

Ok, but i can use also i2c and use at the same time gui?

Kayle

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

Re: Airplane mode

Post by PatrikE »

@Kayle
Short anwer..
YES!...

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

Re: Airplane mode

Post by Kayle »

Thanks

Kayle

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

Re: Airplane mode

Post by PatrikE »

@msev

I use This module
5hz @ 56700baud

I think EosBandi have waypoints in his new gps code?..
It´s just to adapt it.

If i cut throttle in level mode my plane keep level on the wings.
When speed drops it sinks slowly.
Probobly untill it lands somewhere.
If you have problem with stall you can set some accTrim to keep speed up. ( depends on model )

But often theres some upwinds and it can soar for a looong time.

My idé about Bail out was if youre close to the groud and lost video!.

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

Re: Airplane mode

Post by Kayle »

Litte OT question:

I have an osd gps. Can i use the same gps ( only tx line from the gps ) for rth function? Or do i need a seperate gps ?

Kayle

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

Re: Airplane mode

Post by PatrikE »

My code only uses the generic Gps data already in MWii.
If you can connect the tx line from the gps to the promini it should work?!...

Only one way to find out...
When you have GpsFix The status LED will blink rapidly when motor is NOT ARMED.

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

Re: Airplane mode

Post by PatrikE »

And Remember....
PassThru will always override everything and abort.

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

Re: Airplane mode

Post by Kayle »

Ok. Can i use sumppm for plane mode and passthru?

Kayle

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

Re: Airplane mode

Post by PatrikE »

If you have a free AUX channel you should set passthru.
I use ppm with 8ch and setup my 3way switch
low= passthru, mid= gyro, hi= acc.

I had some problem with the height controll today I must take a better look on that part. :cry:

frog32
Posts: 55
Joined: Sun Nov 20, 2011 9:39 pm

Re: Airplane mode

Post by frog32 »

On which version did you build your code? i tried to diff your code and MultiWii_dev_20120504. I found quite a lot of changes.

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

Re: Airplane mode

Post by PatrikE »

It's based on Mwii_shared in trunk.

didlawowo69
Posts: 38
Joined: Tue Oct 11, 2011 1:42 pm

Re: Airplane mode

Post by didlawowo69 »

do you know when release airplane will be integrated in main release of MW ? in 2.1 ?

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

Re: Airplane mode

Post by PatrikE »

The airplane is included in MultiWii_dev release in download area.
downloads

Point65
Posts: 9
Joined: Fri Jan 28, 2011 9:37 pm

Re: Airplane mode

Post by Point65 »

:D A short video after today's test with my Pitts Python using Multiwii in Airplane mode. It's on rails!!
Thanks to all that made this possible.
/Bo :lol:
http://youtu.be/pyeUEpfZmhM (Select HD)

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Airplane mode

Post by Hamburger »

Bo,
- size of plane,
- sensors,
- settings
please?

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

Re: Airplane mode

Post by PatrikE »

8-)
You can really se the gyro working with the elevator..

/ PatrikE

Point65
Posts: 9
Joined: Fri Jan 28, 2011 9:37 pm

Re: Airplane mode

Post by Point65 »

Hamburger wrote:Bo,
- size of plane,
- sensors,
- settings
please?


Hi,
It's about 1000-1100mm wingspan and I used my Multiwii controller from a quad. Original WMP with P=2. No ACC.
I have some vibrations causing the excessive elevator movements in the video at full trottle. So maybe 1,5 or
some smoothing whould limit the movments. From the ground the plane feels rock solid.
I use the early code that was based on 1.9 (still have some upgrade & testing to do.....)
/Bo

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Airplane mode

Post by Hamburger »

You can set pid.attenuation in gui to 0.5 to lessen gyro noise effect for throttle above 50%

frog32
Posts: 55
Joined: Sun Nov 20, 2011 9:39 pm

Re: Airplane mode

Post by frog32 »

Any chance getting the fixed wing navigation so use separate variables in gui not using some unused ones? I don't have a flying plane right now so i can't help testing until my flying wing is completed.

krzysztof21
Posts: 3
Joined: Thu May 31, 2012 7:26 pm

Re: Airplane mode

Post by krzysztof21 »

Hello,
The airplane is included in MultiWii_dev release in download area.
dev_20120528

Is there a mistake in recognizing WMP + NC. In version 2.0 works fine but there is no choice for WMP + NC.
While defining dev_20120528 added to WMP and NC, and now soft does not correctly detect this configuration.

What a pity :( there is Airplane mode

frog32
Posts: 55
Joined: Sun Nov 20, 2011 9:39 pm

Re: Airplane mode

Post by frog32 »

Yes airplane mode is included but not fixed wing navigation.

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

Re: Airplane mode

Post by PatrikE »

In the newest Dev wmp and nb is not default.
They must be defined as any other sensors.

It saves some memory if other sensors is used

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

Re: Airplane mode

Post by Kayle »

Yes airplane mode is included but not fixed wing navigation.


Only Airplaye Mode is included ? So i can´t use my Wing with GPS and RTH ?

Kayle

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

Re: Airplane mode

Post by rbirdie001 »

Hi Guys,
maybe not exactly the right thread but this one seems to live and my question is quite related... ;)
I just added MultiWii stabilization to my flying wing (1,2m wingspan, 800g) and it works almost perfectly but...
I use 1.9 because I had only Arduino168 in the drawer and this is the last one which fits to arduino168, but I don't know if there is significant diff between 1.9 and current version in flying wing code. Only WMP clone, no NK. Firstly I tried P=2, I=0.010 and D=3. In passtrough mode worked normally and I mechanically trimmed plane to have plane well trimmed at AIL+ELE sticks about 1500. When I activated stabilization, plane started roll left and pitch up, I had to set 8 trim beeps to right and 3 down to correct it. Then stabilization worked almost fine. As sometimes tended to oscillate, I reduced to P=0 and because I suspected "I" windup to make it outtrim, I also reduced I=0. Behaviour improved but even with I=0 I still have to trim at least 5 beeps after passtrough/gyro change to keep plane straight. On the GUI there are all GYRO values 0 when the plane isn't moving.
Does anyone noticed this? Any ideas how to correct it? Are there improvements between 1.9 and current dev. version in flying wing mode? (My arduino 328 is on the way :D )
Thanks!
Roman
Edit: I just again played with it on the table using GUI and found that this difference have something to do with trims. When AIL+ELE sticks are really centered at 1500 and no trim is aplied (but this is unreal, because foam plane is NEVER 100% trimmed with all trims at "0") this jump at switchover is really small. Even more interesting that when I applied PITCH trim and got ROLL error. :?: So another questions: Does anyone understand and can "deadband" help there?

Post Reply