To start, here is the Flightgear page on generic protocol:
http://wiki.flightgear.org/Generic_protocolGeneric protocol is how you get flight properties out of flight gear. You need to do that to run fgpanel. In order to move instrument needles and components, fgpanel needs real time data, and that data comes from flight gear via generic protocol. The information on that page is helpful.
The first thing that fgpanel needs is the list of instruments that you want to display as well as their screen locations. To do that, you'll need to find the instrument xml files for your aircraft. Some planes use the same instruments. But in general, to display and animate an instrument, you might need to do some digging in the aircraft xml files to see what instruments are being used and where the xml files are for the instruments. Keep in mind that as I understand it, fgpanel only displays "2d" panels. In other words, the ".ac" instrument files can't be used.
I will list the files and include only a few instruments to avoid confusion.
The first one is the file that fgpanel needs in order to render the instruments:
- Code: Select all
<?xml version="1.0"?>
<!--
Piper Seneca II panel
-->
<PropertyList>
<name>SenecaII IFR Panel</name>
<w>1900</w>
<h>1000</h>
<instruments>
<instrument include="Aircraft/Instruments/alt-c172s.xml">
<name>Altimeter</name>
<x>1400</x>
<y>835</y>
<w>260</w>
<h>260</h>
</instrument>
<instrument include="Aircraft/Instruments/trn-c172s.xml">
<name>Turn Coordinator</name>
<x>535</x>
<y>550</y>
<w>250</w>
<h>250</h>
</instrument>
<instrument include="Aircraft/Instruments/vsi-c172s.xml">
<name>Vertical Velocity Indicator</name>
<x>1300</x>
<y>540</y>
<w>260</w>
<h>260</h>
</instrument>
</instruments>
</PropertyList>
You can see three instruments and their xml file locations under the Aircraft folder. You can also see in this file that each instrument has screen position (x,y) and size (w,h). Give this file a name. In my case since I built this for the SenecaII, I called it SenecaII-fgpanel-items.xml and I placed it into the Aircraft/SenecaII/Panels folder.
The next thing fgpanel needs to have is the list of properties for the instruments above. These are typically in a protocol file. They list the properties for each instrument and the link above has a lot of this information:
- Code: Select all
<?xml version="1.0"?>
<PropertyList>
<comment>
<![CDATA[
Usage:
# fgfs --generic=socket,out,<hz>,<host>,55737,udp,Aircraft/SenecaII/Protocols/Panel1.xml
]]>
</comment>
<generic>
<output>
<line_separator>newline</line_separator>
<var_separator>,</var_separator>
<chunk>
<type>float</type>
<format>%.3f</format>
<node>/instrumentation/altimeter/setting-inhg</node>
</chunk>
<chunk>
<type>float</type>
<format>%.2f</format>
<node>/instrumentation/altimeter/indicated-altitude-ft</node>
</chunk>
<chunk>
<type>float</type>
<format>%.3f</format>
<node>/instrumentation/slip-skid-ball/indicated-slip-skid</node>
</chunk>
<chunk>
<type>float</type>
<format>%.4e</format>
<node>/instrumentation/vertical-speed-indicator/indicated-speed-fpm</node>
</chunk>
</output>
</generic>
</PropertyList>
Again, give this file a name. In my case, SenecaII-fgpanel-protocol.xml.
And finally, a single xml file is used to consolidate these two above for fgpanel. I call it a definition file and mine looks like this:
- Code: Select all
<PropertyList>
<game-mode type="bool">false</game-mode>
<panel include="SenecaII-fgpanel-items.xml"/>
<sim>
<panel>
<flip-x type="bool">false</flip-x>
</panel>
<frame-rate-throttle-hz>30</frame-rate-throttle-hz>
<instrument-options>
<omit-knobs type="bool">true</omit-knobs>
</instrument-options>
</sim>
<communication>
<listen>
<host>127.0.0.1</host> <!-- multicast address! -->
<port>5432</port> <!-- tcp port to listen to -->
<style>udp</style>
</listen>
<protocol include="SenecaII-fgpanel-protocol.xml"/>
</communication>
</PropertyList>
You can see that it names both the items and protocol files. In addition, it contains the generic protocol communication information. Again, give this file a name. For me, it's SenecaII-fgpanel-defs.xml.
You now have the three files that fgpanel needs. In my case I placed them all in my Aircraft/Panels folder. And when you start fgpanel and fgfs, you will need to tell them where these files are. So let's see how to run them.
First you can start fgpanel. When you start it, you should at least be able to see the instruments on the screen. If you don't, something is amiss. I built flightgear using the download and compile script and am running linux. So my installation and paths may be entirely different from yours. So you might need to experiment to get it right. When I run fgpanel, I am using a shell script and cd to the flightgear bin directory. I am sure there are other ways of starting fgpanel to get it to recognize paths, but I've only done it this way. If you have difficulty, post your issues and we'll try to help. It shouldn't really be rocket science at this point! In any event, you can see that I am instructing fgpanel to use my definition file that we created above. Remember it contains the list of instruments, the protocol file and the communications information.
- Code: Select all
./fgpanel --fg-root=$PWD/../fgdata/ --panel=Aircraft/SenecaII/Panels/SenecaII-fgpanel-def.xml
Now you can start flightgear:
- Code: Select all
./fgfs --fg-root=$PWD/../fgdata/ --launcher --generic=socket,out,10,127.0.0.1,5432,udp,../Aircraft/SenecaII/Panels/SenecaII-fgpanel-protocol
Again, I am running linux And you can see here that we're providing generic protocol information as well as the generic protocol file. And **Notice** that the ".xml" extension is not used in the filename here. In other words, don't use SenecaII-fgpanel-protocol.xml in the fgfs command here, just use the truncated name without the extension.
What to look for ....
You should be able to run fgpanel without starting flightgear and you should see your instruments displayed. When you start flightgear and start your aircraft, you should see the needles move immediately. If you don't, check the flightgear log - look for things like file not found, etc.
Post your results in either case. Good Luck!!
Flight Instruction Elevator Control: pull back = houses get smaller, push forward = houses get bigger.