Howto:Implement pushback: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (+ Military truck image)
(Systems/pushback.xml: remove obsolete property declarations)
Line 11: Line 11:
  <system name="pushback">
  <system name="pushback">
   <property>/sim/model/pushback/target-speed-fps</property>
   <property>/sim/model/pushback/target-speed-fps</property>
  <property>/sim/model/pushback/kp</property>
  <property>/sim/model/pushback/ki</property>
  <property>/sim/model/pushback/kd</property>
   <channel name="Pushback">
   <channel name="Pushback">
   
   

Revision as of 18:27, 6 May 2009

A KLM Boeing 747-400 ready for pushback at EHAM. This is the Goldhofert truck.
A F-16 being towed at KLSV. This is the military truck.

Currently, pushback is only used on JSBSim planes. It should be possible with YASim aswell, but it has never be done yet.

Please note: this system does not work over a multiplay network.

Systems/pushback.xml

Create the following directory, if not present $FG_ROOT/Aircraft/.../Systems and create a file named pushback.xml with the following content:

<?xml version='1.0' encoding='UTF-8' ?>
<system name="pushback">
 <property>/sim/model/pushback/target-speed-fps</property>
 <channel name="Pushback">

   <switch name="systems/pushback/linked">
     <default value="-1"/>
     <test value="0">
       /sim/model/pushback/position-norm gt 0.95
       /gear/gear/wow == 1
       gear/unit[0]/wheel-speed-fps lt 50
     </test>
   </switch>

   <summer name="systems/pushback/speed-error">
     <input>/sim/model/pushback/target-speed-fps</input>
     <input>-gear/unit[0]/wheel-speed-fps</input>
   </summer>

   <pid name="systems/pushback/force">
     <input>systems/pushback/speed-error</input>
     <kp>/sim/model/pushback/kp</kp>
     <ki>/sim/model/pushback/ki</ki>
     <kd>/sim/model/pushback/kd</kd>
     <trigger>systems/pushback/linked</trigger>
   </pid>

   <switch name="systems/pushback/output">
     <default value="0"/>
     <test value="systems/pushback/force">
       systems/pushback/linked == 0
     </test>
     <output>external_reactions/pushback/magnitude</output>
   </switch>

 </channel>
</system>

This is the "cruise control" for the pushback truck. You define the cruise speed at the dialog and the controller varies the external force in a way that the actual speed matches your given value. The working horses here are the summer, which compares actual and reference speed, and the PID controller which calculates the resulting force. A basic description is: "the more actual and reference speed differ, the more force is applied (kp) plus the more time passes until the reference speed is reached, the more force is applied (ki)". The switches check, if the pushback truck is actually linked to the aircraft.

.xml (FDM)

After the </propulsion> tag we add a reference to the pushback system:

 <system file="pushback"/>

And at the end of the FDM, the following is needed to attach the forces of the pushback to the aircraft. The location should be somewhere near the nose wheel of the aircraft (where the pushback truck is connected).

<external_reactions>

 <force name="pushback" frame="BODY">
  <location unit="IN">
   <x>  -139 </x>
   <y>    0.0 </y>
   <z>  -71.0 </z>
  </location>
  <direction>
   <x>1</x>
   <y>0</y>
   <z>0</z>
  </direction>
 </force>

</external_reactions>

-set.xml

Between the <model> tags in the -set.xml file add the definitions for the speed-hold controller:

<model>
 <pushback>
  <kp type="double">100</kp>
  <ki type="double">25</ki>
  <kd type="double">0</kd>
  <position-norm type="double">0</position-norm>
 </pushback>
</model>

The values for kp, ki and kd control how the cruise control reacts and may be adjusted depending on the mass of the aircraft. The pushback dialog allows changing of these properties at runtime. Note: if the model tags are already there, you do no need to add them again. Just place the stuff between them. If you want the truck to be connected on startup, position-norm to 1.

Below the </sim> tag, we add our menu dialog. A generic one is available at $FG_ROOT/gui/Dialogs/pushback.xml. Add the following lines to include it in the Equipment menu of the aircraft. Note: if the menubar and default tags are already there, you do no need to add them again. Just place the stuff between them.

<menubar>
 <default>
    
  <menu n="5">
   <item n="10">
    <label>Pushback</label>
    <name>pushback</name>
    <binding>
     <command>dialog-show</command>
     <dialog-name>pushback</dialog-name>
    </binding>
   </item>
  </menu>

 </default>
</menubar>

Models/ .xml

In your planes model file, we add a reference to one of the generic pushback models, or a custom made truck, shipped with your plane. Edit the offsets to fit your plane; the z offset should be at ground level, while the x offset is at the nosewheel(center).

<model>
 <name>Pushback</name>
 <path>Models\Airport\Pushback\Goldhofert.xml</path>
 <offsets>
  <x-m>-25.0</x-m>
  <y-m>0</y-m>
  <z-m>-4.0</z-m>
 </offsets>
</model>