Board index FlightGear Support Hardware

Setting up my flight gear?

Joysticks, pedals, monitors.

Setting up my flight gear?

Postby El Hadji » Fri May 13, 2016 3:40 pm

Ok, so I decided to give Flightgear a go but I ran into trouble almost immediatly. I am trying to setup the following gear for use with the sim:

TrackIR5 + Pro Clip
Thrustmaster HOTAS Warthog stick and throttle
MFG Crosswind V2 rudder pedals

First of all my TiR5 doesn't appear to be detected at all which seems odd in a flight simulator (even if open source). Do I need to manually install anything to get it working? (The main reason for trying FG is the sub-par TrackIR implementation in X-plane10 so I really hope this is better here.

Secondly, only the toe brake axis are detected on my Crosswinds. I can't get the rudder to work at all. Any suggestions?

Third, I can't figure out how to map trim, and flaps etc to the proper buttons on my stick and throttle units. Normally I clear a value, hit a button on the stick to assign a function but that approach does not seem to work here so obviously I am doing something wrong.

Appreciate any help!

EDIT: Discovered another problem. The brake axis is reversed so that the brake is ON by default and when I tick the box "invert" no pedal input is recorded at all. So I guess I'll add this to the list of problems I have.
El Hadji
 
Posts: 3
Joined: Fri May 13, 2016 3:30 pm

Re: Setting up my flight gear?

Postby sim » Fri May 13, 2016 9:40 pm

El Hadji. Your stick and pedals will work in Flightgear. You will need one xml file for stick and another seperate xml file for your pedals. Both xml files will need to be correctly named and placed in Flightgear/Data/Input/Joysticks folder. Flightgear will then find them when you start up Flightgear and read the codes within the stick xml and rudder pedals xml to follow rudder and stick movements and throttle movements. Once you have those basic items working you can set up your HAT to enable view movements up/down and left/right and then set up buttons to operate anything else such as gear, flaps, spoilers, airbrakes, speedbrakes, tailwheel lock, magnetos etc and in your pedals xml left/right rudder, left brake, right brake etc.
As for your TrackIR. No idea sorry. :roll:

Mapping trim to xml stick buttons is an option. HAT primary task is best set to panviews so you can look around but with a modifier button HAT secondary task can be set to aileron and elevator trim. Rudder trim (if you insist on it) will have to go elsewhere. :wink:

Later PS. Seems HAT primary use is better set for aileron/rudder trim. Assuming you get TrackIR working that will be a superior way of looking around compared to panview using HAT. You could still consider whether to use a modifier so
secondary use of HAT is to look around. (just in case TrackIR stops working)
Last edited by sim on Sun May 15, 2016 1:40 pm, edited 1 time in total.
User avatar
sim
 
Posts: 1431
Joined: Tue Jun 30, 2009 2:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

Re: Setting up my flight gear?

Postby El Hadji » Sat May 14, 2016 12:06 am

Thank you for your reply.

Well, since the HAT switch is a trim switch I was hoping that I could use my TrackIR5 for the viewing. I'll fiddle with the xml's to see if I can get the rest running though.

Cheers!
El Hadji
 
Posts: 3
Joined: Fri May 13, 2016 3:30 pm

Re: Setting up my flight gear?

Postby hamzaalloush » Sat May 14, 2016 11:35 am

I was able to get TrackIR 5 working in both Windows and Linux,

for Windows i have documented here: https://forum.flightgear.org/viewtopic.php?f=24&t=28718

for Linux i have found the best resource to follow here, it's very straight forward(clone linux-track and compile, then run the application through a FIFO pipe or a UDP port, accessible by one of FG communication protocols, you will have to read the documentation): https://wiki.gentoo.org/wiki/Track_IR

linuxtrack.nas:

Code: Select all
##
##  Nasal code for using an external head position and orientation tracker.
##
##  This file is licensed under the GPL license version 2 or later.
##    Copyright (C) 2007 - 2009  Anders Gidenstam
##
##  Modified by Alexander Pravdin <aledin@evpatoria.com.ua> for LinuxTrack.
##
##  For the original Anders Gidenstam's version of this file please visit
##  http://www.gidenstam.org/FlightGear/HeadTracking/
##
##  Installation: see ltr_pipe's README file.
##
##  This script is enabled by the FlightGear command line parameter:
##
##    --prop:/sim/linuxtrack/enabled=1
##
##  Note that X, Y, Z are not enabled by default. You can enable all of them
##  at once with the additional parameter:
##
##    --prop:/sim/linuxtrack/track-all=1
##
##  or any of them one by one with such parameters:
##
##    --prop:/sim/linuxtrack/track-x=1
##    --prop:/sim/linuxtrack/track-y=1
##    --prop:/sim/linuxtrack/track-z=1
##

var script_name = "linuxtrack.nas";

var lt_tree = "/sim/linuxtrack";
var cv_tree = "/sim/current-view";


##
# LinuxTrack view handler class.
# Use one instance per tracked view.
#
var ltr_view_handler = {};


ltr_view_handler.new = func {
   return { parents: [ltr_view_handler] };
};


ltr_view_handler.init = func {

   if (contains(me, "enabled"))
      return;

   me.enabled   = props.globals.getNode(lt_tree ~ "/enabled", 1);
   me.data      = props.globals.getNode(lt_tree ~ "/data", 1);
   me.view      = props.globals.getNode(cv_tree, 1);
   me.vcfg      = props.globals.getNode(cv_tree ~ "/config", 1);

   me.track_all = props.globals.getNode(lt_tree ~ "/track-all", 1);
   if (me.track_all.getValue() == 1) {
      setprop(lt_tree ~ "/track-x", 1);
      setprop(lt_tree ~ "/track-y", 1);
      setprop(lt_tree ~ "/track-z", 1);
   }
   me.track_X   = props.globals.getNode(lt_tree ~ "/track-x", 1);
   me.track_Y   = props.globals.getNode(lt_tree ~ "/track-y", 1);
   me.track_Z   = props.globals.getNode(lt_tree ~ "/track-z", 1);

   var default_fov_name = "default-field-of-view-deg";

   # FlightGear target properties names
   var fg_H_name = "goal-heading-offset-deg";
   var fg_P_name = "goal-pitch-offset-deg";
   var fg_R_name = "goal-roll-offset-deg";
   var fg_X_name = "target-x-offset-m";
   var fg_Y_name = "target-y-offset-m";
   var fg_Z_name = "field-of-view";

   # LinuxTrack data properties names
   var lt_H_name = "h"; # heading
   var lt_P_name = "p"; # pitch
   var lt_R_name = "r"; # roll
   var lt_X_name = "x"; # x
   var lt_Y_name = "y"; # y
   var lt_Z_name = "z"; # z

   # Low pass filters
   var lowpass_H = aircraft.lowpass.new(0.1);
   var lowpass_P = aircraft.lowpass.new(0.1);
   var lowpass_R = aircraft.lowpass.new(0.1);
   var lowpass_X = aircraft.lowpass.new(0.1);
   var lowpass_Y = aircraft.lowpass.new(0.1);
   var lowpass_Z = aircraft.lowpass.new(0.1);

   # Limiter for Z
   var limit_Z = func(z) {
      z = asnum(z);
      return (z < 0 ? 0 : (z > 120 ? 120 : z));
   };


   var set_fg_prop = func(name, val) {
      me.view.getChild(name).setDoubleValue(val);
   };

   var get_lt_prop = func(name) {
      return asnum(me.data.getChild(name).getValue());
   };

   var get_default_fov = func {
      return asnum(me.vcfg.getChild(default_fov_name).getValue());
   };


   me.set_fg_H = func(val) {
      val = lowpass_H.filter(asnum(val));
      set_fg_prop(fg_H_name, val);
   };

   me.set_fg_P = func(val) {
      val = lowpass_P.filter(asnum(val));
      set_fg_prop(fg_P_name, val);
   };

   me.set_fg_R = func(val) {
      val = lowpass_R.filter(asnum(val));
      set_fg_prop(fg_R_name, val);
   };

   me.set_fg_X = func(val) {
      val = lowpass_X.filter(asnum(val));
      set_fg_prop(fg_X_name, val);
   };

   me.set_fg_Y = func(val) {
      val = lowpass_Y.filter(asnum(val));
      set_fg_prop(fg_Y_name, val);
   };

   me.set_fg_Z = func(val) {
      val = lowpass_Z.filter(val + get_default_fov());
      val = limit_Z(val);
      set_fg_prop(fg_Z_name, val);
   };

   me.get_lt_H = func { return get_lt_prop(lt_H_name); };
   me.get_lt_P = func { return get_lt_prop(lt_P_name); };
   me.get_lt_R = func { return get_lt_prop(lt_R_name); };
   me.get_lt_X = func { return get_lt_prop(lt_X_name); };
   me.get_lt_Y = func { return get_lt_prop(lt_Y_name); };
   me.get_lt_Z = func { return get_lt_prop(lt_Z_name); };


   printf("%s: initialized", script_name);
   printf("%s: enabled heading, pitch, roll%s%s%s",
      script_name,
      (me.track_X.getValue() == 1 ? ", x" : ""),
      (me.track_Y.getValue() == 1 ? ", y" : ""),
      (me.track_Z.getValue() == 1 ? ", z" : ""));
};


ltr_view_handler.reset = func {

   me.set_fg_H(0);
   me.set_fg_P(0);
   me.set_fg_R(0);

   if (me.track_X.getValue() == 1)
      me.set_fg_X(0);
   if (me.track_Y.getValue() == 1)
      me.set_fg_Y(0);
   if (me.track_Z.getValue() == 1)
      me.set_fg_Z(0);
};


ltr_view_handler.update = func {

   if (me.enabled.getValue() == 0)
      return 0;

   var m_H =  1;
   var m_P =  1;
   var m_R =  1;
   var m_X =  1;
   var m_Y =  1;
   var m_Z =  1;

   var view_name = me.view.getChild("name").getValue();

   if ((view_name == "Helicopter View") or
       (view_name == "Chase View") or
       (view_name == "Chase View Without Yaw")) {
      m_P = -1;
   }

   me.set_fg_H(m_H * me.get_lt_H());
   me.set_fg_P(m_P * me.get_lt_P());
   me.set_fg_R(m_R * me.get_lt_R());

   if (me.track_X.getValue() == 1)
      me.set_fg_X(m_X * me.get_lt_X());
   if (me.track_Y.getValue() == 1)
      me.set_fg_Y(m_Y * me.get_lt_Y());
   if (me.track_Z.getValue() == 1)
      me.set_fg_Z(m_Z * me.get_lt_Z());

   return 0;
};


var asnum = func(n) {
   if(typeof(n) == "scalar") {
      return num(n);
   } else {
      return 0;
   }
};


var regviews = func {

   foreach (var v; view.views) {

      var view_name = v.getChild("name").getValue();

      if ((view_name == "Model View") or
          (view_name == "Fly-By View")) {
         continue;
      }

      view.manager.register(v.getIndex(), ltr_view_handler);

      printf("%s: registered '%s'",
         script_name, view_name);
   }
};


var main = func {

   if (getprop("/sim/signals/fdm-initialized") != 1)
      return;

   if (getprop(lt_tree ~ "/enabled") != 1)
      return;

   # Must wait some seconds untill the objects
   # from view.nas become fully initialized.
   #
   # TODO: Find a better way for this, may be
   #       by using some property checks.

   settimer(regviews, 2);
};


_setlistener("/sim/signals/fdm-initialized", main, 1, 0);



hamzaalloush
 
Posts: 631
Joined: Sat Oct 26, 2013 9:31 am
OS: Windows 10

Re: Setting up my flight gear?

Postby bugman » Sat May 14, 2016 12:12 pm

Hamza, have you thought of creating a simple FlightGear wiki page for this? That would be a great reasource.

Cheers,
Edward
bugman
Moderator
 
Posts: 1801
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: Setting up my flight gear?

Postby hamzaalloush » Sat May 14, 2016 8:28 pm

I did at some point, but there's no one way to do it(i utilize FGCamera for instance), i will try to cover the basics.
hamzaalloush
 
Posts: 631
Joined: Sat Oct 26, 2013 9:31 am
OS: Windows 10

Re: Setting up my flight gear?

Postby sim » Wed May 18, 2016 6:35 pm

That's an excellent video demo of TrackIR in action hamzaalloush :wink:
Very impressed, especially the short clip where you switch view and demo TrackIR in action outside of aircraft !
User avatar
sim
 
Posts: 1431
Joined: Tue Jun 30, 2009 2:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

Re: Setting up my flight gear?

Postby DF_Hammack » Sat Aug 06, 2016 7:27 am

Hi I am interested in the idea of alt mapping my hat to control aileron trim. I really do need the hat for look-about though. How would that be done? I have my 4 top buttons mapped as Elevator and Rudder trim. My other 4 buttons are mapped to flaps and gear. I am looking into the possibility of building an extension keypad to hack into my stick to make full use of the button allocations. I am using a Saitek Cyborg 3D and the hat is mapped as 2 axes. I setup the switches using the FG Joystick util. I didn't see aileron trim as an option. Also, this util wipes out edits to my User JS config. Does it by chance read the main file every time? Could I make my config permanent by writing it to my /usr/bin/share/games/flightgear JS config file? I have had FG for some time (since 2.4, I think), but haven't taken time to fiddle with it till now, so I am an old-newbie
DF_Hammack
 
Posts: 34
Joined: Fri Aug 05, 2016 10:57 pm
Location: Camden, SC, USA
Callsign: SilverSplash
Version: 2017.2.1
OS: Xubuntu 17.10

Re: Setting up my flight gear?

Postby Parnikkapore » Sat Aug 06, 2016 1:39 pm

If you manually edit the XML file, DO NOT DO ANYTHING in the Joystick config dialog! Back up your edited file just in case!
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 831
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Setting up my flight gear?

Postby DF_Hammack » Sun Aug 07, 2016 5:59 am

Parnikkapore wrote in Sat Aug 06, 2016 1:39 pm:If you manually edit the XML file, DO NOT DO ANYTHING in the Joystick config dialog! Back up your edited file just in case!


I found that out the hard way. After I figured that out, I backed up my changes. I am not real familiar with XML coding, but it looks like if I stick with FlightGear, I will be ;)
DF_Hammack
 
Posts: 34
Joined: Fri Aug 05, 2016 10:57 pm
Location: Camden, SC, USA
Callsign: SilverSplash
Version: 2017.2.1
OS: Xubuntu 17.10

Re: Setting up my flight gear?

Postby Parnikkapore » Sun Aug 07, 2016 2:00 pm

Me too!
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 831
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Setting up my flight gear?

Postby Johan G » Sun Aug 14, 2016 3:03 pm

DF_Hammack wrote in Sun Aug 07, 2016 5:59 am:I am not real familiar with XML coding, but it looks like if I stick with FlightGear, I will be ;)

Trust me, you will be. :P

Though not too rarely you might still have a feeling that things only works once in a...
Algernon wrote in Sat Apr 16, 2011 12:27 pm:
Code: Select all
<animation>
  <object-name>Moon</object-name>
  <emission>
    <red>0.0</red>
    <green>0.0</green>
    <blue>1.0</blue>
  </emission>
</animation

:wink:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 6237
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit


Return to Hardware

Who is online

Users browsing this forum: No registered users and 0 guests