Using CH-Products Flight Yoke (Joystick) to remote pilot your APM plane

For anybody interested in using a joystick or flight yoke to pilot your ArduPlane, I have successfully configured the CH-Products 'Flight Yoke' to work with a Spektrum DX6i using a PPM converter and a script written for the yoke that will allow you to change flight modes from the yoke using the buttons and the programming language supplied with the yoke driver.

The yoke can be purchased from here

I paid $85 for one and it works great. There is a newer model, but for basic flying, this one has plenty of buttons and knobs to get the job done.

The PPM converter that I used can be purchased here

This is the 'CompuFly' ppm converter for use with JR transmitters, but it also works with the Spektrum DX6i (and I assume other Spektrum transmitters), by flipping the polarity to 'positive' PPM.

Part 1: Configuring the Flight Yoke:

The main screen of the flight yoke software panel looks like this:


You should test the joystick with your flight simulator before you try making it work with the PPM converter. My test was done using X-plane. It's as simple as following the wizard, and proceed to the 'Test/Calibrate' screen to get the yoke setup for normal windows joystick operation.

Once you have added your yoke to the CH Control Manager, you can then proceed to configure each axis to control your plane. My setup has the following configuration:

Joystick X-Axis (A1) =  Roll 

Joystick Y-Axis (A2) = Pitch 

Joystick Z-Axis (A3) = Throttle

Joystick U-Axis (A4) = Yaw

Joystick Slider-0 = Gear channel (Button 5 and 6) 

Joystick R-Axis = Button modes:

Button 9 = FBWA mode

Button 10 = AUTO mode

Button 11 = RTL mode

Button 12 = MANUAL mode

The modes are (of course) going to be whatever you have them set to in your ArduPilot, but these are the ones I have in my default config. The resolution of the modes can also be modified and more buttons added to the script to achieve more mode possibilities, but my DX6i is setup for 4 modes. 

For the Yaw axis, there is no actual joystick input because I do not have the pedals, so I chose to use a mixing mode and added the Roll channel to the U-axis output in a script to simulate the rudder working with the roll channel. The rudder mixing will apply when flying in MANUAL mode. The ideal simulator would also have the pedals which are optional. You can buy these as an add-on and use them with the yoke and create a single simulated joystick.

I will describe how to setup the script to achieve the rudder mix and button mode code to make this setup work with the ArduPilot for those that do not have the pedals. 

To customize the output of the yoke, the yoke must be configured to run in 'mapped' mode as shown in the following screen:

The "CMS Controls" tab will allow you to select which joystick channel will be used in the scripts and which joystick output will be assigned to that channel. 

My configuration is as follows:

CMS.A3 = R Axis (Button Modes)

CMS.A4 = U-Axis (Yaw Channel) The output is computed in the script. 

CMS.A5= Slider-0 (Gear Channel on radio)

To make these channels programmable, check the "DX Mode" box as shown above.

My transmitter is a 6 channel device, however if yours has more, you can just pick additional CMS inputs to use for the other transmitter channels, and assign them accordingly

On the "FS Yoke" tab, the first three channels should be assigned to Roll (X-Axis), Pitch (Y-Axis), and Throttle (Z-Axis) respectively, and the 'DX Mode" box checked for these channels. This will force the yoke to pass these channels through to your transmitter without any software input. If you want to modify the behavior of these channels in the script, then you must uncheck this box on the 'FS Yoke' tab, and check the box on the CMS Controls' tab for that axis. 

Creating the Script:

The script is actually very simple. For the rudder mix, it's one line of code:

 CMS.A4 = JS1.A1/4+32;

This will give you a 25% rudder movement compared to the roll when flying in MANUAL mode. You can play with the mix as you desire. If you are flying in FBWA, you probably have some rudder mix, so it's probably a good idea to match that here. If you don't want any rudder mix, delete this line of code and the rudder will stay fixed in MANUAL mode.  For stunt flying or 'knife edge' tricks, you may want to get the pedals, or try assigning the 'prop' or 'fuel mix' channel to the rudder and use the slider to control the rudder - this is advanced, and I have not attempted such a configuration but it's possible to setup using the scripts.

Here is the entire script:

// CMS Script File
//
// Game Title:
// Written By:
// Date:
//
script

CMS.A4 = JS1.A1/4+32;

IF (JS1.B9) THEN
CMS.A3 = 0;
ENDIF

IF (JS1.B10) THEN
CMS.A3 = 110;
ENDIF

IF (JS1.B11) THEN
CMS.A3 = 190;
ENDIF

IF (JS1.B12) THEN
CMS.A3 = 255;
ENDIF

IF (JS1.B5) THEN
CMS.A5 = 0;
ENDIF

IF (JS1.B6) THEN
CMS.A5 = 255;
ENDIF

endScript

To cut and paste the script into the joystick, press the "CM Editor' button on the toolbar and paste it in. Then press the "Download" button as shown in this screenshot:

Once you have 'downloaded' the configuration, you can then test it. You should see the following screen after you enter the test mode:

Moving the yoke and observe the channel outputs.  "Roll" should move the X and the U channels. The U channel is the rudder mix. The "Pitch" should move the Y-channel, and Throttle should move the Z channel. 

The R-channel should be changing when you press the buttons that you have configured to control the modes. On my configuration, buttons 9 -12 control the modes.

Lastly, buttons 5 and 6 should control the S0 (Slider 0, Gear channel). On my plane, this turns on the camera for FPV.

Part 2: Configuring the PPM converter

The CompuFly USB PPM converter has a single screen configuration as shown as follows:

For the Spektrum DX6i, set the modulation to 'Positive PPM', and 6 channels. If you have a different radio, you will have to check the documentation or experiment. For my radio, I have channels 1-4 set to INVERT, (inv check box). These are the surface and throttle control channels. You will need to experiment to get these right for your plane and transmitter depending on how your servos are configure with the ArduPilot. For the 'flight modes' and 'Gear' channels, my configuration is set to non-inverted.

The key point of the configuration not shown here is the Joystick-to-channel mapping which is in the (settings.ini) INI file stored in the same directory as the CompuFly.exe application.

Here is my configuration:

[SETTINGS]
PORT=COM23
ChannelCount=5
PPMType=1
Compufly2=1


[INVERT]
CHANNEL1=1
CHANNEL2=1
CHANNEL3=1
CHANNEL4=1
CHANNEL5=0
CHANNEL6=0
CHANNEL7=0


[TRIM]
CHANNEL1=0
CHANNEL2=0
CHANNEL3=0
CHANNEL4=0
CHANNEL5=0
CHANNEL6=0
CHANNEL7=0


[EPA]
CHANNEL1=100
CHANNEL2=100
CHANNEL3=100
CHANNEL4=100
CHANNEL5=100
CHANNEL6=100
CHANNEL7=100


[CHANNELS]
CHANNEL1=3
CHANNEL2=1
CHANNEL3=2
CHANNEL4=5
CHANNEL5=7
CHANNEL6=6
CHANNEL7=10

#Channel Axis Numbers
# X axis = 1
# Y axis = 2
# X axis = 3
# RX axis = 4
# RY axis = 5
# RZ axis = 6
# S1 axis = 7
# S2 axis = 8
# HTX axis = 10
# HTY axis = 11
# SWC axis = 12

 

You can cut-and-paste the previous text directly into your INI file. Take care to test this completely with your plane on the ground and the prop removed! If you get the throttle channel backwards, the motor could go full on you. Be careful here.

To test your setup, plug in the PPM converter to the back of your transmitter in the 'Trainer' port, and turn on your transmitter and power up your plane. Flip the 'trainer' switch on the DX6i.  Move things around and see what happens! For my transmitter, I replaced the trainer switch with a more robust toggle switch. The original one broke off. 

If everything is good, you should be able to control everything using the Flight Yoke, including the flight modes. 

Happy Flying!

Views: 2777

Comment by Søren Kuula on May 2, 2014 at 6:35am
Interesting. But how does this work, is the PPM converter a USB host or a device? If it is not a host, the joystick cannot be connected directly to it. If it is not a device, it cannot connect with a PC. And USB devices are AFAIK never also hosts
Regards, Soren
Comment by Nick Tuttle on May 2, 2014 at 2:53pm

Nice! I'm working on a similar solution (though not as well thought out..) using a raspberry pi and arduino to get a Sidewinder Precision Pro to talk to my Aurora 9. Essentially I should be able to use almost any usb joystick style input supported by the Linux joystick driver.

Comment by Patrick Duffy on May 2, 2014 at 7:09pm

Soren, you are correct, you do do not connect the PPM converter to the joystick. You have to have a ground station PC to do it this way. The PC is connected to both the PPM converter and the joystick and the software running on the PC does the work. 

Comment by criro1999 on May 2, 2014 at 7:11pm

Very interesting article, hope soon to follow your setup.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service