torsdag 26 april 2012

Multiwii Helicopter


How to setup a Multiwii Helicopter
                     updated 2012-05-14
            (New way to setup the Swash mixer)

This Guide is not fully uptodate to V2.3.
In general it is correct but most servosettings can be configured from Gui now.

Same Hardware as a MultiWii copter.
Arduino PRO MINI. 5V 16MHz or Arduino  Mega.
- Gyro Ex Nintendo Wii motion plus.
- Accelerometer.
Acc only needed forAutoleveling.


The code can handle 120 & 90 degree heads.


Connect servos to the Arduino.


 If you use a Mega Board you need to comment
//#define MEGA_HW_PWM_SERVOS
Otherwise Servos will be different pins







Connection diagram 120°






Connection diagram 90°








Setup Transmitter
Set TX channels to full rates it shoud reach between 1000-2000us in the Gui.
Correct the servo directions in the TX.


ServoMixer
In config.h
     // Servo mixing for heli 120  Use 1/10 fractions (ex.5 = 5/10 = 1/2)
    //                                        {Coll,Nick,Roll}
    #define SERVO_NICK    { +10, -10,  -0 }
    #define SERVO_LEFT    { +10, +5, +10 } 
    #define SERVO_RIGHT { +10, +5,  -10 }  
    Invert each function by change from + to -.
    The parts of the mixer is. ( Collective , Nick , Roll  )
    Adjust the Nick mixing so swash don't move up or down when tilting.


   // Servo mixing for heli 90 
   //                                                     {Coll,Nick,Roll}
   #define SERVO_DIRECTIONS {   +1,   -1,   -1   }          // -1 will invert servo


!! Important Note !!
In versions after dev-06-04 there's been a change.
It's effecting GyroSmoothening and Servo_offset.
If you change any of the values in the ConfigFile The RESET button in the Gui
must be pressed before the changes will be applyed!.


 Swash Angels
    Adjust the midpoint offset to trim the swash level.
    #define SERVO_OFFSET     {  0,   0,   0,  0,   0,   0,  0,   0 }
GyroSmootening
Helicopters is known to create lots of different vibrations.
If the gyros feels oversensitive (Hysteric) Try smoothing.
#define GYRO_SMOOTHING {20, 20, 3} // separate averaging ranges for roll, pitch, yaw.
Values must never be below 1.
Increase the values untill it feels right.

The most settings is done  in  Config.h .
*********************************************************************************

// Channel to controll CollectivePitch
#define CollectivePitch AUX1   // Selectable channels: ROLL,PITCH,THROTTLE,YAW,AUX1,AUX2,AUX3,AUX4

// Set Maximum available movement for the servos. Depending on modell.

#define SERVO_ENDPOINT_HIGH {2000,2000,2000,2000,2000,2000,2000,2000};
#define SERVO_ENDPOINT_LOW  {1020,1020,1020,1020,1020,1020,1020,1020};

// Limit the range of Collective Pitch. 100% is Full Range each way and position for Zero Pitch
#define CollectiveRange { 80, 1500, 80 }    // {Min%, ZeroPitch, Max%}.
#define YAWCenter             1500       // Use servo[5] SERVO_ENDPOINT_HIGH/LOW for the endpoits.

#define YAWMOTOR                0       // If a motor is use as YAW Set to 1 else set to 0.

// Proportional throw for Roll & Nick  in 0-100%  or more.
#define ControllRange   { 100, 100 }      //  { ROLL,PITCH }

NOTE!
All changes made to settings to servos in config.h...
Require that you press reset button in gui to accept from config.h
********************************************************************************
SERVO_ENDPOINT
Will limit the absolute maximum servotravel.
Should be set to stop servos to travel to far.
You dont want to stall the servos.

Servos
Totally 8 servos is available.
Default mix uses.
3 Swashservos
1 YawServo (alt. esc for Yawmotor)
1 Trottelservo or esc.
There's 3 free servos to use. A0,A1 & A2
For use of a gimbal or other functions.
The mixes in outputfile can be modified for more advanced setups.

Passthru
Sends Rc commands direct to servos.
Not recomended on a FBL!...

GyroMode
The model should feel stable but can still be flown advanced.

AccMode
Levels the model when sticks is in center.
LevelMode also limits how much the model can tilt.

Preflight setup
After you have changed the servoRates in the code
you can set Dualrates, Expos and curves in the Transmitter.
Engine must be Armed to prevent motorstart by accident..
Should be Armed from AXU-channel if it's setup in the gui (KillSwitch)
Or with stick combination min throttle & max rudder.


First Flight.
Take of in Passthru.
Switch mode on safe height.
Activate Assisted modes and feel the difference.
Initial settings for my first testflight.

Level-P value will Reduce the maximum throw in Level-Mode.
P=9 Will give similar throws as Gyro-Mode.


26 kommentarer:

Unknown sa...

Hello
Do you have some experience with the Version 2.3 ore the nav Version
-450 Helicopter FBL
-crius AOIP V2

Thanks a lot for your Inormation

MABA

Patrik sa...

I have not flown Heli on newer versions my self.
But from the MWii forum it seems to work fine.
Some of the settings have been moved to Gui since this Howto was written
and it's now quite outdated.
The setup is similar but handled from Gui instead to make it easier.

Unknown sa...

Hi,

First of all, many thanks for you code and contributions to this very smart but complex MW code. The question I have and have not yet managed to get an answer to, is where do I map the pins of my FC to the right servos, say for Helicopter? There seems to be a generic set of servos(1-8) defined in the code but its really hard to see where the mapping between these and the right ports(pins) on the FC is done. I'm trying to setup a Heli 120 using AIO board have found out that the servos will work with ports 6(YAW),7,11,12, but no idea why. Will really appreciate any help..

Thanks

Patrik sa...

If you use a Mega Board you need to comment
//#define MEGA_HW_PWM_SERVOS
Otherwise Servos will be different pins
D7 isn't available in V2.3 but is added in next release.
Or you can download the FixedWing Nav
https://multiwii.googlecode.com/svn/branches/PatrikE/FixedWingNav_Dev/FW_Nav_1140402.zip

Unknown sa...

Commenting the
#define MEGA_HW_PWM_SERVOS
line worked and now I have the right servo pin mapping except D7 that you rightly pointed out is not available/working. I will try the FixedWing Nav code you suggested.

Many Thanks

Unknown sa...

Hi,
Is it possible to get some hint/help as to how to reverse the servo directions?(FixedWing Nav code)
The GUI doesn't seem to work and its obviously much better to know how to do it in the code!!
Below line doesn't make any of the servos reverse direction.
#define FORCE_SERVO_RATES {30,30,100,100,100,100,100,100} // 0 = normal, 1= reverse

Also any help in understanding what the #define SERVO_NICK { +10, -10, 0 }

line does? Couldn't see the impact by changing from + to -, so a bit confused.


Many thanks in advance

Patrik sa...

Hi Mas Mod,

Servo settings is saved in Eeprom.
All changes of servos settings made in config.h...
Require that you press reset button in gui to accept from config.h

#define SERVO_NICK { +10, -10, 0 }
It is mixing 100% Collective + 100% inverted Nick to the Nick servo.

Basicly collective Pitch + Nick control.

I'm going to update this guide to V2.3 but you can look at Airplane guide how to use Gui for servos.

http://fotoflygarn.blogspot.com/2012/03/how-to-setup-multiwii-airplane-same.html

Unknown sa...

Thank you. This is very helpful.

Unknown sa...

Just one more question. What version of GUI would have this reset button you're referring to?(I thought Write command will do the same, but have not seen any reset function/button in GUI 2.3, nor a servo tab?)

Hope this is not a very dumb question to ask here!

Patrik sa...

Use the Gui for V2.3.
Below the PID settings is a Read And a Reset button.
The Tab for servos will show up when the Gui is connected to the Controller correctly.
Select Comport in the list.
Press Start + Read.
The values and tabs for your model should appear then.
Sometimes you need to press read button repeatedly.

Unknown sa...

Thank you. My mistake was that I was using Multiwii GUI instead of MultiwiiConf. Now its working as you'd suggested above.

Many Thanks

Unknown sa...

Hi,
Hopefully this is my last question!!
I'm using AUX2 as COLLECTIVE_PITCH.
My servo mixing works fine as expected :
#define SERVO_NICK { +10, +10, 0 }
#define SERVO_LEFT { +10, +10, -10 }
#define SERVO_RIGHT { -10, -10, -10 }
However, when I increase the Throttle stick, the swashplate servos start moving slowly and gradually resulting in a tilted swashplate. (Right servo moves up, Nick and left go down..)
I have no mixing in the transmitter and have used different rx and even controllers but still see the same.
Once again, any idea as to why this is happening will be greatly appreciated.
Thanks

Patrik sa...

The first column controls the collectiv function.
I guess your settings should be like this.
#define SERVO_NICK { -10, +10, 0 }
#define SERVO_LEFT { +10, +6, -10 }
#define SERVO_RIGHT { +10, -6, -10 }
You can't have 10 on the Nick for the side servos.
It will be wrong geometry on the swash.
5-6 is normal.
When you move the cyclic the swash should not move up or down the shaft.If it doe's you need to change side servos until it's as good as you can get it!
Otherwise the copter will react stange in flight.

Unknown sa...

I've modified the settings and tested with +/-5 for the side servos instead of 10. However, the puzzle is that the Throttle increase, still results in moves by the cyclic servos. (Changing the values to 5 reduced the size of the movements but it's still there tilting the swash from the zero throttle state.)
I'm assuming that the Throttle change should in no way impact the cyclic servo movements directly, so can't understand why I'm seeing this.

I replaced the servos with another set(from analogue to digital), but still see the same.

This effect means that the heli can not take off as the swash will get tilted at high Throttle.
Is there anywhere in the code that Throttle input impacts the cyclic servos?(I'm not using the Gov feature)

Many Thanks for your input. (I think I'm almost there, just need to fix this last issue...)

Patrik sa...

@Mas Mod
Did you invert signs for Coll to?
SERVO_NICK & SERVO_RIGHT.
You need to change them to.
And press reset after you uploaded.

Unknown sa...

I just tested with inverted signs for Coll. The issue is still happening.
To add more clarity to the problem, when I increase the Throttle with the heli stationary and fully flat, the servos start moving away from their start up state. (Just noticed that this is also happening to the Tail servo and not just limited to the cyclic ones.) So the cause should not be in the mixing settings?

At zero throttle, everything gets back to normal...

Patrik sa...

I took a closer look.
In V2.3.
You only need to set the mixer values positive in config.h
And change directions in gui switching the reversing boxes
in the Gui servo tab.

When the mixing is correct.
The Checkboxes checked white
indicates a reversed servo.

Unknown sa...

Many Thanks for the spot on advice. When I used the Gui to reverse the Coll servos, the issue of cyclic servos moving away at high throttle is not there anymore.

I only have to address the Yaw servo, which is behaving strangely.

Almost there....

Unknown sa...

Hi,

Its me again!. After a long break I've gone back to get this to work. Now, everything works as expected swash movements, TX movement, etc. I'm trying this on a heli that flies well with off-the shelf Gyros but really want to see it can fly, at least take off, with multiwii(your code). I've used two separate boards one being a mega. I'm experiencing the same issue on both, which is violent shake up before it takes off(never takes off). The servos seems to receive jittery commands on high throttle. I've used filters to reduce vibration effect but nothing is making a difference. I'm using an ESC that can provide 7-10A, so power is not the issue.

Would really help if I could get some ideas as to what causes the continuous servo jitters that I see even sometimes when there's no commend given and heli is stationary!?
Also, is there any way to slow down the servo speed when a command is given? They seem to move too fast.(Some speed dampening will be ideal).

Thanks

Patrik sa...

#define GYRO_SMOOTHING {60, 60, 3}
adds extra filtering on the Gyros.
There is no settable servo speed in the code.
But both Helis and Flying wings would benefit from it.
I don't have any good solution atm.
There's a slow function on flaps code but i'm not sure if it is good for other functions.
Have you tried to use more Expo?

Unknown sa...

Hi,

I've not tried the Expo on this kit though in the past it didn't affect the servo speed just the response time. Will try out the Expo and see..

Where do I find the " slow function on flaps code " that you referred to?
I also think a slow function to control servo speed will make the code really powerful and more versatile, although the code is quite smart as is...

Many Thanks

Unknown sa...

Actually I think I've found out why my Heli does not take off, though don't know the cause. At high throttle, the left side servo goes down to its limit tilting the Swashplate fully to the left. This means the heli can not take off.

I have used two different transmitter, Spektrum and ORX. For both I have used heli and plane models, but still see the issue, which tells me it must happen somewhere in the code. The heli is stable and has no vibration prior to the servo's sudden move at high throttle.

Any hint or ideas on why this is happening will be greatly appreciated.

Thanks

Patrik sa...

It sounds like a overflow in the Mixtable.
Change these defs to int16_t
static int8_t nickMix[3] = SERVO_NICK;
static int8_t leftMix[3] = SERVO_LEFT;
static int_t rightMix[3]= SERVO_RIGHT;

I made a test with slow servos too.
Only for heli_120

In config.h
#define SERVOSPEED 0
0 = disabled 1 superslow.
100 = relatively fast

https://dl.dropboxusercontent.com/u/9750287/MultiWii/Heli/MultiWii_Slowservos.rar

Note!..
This is NOT tested in a model.
Only for testing on the bench until you are sure it really works.

Play safe!...
Patrik

Unknown sa...

Thank you. Can't wait to test(bench) and see....
Will try the servo slow function separately for fine tuning..

Cheers!

Unknown sa...

Hi,

Haven't managed to test the changes yet as the motor stops at high throttle. (Only spins at mid-stick...)

Was wondering if any of the changes are responsible?(Have tried different ESC and TX but still see the same..)

Thanks

Unknown sa...

Just an update. The int16_t change fixed the servo problem and the Throttle issue was related to the SERVOSPEED function which when removed, fixed the problem.
(Now I just need to deal with the vibration as the gyro tilt numbers increase over time even though the heli is kept stationary on the ground!)

Thanks