Monday, 3 May 2010

Settings for "FlightGear in a testing 2x3 display wall"

Let's explain here what I did in order to get my testing 2x3 display wall working (as seen in FlightGear in a testing 2x3 display wall).

I've got 3 PC's in typical cluster configuration (one of them acting as a head node with two ethernet cards: one to the outside world and the other one to the internal network, via a Gigabit switch; the other two PC's are just connected to the internal network), although this should not matter for the FlightGear configuration. All 3 PC's are running Ubuntu Karmic (9.10). For some reason, the sound in FlightGear was not behaving properly, so in my home directory I had to create the file ".alsoftrc" as follows (http://www.flightgear.org/forums/viewtopic.php?f=2&t=6291):


angelv@vaiven:~$ cat .alsoftrc
drivers = oss
angelv@vaiven:~$


Each PC controls two monitors (a column in the picture in FlightGear in a testing 2x3 display wall). So first I had to deal with using both monitors. I use Nvidia drivers, and I'm using Twinview, but this has the problem that in some window managers, when you maximize a window, it will only expand as to occupy one of the monitors, so I changed to TWM, a very basic window manager, but when you run FlightGear in fullscreen mode, it will occupy all the available space (both monitors). With this, it is now just a matter of creating an appropriate XML file which will describe the views that I want in each of the monitors. For the central column I want the cockpit view and the helicopter view. For this I got my configuration file as:


angelv@vaiven:~$ cat fgfs-config
<PropertyList>
  <sim>
    <rendering>
      <camera-group>
        <window>
          <name>wide</name>
          <host-name type="string"></host-name>
          <display>0</display>
          <screen>0</screen>
          <width>1280</width>
          <height>2048</height>
          <decoration type = "bool">false</decoration>
        </window>
        <camera>
          <window>
            <name>wide</name>
          </window>
          <viewport>
            <x>0</x>
            <y>0</y>
            <width>1280</width>
            <height>1024</height>
          </viewport>
          <view>
            <heading-deg type = "double">0</heading-deg>
          </view>
          <frustum>
            <top>0.133</top>
            <bottom>-0.133</bottom>
            <left>-.1668</left>
            <right>.1668</right>
            <near>0.25</near>
            <far>120000.0</far>
          </frustum>
        </camera>
        <camera>
          <window>
            <name type="string">wide</name>
          </window>
          <viewport>
            <x>0</x>
            <y>1024</y>
            <width>1280</width>
            <height>1024</height>
          </viewport>
          <view>
            <heading-deg type = "double">0</heading-deg>
        <z>20</z>
          </view>
          <frustum>
            <top>0.133</top>
            <bottom>-0.133</bottom>
            <left>-.1668</left>
            <right>.1668</right>
            <near>0.4</near>
            <far>120000.0</far>
          </frustum>
        </camera>
        <gui>
          <window>
            <name type="string">wide</name>
          </window>
        </gui>
      </camera-group>
    </rendering>
  </sim>
</PropertyList>
angelv@vaiven:~$



For the right and the left columns I want basically the same view (though viewed from an angle as we will see later), but I also wanted to point the camera in the upper row a little bit lower (which can be useful to appreciate landings), so I created another XML file, basically the same as above, but displacing the camera a little bit:


angelv@vaiven:~$ diff -C 5 fgfs-config fgfs-config.sides
*** fgfs-config    2010-04-29 14:48:43.112948642 +0100
--- fgfs-config.sides    2010-04-29 15:16:40.880449639 +0100
***************
*** 44,53 ****
--- 44,54 ----
              <height>1024</height>
            </viewport>
            <view>
              <heading-deg type = "double">0</heading-deg>
          <z>20</z>
+         <y>-3</y>
            </view>
            <frustum>
              <top>0.133</top>
              <bottom>-0.133</bottom>
              <left>-.1668</left>
angelv@vaiven:~$


Once this is in place, I checked the FlightGear documentation and this document to make a multiple computer setting. At the end, it all came to creating this script:


angelv@vaiven:~$ cat fgfs-wall.sh
#!/bin/sh

killall -9 fgfs
ssh dwall-0 killall -9 fgfs
ssh dwall-1 killall -9 fgfs

ssh dwall-0 'fgfs --config=/home/angelv/fgfs-config --prop:/sim/menubar/visibility=false --enable-hud --enable-fullscreen --timeofday=noon --native-fdm=socket,out,60,vaiven,5500,udp --native-fdm=socket,out,60,dwall-1,5501,udp --native-ctrls=socket,out,60,vaiven,5600,udp --native-ctrls=socket,out,60,dwall-1,5601,udp --prop:/sim/view[0]/config/heading-offset-deg=-10&'  &

ssh dwall-1 fgfs --config=/home/angelv/fgfs-config.sides --prop:/sim/menubar/visibility=false --enable-hud --enable-fullscreen --timeofday=noon --fdm=null --native-fdm=socket,in,60,,5501,udp --native-ctrls=socket,in,60,,5601,udp --prop:/sim/view[0]/config/heading-offset-deg=70&

fgfs --config=/home/angelv/fgfs-config.sides --prop:/sim/menubar/visibility=false --enable-hud --enable-fullscreen --timeofday=noon --fdm=null --native-fdm=socket,in,60,,5500,udp --native-ctrls=socket,in,60,,5600,udp --prop:/sim/view[0]/config/heading-offset-deg=-80 &

angelv@vaiven:~$


I run this in "vaiven" (which is my cluster head node, and controlling the right column of monitors). dwall-0 is the centre column, and where I run the "controller" FlightGear. I'm sure this can be done much better, but this was just a quick hack to get it working in my 2x3 display wall. Any comments on how to improve this configuration are wellcome.

By the way, my keyboard and mouse are connected (for "historical" reasons) to vaiven, the computer in the right column of monitors, but I want to control FlightGear from the monitor in the centre column of the display wall. This is very easily done by using Synergy

No comments: