Opentrack

From FlightGear wiki
Revision as of 23:16, 9 September 2020 by Ranguli (talk | contribs) (Created article about opentrack)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
opentrack
The opentrack interface
The opentrack interface
Written in C, C++
OS Cross-platform
Development status Active
License Most all code is under the ICS license
Website

Opentrack is a head-tracking program with built-in support for the FlightGear interface, allowing head tracking data to be sent directly as input data to FlightGear. Licensed as open-source software, Opentrack has its roots in the FaceTrackNoIR project, and maintains many of the projects ideas.

Installation

Compiling for Linux

Linux users may be disappointed to know that no binaries are provided for opentrack. Luckily, compiling opentrack is a fairly mild process.

The following dependencies are for Debian-based systems, however it should give users of other distros a rough idea of what they will need to hunt for in their own package manager. Users of other distributions are encouraged to expand upon this guide.

Dependencies

  • cmake
  • git
  • qttools5-dev
  • qtbase5-private-dev
  • libprocps-dev
  • libopencv-dev
Note  While opentrack will build without OpenCV, it will only compile with a very minimal subset of its functionality, making it of little use to the average user who does not have very specific usage requirements.

Building

Compiling the project is the same as with any cmake project:

git clone https://github.com/opentrack/opentrack
cd opentrack/
cmake .
make
make install
Note  The resulting build output will be placed in the install/ directory. It will not 'install' itself anywhere outside of the current directory.


Configuration

FlightGear will not automatically start accepting input from opentrack just because you have it running, because it has not been told to listen for input from opentrack, or what to do with it. In order to remedy this, FlightGear must be configured as follows.

Adding XML

FlightGear must be told how to interpret the data from opentrack and what to do with it. This is done by providing FlightGear with an XML document containing this information. Add the following XML to a file called opentrack.xml in the Protocol/ subdirectory in your $FG_ROOT directory.

<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
   <comment>
<![CDATA[
  Usage:

  fgfs --generic=socket,in,52,,5542,udp,opentrack
]]>
   </comment>
   <generic>
      <input>
         <binary_mode>true</binary_mode>
         <byte_order>host</byte_order>
         <chunk>
            <type>double</type>
            <node>/sim/current-view/tx</node>
         </chunk>
         <chunk>
            <type>double</type>
            <node>/sim/current-view/ty</node>
         </chunk>
         <chunk>
            <type>double</type>
            <node>/sim/current-view/tz</node>
         </chunk>
         <chunk>
            <type>double</type>
            <node>/sim/current-view/heading-offset-deg</node>
         </chunk>
         <chunk>
            <type>double</type>
            <node>/sim/current-view/roll</node>
         </chunk>
         <chunk>
            <type>double</type>
            <node>/sim/current-view/pitch-offset-deg</node>
         </chunk>
         <chunk>
            <type>int</type>
            <node>/sim/current-view/status</node>
         </chunk>
      </input>
   </generic>
</PropertyList>

Taken from the Re: Opentrack post on the forum This is a link to the FlightGear forum.

Changing startup options

Finally, you must add the following options either from the command line, or through the FlightGear launcher:

--generic=socket,in,25,127.0.0.1,5542,udp,opentrack

Taken from the Re: Opentrack post on the forum This is a link to the FlightGear forum.

Usage

Note  Proper calibration of your head-tracking setup is crucial for success, it may require lots of experimenting. Also ensure that no other software is trying to use your webcam, that FlightGear is selected as the "Output", and that your tracking is running before launching FlightGear

A generic quickstart video demonstrating the usage of opentrack can be found below.

FlightGear must be selected as the "Output" in order for the head tracking to work


Related content

External links