User:Texnicer/devblog

From FlightGear wiki
Jump to navigation Jump to search

Joysticks

Cessna Flight Yoke

Basic configuration

The default comes with: Elevator trim inverted; PTT in mumble not working; Rudder trim, instead of Aileron trim for the right thumb W-E button.

  <!-- Right hand vertical two-way switch -->
    <button n="4"> 
	<name>Right vertical rocker switch up</name>
        <desc>Elevator trim up</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.elevatorTrim(1)</script>
        </binding>
    </button>
    <button n="5">
	<name>Right vertical rocker switch down</name>
        <desc>Elevator trim down</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.elevatorTrim(-1)</script>
        </binding>
    </button>

    <!-- Right hand horizontal two-way switch -->
    <button n="6"> 
	<name>Right horizontal rocker switch right</name>
        <desc>Rudder trim right</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.rudderTrim(-1)</script>
        </binding>
    </button>
    <button n="7">
	<name>Right horizontal rocker switch left</name>
        <desc>Rudder trim left</desc>
        <repeatable>true</repeatable>
        <binding>
            <command>nasal</command>
            <script>controls.rudderTrim(1)</script>
        </binding>
    </button>

Also remarkable: the three mode stages implemented as sensivity low/medium/high for the view-coolie hat

    <button n="22">
	<name>Yoke mode switch left</name>
        <desc>Coolie hat sensitivity low</desc>
        <repeatable type="bool">false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/devices/status/yoke/offset</property>
            <value>1</value>
        </binding>
    </button>
    <button n="23">
	<name>Yoke mode switch middle</name>
        <desc>Coolie hat sensitivity medium</desc>
        <repeatable type="bool">false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/devices/status/yoke/offset</property>
            <value>5</value>
        </binding>
    </button>
    <button n="24">
        <name>Yoke mode switch right</name>
        <desc>Coolie hat sensitivity high</desc>
        <repeatable type="bool">false</repeatable>
        <binding>
            <command>property-assign</command>
            <property>/devices/status/yoke/offset</property>
            <value>10</value>
        </binding>
    </button>

PTT (Push-to-talk) button for Mumble

inspired, partly taken from: Mumble

Button 0 (left button): PTT (red one)

# dmesg | grep -i 'yoke'
[    6.075059] usb 1-1.2.2.4: Product: Pro Flight Cessna Yoke
[    6.078248] input: Saitek  Pro Flight Cessna Yoke as /devices/pci0000:00/0000:00:12.0/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2.4/1-1.2.2.4:1.0/0003:06A3:0BD3.0005/input/input12
[    6.078319] hid-generic 0003:06A3:0BD3.0005: input,hidraw4: USB HID v1.11 Joystick [Saitek  Pro Flight Cessna Yoke] on usb-0000:00:12.0-1.2.2.4/input0
# apt install input-utils
$ lsinput

... quite interesting

in: ~/.config/Mumble/Mumble.conf

[shortcut]
linux\evdev\enable=true
# /sbin/usermod MY_LOGIN -aG input

Do not forget to re-log!

$ mumble &
...
<W>2020-04-28 10:13:59.338 GlobalShortcutX: /dev/input/event11: Saitek  Pro Flight Cessna Yoke
...

Proposals for every Aircraft, focusing (not only) on VFR

Toggle external/internal view (to avoid excessive cycling)

found in: eurofighter, Version: HerbyW

 
  <key n="60">
   <name> > </name>
   <desc>Change Pilot Model</desc>
   <binding>
    <command>property-cycle</command>
      <property>/sim/current-view/view-number</property>  
      <value>0</value>
      <value>7</value>
  </binding>
 </key>

Hack for scenery

Thanks EGBB/Woosh

--prop:/sim/rendering/static-lod/bare=15000 

Linux, Alt-Key, X, Blender

 gsettings get org.gnome.desktop.wm.preferences mouse-button-modifier 
 xfconf-query -c xfce4-keyboard-shortcuts -l -v


Blender

http://media.kswillisau.ch/in/blender/tasten.html

basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 8)

...happens when you do not transform LAT.nnnnnn into N|SLAT MIN.NNNNNN in your ICAO.groundnet.xml

	<Parking index="4" type="ga" name="GA5" lat="N54 20.173" lon="E12 42.878" heading="270.00" radius="20" />
	<!--	
        <Parking index="5" type="ga" name="GAS" lat="N54 20.181" lon="E12 42.996" heading="350.00" radius="20" />
        -->
        <Parking index="5" type="ga" name="GAS" lat="54.336312" lon="012.716619" heading="350.00" radius="20" />

Using the (Linux) console for calculation e.g. *60 or /60 of decimal/nautical minutes for parking coordinates

#apt install octave
$function calc() { echo $1 | octave -q; }
$calc 4*6
$function dec2min() { echo $1*60 | octave -q; }
$dec2min .5
ans=30
$function min2dec() { echo $1/60 | octave -q; }
$min2dec 45
ans=.75000

Source/Inspiration: https://www.pro-linux.de/kurztipps/2/1367/komfortables-rechnen-in-der-shell.html

Adding a existing component to an existing aircraft

On march 25, 2020 I was asked via mumble, if I could add the garmin196 to the Seneca II, hence the AP is not charming. Here ist what I did, an how I did it.

Creating a working copy of the aircraft

At first I aquired the Aircraft. It's part of the sourceforge/svn-repository.

I got the plane searching throught FGADDON/AIRCRAFT (https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Aircraft/) using the SVN system.

   $ svn checkout https://svn.code.sf.net/p/flightgear/fgaddon/trunk/Aircraft/SenecaII

note: sourceforge does not support the correct svn-codeline, you need to correct the path starting after trunk'

Locating the system to add

I went into my system's Flightgear root directory $FG_ROOT - which is nice to know. On ubuntu and DeBIAN systems it is likely to be found in:

/usr/share/games/flightgear
  $ cd /usr/share/games/flightgear/

Hence I looked for garmin196 invoking a full recursive file-search

 me@machine:/usr/share/games/flightgear/$ ls -R | grep -A1 -i garmin196

and I figured that the device's files are located in /Aircraft/Instrument-3d/garmin196

Understanding the components of the system

Adding the model to the aircraft, positioning

note: understanding the euclidian space, the axis, the system's origin, helps alot placing the model roughly and visual in the cockpit. finetuning can be done while correcting the .xml file being in the simulator and using the "debug"-menu and "reload model" once and again.

note: you can easily use the tutorial marker from the debug menu in order to access the coordinates (you might want to install the modell 'pink circle' first)

in /Models/SenecaII.xml:

	<model> 
		<path>Aircraft/Instruments-3d/garmin196/garmin196.xml</path>
		<offsets> 
			<heading-deg>-40</heading-deg>
			<x-m>-1.945</x-m>
			<y-m>0.15</y-m>
			<z-m>1.65</z-m>
		</offsets>
	</model>
garmin196 added to SenecaII

Implementing the functionality

in /SenecaII-base.xml: (im Block "nasal")

        <garmin196>
		<file>Aircraft/Instruments-3d/garmin196/garmin196.nas</file>
	</garmin196>

Adapting, Adding, Extending

  • the autopilot menu is not working yet
  • hence the menu route manager is not working yet
  • routes must be added manually into garmin196


Adding an internal view to an existing aircraft

  • I started copying a local draft of my aircraft. hint: adding some id to the name string helps to find your version in the aircraft list at startup
  • The directory for that draft needs to be in a directory published to the starter/launcher and needs to be added if not already done.
  • I started FlightGear using my fork/draft. Using the mouse, LCTRL, RMB combination I navigated to the desired viewpoint (or is it point of view?).
  • F10 menu: DEBUG -> show property browser -> /sim/current-view
  • I found the view-definitions of my draft using the OS' console in the aircraft base folder:
  $ grep -winr . -e 'view n='   

note: for the DR400 the views are stored in /nasal/view.xml which is not default IMHO

  • following lines were added to /nasal/view.xml
 <view n="105">
    <name>Radio operation and GPS</name>
    <internal archive="y">true</internal>
    <type>lookfrom</type>
    <config>
      <from-model type="bool">true</from-model>
      <ground-level-nearplane-m type="double">0.5f</ground-level-nearplane-m>
      <x-offset-m archive="y">  0.141 </x-offset-m>	<!-- Right -->
      <y-offset-m archive="y">  0.400 </y-offset-m>	<!-- Up    -->
      <z-offset-m archive="y"> -1.189 </z-offset-m>	<!-- Back  -->
      <pitch-offset-deg>-13.5</pitch-offset-deg>
      <default-field-of-view-deg>26.569</default-field-of-view-deg>
      <dynamic-view type="bool">false</dynamic-view>
    </config>
  </view>