QuadPlane help for code

H all,

I have a project of building a quadplane with a servo to control the angle of the 4 motors.
It’s different from all the Quadplane projects i saw on the forum do I started learning how to code :wink:

I want to wire my quadplane as it :
MAIN1: Front right motor, CCW
MAIN2: Back left motor, CCW
MAIN3: Front left motor, CW
MAIN4: Back right motor, CW
AUX1: Aileron
AUX2: Elevator
AUX3: Rudder
AUX4: Servo for motor angle

I think I don’t need to do much :
_ Creating a copy of the modes STABILIZE, ALT HOLD and RTL --> QSTABILIZE, QALT HOLD and QRTL
with a specific servo outpout that i could add as a parameter for example : PWM_QUADCOPTER to command AUX4.
I’d like to also have the commands as in a MANUAL Mode in Plane for the Aileron, Elev and Rudder (I have a V-Tail so I hope it’ll not be so hard to implement the V-Tail option in the code !)
_ Creating a Mode PMANUAL in which Aileron, Elev and Rudder are working as in MANUAL ARDUPLANE and all the MOTORS receives the THROTTLE input.

Hope you guys can help me :slight_smile:

http://discuss.ardupilot.org/t/tiltrotor-support-for-plane/8805

1 Like

Thank you a lot !
But I didn’t understand how to build the .px4 :confused:
The Quadplane.cpp is in the Ardupilot repository in the ArduPlane folder.
I succeed in building the ArduPlane.px4 with the command on the Px4 console :
make px4
and It does 3 .px4 files : arduplane-v1, arduplane-v2, arduplane-v4.

When I load the arduplane-v2.px4 on my Pixhawk board, it is not showing any of the quadplanes parameters or possibilities.

Edit : With ArduPlane 3.7 I put Q_ENABLE to 1 and BOOM !
Now I am figuring out which parameter is doing what I want ^^

@maelito support for tiltrotors is actually in the 3.7.0 release, but it has only ever been flown in a simulator.
I’m away all this week but hope to do some tiltrotor testing when I get back

Thank you @tridge and from what I saw you did a grood part of the coding work !

I copyed the QHOVER mode everywhere I could find it into a QHOVER15 that is a transition mode as I have only the motor tilting, so the wing is horizontal when I am fully going forward in QHOVER15.
So here is what I did :

if (plane.control_mode == QSTABILIZE ||
    plane.control_mode == QHOVER) {
    tiltrotor_slew(0);
    return;
}

if (plane.control_mode == QHOVER15) {
    tiltrotor_slew(0.15);
    return;
}

And the mode is working pretty good in theory because from now I only tested the outputs with servos with nothing on it because I am still working to do the mechanical part :wink:
What I can’t figure out is where can I param the PWM or angles to the tilt motor servo of plane and Copter ?
The param Q_TILT_MAX is not changing the angle for me (I supposed it was this parameter)

Here are my parameters for now and it is approximative, I have nothing pluged in my pixhawk exept servos to verify outputs and the receiver with PPM encoder : Parametres for quad tilt rotors.txt (12.6 KB)

@maelito there is support for tiltrotor transition already in the code. Just set:
Q_TILT_MASK = mask of motors that can tilt (so 15 for all 4 motors)
Q_TILT_RATE = rate of tilt in degrees/sec
you also need to setup an RCn_FUNCTION=41 for the output channel controlling the servo tilt. For example, if you are doing tilt on channel 9 then set RC9_FUNCTION=41. You can then set RC9_MIN, RC9_MAX and RC9_REV as needed for the tilt.
Then to transition you switch to FBWA mode.
I have not done any simulator testing with a quad that tilts all 4 motors btw. I’ve only tested tilting two of the motors.

1 Like

@tridge Thank you !
You confirmed what I figured out reading your posts in the “Tiltrotor support for plane” section.
And for the RCx_MIN and RCx_Max,I just Configured it this morning and it is perfect now !

The only thing I noticed is that I had weird behaviour when I was doing transition from MANUAL MODE to QHOVER. When switching from MANUAL to QHOVER the Motors were all runing fairly quick and when I throttled down it took 5-7 seconds to stop and it was apparently not responsive at all… (I did tests with no props on ;))

I saw that you were using FBWA mode as the first mode in Plane after the transition, why ? Can I do a flight like this : Taking-off in QHOVER, taking altitude with it, then to my mode QHOVER15 to gain speed and then switch to MANUAL and fly in MANUAL as a PLANE and ultimatly land as a plane ?

Today I also wanted to check the simulation of quadplane but I really don’t understand how simulation is working !

I installed Flightgear. I have a cable from my Futaba FX-30 to USB and I succed to fly the Rascal 110 RC with it.

Then what I wanted is to connect the Pixhawk receiving the signal via the PPM encoder and the radio controller not pluged with USB to use the RCIN of the Pixhawk as the inputs of the FlightGear Joystick.
when I launch Simulation when I press on the Plane (Mission Planner 1.3.41) It disconnect the Pixhawk and start to link with a TCP port. I have no Idea how to reach it with FlightGear. when I go to Joystick Configuration there is nothing.

When I select quadplane in Advanced users only it’s the same.

note : I had the choice to put an adress something like 255.0.0.0 but I could find anywhere in the peripheral settings or in the Control Panel’s tools the adress of my Joystick when linked by USB.