MultiWii Mixing for TBS Discovery

Firstly, I don’t have a TBS Discovery – I’m cheap.  But, I did use the pattern of the Discovery to make my quad out of 1/8″ plywood.  It seems like a popular layout that doesn’t allow props in the video, so I went with it.  Now I just need a mix to accommodate the oddball motor layout.  Here’s how.

Firstly, I owe all the credit to Adam Polak  here: http://polakiumengineering.org/?p=1612

This procedure is for my Witespy Mega Ez 3 board.  It is a Mega 2560, so some info to note is:

Motor 0 = Digital Pin 3
Motor 1 = Digital Pin 5
Motor 2 = Digital Pin 6
Motor 3 = Digital Pin 2
Motor 4 = Digital Pin 7
Motor 5 = Digital Pin 8
Motor 6 = Digital Pin 9
Motor 7 = Digital Pin 10

Motor layout with relation to Pin is shown here:

MotorLayout

I took a picture of my quad and overlayed a grid on the picture.  This made it easy to get some numbers for ratios.

DiscoGrid

Adam Polak says on his web page:

Using the grid as an aid, determine the magnitude of the pitch, roll and yaw mix by measuring the coordinates of the motor. For example, the mix for this quadx would be:

#if def QUADX
motor[0] = PIDMIX(-1,+1,-1); //REAR_R
motor[1] = PIDMIX(-1,-1,+1); //FRONT_R
motor[2] = PIDMIX(+1,+1,+1); //REAR_L
motor[3] = PIDMIX(+1,-1,-1); //FRONT_L
#endif

The syntax of the mix would be as follows:

*Be aware of the sign change!

“motor[‘motor number’] = PIDMIX( ‘- X-Coordinate’, ‘- Y-Coordinate’, ‘Rotation (‘clockwise ‘-’, counter-clockwise’+’)’);

Looking at my grid, I can modify the standard QuadX configuration to be:

motor[0] = PIDMIX(-1,+3/4,-1); //REAR_R
motor[1] = PIDMIX(-5/4,-3/4,+1); //FRONT_R
motor[2] = PIDMIX(+1,+3/4,+1); //REAR_L
motor[3] = PIDMIX(+5/4,-3/4,-1); //FRONT_L

Armed with that information, I need to make 4 changes to the MultiWii sketch

  1. In Output.ino, add the following config for QUADXDISCO:
    #ifdef QUADX
     motor[0] = PIDMIX(-1,+1,-1); //REAR_R
     motor[1] = PIDMIX(-1,-1,+1); //FRONT_R
     motor[2] = PIDMIX(+1,+1,+1); //REAR_L
     motor[3] = PIDMIX(+1,-1,-1); //FRONT_L
     #endif
     #ifdef QUADXDISCO
      motor[0] = PIDMIX(-1,+3/4,-1); //REAR_R
      motor[1] = PIDMIX(-5/4,-3/4,+1); //FRONT_R
      motor[2] = PIDMIX(+1,+3/4,+1); //REAR_L
      motor[3] = PIDMIX(+5/4,-3/4,-1); //FRONT_L
      #endif
     #ifdef Y4
     motor[0] = PIDMIX(+0,+1,-1);   //REAR_1 CW
     motor[1] = PIDMIX(-1,-1, 0); //FRONT_R CCW
     motor[2] = PIDMIX(+0,+1,+1);   //REAR_2 CCW
     motor[3] = PIDMIX(+1,-1, 0); //FRONT_L CW
     #endif

    This is line 843 in MultiWii 2.2

  2. Add the frame definition to Config.h:
    //#define QUADP
     //#define QUADX
     #define QUADXDISCO
     //#define Y4
     //#define Y6
  3. In def.h in the section labelled “Multitype decleration for the GUI’s”, I changed this line:
    #elif defined(QUADX)
     #define MULTITYPE 3

    To:

    #elif defined(QUADX) || defined (QUADXDISCO)
     #define MULTITYPE 3

    This allows the GUI to display the correct craft type.

  4. Also in def.h, find the following line (line 135 in MultiWii 2.2):
    #elif defined(QUADP) || defined(QUADX) || defined(Y4)|| defined(VTAIL4)
     #define NUMBER_MOTOR     4

    Add another condition for your model:

    #elif defined(QUADP) || defined(QUADX) || defined(Y4)|| defined(VTAIL4) || defined(QUADXDISCO) 
     #define NUMBER_MOTOR     4

     

Once these changes were made, I opened up MultiWii WinGUI to save my settings to file (don’t wanna recreate the wheel), then loaded the EEPROM_CLEAR sketch to ensure a clean upload.  Once cleared, I loaded up the new MultiWii sketch, uploaded my settings via WinGUI and went for a test flight.  So far so good, but unfortunately it started raining right when I got in the air, so more updates to come.

Advertisements