TRIWII VTOL

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

TRIWII VTOL

Post by cob »

Hello and hug to all who contribute to this project.
I was dreaming of a flying machine like an insect: able to hover stably (triwii) and to fly long distances economically (plane).
Si here is the TRICOPLANE !
Image

I need some help to change the code. I know some old 80's Basic... but C++ :cry:

I'll use a PPM serial sum board to free Digital pin 4 5 6 7
4 and 5 will be used as Servo output to control Pitch and Roll in Plane mode.
6 and 7 will be used as AUX1 and AUX2 as analog inputs 1-2-3 are used by an ADXL335 surgically extracted from a WIImote. 2 NCK went into the garbage can (one with a MMA7660 the other with a MMA6661 acc).
I changed some value in the code to use the ADXL335

You can see this post http://wbb.multiwii.com/viewtopic.php?f=8&t=518
and this one : http://wbb.multiwii.com/viewtopic.php?f=6&t=521 regarding change to the MWII code.

To read the digital output values of the ADXL335 you may use the code given at the end of this post.

I hope this will help and contribute to bring solutions. Of course if I spend 150 bucks more I would not have to fumble around an ADXL335 :P
And if I had many tousand buck I could hire someone to write and modify Alex's code for me :lol:

If someone can help me about this project coding... I'll really appreciate.
I need to use AUX2 to change the axis of the front motors and stop the rear motor and servo when the plane is beginning to fly.
Then Digital pin 4 and 5 will control the plane as a Pitch and Roll servo output.
_______________________________________

Code: Select all

//////////////////////////////////////////////////////////////////
//originally coded by 2011 bildr to gives angular values,
//Released under the MIT License - Please reuse change and share
//Simple code for the ADXL335, prints Digital values via serial
//////////////////////////////////////////////////////////////////

//Analog read pins
const int xPin = 1;
const int yPin = 2;
const int zPin = 3;

// minimum and maximum values that come from
//the accelerometer while standing still, Y axis get 1G this is the value to read

void setup(){
  Serial.begin(9600);
}

void loop(){

  //read the analog values from the accelerometer
  int xRead = analogRead(xPin);
  int yRead = analogRead(yPin);
  int zRead = analogRead(zPin);

  //Output the value
  Serial.print("x: ");
  Serial.print(xRead);
  Serial.print(" | y: ");
  Serial.print(yRead);
  Serial.print(" | z: ");
  Serial.println(zRead);


  delay(400);//just here to slow down the serial output - Easier to read
}

________________________________________________
Last edited by cob on Sat Jul 30, 2011 1:56 am, edited 3 times in total.

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: TRIWII VTOL

Post by captaingeek »

that looks awesome!!!

not sure about the coding, but I think if I were to try this I would to it all through radio programming. take off and land using the triwii as normal. When you want to transition to plane mode, just use some servos that tilt the front 2 rotors down that. fly the plane normally with ailerons / elevator.

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

Re: TRIWII VTOL

Post by cob »

Thanks for the suggestion Captaingeek. AUX2 will be used for that : tilting down the 2 front motors and in the same time giving order to Arduino to stop rear motor and transfer control on ailerons/elevators. I had that same idea but I'd like to integrate FlyingWing stabilization in order to get some FPV possibilities and UAV later on with a GPS. I can do it all on an analogic way using micro switches and programming the radio, but what the use of an Arduino then ? Also return to home is planned.

User avatar
captaingeek
Posts: 228
Joined: Fri Jan 28, 2011 6:42 pm

Re: TRIWII VTOL

Post by captaingeek »

but you could continue to use the mwii if you just connect the appropriate channels to the ESC / servos for fixed wind and just shut the motors off. when hovering just leave the servo's connected and active.

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

Re: TRIWII VTOL

Post by cob »

Yes indeed. I burried myself into the mwii code and came out with some success. It took me the week to understand some C++ code and the structure of mwii software. The mwii code offers now options for a VTOL ;-), let's say Version beta is operating.
As I'm not a programmer there is forcefully some code that can be optimized plus to check that VTOL options in config.h and elsewhere don't mingle in the rest of the prg. There is also the gui to be adapted for such config. That I don't know how to do. On the Gui the VTOL appears like a TRI for now.
I have pin D3-9-10-11 for Tri config, pin D4-5-6-7 for Pitch-Roll-Tilt motor left-Tilt motor right using the AUX2 to tilt vertically and horizontally the motors. When motors are in plane config, rear motor and its servo are stopped. Aux1 is still used to activate Level option in Tri mode. I'm on wing type V-tail mixing on Ail and Elev. Should be finished this week. I tried mixing with the radio but in that case in Level Mode the Ail+Elev are not mixed. So all is to be done by Multiwii without special mixing on the radio except trimming and reversing servos. We can also reverse servos easily on soft by adding options to choose in config.h
Regards

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

Re: TRIWII VTOL

Post by cob »

Here is an account of my progress on that project.
MWII soft is operating now. Everything is working correctly and the code is not modified so as to preserve any former options in it. I just added options for VTOL config. which is basically a mix of TRI and FLYINGWING switched on AUX2
Two problems not solved yet on the soft :
FlyingWing mode:
1) Mixing of Roll and Pitch servos is on an external mixer as I've not been able to change the code in Output.pde to apply a correct mixing to servos.
-It would be nice to have a mixing table to choose for FlyingWing in such a way that Roll and Pitch servos can be mixed according to their position on
the wing without interfering with motor control.
TRI mode:
2) Problem is to make CG the same on TRI and FlyingWing. I choose to have a correct CG for FlyingWing forcing the TRI to handle 70% of weight on the two front motors. It requires a smaller rear motor or propeller - or a moving CG. Smaller propeller is working but we loose a good part of the thrust. It gives a nice VTOL taking off in a few meters. This may be solved by using a squared wing and a BI configuration having the two motors on the tip of the wing at CG position. Which I didn't want. I want a stable powerfull TRI for CAM shooting and a fast Plane for FPVing!!

Here is the modified code if anyone wants to dig in it and correct it or any change to be made...welcome!! :idea: :idea:
Multiwii_VTOL_V1_4.rar
MWII code added VTOL options
(159.63 KiB) Downloaded 305 times

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

Re: TRIWII VTOL

Post by PatrikE »

Yuo can change the mixtable for the rear motor.

Code: Select all

  motor[0] = PIDMIX( 0,+4/6, 0); // * REAR_MOTOR_RPM; //REAR rpm minus 10 to 50%
//to
  motor[0] = PIDMIX( 0,+1/3, 0); // * REAR_MOTOR_RPM; //REAR rpm minus 10 to 50% 

Then the rear motor will compensate less on nick.
It's posible to use 4/10 or something like that to experiment with.

PIDMIX( 0,+1, 0) => PIDMIX(ROLL,NICK,Z).

/Patrik

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

Re: TRIWII VTOL

Post by cob »

Thank you it clarifies a bit more those things. I already fumbled into those PIDMIX (x,y,z) and discovered the last dev from Alex where he lowered the values on all axis. Actually with a non centered CG on a TRI the Level mode is the one efficient. Accro mode allow the TRI to pitch down if not corrected on the radio stick. So I built a moving tray under the plane to move the Lipo pack accordingly in order to satisfy the need for a CG back to the rear in TRI mode and moving to front in FlyingWing mode.
P1110285.jpg
P1110288.jpg
P1110291.jpg
P1110292.jpg

Et voilà!

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

Re: TRIWII VTOL

Post by PatrikE »

cob wrote:Here is the modified code if anyone wants to dig in it and correct it or any change to be made...welcome!!


Hi cob.
I looked at your code.
And here is how i would like to do it.

Code: Select all

 #ifdef VTOL //VTOL motor and servo controls outputs_______________ 
   if ((rcData[AUX2]) < TILT_VTOL_DETECT) { //TILT_VTOL_DETECT=value in millis of servos position see config.h
   //TRI mode
    motor[0] = PIDMIX( 0,+4/10, 0); //REAR
    motor[1] = PIDMIX(-1,-2/3, 0); //RIGHT
    motor[2] = PIDMIX(+1,-2/3, 0); //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); //LEFT ELEVON Flying wing at neutral position in TRI mode
    servo[2] = constrain(TILT_ROLL_MIDDLE, TILT_ROLL_MIN, TILT_ROLL_MAX); //RIGHT ELEVON   
    } else {
   //Flying mode
   motor[0] = MINCOMMAND; //PIDMIX( 0,0,0),VTOLSTOPTHROTTLE; //can be adjusted in config.h stops REAR motor
    motor[1] = constrain(rcData[THROTTLE],VTOLMINTHROTTLE,VTOLMAXTHROTTLE); //RIGHT //PIDMIX( 0, 0, 0); //
    motor[2] = constrain(rcData[THROTTLE],VTOLMINTHROTTLE,VTOLMAXTHROTTLE); //LEFT//PIDMIX( 0, 0, 0); //
    servo[0] = constrain(TRI_YAW_MIDDLE,TRI_YAW_CONSTRAINT_MIN, TRI_YAW_CONSTRAINT_MAX); //TRI REAR SERVO
   
   // Activate LEVEL-Mode in the GUI with AUX1-checkbox. (Activates both flightmodes)
    servo[1]  = constrain(1500 + (+axisPID[PITCH] -axisPID[ROLL]), 1020, 2000); //LEFT ELEVON      the direction of the 2 servo can be changed here:
    servo[2]  = constrain(1500 + (+axisPID[PITCH] +axisPID[ROLL]), 1020, 2000); //RIGHT   ELEVON      invert the sign before axisPID
   }
   // Tiltfunction
 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[AUX2]      ,TILT_VTOLP2_MIN,TILT_VTOLP2_MAX); //VTOL tilt left front motors always in function
 servo[5] = constrain(rcData[CAMPITCH] ,VTOLCG_MIN,   VTOLCG_MAX);         //VTOL moving CG back and forth following radio mix on left motor position
  #endif


Use the gui to setup Level mode.

/Patrik

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

Re: TRIWII VTOL

Post by PatrikE »

BTW....
What happens if you fly tri and change mode?....
You Will have a fully stalled wing... :o

I think a soft modechange is neded.
Slowly tilt front motors to build up speed...

Fastforward with a tri means front is pointing down.
Not a god way to launch a wing at low altitude.....

Just crossed my mind.

/ Patrik

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

Re: TRIWII VTOL

Post by cob »

Impossible to fly TRI and change mode as the mode is not controlled by a switch.
I control it via the AUX2 channel having a lateral potentiometer on the side of my Radio (Aurora 9)

Yes slowly tilting to 45-50° the two front motors and when speed is enough it'll fly.

Landing is simple : reduce speed, just before stall back to TRI mode. Or keep some speed having the two front motors at a 65-80° and land like a conventional VTOL. Or cut all power, tilt the front motors up to not destroy the propellers and land like a sail-plane.

For now it is NOT on automatic flight mode change. It is planned in the near future. ;)
But I need to test in real flight, only hoover has been tested yet. And I'm not fully satisfied with it. When hovering will be very stable I'll work on the others flight characteristics. (It implies possible vortex generators to delay and smooth stall, bigger Ailerons to get earlier control or even thicker profile to slow it down...)
I'm still wondering what kind of a gear I'll put under it. And I'm awaiting bigger propellers for front motors to make more testing.
Takes time, but hope will worth it!

cass3825
Posts: 14
Joined: Thu Mar 31, 2011 3:09 am

Re: TRIWII VTOL

Post by cass3825 »

Cob,
I believe we are on parallel paths. Take a look at our accomplishments here: http://www.rcgroups.com/forums/showthread.php?t=1408344

Videos are in the first post. I'm in the process of porting our code mods from 1.7 to 1.8.

Regards,
Billy

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

Re: TRIWII VTOL

Post by cob »

Hi Billy
Yes we are on the same path but on different machines. I'm using a Falcon Wing.
I'm answering very late to your post as I switched to another board: the Blackvortex from CSG_EU.
After many tests & searching I'm satisfied with it, I'm not using ArduPirate codes as too lenghty and not simple to use with specific libraries etc...
So I'm currently using MWII last dev modified as I'm using TRI config and 4 more servos.
I'm currently having satisfying results in stable mode only tested hovering yet.
Next step is to work transitions and then use GPS functions with RTH, followed by FPV.
I'll dig in Google code trying to find your mods.
I think you are more further in progress than I.
Regards
Olivier

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

Re: TRIWII VTOL

Post by cob »

Here is a link to a video, first real flight. Windy conditions.
http://youtu.be/MujhwmyNC6o

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: TRIWII VTOL

Post by copterrichie »

Interesting.. Great Job!

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

Re: TRIWII VTOL

Post by PatrikE »

@cob.
Have you tested the transaction yet?

Post Reply