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
darlofranco
Posts: 13
Joined: Sat Jun 18, 2011 4:16 pm

Re: Airplane mode

Post by darlofranco »

Thats great news Patrik, I would like to try in my AP plane. Can I ask which version of the code you use?

/Frank

cob
Posts: 37
Joined: Thu Jul 07, 2011 12:00 am

Re: Airplane mode

Post by cob »

Hi PatrickE and all,
I quote
I had problems using servo(3).
It moved with servo(1)
Maby something i messed up..


I experimented a lot in order to get ....5 servos working. Using a serial sumPPM I have Pin 4-5-6-7-8 free.
Using Motors output for servo needs to define a few things, here is what I did:

in config.h definition of Plane, Ihave not used the existing definitions (FlyingWing) in order to let that option as intended
This allows to define specific options in the soft for that Plane and nothing else.

then in def.h is some important definitions of functions regarding PIN assignments and code which will be used in Output.pde to send the correct command to the correct pin under that part:

Code: Select all

#if defined(PROMINI)

to which I added :

Code: Select all

#if defined(VTOL) && defined(PROMINI) 


so as to allow this new pin assignment only for my VTOL config using Promini board.

In that part Alex has used a direct writing mode not using the "digitalWrite" function. It goes like this:
PINs:
8:= PORTB |= 1<<0;
9:= PORTB |= 1<<1;
10:= PORTB |= 1<<2;
11:= PORTB |= 1<<3;

for my coding I did this as an example in def.h to have servos working on pins 4-5-6-7-8

Code: Select all

    #define DIGITAL_TILT_ROLL_PINMODE  pinMode(4,OUTPUT); //VTOL Roll et Pitch  Flying wing out on Pins D5 and D6
  #define DIGITAL_TILT_ROLL_HIGH     PORTD |= 1<<4; //VTOL
  #define DIGITAL_TILT_ROLL_LOW      PORTD &= ~(1<<4); //VTOL
  #define DIGITAL_TILT_PITCH_PINMODE pinMode(5,OUTPUT); //VTOL
  #define DIGITAL_TILT_PITCH_HIGH    PORTD |= 1<<5; //VTOL
  #define DIGITAL_TILT_PITCH_LOW     PORTD &= ~(1<<5); //VTOL
  #define DIGITAL_TILT_VTOL_PINMODE  pinMode(6,OUTPUT); //VTOL Tilting down right front motor with AUX2
  #define DIGITAL_TILT_VTOL_HIGH     PORTD |= 1<<6; //VTOL
  #define DIGITAL_TILT_VTOL_LOW      PORTD &= ~(1<<6); //VTOL
  #define DIGITAL_TILT_VTOL2_PINMODE pinMode(7,OUTPUT); //VTOL Tilting down left front motor with AUX2
  #define DIGITAL_TILT_VTOL2_HIGH    PORTD |= 1<<7; //VTOL
  #define DIGITAL_TILT_VTOL2_LOW     PORTD &= ~(1<<7); //VTOL
  #define CGPIN_PINMODE              pinMode (8, OUTPUT); //VTOL pin 8 used for a servo to move the CG back and forth
  #define CGPIN_HIGH                 PORTB |= 1<<0; //VTOL
  #define CGPIN_LOW                  PORTB &= ~(1<<0); //VTOL


so you may do the same using port B above and give name to the pin and state of pin. High and Low are important as it is what it does: put the pin in High state or low state. You gives whatever name you want to the pin like RUDDER_PINMODE, RUDDER_HIGH and RUDDER_LOW. It writes like this:

Code: Select all

 #define RUDDER_PINMODE  pinMode(8,OUTPUT); //Rudder in Plane mode
  #define RUDDER_HIGH     PORTB |= 1<<0; //Rudder high on portB pin 8
  #define RUDDER_LOW      PORTB &= ~(1<<0); //Rudder low on portB pin 8

and so on for any other servo on pin 9 10 of 11 as you choose. Of course if you use pin 9 for motor, don't define it for servo. You may use pin 7 if your radio has only 4 channels. You may keep the use of pins A0-1-2-3 for any gimbal camera tilt as it is. Remember pin 8 is used to Lipo alarm.
Then in output.pde we have: a conditional statemet if defined....Plane which will assign number of motors for Plane mode only.

Code: Select all

#if defined(GIMBAL) || defined(FLYING_WING)
  #define NUMBER_MOTOR 0

in this there is no motor, you can specify one under the statement : #if defined (Plane)

Then there is this part wher the number of servo is defined:

Code: Select all

uint8_t PWM_PIN[8] = {MOTOR_ORDER};
volatile uint8_t atomicServo[6] = {125,125,125,125,125,125}; //VTOL  2 more servos default is [4]

....

void writeServos() {
  #if defined(SERVO)
    atomicServo[0] = (servo[0]-1000)/4; //Yaw
    atomicServo[1] = (servo[1]-1000)/4; //Pitch
    atomicServo[2] = (servo[2]-1000)/4; //Roll
    atomicServo[3] = (servo[3]-1000)/4; //VTOL tilt motor servos [3]
    atomicServo[4] = (servo[4]-1000)/4; //VTOL tilt motor servos  [4]
    atomicServo[5] = (servo[5]-1000)/4; //VTOL tilt motor servos  [5] CG
  #endif


we arrive then to tha part saying : #if defined(SERVO)... and there you can specify your plane and the pin assignment like this : (I use VTOL key name for my project:

Code: Select all

  #if defined (VTOL)
     DIGITAL_SERVO_TRI_PINMODE
     DIGITAL_TILT_ROLL_PINMODE
     DIGITAL_TILT_PITCH_PINMODE
     DIGITAL_TILT_VTOL_PINMODE
     DIGITAL_TILT_VTOL2_PINMODE
     CGPIN_PINMODE
  #endif

The code her is defining the use of pins I will do in my particular configuration for VTOL.

and finally THE routine implementing high state, followed by a time calculated to get the value so as to create the PPM accordingly, followed by low state. Here is an example :

Code: Select all

// ****servo yaw with a 50Hz refresh rate****
// prescaler is set by default to 64 on Timer0
// Duemilanove : 16MHz / 64 => 4 us
// 256 steps = 1 counter cycle = 1024 us
// algorithm strategy:
// pulse high servo 0 -> do nothing for 1000 us -> do nothing for [0 to 1000] us -> pulse down servo 0
// pulse high servo 1 -> do nothing for 1000 us -> do nothing for [0 to 1000] us -> pulse down servo 1
// pulse high servo 2 -> do nothing for 1000 us -> do nothing for [0 to 1000] us -> pulse down servo 2
// pulse high servo 3 -> do nothing for 1000 us -> do nothing for [0 to 1000] us -> pulse down servo 3
// do nothing for 14 x 1000 us
ISR(TIMER0_COMPA_vect) {
  static uint8_t state = 0;
  static uint8_t count;
  if (state == 0) {
    //http://billgrundmann.wordpress.com/2009/03/03/to-use-or-not-use-writedigital/
    #if defined(TRI) || defined (BI) || defined(VTOL)
    DIGITAL_SERVO_TRI_HIGH
    #endif
    OCR0A+= 250; // 1000 us
    state++ ;
  } else if (state == 1) {
    OCR0A+= atomicServo[0]; // 1000 + [0-1020] us
    state++;
  } else if (state == 2) {
    #if defined(TRI) || defined (BI)
      DIGITAL_SERVO_TRI_LOW
    #endif
    #if defined(BI)
      DIGITAL_BI_LEFT_HIGH
    #endif
    #if defined(SERVO_TILT) || defined(GIMBAL) || defined(FLYING_WING)
    DIGITAL_TILT_PITCH_HIGH
    #endif
    #if defined (VTOL)   
    DIGITAL_SERVO_TRI_LOW
    DIGITAL_TILT_PITCH_HIGH
    #endif
    OCR0A+= 250; // 1000 us
    state++;
  } else if (state == 3) {
    OCR0A+= atomicServo[1]; // 1000 + [0-1020] us
    state++;
  } else if (state == 4) {
    #if defined(SERVO_TILT) || defined(GIMBAL) || defined(FLYING_WING) || defined(VTOL)
      DIGITAL_TILT_PITCH_LOW
      DIGITAL_TILT_ROLL_HIGH
    #endif
    #if defined(BI)
      DIGITAL_BI_LEFT_LOW
    #endif
    state++;
    OCR0A+= 250; // 1000 us
  } else if (state == 5) {
    OCR0A+= atomicServo[2]; // 1000 + [0-1020] us
    state++;
  } else if (state == 6) {
    #if defined(SERVO_TILT) || defined(GIMBAL) || defined(FLYING_WING) || defined(VTOL)
      DIGITAL_TILT_ROLL_LOW
      DIGITAL_TILT_VTOL_HIGH
    #endif
    #if defined(CAMTRIG)
      DIGITAL_CAM_HIGH
    #endif
    state++;
    OCR0A+= 250; // 1000 us
  } else if (state == 7) {
    OCR0A+= atomicServo[3]; // 1000 + [0-1020] us
    state++;
  } else if (state == 8) {
    #if defined(CAMTRIG)
      DIGITAL_CAM_LOW
    #endif
    #if defined(VTOL)
     DIGITAL_TILT_VTOL_LOW
     DIGITAL_TILT_VTOL2_HIGH
    #endif
    state++;
    OCR0A+= 250; // 1000 us
  } else if (state == 9) {
    OCR0A+= atomicServo[4]; // 1000 + [0-1020] us
    state++;
  } else if (state == 10) {
    #if defined(VTOL)
    DIGITAL_TILT_VTOL2_LOW
    CGPIN_HIGH
    #endif
    state++;
    OCR0A+= 250; // 1000 us
  } else if (state == 11) {
    OCR0A+= atomicServo[5]; // 1000 + [0-1020] us
    state++;
  } else if (state == 12) {
    #if defined(VTOL)
    CGPIN_LOW
    #endif
    count = 12; // 14 x 1000 us
    state++; //13
    OCR0A+= 250; // 1000 us
  } else if (state == 13) {
    if (count > 0) count--;
    else state = 0;
    OCR0A+= 250;
  }
}
#endif


Which I copied entirely here as the sequence is very important. Each servo has to be put in high state, folowed by how long it stay in high state and then in low state. It is done in sequence and you cant mismatch the sequence otherwise individual servos are not adressed correctly with subsequent code. For example you will have two servos moving together or one servo moving correctly but not getting the "constrain" required.
This is the most difficult part as I had to follow each item in the sequence to be sure to not misplace a servo high of low.

Then and finally we find the real code given to each servo, like I use for my VTOL project (sorry to give you all that bunch of code bu I think it will help to understand...)

Code: Select all

  #ifdef VTOL //VTOL motor and servo controls outputs_______________
   if(abs(rcData[AUX2]) < TILT_VTOL_DETECT) { //TILT_VTOL_DETECT=value in millis of servos position see config.h//
    motor[0] = PIDMIX( 0,+4/3, 0);//PIDMIX( 0,+4/3, 0);dev 110705//PIDMIX( 0,+4/6, 0);dev 110722// PIDMIX( 0,+3/6, 0)=12 points de trim pour diminuer// REAR
    motor[1] = PIDMIX(-1,-1/6, 0);//PIDMIX(-1,-1/6, 0);dev 110705//RIGHT
    motor[2] = PIDMIX(+1,-1/6, 0);//PIDMIX(+1,-1/6, 0);dev 110705//LEFT
    servo[0] = constrain(TRI_YAW_MIDDLE + YAW_DIRECTION * axisPID[YAW], TRI_YAW_CONSTRAINT_MIN, TRI_YAW_CONSTRAINT_MAX); //TRI REAR SERVO
    servo[1] = constrain(TILT_PITCH_MIDDLE, TILT_PITCH_MIN, TILT_PITCH_MAX); //AIL and PITCH Flying wing at neutral position in TRI mode
    servo[2] = constrain(TILT_ROLL_MIDDLE, TILT_ROLL_MIN, TILT_ROLL_MAX); //RIGHT
    } else { //Flying mode
    motor[0] = MINCOMMAND; //VTOLMIN_THROTTLE; //MINCOMMAND; //PIDMIX( 0,0,0),VTOLSTOPTHROTTLE; //can be adjusted in config.h stops REAR motor
    motor[1] = constrain(rcData[THROTTLE],VTOLMIN_THROTTLE,VTOLMAX_THROTTLE); //RIGHT //PIDMIX( 0, 0, 0); //
    motor[2] = constrain(rcData[THROTTLE],VTOLMIN_THROTTLE,VTOLMAX_THROTTLE); //LEFT//PIDMIX( 0, 0, 0); //
    servo[0] = constrain(TRI_YAW_MIDDLE,TRI_YAW_CONSTRAINT_MIN, TRI_YAW_CONSTRAINT_MAX); //TRI REAR SERVO
   
    if(abs(rcData[AUX1]) > VTOL_STAB) { // LEVEL Mode stabilisation
         /*Stabilization in Fly mode. VTOL_STAB=1700. For VTOL :
                            if tilt motor VTOL servos are not in correct position, use <VTOLPOSMIN (1300)
                            or smaller or greater values for VTOL_STAB, adjust right position mechanically or
                            change the value in config.h*/
      servo[1] = constrain(TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] /16 + (1500-rcData[PITCH]), TILT_PITCH_MIN, TILT_PITCH_MAX); //inverse pitch radio-normal PID levelling -- used with an external mixer
      servo[2] = constrain(TILT_ROLL_MIDDLE  + TILT_ROLL_PROP  * angle[ROLL]  /16 + (1500-rcData[ROLL]), TILT_ROLL_MIN, TILT_ROLL_MAX); //inverse roll radio-normal PID levelling-- used with an external mixer

   //commented lines are without external mixer. ok roll, pitch acting as roll/ servo[1] = constrain((TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] /16 + TILT_ROLL_MIDDLE  + TILT_ROLL_PROP  * angle[ROLL]  /16) - 1500, TILT_PITCH_MIN, TILT_PITCH_MAX); //+ (1500-rcCommand[PITCH]+rcCommand[ROLL]), TILT_PITCH_MIN, TILT_PITCH_MAX);
   // ok roll, pitch acting as roll/  servo[2] = constrain(1500+(TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] /16 - TILT_ROLL_MIDDLE  + TILT_ROLL_PROP  * angle[ROLL]  /16) , TILT_ROLL_MIN, TILT_ROLL_MAX); //+(1500+rcCommand[ROLL]-rcCommand[PITCH]), TILT_ROLL_MIN, TILT_ROLL_MAX);
    // same problem:pitch ok roll wrong /servo[1]  = constrain(axisPID[ROLL] + axisPID[PITCH]+1500, 1020, 2000);//RIGHT
   //same problem:pitch ok roll wrong  / servo[2]  = constrain(axisPID[ROLL] - axisPID[PITCH]+1500, 1020, 2000); //LEFT the direction of the 2 servo can be changed here: invert the sign before axisPID //doesn't work...
   }
   else {
    servo[1] = constrain(TILT_PITCH_MIDDLE  + (1500-rcData[PITCH]), TILT_PITCH_MIN, TILT_PITCH_MAX); //inverse pitch radio -- used with an external mixer - no stabilization
    servo[2] = constrain(TILT_ROLL_MIDDLE   + (1500-rcData[ROLL]),  TILT_ROLL_MIN, TILT_ROLL_MAX); //inverse roll radio-- used with an external mixer - no stabilization

    }
   }
 servo[3] = constrain(3000-rcData[AUX2], TILT_VTOLP1_MIN, TILT_VTOLP1_MAX); //VTOL tilt rigth front motor always in function. Here we inverse servo[3] so both servo goes in the same direction..
 servo[4] = constrain(rcData[CAMROLL], TILT_VTOLP2_MIN, TILT_VTOLP2_MAX); //VTOL tilt left front motors always in function,  use rcData[AUX2] to free one more radio channel
 servo[5] = constrain(rcData[CAMPITCH],VTOLCG_MIN, VTOLCG_MAX); //VTOL moving CG back and forth following radio mix on left motor position
 #endif

On servo[4] and [5] above I used CAMROLL and CAMPITCH as it exists already.

I hope it may help the community to buil a real airplane mode in multiwii ;)
Last edited by cob on Sun Aug 14, 2011 12:57 am, edited 7 times in total.

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

Re: Airplane mode

Post by PatrikE »

Hi darlofranco,
I always use latest files from SVN.
http://code.google.com/p/multiwii/source/browse/#svn%2Ftrunk%2FMultiWii
The code i based it from is r214. (Actual files right now.)
I left the svn-files in the projekt.
If you use Tortoise or another svn client it's possible to check DIFF.
Then you can see the changes.

Programs that i use.
http://tortoisesvn.net/downloads.html SVN client (rightclick files)
http://winmerge.org/downloads/ Program to compare 2 files.

/Patrik

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

Re: Airplane mode

Post by PatrikE »

Nice cob.
8-)
I will take a look at it.

/Patrik

jimnaz
Posts: 16
Joined: Fri Jan 21, 2011 5:21 pm

Re: Airplane mode

Post by jimnaz »

Nice job Cob and Patrik

I have lost interest with the MW project since it started to spread out and add all the other stuff like Baro, different Accells... BUT now that you have started to make some real progress in using it on airplanes the interest is back for me. Thank you.

I have a question about what you call a serialsummPPM. Are you using a piece of hardware or did you do it using code? I am sorry to ask this if it is obvious but to me it is not clear.

Can one take the code you provided in .RAR zip and use it as is on a ProMini? As a note, I have been flying my Tri on 1.7 for a while now but would like to venture into using it on an airplane.

Thank you in advance.

Jim

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

Re: Airplane mode

Post by PatrikE »

Hi Jim.

I use FRsky RX who provides a serialSum output.
It's only compatible with FRsky TX modules.
But there is other converters on the market to connect between RX and the ArduinBoard.

ProMini code only provide 5 Channels without PPM.
Only AUX1 is suported.
The current code can be used with A0,A1 & DO/3 for servos.

PPM is neded when more servos is added.
I have a new VER using totally 6 servos.(not publiched yet) ;)

The short answer...
Yes you must provide PPM signal From harware.
Yes it works on a ProMini. using A0,A1&DO/3 for servos.


/Patrik

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

Re: Airplane mode

Post by PatrikE »

Great cob.
8-)
I now have everything up running on 6 servos..
I will post code tomorrow after work.

/Patrik

cob
Posts: 37
Joined: Thu Jul 07, 2011 12:00 am

Re: Airplane mode

Post by cob »

You're welcome PatrickE, you helped me too so I had to share the hours I digged :cry: into this damned code to progress in my project (VTOL). :?
I added the full command section of code to drive the 4 servos in flying mode
I'm very curious to see your finished code for airplane, particularly the GUI settings.
As this is where my roots are as an R/C pilot. :D
For now I'm there:
1) Roll/Pitch various mixing not done yet
3) Some more PID experimentation to be done
Testing in real flight gives a hovering nearly stable. I still have vibrations and not the best sensors.
But it is in progress. 8-)

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

Re: Airplane mode

Post by UndCon »

Good job P!

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

Re: Airplane mode

Post by PatrikE »

As promised. :D

The SIX servo version for AeroPlane

SERVO 0 => DO/3 Rudder/Yaw
SERVO 1 => A1 Can be used without camstab
SERVO 2 => A0 Can be used without camstab
SERVO 3 => DO/6 Thottle
SERVO 4 => DO/7 Elevator/Nick
SERVO 5 => DO/8 Roll
MOTOR 0 => DO/9 ESC 490hz

Setup servo directions and endpoints in the mixtable inside Output.pde

The controls is...by default...
AUX1 switches between Passthru and MWii.
Use AUX2 enable Stable mode etc.

I also added a RESET button in gui.
It will reset all PIDs and settings.

I have some issues with the gui. :cry:
I only get servo 0-3 to work in the gui.
I changed to 6 servos in the serialcom in gui and MwiiCode.
But it doesn't work...
Can someone check why... I gave up..
My java-programming means mostly copy/paste... :(

It means only Throttle,Elevator and Rudder will change in the gui..
Buzzer is be disabled in AeroplaneMode it Uses same pin as ROLL.

Otherwise everything is the same as the 4 servo version from earlier.
http://www.multiwii.com/forum/viewtopic.php?f=8&t=364&start=40#p2797

Play safe Fly Low and Slow...

/Patrik
Attachments
MultiWiiAirPlane.rar
(92.12 KiB) Downloaded 426 times

cob
Posts: 37
Joined: Thu Jul 07, 2011 12:00 am

Re: Airplane mode

Post by cob »

I finally completed the mixing of wing servos on my VTOL. I don't need anymore an external mixer creating glitches... ;)
Here is the config:
Mixes.jpg


and the code with stabilization (or not) in Output.pde

Code: Select all

    if(abs(rcData[AUX1]) > PLANE_STAB) { // Flight LEVEL Mode stabilisation PLANE_STAB to be defined as 1700 in config.h
         
//below is wihout mixing using external mixer
     // servo[1] = constrain(TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] /16 + (1500-rcData[PITCH]), TILT_PITCH_MIN, TILT_PITCH_MAX); //inverse pitch radio-normal PID levelling -- used with an external mixer
     // servo[2] = constrain(TILT_ROLL_MIDDLE  + TILT_ROLL_PROP  * angle[ROLL]  /16 + (1500-rcData[ROLL]), TILT_ROLL_MIN, TILT_ROLL_MAX); //inverse roll radio-normal PID levelling-- used with an external mixer

     //below is mix working servo [1] ->pitch left wing on output pin 5 and servo[2] ->roll right wing is on output pin 4 . Servos are mounted flat on extrados heads front out, bottom facing.
      servo[1] = constrain((TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] /16 + (1500-rcData[PITCH]))+(TILT_ROLL_MIDDLE  + TILT_ROLL_PROP  * angle[ROLL]  /16 + (1500-rcData[ROLL]))-1500, TILT_PITCH_MIN, TILT_PITCH_MAX); //inverse pitch radio-normal PID levelling -- used with an external mixer
      servo[2] = constrain(1500+(TILT_ROLL_MIDDLE  + TILT_ROLL_PROP  * angle[ROLL]  /16 + (1500-rcData[ROLL]))-(TILT_PITCH_MIDDLE + TILT_PITCH_PROP * angle[PITCH] /16 + (1500-rcData[PITCH])), TILT_ROLL_MIN, TILT_ROLL_MAX); //inverse roll radio-normal PID levelling-- used with an external mixer

   }
   else {
   // servo[1] = constrain(TILT_PITCH_MIDDLE  + (1500-rcData[PITCH]), TILT_PITCH_MIN, TILT_PITCH_MAX); //inverse pitch radio -- used with an external mixer - no stabilization
   // servo[2] = constrain(TILT_ROLL_MIDDLE   + (1500-rcData[ROLL]),  TILT_ROLL_MIN, TILT_ROLL_MAX); //inverse roll radio-- used with an external mixer - no stabilization
////below is mix working as above no stabilization
    servo[1] = constrain((TILT_PITCH_MIDDLE  + (1500-rcData[PITCH]))+(TILT_ROLL_MIDDLE   + (1500-rcData[ROLL]))-1500, TILT_PITCH_MIN, TILT_PITCH_MAX); //inverse pitch radio -- used with an external mixer - no stabilization
    servo[2] = constrain(1500+(TILT_ROLL_MIDDLE   + (1500-rcData[ROLL]))-(TILT_PITCH_MIDDLE  + (1500-rcData[PITCH])),  TILT_ROLL_MIN, TILT_ROLL_MAX); //inverse roll radio-- used with an external mixer - no stabilization

    }


Hope it may help ;)

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

Re: Airplane mode

Post by msev »

Guys I'm planning to try to do this on at least one of my planes, will you asist me in correctly connecting everything (i'll post pics before i start soldering, but first have to order everything)...What about the receiver, will the receiver from turnigy 9x be good?

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

Re: Airplane mode

Post by PatrikE »

Intresting.
what sort of plane are you planning to use.
A funfly isn't the best choice... I know... But it works. ;)
I'm planning to test on my EZ-Hawk some time.

The Tgy rx doesn't have serial sumPPM.
It means only 5 channels can be used on mwii.

If you have a serial sumPPM rx 8 channes is supported today.

/Patrik

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

Re: Airplane mode

Post by msev »

I have a beaten up EZ* which I would have to repair,...but I also have a Twinstar 2 in mint condition (maybe rather this one? :D )..Motors are through Y cable connected..Isn't that enough 5 channels, so 2 ailerons, rudder and elevator, 1 more left could be for cam tilt compensation (although I even don't know if it's necessary)..

Edit: is throttle also controlled by multiwii?

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

Re: Airplane mode

Post by PatrikE »

msev wrote:is throttle also controlled by multiwii?


The SIX servo version for AeroPlane

SERVO 0 => DO/3 Rudder/Yaw
SERVO 1 => A1 Can be used without camstab
SERVO 2 => A0 Can be used without camstab
SERVO 3 => DO/6 Thottle
SERVO 4 => DO/7 Elevator/Nick
SERVO 5 => DO/8 Roll
MOTOR 0 => DO/9 ESC 490hz

Yes throttle can be used with MWii.
You can change the mixtable as you want on any servo.

/Patrik

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

Re: Airplane mode

Post by msev »

If for example I would loose rc range (turnigy 9x doesn't have failsafe, but I could make a seperate failsafe circuit -rc-cam's rcfsv2), would the stabilization be still on? (which is favorable because it will ensure more "safe" landing, if an accelerometer would be installed)..

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

Re: Airplane mode

Post by PatrikE »

Failsafe is alredy built in to the MWii code.
Look in the Config file.

Code: Select all

#define FAILSAFE  


If there is no signal It will enter failsafe.
*Level mode.
*Shut down motors after a delay

Code: Select all

#define FAILSAVE_OFF_DELAY 200         // Time for Landing before motors stop in 0.1sec. 1 step = 0.1sec - 20sec in example


For a plane you might set some rudder input to make a large circel otherwise it vill keep a stright line.
Or better have gps and Return home.(Not implemented yet...)

/Patrik

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

Re: Airplane mode

Post by msev »

Nice, great I'm loving it more and more when I hear the details :).. Got to order the parts soon :)...It would be possible to also dial in some spoilerons after failsafe initiation right?

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

Re: Airplane mode

Post by PatrikE »

What ever you want...
But then you ned to have 2 outputs for the ailerons.

It sounds like it's best for you to go for a PPM-sum solution.
This will free up more I/O pins And lets you control more setings from the radio.
AUX1 & AUX2
Stable,Gimball,cameratrigger,GPS.
And you can control spoilers,flaps and multiple motors.

Get a Frsky TX Hackmodule for 16$
and a FrSKY V8R7-SP 24$


Best bennefits is Only ONE cable between RX and PROMINI...

/Patrik

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

Re: Airplane mode

Post by UndCon »

My goals is 4 wingservos :)

2 ailerons and 2 flaps

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

Re: Airplane mode

Post by msev »

Good for you UndCon :) hehe...For starters maybe I'll try 5ch - 2 ail, 1 ele, 1 rud, 1 thr...sounds good for a start, later I'll go with the ppm-sum , since I'll have to hack the turnigy module to make it removable, and it's antenna interchangeable for trying out directional antennas....
It would be really nice to see a clip of how this multiwii stabilization works in real life, I always like to watch nice clips :D

User avatar
DinoBravo
Posts: 6
Joined: Tue Jul 12, 2011 9:43 pm
Location: Canada

Re: Airplane mode

Post by DinoBravo »

Thanks to all of you that have worked on the Airplane mode.

I am very interested in getting involved in anyway I can to develop or test.

I have uploaded the airplane pde and Gui. The RX and RC alias channels have changed as I use a Warthox board (taken out of my quad).

Here is a screen capture of the GUI.

I have a couple of questions :?: :
1) Why does the ACC light not turn green (directly below the NUNCHUK)?
2) When I deactivate LEVEL the gyros don't correct the ailerons or elevator - is this normal or is this related to 1) above?

Untitled-1.jpg


Cheers DinoBravo

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

Re: Airplane mode

Post by PatrikE »

Hi DinoBravo.
What kind of plane are you setting up?
I'we done some test with a Funfly model.

I have a couple of questions :
1) Why does the ACC light not turn green (directly below the NUNCHUK)?
2) When I deactivate LEVEL the gyros don't correct the ailerons or elevator - is this normal or is this related to 1) above?


1) In the picture AUX1 value is 2053 and you have checked the level box for AUX1 High. It's correct.

2) AUX1 is hardcoded to control Passthru...
Under 1500 will send comands direct from your reciver to the servos.

Code: Select all

  if(abs(rcData[AUX1])>1500)   {  //Use aux1 to activate Passthru or MWii mode

Use AUX2 to switch between stable and gyro mode.

Start with low P-values and increase later.

/Patrik

User avatar
DinoBravo
Posts: 6
Joined: Tue Jul 12, 2011 9:43 pm
Location: Canada

Re: Airplane mode

Post by DinoBravo »

Hi Patrik,

It will be going into a GWS E-starter until the bugs are worked out (sIngle aileron servo). After that I may put it into a Mini Showtime... looking for some assitance to hover... like the A.S.3.X. technology.

I have a Warhox setup and t does not use Aux2 :(
Is there anyway to have just the gyros on by default for bench testing?

D

User avatar
DinoBravo
Posts: 6
Joined: Tue Jul 12, 2011 9:43 pm
Location: Canada

Re: Airplane mode

Post by DinoBravo »

Here is my work-around with only AUX1 (no AUX 2) to have 3 flight modes avaliable (1. direct pass thru, 2. gyros only, and 3. Autolevel [Gyro+acc]).

1) In Spektrum transmitter Gear (AUX1) is reversed and MIX2 has AUX2->GEAR, RATE:+100%,0% OFFSET:0
With GEAR switch low(0) then AUX1 <1000 (i.e. turn off Multiwii),
With GEAR switch high(1) and AUX2 low(0) then AUX1 = 1500 (i.e. turn on gyros only)
With GEAR switch high(1) and AUX2 high(1) then AUX1 > 2000 (i.e. turn on autolevel)

2) change the following line in OUTPUT.PDE from
if(abs(rcData[AUX1])>1500) { //Use aux1 to activate Passthru or MWii mode
to
if(abs(rcData[AUX1])>1200) { //Use aux1 to activate Passthru or MWii mode

3) In Multiwiiconf turn on AUTOLEVEL with AUX1 HIGH

Cheers, D

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

Re: Airplane mode

Post by PatrikE »

Looks really god 8-)

The PassthruMode is nice to use for initial flights.
Launch with Passthru and switch over at safe altitude.

/Patrik

User avatar
DinoBravo
Posts: 6
Joined: Tue Jul 12, 2011 9:43 pm
Location: Canada

Re: Airplane mode

Post by DinoBravo »

I very much agree with having the passthru mode.

Yaw (rudder) does not seem to be implemented into the airplane mode... is this on the drawing board?
Is there a group working on development?

I am in Canada and it is too cold to fly, but I can do GUI and bench testing.

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

Re: Airplane mode

Post by PatrikE »

There are more than one ver in the thread.
One with suport for 4 servos
The one for 6 who have rudder implemented.

You can find my last here.
http://www.multiwii.com/forum/viewtopic.php?f=8&t=364&start=50#p2926

As far as i know only i have tested the planemode on a Funfly.
I plan to put it in my EZ-Hawk in the future.

The code is based on a rather old MWii ver.
Maybe in need to be updated but it's a quite satble dev.

There's not snow here in Sweden yet and it's still possible to fly with frozen fingers...

Gagarien
Posts: 8
Joined: Wed Sep 21, 2011 10:01 am

Re: Airplane mode

Post by Gagarien »

Nice going guy's

Me too Passthru for initial take offs is essential and then you can change it later to Gyro take offs if you are happy with your settings, this I have done now with flying wing mode.

Ha ha ha here on my side of the planet it is cooking - South Africa

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

Re: Airplane mode

Post by PatrikE »

It's not so much the cold tempertue who limits the flying.
The worst issue is the short day's.
It starts to get dark between 3-4 in the "evenings" during the winter..(If the weather is clear)

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

Re: Airplane mode

Post by Hamburger »

Hi,
I have been working on the Flying Wing code. Now I added this - passThru mode is user configurable in GUI. Submitted to the *_shared tree.

Passthrough mode now is a checkboxes item in GUI so user can asign to preferred aux1/aux2 low/mid/high state(s).
Currently in use for Flying Wing in arduino code.

Example: Wing with gyro and acc
in GUI turn checkboxes on for Level - high and PassThru - low, both for aux1
This yields ->
aux1=low : no multiwii sensors interference, only delta mixing
aux1=mid: gyro only acro mode
aux1=high: gyro+acc level mode

The status of passthrough mode is accessible in arduino sketch via a variable (see my Flying Wing code in output.pde to clarify.)
Excuse the long rambling. Please use this feature for airplane mode if it applies.
Hamburger

DupeS
Posts: 3
Joined: Wed Jan 04, 2012 6:44 pm
Location: Sweden Linkoping

Re: Airplane mode

Post by DupeS »

This looks very interesting!
Do someone have any video on flight or test?

How about 1.9 implementation that eliminates the need of ppmsum on 6motor setups on the promini? that would be great!

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

Re: Airplane mode

Post by UndCon »

In lack of suitable platforms to test I will order a Bixler that I can dedicate to this testing.

I still intend to test:


Easystar (3ch)

Bixler (4ch)
(1 aileron servo)

Skywalker(4ch)
(2 ailerons where 1 is reversed)


I hope the code is compatible with all of them ;)
//UndCon

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

Re: Airplane mode

Post by PatrikE »

I can try to merge the project with the latest Dev if someone's intrested.
I think it's based on 1.7 or 1.8 now.

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

Re: Airplane mode

Post by UndCon »

Yes please :)

//UndCon

jimnaz
Posts: 16
Joined: Fri Jan 21, 2011 5:21 pm

Re: Airplane mode

Post by jimnaz »

@PatrikE

+1` on please do!!!!

DupeS
Posts: 3
Joined: Wed Jan 04, 2012 6:44 pm
Location: Sweden Linkoping

Re: Airplane mode

Post by DupeS »

o yes !

darlofranco
Posts: 13
Joined: Sat Jun 18, 2011 4:16 pm

Re: Airplane mode

Post by darlofranco »

+1 - and another :)

Gagarien
Posts: 8
Joined: Wed Sep 21, 2011 10:01 am

Re: Airplane mode

Post by Gagarien »

That would be SUPER Patrik!

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

Re: Airplane mode

Post by PatrikE »

Ok..
I'm on it!..
The original code can only handle 3 servos so
i will try to use the servocode from this thread as it supports up to 8 servos.
http://www.multiwii.com/forum/viewtopic.php?f=8&t=1134&p=8014#p8014

Iw'e mergde them and will perform test to see that everything works as expected.
The scetch compiles so its time to do some tests...
Hopefully before the weekend.

I will use this as a testbed.
http://www.nitroplanes.com/ezhael4chrtf.html
It's probably a better candidate than a FunFly!.. :evil:

//Patrik

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

Re: Airplane mode

Post by UndCon »

Cool work - I set up my Skywalker with Arduplane as testbed...so I have to get a new plane(Bixler) for Multiwii purpose ;)

//UndCon

Tom
Posts: 5
Joined: Fri Jan 27, 2012 1:59 pm
Location: Chicago US

Re: Airplane mode

Post by Tom »

Thanks for Your work - Its great but...
Can You please post link for simply download of AirplaneWii.
After 30 years playing with computers I can't handle code repository/TortoiseSVN
I assume is more "retarded" users around willing to try it.
Best Regards
Tom

Tom
Posts: 5
Joined: Fri Jan 27, 2012 1:59 pm
Location: Chicago US

Re: Airplane mode

Post by Tom »

Hi !
Looks like I asked for to much :(
Or You like to keep it for Yourself :)
Tom

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

Re: Airplane mode

Post by PatrikE »

Tom wrote:Hi !
Looks like I asked for to much :(
Or You like to keep it for Yourself :)
Tom


Sorry but Alex want to implement the new servocode before i publish the new models.
It's Best that he do the bigger changes in the code who effects the whole project!
The change of servo effects timers,servos and motors plus maby something else.... :?:
And i dont want to mess it up for him. :oops:

After all it's Alex Child we are playing with and he Is the Father!.. :D
And he is working on it.

My changes is ready for fieldtest tomorrow With my implementation of the new sevos.

/Patrik

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

Re: Airplane mode

Post by Alexinparis »

Hi Patrik,
I did most of the needed changes to implement Felix suggestion + some GUI mods.
8 servo values are now sent over the serial line.
You can use it as you want to define new configs. It should also ease the task.
It's now in the google code repository

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

Re: Airplane mode

Post by PatrikE »

Thanks Alex,
I will start implement the new models asp.. :D

Patrik

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

Re: Airplane mode

Post by UndCon »

Cool - I was adding some servo-bars in GUI to help verify orientations/movements of my testbed

However there are now different ways Flying Wing and Aeroplane are implemented...needs a fix I think
//UndCon

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

Re: Airplane mode

Post by PatrikE »

The schetch is now ready for betatesting.
It's now in the google code repository.
http://code.google.com/p/multiwii/source/browse/#svn%2Fbranches%2FPatrikE

And i added a rar file for you Tom. ;)
http://code.google.com/p/multiwii/source/browse/branches/PatrikE/Aero_Heli.rar

passThruMode is added to the models and should absolutly be used for first test!
You must ARM the motor!....
Read the textdokuments for more info.

Hey Be Careful Out There..

/Patrik
Last edited by PatrikE on Sun Jan 29, 2012 3:11 pm, edited 1 time in total.

Tom
Posts: 5
Joined: Fri Jan 27, 2012 1:59 pm
Location: Chicago US

Re: Airplane mode

Post by Tom »

Hi !
Looks like I have Christmas today ! :D
New code to play and two genuine WM+ and one Nunchuk :D :D
Thanks Alex, Patrick and All
Regards
Tom

User avatar
Gartenflieger
Posts: 65
Joined: Sat Oct 01, 2011 10:07 pm
Location: Dortmund, Germany

Re: Airplane mode

Post by Gartenflieger »

Great job, Patrick!

I volunteer for testing it on a HK Reaktor. I noticed the previous version would work only with a PPM receiver. What about this one?
However, first I will have to replace my WMP clone with a working one.

Greets
Christoph

Post Reply