Helicopter integration

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
User avatar
AlouetteIII
Posts: 27
Joined: Tue Jan 25, 2011 2:34 pm
Location: AU Australia
Contact:

Re: Helicopter integration

Post by AlouetteIII »

Thanks PatrikE - :)

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

Re: Helicopter integration

Post by Hamburger »

I think the current implementation has a problem when collective center is set to != 1500, because with most ccpm one servo is mounted upside down, so its range is effectively [2000;1020] while the others hare [1020;2000].
The effect is if you move this center value away from 1500, one servo will move its zero position in other direction than the other two and trim is not suitable to correct this. (I like to have hover pitch (+3 degrees) at midstick=1500; leaves more tx stick travel for positive pitch - no inverted flying for me with 4-bladed head; that moves zero pitch to 1350)

@Patrik: any idea how to fix this?
It is not a real problem yet, as can I run {60, 1500, 60} and have a suitable pitch curve in my tx. It is only when I wanted to use the center value for the predicitve governor that I found out.

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

Re: Helicopter integration

Post by PatrikE »

Hi Hamburger,

Noticed the collective center did not work at all!
Try to change this line in Output.

from
#define HeliXPIDMIX(Z,Y,X) collRange[1]+collective*Z + heliNick*Y + heliRoll*X
to
#define HeliXPIDMIX(Z,Y,X) rcData[COLLECTIVE_PITCH]-collective*Z + heliNick*Y + heliRoll*X

Then you can set zero pitch to 1350.

/Patrik

stolidedog
Posts: 3
Joined: Fri Jan 11, 2013 4:21 am

Re: Helicopter integration

Post by stolidedog »

Hi,

I'm somewhat new to this. I have a Trex 450 FBL/DFC with Tarot ZYX-S. I also have a Witespy Multiwii 2.0 Pro with uBlox 6M GPS . I was wondering if it was possible to run this FC on my Trex? I'm interested in auto stabilize, hover, RTH mostly. Is it a pain to set up? I'm a little familiar with Arduino and how to make minor changes and compile and upload to the board. Is there any short instructions on how to do this?

Any help is greatly appreciated.

Thanks!

Bob

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

Re: Helicopter integration

Post by Hamburger »

Bob,
it is possible. I have been flying a 450 fbl with MWii for some time now. It works, just needs tuning of the parameters. The tail is like good rate gyro only. Patrik has linked to his setup guide in earlier post.
With dfc head you need phasing set differently, right? Should be possible by tweaking the 3x3 servo matrix. I have to do this for a 250 with dfc myself soon.

olaf45
Posts: 24
Joined: Sun Nov 25, 2012 11:38 am
Location: France

Re: Helicopter integration

Post by olaf45 »

Hamburger,

What do you mean with some "tweaks" for dfc. On my 450 with Tarot DFC head, I didn't make something special. Perhaps I need.

Olivier

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

Re: Helicopter integration

Post by Hamburger »

Olivier,
olaf45 wrote:What do you mean with some "tweaks" for dfc. On my 450 with Tarot DFC head, I didn't make something special. Perhaps I need.

I expect you need to set phasing differently? (see my previous post for how I think it must be done). Maybe I am wrong? Will find out soon.
If it already works for you, please confirm.

stolidedog
Posts: 3
Joined: Fri Jan 11, 2013 4:21 am

Re: Helicopter integration

Post by stolidedog »

Hamburger wrote:Bob,
it is possible. I have been flying a 450 fbl with MWii for some time now. It works, just needs tuning of the parameters. The tail is like good rate gyro only. Patrik has linked to his setup guide in earlier post.
With dfc head you need phasing set differently, right? Should be possible by tweaking the 3x3 servo matrix. I have to do this for a 250 with dfc myself soon.


Thanks Hamburger,

Are you referring to Patrik's config web page where you fill in the params of your board and generate a config.h? Yeah I saw that. I guess what I was after is a boiled down version of what to do. There is a lot of good information on this forum, but there is a lot of it over several posts, so it is unclear what exactly I need to do. It sounds like it is all at the early stages of figuring it all out. I think I'll wait a while for this to progress. I'm afraid my limited knowledge will just cause me a bunch of crashes and frustration because I won't know what I'm doing.

I'll just check back time to time to see how things progress.

Thanks again!

Bob


stolidedog
Posts: 3
Joined: Fri Jan 11, 2013 4:21 am

Re: Helicopter integration

Post by stolidedog »



Thanks Patrik,

I'll try this out and see how it goes and let you guys know what I have and what the results are.

Bob

Mystic3D
Posts: 31
Joined: Sat Jan 12, 2013 2:33 am

Helicopter integration

Post by Mystic3D »

You guys are brave!
Heli's and Flight Stabilization(FBL) is pretty refined. I am quite into Helis but would only trust a $3K Heli to a pretty proven system.

olaf45
Posts: 24
Joined: Sun Nov 25, 2012 11:38 am
Location: France

Re: Helicopter integration

Post by olaf45 »

Hamburger,

Hamburger wrote:I expect you need to set phasing differently? (see my previous post for how I think it must be done). Maybe I am wrong? Will find out soon.
If it already works for you, please confirm.


Please, can you give me the link to your post about the phasing. For me, there isn't any difference between FBL in DFC configuration and standard FBL.

Regards

Olivier

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

Re: Helicopter integration

Post by Hamburger »

olaf45 wrote:Please, can you give me the link to your post about the phasing. For me, there isn't any difference between FBL in DFC configuration and standard FBL.

Olivier,
if it works for you then do not worry. I was under the impression dfc heads needed the phasing done in software instead of having it in regular fb/fbl head layout. That was an assumption only.

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

Re: Helicopter integration

Post by Hamburger »

Mystic3D wrote:You guys are brave!
Heli's and Flight Stabilization(FBL) is pretty refined. I am quite into Helis but would only trust a $3K Heli to a pretty proven system.

For me it is 325mm helis, that will put it way below your $3k.
On the other hand my flying style is limited by my flying caps, so I enjoy the enhanced fallback/security from horizon mode.

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

Re: Helicopter integration

Post by Hamburger »

PatrikE wrote:Hi Hamburger,
Noticed the collective center did not work at all!
Try to change this line in Output.
from
#define HeliXPIDMIX(Z,Y,X) collRange[1]+collective*Z + heliNick*Y + heliRoll*X
to
#define HeliXPIDMIX(Z,Y,X) rcData[COLLECTIVE_PITCH]-collective*Z + heliNick*Y + heliRoll*X
Then you can set zero pitch to 1350.

Hi Patrik,
does not work well for me. Whatever signs I give to the collective column values for 3 servos in that matrix, two servos will always travel backwards for collective. It must be flawed somehow or I do not understand what you intend

some scaling put aside, you do

Code: Select all

collective = rcData[COLLECTIVE_PITCH]-collRange[1]; //how far from center value
#define HeliXPIDMIX(Z,Y,X) rcData[COLLECTIVE_PITCH]-collective*Z + heliNick*Y + heliRoll*X
servo[4]  =  HeliXPIDMIX( (leftMix[0]*0.1) , leftMix[1]*0.1, leftMix[2]*0.1) +conf.servoTrim[4] ;   //    LEFT servo


which basically equals

Code: Select all

#define HeliXPIDMIX(Z,Y,X) rcData[COLLECTIVE_PITCH]-(rcData[COLLECTIVE_PITCH]-collRange[1])*Z + heliNick*Y + heliRoll*X
or
#define HeliXPIDMIX(Z,Y,X) (1-Z) * rcData[COLLECTIVE_PITCH] -collRange[1])*Z + heliNick*Y + heliRoll*X


looks flawed with values for Z being +10 or -10?

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

Re: Helicopter integration

Post by Hamburger »

just food for thought, some 60% scaling put aside.
let us assume collective center = zero pitch is set to 1350 in collrange[1]
if tx stick is at 1350 we want zero pitch => collective == 0; ok.
Then the servo value must be 1350 for servos with positive collective value (+10) in column 0
and for servos with negative collective value (-10) it must be the equivalent which is 1500 + (1500 -1350)=1650.

If this makes sense, then maybe it is easier to use
collRange[1] = -150 // the offset from tx center
and
#define HeliXPIDMIX(Z,Y,X) 1500 + (collrange[1]*Z)/10 + collective*Z + heliNick*Y + heliRoll*X

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

Re: Helicopter integration

Post by Hamburger »

together with change to computation of collective variable submitted as r1313.
Works on the bench as expected - test flight pending weather permitting.

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Helicopter integration

Post by justk1w1 »

PatrickE, Hamburger,

After shelving the helicopter for 6 months - busy playing with multirotors - I'm now back to trying to get a 450 stable and in the air. Been reading back through all the information in this forum and was wondering if you guys could provide examples of your config setups. I'm attempting to setup both a flybar 450 and also a 4 blade 450. Some insight to your settings would be a great starting point. I do understand that each setup is different, but gives a good reference point when starting.
For the Flybar 450 I have set the collective range between 20% and 40% which equates to approx 0 pitch and +8 pitch, and adjusted the throttle expo in the GUI to give a good curve, but I'm not sure what the setting should be for the GYRO_SMOOTHING {40, 40, 30} for FBL and GYRO_SMOOTHING {1, 1, 30} for the FB?

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

Re: Helicopter integration

Post by Hamburger »

justk1w1 wrote:PatrickE, Hamburger,

After shelving the helicopter for 6 months - busy playing with multirotors - I'm now back to trying to get a 450 stable and in the air. Been reading back through all the information in this forum and was wondering if you guys could provide examples of your config setups. I'm attempting to setup both a flybar 450 and also a 4 blade 450. Some insight to your settings would be a great starting point. I do understand that each setup is different, but gives a good reference point when starting.
For the Flybar 450 I have set the collective range between 20% and 40% which equates to approx 0 pitch and +8 pitch, and adjusted the throttle expo in the GUI to give a good curve, but I'm not sure what the setting should be for the GYRO_SMOOTHING {40, 40, 30} for FBL and GYRO_SMOOTHING {1, 1, 30} for the FB?

I have no experience with MWii on a FB system, only FBL on 450 both 2blade (buried) and 4blade.
Settings - what is different from stock config.h - take your pick:

Code: Select all

/* for flased F40-A ESCs wii-ESC : */
#define MINCOMMAND 1008
#define MINTHROTTLE 1060  // 1080
#define MAXTHROTTLE 2000
#define EXT_MOTOR_RANGE

//#define MINTHROTTLE 1100
//#define MAXTHROTTLE 2000


#define HELI_120_CCPM
#define COLLECTIVE_PITCH      AUX2 //THROTTLE
// Set Maximum available movement for the servos. Depending on modell.
#define SERVO_ENDPOINT_HIGH {2000,2000,2000,2000,2000,1850,2000,2000};
#define SERVO_ENDPOINT_LOW  {1020,1020,1020,1020,1020,1230,1020,1020};
// Adjust Servo MID Offset & Swash angles // depends on coll.range zero.pitch :
#define SERVO_OFFSET        {  0,   0,   0,   0, -80,   0,  40,   0 }
//  0,1,2 nn                   nn   nn   nn nick left  yaw right  motor
//  3 nick
//  4 left
//  5 tail = yaw servo
//  6 right
//  7 motor

// Limit the range of Collective Pitch. 100% is Full Range each way and position for Zero Pitch
//#define COLLECTIVE_RANGE { 60, 1500, 60 }// {Min%, ZeroPitch, Max%}.
#define COLLECTIVE_RANGE { 60, -40, 60 }// {Min%, ZeroPitch, Max%}.
#define YAW_CENTER             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.

// Limit Maximum controll for Roll & Nick  in 0-100%
#define CONTROL_RANGE   { 60, 60 }      //  { ROLL,PITCH }
// 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 }

#undef HELI_USE_SERVO_FOR_THROTTLE
#define GOVERNOR_P 8
#define GOVERNOR_D 4
#define GOVERNOR_R 10


#define I2C_SPEED 400000L

//#define CRIUS_LITE home-made (180 deg rotated):
#define ITG3200 // gyro
#define ADXL345 // acc
//orig  #define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] =  Y; gyroADC[PITCH] = -X; gyroADC[YAW] = -Z;}
//orig  #define ACC_ORIENTATION(X, Y, Z)  {accADC[ROLL]  = -X; accADC[PITCH]  = -Y; accADC[YAW]  =  Z;}
// 180 deg rotate:
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = -Y; gyroADC[PITCH] = X; gyroADC[YAW] = -Z;}
#define ACC_ORIENTATION(X, Y, Z)  {accADC[ROLL]  = X;  accADC[PITCH]  = Y; accADC[YAW]  =  Z;}

#undef INTERNAL_I2C_PULLUPS

// 2

//#define YAW_DIRECTION 1 //1020-1700
// s306g-hv for yaw :
#define YAW_DIRECTION -1


#undef ALLOW_ARM_DISARM_VIA_TX_ROLL
#define ALLOW_ARM_DISARM_VIA_TX_YAW

// 3

#define RCAUXPIN8
#undef D12_POWER
#undef DISABLE_POWER_PIN

#define OVERRIDE_V_BATPIN                   A0 // instead of A3    // Analog PIN 3
#define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A2, OUTPUT); // was 8
// swap buzzer on and off ; used for permanent led lights
#define OVERRIDE_BUZZERPIN_OFF              PORTC |= 1<<2 //PORTB |= 1;
#define OVERRIDE_BUZZERPIN_ON               PORTC &= ~(1<<2); //PORTB &= ~1;


// 4

  //#define ITG3200_LPF_256HZ     // This is the default setting, no need to uncomment, just for reference
  //#define ITG3200_LPF_188HZ
    //#define ITG3200_LPF_98HZ
  //#define ITG3200_LPF_42HZ
  #define ITG3200_LPF_20HZ
  //#define ITG3200_LPF_10HZ      // Use this only in extreme cases, rather change motors and/or props

  #define GYRO_SMOOTHING {50, 50, 50}


// 5

#define BUZZER
#define RCOPTIONSBEEP        //uncomment this if you want beep at any rcOptions change on channel Aux1 to Aux4
#define ARMEDTIMEWARNING 420 // 8 min = 480seconds

#define FAILSAFE
#define FAILSAFE_DELAY     15
#define FAILSAFE_THR0TTLE  MINTHROTTLE //1700 // Throttle level used for landing


#define LCD_CONF
#define LCD_CONF_AUX
#define SUPPRESS_LCD_CONF_AUX34

//#define LCD_TEXTSTAR
//#define LCD_VT100
#define OLED_I2C_128x64
#define SUPPRESS_OLED_I2C_128x64LOGO
#define DISPLAY_FONT_DSIZE

#define LCD_TELEMETRY
#define LCD_TELEMETRY_AUTO "1!"
#define LCD_TELEMETRY_STEP "1!5%4$2@9R"
//#define SUPPRESS_TELEMETRY_PAGE_2 // sensor readings
#define SUPPRESS_TELEMETRY_PAGE_3 // checkboxitems
//#define SUPPRESS_TELEMETRY_PAGE_4 // rx inputs
//#define SUPPRESS_TELEMETRY_PAGE_5 // servo&motor outputs
#define SUPPRESS_TELEMETRY_PAGE_7 // gps
//#define SUPPRESS_TELEMETRY_PAGE_9 // cycle & fails

#define VBAT
#define VBATSCALE    129 // 130 // 121 //119 //123 // 130 // 150 // neue hohe Wrte fuer f40-a flashed mit wii-esc, vorher unflashed
#define VBATLEVEL_WARN1 101 // 10.2V unter Last
#define VBATLEVEL_WARN2  97 // 9.8V unter Last
#define VBATLEVEL_CRIT   91 // 9.6V unter Last
#define NO_VBAT          70 // Avoid beeping without any battery

#define POWERMETER_SOFT
#define PLEVELDIVSOFT 18100 // 21700 // 22400  // 16800
#define PLEVELDIV     PLEVELDIVSOFT

// 6

#define ACC_LPF_FACTOR 200 // 100 //1000

//And Gyro Weight for Gyro/Acc complementary filter
#define GYR_CMPF_FACTOR 600.0f //400.0f

//#define MOTOR_STOP

#define LOG_VALUES 2
//#define DEBUG


//#define LCD_TELEMETRY_FREQ 11       // to send telemetry data over serial 23 <=> 60ms <=> 16Hz (only sending interlaced, so 8Hz update rate)
#define LCD_TELEMETRY_AUTO_FREQ 1367 // to step to next telemetry page 967 <=> 3s

#define BOARD_NAME "Cx450-1313 V-.--"
//                  123456789.123456

// 7

#define LOG_PERMANENT 1023
#define LOG_PERMANENT_SHOW_AT_STARTUP
#define LOG_PERMANENT_SHOW_AT_L
#define LOG_PERMANENT_SERVICE_LIFETIME 36000

//#undef SERVO_RFR_50HZ
    /* up to 160Hz servo refreshrate .. works with the most analog servos*/
//#define SERVO_RFR_160HZ


#ifdef INTERNAL_I2C_PULLUPS
   #error "for freeimu from fax8, you MUST undefine internal i2c pullups. Else you destroy board!"
#endif

if you have no lcd, you best compile in lcd.tty so you can tune most of the extra params via the serial terminal from arduino IDE.
Attachments
CX450-20130102-r1295.jpeg

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Helicopter integration

Post by justk1w1 »

@Hamburger,

Thanks for that information - had a look through the config and just have a couple of ( probably really dumb ) questions about some of your settings:
You have the COLLECTIVE_PITCH AUX2 //THROTTLE - I assume then that you have one of the variable dials on the transmitter set to aux2 and control the pitch through this. Do you dial up a fixed pitch and then just adjust the throttle to control the height. I've been struggling with trying to get the throttle and the pitch to what I thought was a correct level - was using the collective range to limit the collective pitch (20,250,50) and the 250 value to move the zero pitch to match the head speed. Adjusting the head speed through the Throttle mid and expo to try to set a relatively incremental throttle. Would it be better to lower the 0 pitch through the servo offset?
Is there a way of setting the AUX2 to control the throttle and then using the throttle channel to control the pitch?? Would this be any advantage to the other way around?

Looks like I may have to reconfigure a 34U4 (leostick). I am currently using one of the HK HoobyBro MultiWii 328P boards, which does not have a good configuration for the aux channels

I have an xbee hooked up so that I can monitor the performance through the GUI - is there an advantage to using the lcd.tty? I assume I just need to uncomment the #define LCD_TTY and then connect over the xbee with the serial terminal in the arduino IDE

Is it possible to use some of the other features of MultiWII (gps hold, alt hold, headfree - given the required sensors attached) with the heilcopter integration.

Is a 4 blade head considered to be a fbl head? Just wondering if I should swap to the 4 Blade head.

Many thanks
Last edited by justk1w1 on Wed Feb 27, 2013 7:14 am, edited 1 time in total.

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Helicopter integration

Post by justk1w1 »

Trying to look for a way to reconfigure the board to allow for a second AUX channel. Unfortunately the d8 pin is not connected and the described aux 2 pin is connected to d12, which is used for the NICk servo - is it possible to swap the definitions in def.h for the SERVO_3..... and the
SERVO_4... (for the promini) which would then move the NICK servo from D12 to A2 and therefore free the D12 pin to be used as an AUX 2 channel. ( I know that this sacrifices the CAM Trig, but my soldering skills are not that great to try to reconnect D8 -i'll attempt this as a last resort :oops: )
Are there any other possibilities.

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

Re: Helicopter integration

Post by Hamburger »

on Spektrum radios in helicopter mode, both throttle and pitch curves are tied to the throttle stick. When mixing is set to 90deg in transmitter, then the pitch value is transmitted on the aux2 channel.

your xbee is replacing the serial/usb cable - that is very convenient. You can run both the GUI and the lcd.tty over that - just not at the same time. gui is with graphics, lcd.tty with lcd.conf is for tweaking some extra params.

Yes, heli is just another coptertype. So all features should work, provided you have the neccessary sensors etc.

4bladed head is without flybar, so it is FBL. No 3D with 4bladed head.

hkubota
Posts: 35
Joined: Wed Sep 05, 2012 2:48 pm

Re: Helicopter integration

Post by hkubota »

Hamburger wrote:
4bladed head is without flybar, so it is FBL. No 3D with 4bladed head.


Uh, is that a general statement or for MWC as controller?

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

Re: Helicopter integration

Post by Hamburger »

hkubota wrote:
Hamburger wrote:
4bladed head is without flybar, so it is FBL. No 3D with 4bladed head.

Uh, is that a general statement or for MWC as controller?

that would be my personal statements.
I have never seen a 4blade head with a flybar, mince certainly is FBL; and I think doing 3D with it is not appropriate. Ymmv.
If you do 3D with your heli + MWC, then please post video and tell us; I would sure like to know and see (and ask some questions).

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Helicopter integration

Post by justk1w1 »

Hamburger,

Sorry for all the questions - but really keen to get a heli up with MWC.

Thanks for your feedback - I have now made all the changes - had to switch to the Turnigy 9x as the Hitec 6 doesn't have a slider/dial control to control the pitch. Would it be better to have the throttle on the dial and the pitch controlled on the sticks?
Tried to adjust the SERVO_OFFSETS in config.h, but they don't seem to have any effect in pass through, whereas the other settings (COLLECTIVE_RANGE , CONTROL_RANGE) actually do - are the SERVO_OFFSET values for setting up the servo trim for MWC control modes and not pass_through. I understand that any trim adjustments on the transmitter would effect all modes, so do you used these settings to actually conteract the trim settings from the controller when it is another mode (LEVEL, HORIZON).

Using the 328p I moved the Nick Servo to A2 and then changed the settings to put Aux 2 on D12. After a lot of messing around with the 9x I managed to get everything working. Got some compile errors after enabling the Governor until I realised that I didn't have the vbat enabled - hadn't got to the point of connecting the battery monitoring yet. Have to go back through the pitch level setup as it currently looks to be heavily -ve biased with the 0 pitch to high.

No Fears with the 4 blade head and the 3D flying at this stage - going take me a little while to get to that point.

Thanks for all your help - off to do a bit more research on the 9x settings for 90 degree heli

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

Re: Helicopter integration

Post by Hamburger »

Tx usually have 2 swash modes for helis - straight passthru (sometimes called 90 deg) and ccpm (mixing for 3 or 4 servos done in tx). You want straight passthru from your tx - the mixing for 3 servos is done in the MWC.

Usually with tx in heli mode you have both pitch and throttle signals coming from the same throttle stick movement. your t9x should be able to do that too.

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Helicopter integration

Post by justk1w1 »

Hamburger,

I have setup the tx9 for 90 degree heli with the collective on aux 4 (ch8). I have then assigned aux 4 to a trim pot - this then gives me throttle control on the right hand stick (mode 1) and the collective control on the trim pot. I assume that this is the way that you have setup by the:

#define COLLECTIVE_PITCH AUX2

I guess that this would then make the machine more of a fixed pitch ( I adjust the trim for the desired collective blade pitch angle and then use the throttle to control height). The thing I was wondering about was if it would be better to be able to dial up the throttle to a set level and then use the pitch on the right stick to control the height - any suggestions?

I have just been back through and reset the servo 0 pitch, swash plate level and pitch 0.

Did a quick test of level mode - only moving the chopper by hand and the swash appears to try to level the chopper - now onto power up, check blade tracking and vibrations.

Any Idea about the servo offsets?? Is this just the trims for the modes or should this also effect the servos in pass through??

Thanks

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

Re: Helicopter integration

Post by PatrikE »

From your discussinon it seems you have never setup a Heli before.

The throttle stick controlls both Thro and collective.
It chould be mixed with ThrottleChannel as master and Collective(AXU4) will follow.
In heli mode you can make Thr and Coll curves in the Tx.

In MWii you can use Airplane Mode in TX.
Set #define COLLECTIVE_PITCH THROTTLE.
Use the Collective settings in config to set the zeroColledtive relative the ThrottleChannel.
Limit the throw on collective to get sitable Pitch angles
A suitable startpoint is about -1 to ~6 degrees for a beginner


Yuo can experiment with the branch i'm working on.
Most settings can easily be made from the gui.
svn/branches/PatrikE/Servotest.zip

Most settings is explained in the HowTo.
http://fotoflygarn.blogspot.com/2012/04/multiwii-helicopter.html

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Helicopter integration

Post by justk1w1 »

PatrikE

Thanks for the reply - you are correct I have not setup a heli "properly" before - my last attempt was as usual a jump into the fire, which resulted in a lot of frustration and the reason I shelved it for 6 months - to go back to the basics and test, build and fly multirotors. I'm still actually doing this, but having the 450 just sitting there got to me and I decided it was time to get it running.
I asked Hamburger for his config information, as I knew he had been through the setup, and noticed that he had COLLECTIVE_PITCH AUX2, which started me down the track of setting up and asking about heli90. I understand the standard approach is to have the collective tied to the throttle ( airplane mode ), but I was more just asking about the advantages of having the collective pitch on AUX2. - After thinking about this on the drive home have finally realised why his config is like this and why you have stated that - his TX automatically outputs the collective on ch8. Took a while but the panny has dropped :)

Thanks for the copy of your code - will definitely run it up and have a go.

Thanks

justk1w1
Posts: 62
Joined: Fri Jun 29, 2012 2:31 pm

Re: Helicopter integration

Post by justk1w1 »

Finally managed to get it all worked out - :shock: :shock: The turnigy 9x outputs the pitch control on aux2 when set to standard heli mode and acts like a heli90. Now I can independantly set both the throttle and pitch curves ... Wow that was a struggle - sorry for all the stupid questions guys. The only hassle I had was that the 9x has to have the throttle channel reversed which means that you have to set an inverted throttle curve.

PatrikE - Loaded up your code and used the MultiWii GUI - GREAT stuff - that is an excellent tool - that has save so much time with having to play with parameters and recompile, play- recompile, etc.

can we see this being expanded to include all parameters like control range, gyro smoothing, etc. Another possibility would be to add joystick i/p to control the servos from this?

Many thanks for that - hopefully a fine day tomorrow for a test flight. :D :D

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

Re: Helicopter integration

Post by PatrikE »

Did you notice that you can simulate rc input by pulling the TX sliders?

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

Re: Helicopter integration

Post by Hamburger »

just another success story - I managed to tune my rex250 FBL + original nanoWii prototype board + spektrum Satellite + detachable OLED. Actually it seems to get harder getting rid of vibrations the smaller the heli gets? For the 6050 sensor I had to enable the 5Hz filter. Here's some photos - no video jockey was present during the first flights
nanoWii prototype board as FBL controller
nanoWii prototype board as FBL controller

close up with OLED attached (satellite underneath)
close up with OLED attached (satellite underneath)

electron6
Posts: 5
Joined: Tue Mar 12, 2013 6:26 pm

Re: Helicopter integration

Post by electron6 »

Just another success story.
My first Multiwii project is a 450 size Heli controlled by Nanowii hardware. Its flying very nice.
But I have some general questions:

1.
ESC is connected directly to receiver. As actuators there are only the 4 servos connected to the Nanowii. So I dont care about arm/disarm. I alway fly in disarm state. Are there some disadvantages this way?

2.
If there are only servos connected and no ESC: is it recommended to undefine "HWPWM6" mode to increase software PWM precision?

3. At the end I'd like to control 6 servos in total. Which outputs are the best solution according performance/precision?
#define NUMBER_MOTOR 0 // no ESC
#define PRI_SERVO_FROM 3 // use servo from 3 to 8
#define PRI_SERVO_TO 8

Or is it better to use servo from 1 to 6?

Thanks a lot
Markus

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

Re: Helicopter integration

Post by Hamburger »

Wow, first MWii project and that being a helicopter!. Good to hear it works for you.
1. you cannot enter stick combos that require throttle signal. If you do not miss any functionality or want to attach a display for config@field, then if it works for you, ok.
2. & 3. dunno

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

Re: Helicopter integration

Post by Hamburger »

@Markus,
what params did you end up with?
Do you use gyro.smoothing or mmgyro; if so what values work for you?

electron6
Posts: 5
Joined: Tue Mar 12, 2013 6:26 pm

Re: Helicopter integration

Post by electron6 »

No gyro smoothing (I was playing around with smoothing, but this function was not working as expected. With smoothing there is almost no servo movement at all).
I set the LPF of MPU6050 to 20Hz. Result is pretty good.

PID Values are shown in attachment. In compare to others I have lower values. It's because mechanical setup: small servo movement results in a relative big blade angle movement. This is not the best way for flybarless helicopter, but it works acceptable.
I did not play with D-values yet. Thats next step.
Attachments
Unbenannt.jpg
Multiwiiconf2.1
(31.04 KiB) Not downloaded yet

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Helicopter integration

Post by Plüschi »

I have tried helicopter as well.
It's a 450 HK made from leftover pieces, with a 19$ nanowii from HK and a 11$ orange sat.

My PID values are very low, even lower than electron6 ones. I have 5hz 6050 filtering engaged, otherwise random servo shaking.
Heli flies very smooth in bypass or level mode, shitty in angle mode. Still some slow tail wag.
I will mount FBL head today and re-test pid values, until now it was a flybar head wich might cause the bad angle mode behaviour.

I did come over an issue in the code. The values for #define SERVO_LEFT and #define SERVO_RIGHT are not right.
instead of 10 in the roll part it should be 8.66 , but since it is an int can only be 8 or 9.
reason: col = 1, nick = cos 60, roll = sin 60, which is 1, 0.5, 0.866

Can someone update this in the source? Or can the factor be made into float or a higher res integer without overruns in the output calculation?

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

Re: Helicopter integration

Post by PatrikE »

Hi.

I had higher res from start but got calculation overflows i couldn't identify.
that's why the resolutuion is low.

It flies and the general intrest for the MIX has been low so i havn't put any more effort in it.
The Mixtable work as the multis.
You can test to insert floats in the table if you want to experiment.
Or in fractions 17/20 witch is 0,85

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

Re: Helicopter integration

Post by PatrikE »

This works and give more resolution and no overflow for me.
Replace the code in the Mixtable and you can experiment.

Code: Select all

 #define HeliXPIDMIX(Z,Y,X) 1500 + (collRange[1]*Z + collective*Z + heliNick*Y +  heliRoll*X)//  Remove >>/10
 
      #ifdef HELI_120_CCPM
     //   static int8_t nickMix[3] =SERVO_NICK;
     //   static int8_t leftMix[3] =SERVO_LEFT;
     //   static int8_t rightMix[3]=SERVO_RIGHT;

        servo[3]  =  HeliXPIDMIX( 1,   -1,      0) + servoMid[3]-MIDRC ;   //    NICK  servo
        servo[4]  =  HeliXPIDMIX( 1, +1/2,  17/20) + servoMid[4]-MIDRC ;   //    LEFT servo
        servo[6]  =  HeliXPIDMIX( 1, +1/2, -17/20) + servoMid[6]-MIDRC ;   //    RIGHT  servo
      #endif

Backside is it's less userfriendly.
You need to know more about coding than when you can change in config....
//Patrik

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Helicopter integration

Post by Plüschi »

In the helixpidmitx its calculated as int 16, so +- 32000. Values are +- 500.
500 * 8 / 10 is in the range, but 500 * 86 / 100 computes to 43000 so range overflow.
500 * 17 / 20 goes to 8500, no problem here.

On a second thought the values are for symmetrical left-right servos, and do not interact with nick, so it really doesent matter that much. I did put in a 9 and i am happy with it, the bird flies OK. I did actually a good 40 min "in the air" to adjust PID values, and hell does it fly nicely now. Thanks to whoever made this addition.

One question, i did try the aeroplane mode earlier, it uses soft-pwm code for the 50hz servos :(
Heli mode uses the same pins the esc uses, is it hardware pwm? If yes, how did you manage to do?

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

Re: Helicopter integration

Post by PatrikE »

It's no Rocket sience....
Planes uses servo[] 50hz
and helis use motor[] 490hz

Code: Select all

servo[7]  = rcData[THROTTLE]; //   50hz ESC or servo
....
motor[0] = rcData[THROTTLE]; // use motor output - ESC capable of 490hz


//Patrik

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Helicopter integration

Post by Plüschi »

Oh, then its soft pwm as well :(

I did manage to change the code to hardware pwm for the nanowii AVR_ATmega32U4 PROMICRO device.
This by using other prescalers on the timers to go from 490hz to 60hz. I had to change the channel sequence to make it nicer, swash servos are 0,1,2 (pin 9,10,5) the throttle on 3 (pin 6), then rudder on 4 (pin 11).

Oh ... untested in flight :) my usbee says its ok and the servos move :)

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Helicopter integration

Post by Plüschi »

I did test-fly the thing with hardware pwm and it flies. :mrgreen:
Cant really tell the difference to soft-pwm because i did not save the PID values and they got deleted :(

One issue is level mode. The heli has to be roll-tilted to compensate for tailrotor thrust in stationary flight. My solution was to calibrate ACC with a tilted heli, but this is very difficult to get right. Any ideas?

Another issue is the "arm" led. Works when connected via usb, doesent work when powered by the esc. :?:

btw i have all servos on 16bit timers at 60hz and esc on 10bit timer at 240hz. Going to 60hz on a 10 bit timer would make the resolution bad.

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

Re: Helicopter integration

Post by PatrikE »

Read about INFLIGHT_ACC_CALIBRATION
viewtopic.php?f=7&t=893

You can also add trim with stick combinations.

User avatar
Plüschi
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Helicopter integration

Post by Plüschi »

Cool :)

str8inpilot
Posts: 2
Joined: Wed May 15, 2013 11:19 pm

Re: Helicopter integration

Post by str8inpilot »

G'day,
I've been working on getting a 450 Pro FBL to fly for a few weeks, on and off. So far, I had the controls working correctly and all looked like it was going well. I had set the LPF to 10Hz, and got the servos to stop jittering. I can't do a test flight yet, because every time shake the heli or spool up the rotor, the system freezes and locks up the servos on a random position. It then ignores RC inputs. The latest is that the board (hobbyking NanoWii) now will not allow the GUI to run and the elevator and aileron inputs from the RC do not work. At this stage, I think I might have damaged the board or the RX. Possible cause: running all servo power through the RX common power. For any case, I now have to disonnect it all and try a different RX and a new board and see if I can get back to where I was.

Has anyone found and solved the problem with the servos locking? Was this able to be solved in the code? and if so, which lines?
Kind regards Str8inPilot. :)

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

Re: Helicopter integration

Post by Hamburger »

Not a known problem with v2.2.
Sounds like a hardware problem with the cheap HK nanowii clone.
You can try and disable some features and see if freezes go away.

str8inpilot
Posts: 2
Joined: Wed May 15, 2013 11:19 pm

Re: Helicopter integration

Post by str8inpilot »

Thanks for your reply, I initially started my little project of using multiwii for an FBL heli to improve my understanding of the system and as a small project to make use of a heli that I had lying around. At that stage I was not very optimistic that I would be successful with getting a viable, flying helicopter, so using a $20 board seemed appropriate. Some of the posted opinions and statements that I have read on this forum make me think that there are issues with some of the cheaper arduino boards from HK. Is there a genuine, quality board that you would be able to recommend to use on a CCPM heli to avoid these niggly issues like locked up servos and inconsistent usb comms when using the GUI on windows 7?

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

Re: Helicopter integration

Post by Hamburger »

I cannot comment on win* effects.
I have had usb-related troubles with various m32u4 based boards.
I have one 450 flying for 600+ minutes with a chinese crius lite board + oled lcd. Lucky, I guess. The original nanowii available from flyduino.net have good reputation for both product and service.

olaf45
Posts: 24
Joined: Sun Nov 25, 2012 11:38 am
Location: France

Helicopter integration

Post by olaf45 »

Hello,

After several months enjoying with my FBL in acro mode , I tested the level mode, which seems to work good when the engine is off, and the crash was very closed. The only things the heli want to do is the back flip . I don't understand. When the engine is stop and I move the hell, the correction is in the good direction.
Nevertheless, i notice when I move the heli beyond a specific angle the led blinks , and I don't why.
Coud somebody know the reason of the led blinking?

Thanks

Post Reply