Software Control Scheme for an X52, using GlovePIE and PPJoy through Fly-by-Wire

HarvesteR

Member
Joined
Apr 22, 2008
Messages
386
Reaction score
22
Points
18
Hello,

I have no idea if this is the proper forum for this... but then again, it IS related to both hardware and software ;) (If I'm wrong, do move, please)

Seeing that quite a number of people here have X52 sticks, I thought it'd be useful for some to share my control scheme for Orbiter.

Orbiter by default is pretty limited with input handling, so I decided some time ago to take my time to cook up a scheme for some more advanced input mappings... something that could handle my X52, the pedals, and my SpaceNavigator 3D mouse.

This scheme works like this:

There are 3 main control modes:
Flight mode is used when flying under an atmosphere, or reentering a planet with an atmosphere (Mars is a little ambiguous on this respect...), Here you control your ship as an airplane (shuttle or DG style).

Orbital Mode is used for orbiting and docking

Maneuver mode is used for flying in a planet or moon with no atmosphere (or Mars, which is thin enough). This mode changes control so a ship with hover engines will handle like a helicopter.

There's still much to be done with the setup, but it's pretty playable as it is right now... So here's how it's done:

GlovePIE reads the axes from the X52, the rudder pedals and the SpaceNavigator, and runs a script that maps them, depending on which of the 3 modes it's set to, onto PPjoy.

PPjoy is a virtual joystick driver, that creates, well, virtual joysticks. GlovePIE can write to them, and the Fly-by-Wire module in Orbiter reads them.
There are 3 virtual joysticks setup, each with a specific function in Orbiter. What the GlovePIE script does is, depending on mode, assign different axes from the X52 and friends to these virtual joystick axes, which are in turn, received by Fly-by-Wire.

Fly-by-Wire then, passes the mapped input axes onto Orbiter. :thumbup:

Ok, so, here's how to set it up... Attached are 2 GlovePIE scripts (one that uses the SpaceNavigator for RCS, and on that uses only joystick buttons and axes for that), a profile configuration for Fly-By-Wire, and a profile for the X52.

You will need to install PPJoy and set up the virtual devices on your own though (more on that later... keep reading)

What you will need:

GlovePIE (Programmable Input Emulator) 0.43
http://glovepie.org/GlovePIEWithoutEmotiv043.zip

PPjoy 0.8.4.6
http://drop.io/ppjoy0846testrelease
http://www.megaupload.com/?d=US4CQ0TS (alt. link to PPjoy, in case the one above doesn't work)

Fly-By-Wire 0.9.1 beta
[ame="http://www.orbithangar.com/searchid.php?ID=3223"]Fly-By-Wire 0.9.1 beta[/ame]

Saitek SST programming software
(if you got an X52, you probably have it installed. If not, you can grab them from the Saitek site here: http://www.saitek.com/uk/down/drivers.php)


How to set it up:

First of all, install PPJoy. that is possibly the most complicated part of the whole process, since it's not always so easy to install it... on WinXP it should work alright, but on Vista and 7 you might need to enable test mode for the drivers before installing. here's how:

- Open up the command prompt (Start->Run->type cmd), and in there, type: BCDEDIT -SET TESTSIGNING ON
- restart your computer... next time you boot you should see a 'test mode' message near the clock on your desktop.
- now install PPJoy (it shouldn't complain now)

Once PPjoy is installed, you need to set up your virtual joysticks (it enables none by default)... that's pretty straightforward. Just open the 'configure virtual joysticks' app on your start menu, under Parallel Port Joystick, and create 3 new devices. When creating a device, it will ask you for a device number. Give it the next available number, based on how many joysticks you already have installed. (if you got the X52 and pedals, the first virtual device you create should be number 3)

You can verify that you have 3 shiny new virtual joysticks by going into Game Controllers on the control panel (for windows 7, Start->Run->Type joy.cpl), and making sure there are new devices there.

Ok, so now we have the virtual joysticks in place, let's go ahead and install GlovePIE. This awesome program can do pretty much anything when it comes to hacking input devices. The core of the setup is done here. Once installed, you can open the attached .PIE files with it, and have a look at them.

GlovePIE has it's own scripting language, and that enables us to do whatever we want. in this instance, it's reading the input from the physical joysticks, and mapping them, depending on mode, onto virtual devices that will be mapped into Orbiter through FBW.

Now, open up one of the included scripts with GlovePIE (if you haven't a SpaceNavigator, it should probably be the one that doesn't say SpaceNavigator ;) )

The first section of the attached scripts are comments that explain in a little more depth what is going on here... Also here I wrote down the virtual axis mapping into Fly-By-Wire, just in case the profile configuration I'm including doesn't work.

Run the script in GlovePIE now... you should hear Microsoft Anna saying "flight controls started". (yes, the control scheme talks to you :thumbup: )


Ok, now... we got PPjoy and GlovePIE up and running (here's hoping everything went ok up until now)

By now you should probably be installing Fly-By-Wire, if you haven't already, and replacing it's profile in the '<OrbiterDir>/FlyByWire/Current' folder by the one here.

Now we're just missing one little but critically important part of the process... We need to set up a profile for Orbiter in the Saitek SST... included is a my profile for it, which is simply a profile that's been stripped of ALL modes (except mode 1, which is mandatory), and has absolutely no mappings.
This is necessary, since without it, you can't read the state of the mode switch... which renders this whole thing pointless... by disabling all modes, GlovePIE can read the mode switch as buttons.

So, either load up the included profile, or create one and wipe it clean of all modes and apply it.

Now, when you run the glovePIE script, you will hear MS Anna again... and nothing new will have happened... now, assuming everything went right, if you hit the A button (the upper one right of the safe button), MS Anna should say "atmospheric flight controls engaged".

Now, you can go into Launchpad, open up FBW's config dialog, and see if the axes move when you move your stick (and rudder (and SpaceNavigator if you have one)). If that works, you're pretty much done!! Congratulations!!


This is the abbridged control mapping for my scheme... I hope you like it (changing it will require some tweaking of the GlovePIE script). you will find the full mapping commented throughout the GlovePIE script (it's quite large... I'm sure I'll forget a few)

Mode 1 :: Atmospheric Flight Control

X52:
X - Roll
y - Pitch
Throttle - well, throttle :p
Left toggle (T1) - Gears up/down
Small Rotary - Elevator Trim
Right toggle (T3) - Flight RCS assist on/off (voice cue will let you know)

Rudder Pedals:
Left/Right - Yaw
(still missing are mappings for the toebrakes... I still have to get around to doing it... should take 5 minutes though...)


Mode 2 :: Orbital Controls

X52:
Safe Button - Undock from station
Hat 2 - attitude autipilot (clockwise: prograde, normal, retro, antinormal)
Throttle - Main Engines
Slider - Retro

RCS: (non-spaceNavigator version)
Roll, pitch and yaw - X52 stick and rudder pedals
LIN X - rudder toebrakes
LIN Y - throttle hat up and down
LIN Z - x52 trigger and pinkie switch

Mode 3 :: Maneuver (non-atmospheric flight) (handles like a helicopter)

Roll, pitch and yaw - X52 stick and rudder pedals
Hover - X52 throttle
Main Engines - X52 throttle slider

RCS: Same as above.


Common controls for all modes:

C button: Kill Rot.
A Button: Engage Mode
Mode switch : switch modes

One thing worthy of note: when you switch from one mode to another, you will hear MS Anna say "controls disengaged". This is so you can have time to replace your axes (mainly throttle and slider) back to zero before engaging the next mode, since they will change functions on some modes.

To engage the new mode, press the A button again. MS Anna will call it out.


Another thing: The SpaceNavigator version overrides the RCS control only when in Orbital mode (which is the mode used for docking). When in flight or maneuver, RCS is still controlled by the stick. (linear RCS is available for Maneuver and Orbital modes only)

One last thing: This setup will completely override Orbiter's RCS mode switch... be it on ROT, LIN or OFF, it doesn't matter anymore... this is more Fly-By-Wire's doing than mine, really... but it shouldn't matter since if you want if off, you can just flip the mode switch and disengage all controls, or just put it in flight mode and leave RCS assist off. Also, the AF controls switch is also overriden... these shouldn't be a big deal really...


Well, this was a VERY long post... if you read this far, congratulations, and thanks for putting up with my ramblings :)

I hope this helps out others. BTW, you have full permission to modify the supplied scripts... whatever works for you :thumbup:
You may not, ever ever, sell these or make money from these in any way.
And please, remember to give credit if redistributing to a (freeware) source.

Best of luck.

Cheers

View attachment control scheme.zip
 
Last edited:

n122vu

Addon Developer
Addon Developer
Donator
Joined
Nov 1, 2007
Messages
3,196
Reaction score
52
Points
73
Location
KDCY
Definitely going to give this a try. Thanks for taking the time to share and explain the setup!

One question, and I'd check this myself if I wasn't at work, but using this method, is it possible to map controls for the scram engines on the XR vessels? That's been a "REALLY-nice-to-have" that's been on my list for a long time...

Thanks again!
n122vu
 

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
ooooor....

you -could- just have searched the forum before going mad with all this, and you would have found my multi-joystick module which already does all that through DirectInput and the orbiter-SDK itself, eliminating all need for external programs :hmm:

it's not done yet - but i have the same X52+spacenavigator setup as you and i wrote this thing pretty much as an ad-hoc adaptor for it...

the "not-done" part is pretty much most things related to getting this to work for people with different rigs


yours should be fine then.... :cheers:

---------- Post added at 11:04 AM ---------- Previous post was at 10:57 AM ----------

(...) is it possible to map controls for the scram engines on the XR vessels? That's been a "REALLY-nice-to-have" that's been on my list for a long time...


that's one to ask Doug about... as far as i get it, the XR-series vessels don't use axes to control their scram engines, instead, they are set by an internal variable which is only accessible by keyboard....

quite a shame, if you ask me :rolleyes:

either way, one possible alternative is to somehow get a joystick to report axis increments in the form of key-taps.... it's not a very elegant solution... and should take it's toll on precision, and in a worse-case-scenario, the full range of the axis fails to correspond to the amount of taps betweem min and max throttle :uhh:

...that would also require some extra coding, for my module still doesn't do that :rolleyes:
 

C3PO

Addon Developer
Addon Developer
Donator
Joined
Feb 11, 2008
Messages
2,605
Reaction score
17
Points
53
ooooor....

you -could- just have searched the forum before going mad with all this, and you would have found my multi-joystick module which already does all that through DirectInput and the orbiter-SDK itself, eliminating all need for external programs :hmm:

Have you considered releasing it? A v0.0x on Orbithangar would make it much more accessable for Orbiteers.
 

HarvesteR

Member
Joined
Apr 22, 2008
Messages
386
Reaction score
22
Points
18
ooooor....

you -could- just have searched the forum before going mad with all this, and you would have found my multi-joystick module which already does all that through DirectInput and the orbiter-SDK itself, eliminating all need for external programs :hmm:

it's not done yet - but i have the same X52+spacenavigator setup as you and i wrote this thing pretty much as an ad-hoc adaptor for it...

the "not-done" part is pretty much most things related to getting this to work for people with different rigs

The one advantage of my setup is that it endlessly tweakable... you don't have to have the source for it, since it's scripted... and that, to me, is very useful, since I'm never fully satisfied with it... and it only took me 2 days :rolleyes:

GlovePIE script is really simple (I picked it up just by looking at the examples... had to really, since the docs are, well, scarce)... and many will be able to tweak it to work the way they want it to. Plus, it TALKS!!

BUt yeah, I reckon my scheme is pretty ad-hoc too... but if you want to get down and dirty with the scripting, you can tweak it to work with any other joystick... Or come up with even crazier controls... the thing about this method, is that it effectively separates the axes from the actions, so you can have full flexibility (as opposed to an SST profile, that only lets you configure buttons... this lets you configure everything)

About the scrams... yeah, I'm still looking for a way to have those mapped in... you will note that Flight Mode has nothing mapped to the slider axis on the throttle... it's set apart for the scram engines... once I figure out how to get orbiter to read it...

The incremental button-push axis Moach mentioned is actually a valid possibility... I have an SST profile to use the X52 throttle in Photoshop, as a brush controller, and it's almost entirely based on incremental axes...

They sometimes become offset from the target value... but (in PS at least) it's just a matter of cycling the full range again. The frequency of keystrokes vs axis range travelled must be carefully configured, so that an average throw will send out enough keys to max out the value.

In GlovePIE, it should in fact be easier to code up something to that end... You could measure a delta in axis position, and, from that, send out as many keystrokes as that delta would correspond to.... since you can declare variables, you have more control over how it's being done...

I wanted to try it... but I haven't even been able to figure out the keystrokes for the scrams :blush: (talk about selective learning :shifty: )

Also, can airbrakes be controlled by axes? or are they just a binary command, like the toebrakes?

Well, To those about to try it, me and these smilies salute you. :tiphat: :tiphat: :tiphat:

Cheers
 
Last edited:

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
airbrakes... no...
well, in the G42 you can, but that's because i rigged them to respond to the retro axis :huh:

orbiter doesn't really have "airbrakes" in it's simulation... it has "variable drag elements" which are exposed to VESSEL-class objects in the API...

the delta-glider toggles them with "b" but another ship might not... it's not like in FS where aibrakes are always airbrakes and that's that :hmm:
 
Top