Howto:Implement a Control Display Unit

From FlightGear wiki
Jump to navigation Jump to search
IMPORTANT: Some, and possibly most, of the features/ideas discussed here are likely to be affected, and possibly even deprecated, by the ongoing work on providing a property tree-based 2D drawing API accessible from Nasal using the new Canvas system available since FlightGear 2.80 (08/2012). Please see: Canvas MCDU Framework for further information

You are advised not to start working on anything directly related to this without first discussing/coordinating your ideas with other FlightGear contributors using the FlightGear developers mailing list or the Canvas subforum This is a link to the FlightGear forum.. Anything related to Canvas Core Development should be discussed first of all with TheTom and Zakalawe. Nasal-space frameworks are being maintained by Philosopher and Hooray currently. talk page.

Canvasready.png
The Boeing-style CDU as seen on a Boeing 747-400.

FlightGear has a generic Control Display Unit (CDU) model available, for easy implementation into aircraft. Currently only a Boeing style one is available, under Aircraft/Instruments-3d/cdu/. Be sure you have implemented a V-speed calculator before implementing the CDU.

The Boeing 747-400 is an example aircraft for the generic CDU.

Status 01/2013

As of 01/2013, a new CDU framework is being worked on by James, based on a combination of C++ and Nasal code, for further details please check out FlightGear Newsletter January 2013#Canvas-based CDU development.

model .xml

For each single CDU unit, the following code block is required in your aircraft's model .xml file. You can add as many CDUs as you need.

<model>
 <path>Aircraft/Instruments-3d/cdu/boeing.xml</path>
 <offsets>
  <x-m> 0.858</x-m>
  <y-m> 0.186</y-m>
  <z-m> 0.489</z-m>
  <pitch-deg>-75</pitch-deg>
 </offsets>
 <overlay>
  <texture>boeing_brown.png</texture>
 </overlay>
</model>
  • offsets: use these to position the CDU in your cockpit. The CDU model's origin is in the center of the model.
  • texture: currently there are two textures to chose from, in order to fit your aircraft's panel color:

-set.xml

These should all be placed outside the <sim></sim> part.

<instrumentation>
 <cdu>
  <display>IDENT</display>
  <ident>
   <model>747-400</model>
   <engines>-80C2B1F</engines>
  </ident>
  <input type="string"/>
  <serviceable type="bool">true</serviceable>
 </cdu>
</instrumentation>

<nasal>
 <cdu>
  <file>Aircraft/Instruments-3d/cdu/boeing.nas</file>
 </cdu>
</nasal>
  • display: the initial page, when power is first applied to the aircraft.
  • ident: data to be displayed on the IDENTIFICATION page.