From FlightGear wiki
< User:Texnicer
Revision as of 15:46, 26 March 2020 by Texnicer (Talk | contribs) (Adding an internal view to an existing aircraft)

Jump to: navigation, search

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 ( using the SVN system.

   $ svn checkout

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:
  $ 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.

in /Models/SenecaII.xml:

garmin196 added to SenecaII

Implementing the functionality

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


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>
      <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  -->
      <dynamic-view type="bool">false</dynamic-view>