Board index FlightGear Support Hardware

PS3 Joypad XML

Joysticks, pedals, monitors.

PS3 Joypad XML

Postby anewb » Wed Mar 24, 2010 7:41 pm

Hey guys, didn't know where else to put this.. so..


Since my PS3 60GB died of YLOD (Dry thermal compound! Yes yes, have your laughs..) I was looking for something else to do with my controller, and well I found it.. so..

I googled around for a PS3 Joypad XML first day I started out with FlightGear, I could not find one, found bits of discussion about one, but never found one, so if one exists, sorry about that.

So, I set about making my own.. after a little research of the tags used and what not, I started making one. After some shouting some swearing, and lots of controller errors, and a few game crashes caused by the controller and buttons sometimes simply not working and a bit of help with jstest, this is now [s]mostly[/s] working, [s]all but the Fire Engine Starter button, but aside from that, everything else works :-)[/s]. Figured I'd post it up, so if anyone else is searching around for one, they can find one :-). I've only tested this on Linux Fedora 12, cannot guarantee it'll work on Windows. Had a few flights with it, and all seems to be fine so far :-)

You may also want to adjust the rudder speed, I originally had the rudders working one way, but had to do it another as seemingly they only worked on certain aircraft, however they work fine on all now (At least what I tested) :-)

Anyhow..

Controls:
Image

If you ever forget them, just go to Help > Joystick info - There all there :-)
The XML:
Code: Select all
<?xml version="1.0"?>
<!--
   To override or add "named" joystick drivers list them in
   <js-named> entries with paths relative to the directory where
   the joysticks.xml file resides (first example). Such "named"
   drivers are only picked up if one of their <name>s matches
   the joystick hardware (see output of the js_demo application).
   These drivers have precedence over already existing drivers
   with the same <name>. (You can also add a <name>default</name>
   entry to the driver to make it the default choice.)

   The second example shows how to load a driver directly to
   position 0. This will then be used for the first joystick on
   your system and FlightGear will not overwrite it.
-->

<PropertyList>
  <axis>
    <name>Left Stick Left/Right</name>
    <desc>Aileron</desc>
    <direction>right</direction>
    <binding>
      <command>property-scale</command>
      <property>/controls/flight/aileron</property>
      <offset type="double">0</offset>
      <factor type="double">1</factor>
      <power type="int">1</power>
    </binding>
    <dead-band type="double">0.01031525619</dead-band>
  </axis>
  <axis n="1">
    <name>Left Stick Up/Down</name>
    <desc>Elevator</desc>
    <direction>down/forward</direction>
    <binding>
      <command>property-scale</command>
      <property>/controls/flight/elevator</property>
      <factor type="double">-1</factor>
      <power type="int">1</power>
    </binding>
    <dead-band type="double">0.01031525806</dead-band>
  </axis>
  <button n="9">
   <name>R2</name>
   <desc>Rudder Right</desc>
   <repeatable type="bool">true</repeatable>
   <binding>
      <command>property-adjust</command>
      <property>/controls/flight/rudder</property>
         <step type="double">0.05</step>
   </binding>
  </button>
  <button n="8">
   <name>L2</name>
   <desc>Rudder Left</desc>
   <repeatable type="bool">true</repeatable>
   <binding>
      <command>property-adjust</command>
      <property>/controls/flight/rudder</property>
         <step type="double">-0.05</step>
   </binding>
  </button>
  <axis n="3">
    <name>Right Stick Up/Down</name>
    <desc>Throttle</desc>
    <direction>forward</direction>
    <repeatable>true</repeatable>
    <binding>
      <command>nasal</command>
      <script>controls.throttleAxis()</script>
      <factor type="double">-1</factor>
    </binding>
    <dead-band type="double">0</dead-band>
  </axis>
  <button n="0">
    <name>Select</name>
    <desc>View Cycle</desc>
    <repeatable>false</repeatable>
    <binding>
      <command>nasal</command>
      <script>view.stepView(1)</script>
    </binding>
  </button>
  <button n="14">
    <name>X</name>
    <desc>Brakes</desc>
    <binding>
      <command>nasal</command>
      <script>controls.applyBrakes(1)</script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>controls.applyBrakes(0)</script>
      </binding>
    </mod-up>
  </button>
  <button n="15">
    <name>Square</name>
    <desc>Left Brake</desc>
    <binding>
      <command>nasal</command>
      <script>controls.applyBrakes(1, -1)</script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>controls.applyBrakes(0, -1)</script>
      </binding>
    </mod-up>
  </button>
  <button n="13">
    <name>Circle</name>
    <desc>Right Brake</desc>
    <binding>
      <command>nasal</command>
      <script>controls.applyBrakes(1, 1)</script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>controls.applyBrakes(0, 1)</script>
      </binding>
    </mod-up>
  </button>
  <button n="11">
    <name>L1</name>
    <desc>Flaps Down</desc>
    <repeatable>false</repeatable>
    <binding>
      <command>nasal</command>
      <script>controls.flapsDown(-1)</script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>controls.flapsDown(0)</script>
      </binding>
    </mod-up>
  </button>
  <button n="10">
    <name>R1</name>
    <desc>Flaps Up</desc>
    <repeatable>false</repeatable>
    <binding>
      <command>nasal</command>
      <script>controls.flapsDown(1)</script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>controls.flapsDown(0)</script>
      </binding>
    </mod-up>
  </button>
  <button n="4">
    <name>Up</name>
    <desc>Elevator Trim Forward</desc>
    <repeatable>true</repeatable>
    <binding>
      <command>nasal</command>
      <script>controls.elevatorTrim(0.75)</script>
    </binding>
  </button>
  <button n="6">
    <name>Down</name>
    <desc>Elevator Trim Backward</desc>
    <repeatable>true</repeatable>
    <binding>
      <command>nasal</command>
      <script>controls.elevatorTrim(-0.75)</script>
    </binding>
  </button>
  <button n="12">
    <name>Triangle</name>
    <desc>Landing Gear Toggle</desc>
    <repeatable>false</repeatable>
    <binding>
      <command>nasal</command>
      <script>controls.gearToggle()</script>
    </binding>
  </button>
  <button n="1">
    <name>L3</name>
    <desc>Parking Break Toggle</desc>
    <binding>
       <command>property-toggle</command>
       <property>/controls/gear/brake-parking</property>
   </binding>
  </button>
  <button n="2">
    <name>R3</name>
    <desc>Thrust Reverse Toggle</desc>
    <binding>
      <command>property-toggle</command>
      <property>controls/engines/engine[0]/reverser</property>
   </binding>
   <binding>
      <command>property-toggle</command>
      <property>controls/engines/engine[1]/reverser</property>
    </binding>
  </button>
  <button n="3">
    <name>Start</name>
    <desc>Toggle the pause state of the sim</desc>
    <binding>
      <command>property-toggle</command>
       <property>/sim/freeze/master</property>
    </binding>
    <binding>
      <command>property-toggle</command>
       <property>/sim/freeze/clock</property>
    </binding>
    <binding>
      <condition>
           <property>/sim/freeze/replay-state</property>
      </condition>
       <command>property-assign</command>
      <property>/sim/freeze/replay-state</property>
      <value type="int">0</value>
    </binding>
  </button>
  <button n="5">
    <name>Right</name>
    <desc>Increase Magneto on Selected Engine</desc>
    <binding>
      <command>nasal</command>
       <script>controls.stepMagnetos(1)</script>
    </binding>
    <mod-up>
    <binding>
       <command>nasal</command>
       <script>controls.stepMagnetos(0)</script>
    </binding>
    </mod-up>
   </button>
  <button n="7">
    <name>Left</name>
    <desc>Decrease Magneto on Selected Engine</desc>
    <binding>
      <command>nasal</command>
       <script>controls.stepMagnetos(-1)</script>
    </binding>
    <mod-up>
    <binding>
       <command>nasal</command>
       <script>controls.stepMagnetos(0)</script>
    </binding>
    </mod-up>
   </button>
  <button n="16">
    <name>PS Button</name>
    <desc>Show/Hide Menubar</desc>
    <binding>
      <command>property-toggle</command>
      <property>/sim/menubar/visibility</property>
    </binding>
   </button>
  <name type="string">PLAYSTATION(R)3 Controller</name>
</PropertyList>


Update: Fixed typo's of "Flaps Up" & "Flaps down". L1 is down, not up. and visa versa :lol:
Update: See my post below.

Anyhow, Enjoy :-)
anewb
 
Posts: 55
Joined: Sat Mar 13, 2010 8:04 am
Location: England
Callsign: anewb, Crazy-J
OS: Linux Fedora 28

Re: PS3 Joypad XML

Postby anewb » Tue Mar 30, 2010 9:57 pm

Figured I'd bump this so people notice it was updated, in-case they're using it and don't notice the update.. anyhow:

I changed it a bit, I couldn't get the silly fire starter working. Thus it's gone. And replaced by Parking Break. Which used to be on R3, however R3 now has thrust reverser. The PS Button now does something also! :D - this now shows / hides the menu.

I've used this for a while now, and is working fine :-) as far as I am aware, all buttons are now working. If you find a dud button, let me know :-) - I've tried to make the need to ever reach for the keyboard minimal as possible :-)

Note: I did however, find a slight bug, that is, not all heli's start straight away using the Right button, this can be solved by first starting the heli initially with }, and then the right button will work, even after a reset (However not after a game restart) mostly noticed this with the v22.

PS: That thrust reverser comes in damn handy when used with 777 for landing, I got near on perfect landing using both Parking break & thrust reverser :-). Though that was after consistently taking off, turning round and landing again quite a few times :-).
anewb
 
Posts: 55
Joined: Sat Mar 13, 2010 8:04 am
Location: England
Callsign: anewb, Crazy-J
OS: Linux Fedora 28

Re: PS3 Joypad XML

Postby Casey » Sat Jul 03, 2010 8:18 pm

Hey, I just downloaded FG 2.0, I have, for now, a similar gamepad, except it is USB. I played MSFS 2004 for about 3 yrs after launch, had an actual steering yoke and pedals, the whole works. Anyway. I recently moved to NY from VA, and ran across FG, totally by accident, unfortunately for now all have is a gamepad to play it with. !st question, will this setup work with similar gamepads, all buttons are the same, just different type. And second, if so, could someone walk me through setting up the buttons, I have no clue where to start. Thanx! And, Great sim BTW!. :)
Casey
 
Posts: 3
Joined: Sat Jul 03, 2010 3:26 pm

Re: PS3 Joypad XML

Postby Toanphuc » Thu Jul 15, 2010 12:40 pm

Can you show me how to make the throtle position not return to 0 when i release the right stick?BTW it work well on windows.
A good flight sim is not to make people feel fly easier but to make them feel fly is as real as it get.
Other Free Flight Sims viewtopic.php?f=3&t=8847
Toanphuc
 
Posts: 183
Joined: Sun Jun 20, 2010 5:26 am

Re: PS3 Joypad XML

Postby KoviRobi-HU » Tue Sep 07, 2010 8:38 pm

Can I make a few modifications on your file, so it fits my Sixaxis configuration guide?
http://www.flightgear.org/forums/viewtopic.php?f=24&t=9402&p=93975#p93975

Thank you, Robert Kovacsics
KoviRobi-HU
 
Posts: 12
Joined: Wed Jun 02, 2010 11:26 pm

Re: PS3 Joypad XML

Postby T4b » Sat Oct 30, 2010 11:46 am

When I try to use this I get:
Code: Select all
Fatal error: xml processing instruction not at start of external entity
 at /usr/share/games/FlightGear/Input/Joysticks/PS3/controller.xml,
line 1, column 4
 (received from SimGear XML Parser)


What did I do wrong?
T4b
 
Posts: 1
Joined: Sat Oct 30, 2010 11:45 am

Re: PS3 Joypad XML

Postby KoviRobi-HU » Sat Oct 30, 2010 10:19 pm

Hi T4b!

From the looks of it, I think you copied the XML file incorrectly, i.e. missing "<?xml version="1.0"?>".
KoviRobi-HU
 
Posts: 12
Joined: Wed Jun 02, 2010 11:26 pm

Re: PS3 Joypad XML

Postby Lelijk » Sat Mar 19, 2011 9:51 pm

I'm new here ...
I have already connected my PS3 controller to my mac,
It works and its all fine.
But how can i get that code above working ? :?:
I know that I have to go to "others" an paste it right there, but the button "start flight" dosen't work untill I delete the hole code...
The button "view options" ... I don't even know why he exist :!:

Cause its seems me way to awesome that its possible to control everything on your plane with the PS3 controller.
( very annoying that i can't now, cause I'm a big fan of helicopters (rudder). :P )
Lelijk
 
Posts: 1
Joined: Sat Mar 19, 2011 9:38 pm

Re: PS3 Joypad XML

Postby Intel-Qube » Fri Mar 25, 2011 6:10 pm

I was thinking about posting something like this, looks like you beat me to it. Good Job! This thread should be stickied.
Fav. Jet: [Self-Designed] X-29
Fav. Plane: de Havilland DHC6
Fav. Airports: KEGE, KDEN, KFCS, KSFO, XBEL
"My mind is like a sponge, it absorbs knowledge." "That's my line." "Yeah, well I absorbed it." -Greg Sanders to Gil Grissom
User avatar
Intel-Qube
 
Posts: 207
Joined: Wed Sep 09, 2009 3:42 am
Location: Colorado, United States
Callsign: Intel-Q
Version: GIT
OS: Win 7 64-bit

Re: PS3 Joypad XML

Postby DarthCookieJM » Sat Apr 16, 2011 5:30 pm

How do I use this to play with my controller? Could someone please run through the steps for me quickly? Sorry and thank you in advance, Jake.
EDIT: where do i put this code?
DarthCookieJM
 
Posts: 1
Joined: Sat Apr 16, 2011 5:24 pm

Re: PS3 Joypad XML

Postby NAVE1 » Sat May 21, 2011 6:16 am

Hi anewb, thank you very much for this! I've it working and I love it :) I've got just one question: Is it possible to configure the throttle so it remains on the last spot when you release the stick? It seems to return to a preconfigured setting now and is very difficult to hold it everywhere else (that's my opinion of course).

And again, thank you for the effort and sharing.

Xavier
NAVE1
 
Posts: 6
Joined: Thu May 12, 2011 12:57 pm

Re: PS3 Joypad XML

Postby Ram » Sat May 28, 2011 11:11 pm

Hi, thank you for this code.

However I had LOTS of problem trying to make it work on windows 7. I have failed.

The reason is that in order to make the PS3 controller work on windows 7 the drivers used change the actual names of the controles. For example the R2/L2 analogue are renamed to some stuff like axis Z. Someone posted that he made it work on windows. Can you guive us some details?

Thank you very much.
Ram
 
Posts: 1
Joined: Sat May 28, 2011 11:05 pm

Re: PS3 Joypad XML

Postby nitekillerz » Tue Oct 04, 2011 9:56 pm

Hello. Awesome program you have here but i am a complete noob and do not know how to use this. I copied the whole thing and saved it in Microsoft word as an XML document. Then i put it into joysticks/default/ps3.xml but when i try to open flight gear it says flight gear quit. Until i delete the code i can't open flight gear. I made sure i press the select all button and copied it straight to word like that. What am i doing wrong? Please and thank you and if you can reply to my email (juanrox20@yahoo.com)
nitekillerz
 
Posts: 2
Joined: Tue Oct 04, 2011 9:44 pm

Re: PS3 Joypad XML

Postby Figaro » Wed Oct 05, 2011 6:26 am

Well the forum IS here for a reason...

Try copying and pasting into Notepad.
User avatar
Figaro
 
Posts: 1254
Joined: Fri Feb 25, 2011 9:23 pm
Callsign: 4L-FIG

Re: PS3 Joypad XML

Postby gooneybird » Wed Oct 05, 2011 9:41 am

I think this problem has come up before.

Try manually selecting and copying the text in the code box, don't use the "select all" button. Then use a plain text editor, like connect said notepad will do, word processor programs like Word will sometimes include extra unseen characters that play havoc with XML files.
Currently running 2018.1 but if it doesn't stop crashing I'm taking up tiddlywinks!
User avatar
gooneybird
 
Posts: 2931
Joined: Sat May 31, 2008 1:57 pm
Location: Essex, UK
Callsign: G-OONY
Version: 2018.1
OS: win 7 64

Next

Return to Hardware

Who is online

Users browsing this forum: No registered users and 0 guests