Howto:Implement pushback: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (update)
(+ Template:Note; copy editing; +related: Autopush)
(32 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Image:747-400_pushback_eham.jpg|thumb|270px|A KLM [[Boeing 747-400]] ready for pushback at [[EHAM]]. This is the Goldhofert truck.]]
{{Note|This system does not work over the [[Howto: Multiplayer|multiplayer]] network.}}
Currently, pushback is only used on [[JSBSim]] planes. It should be possible with [[YASim]] aswell, but it has never be done yet.
[[File:747-400_pushback_eham.jpg|thumb|270px|A KLM [[Boeing 747-400]] ready for pushback at [[EHAM]]. This is the Goldhofert truck.]]
[[File:F-16 pushback.jpg|thumb|270px|A [[F-16]] being towed at [[KLSV]]. This is the military truck.]]
[[File:YASim-pushback.jpeg|thumb|270px|A BA [[Boeing 777-200]] being pushbacked at [[EHAM]]. 777-200 is YASim]]
[[File:YASim-pushback2.jpeg|thumb|270px|A LH [[Boeing 727-230]] being pushbacked at [[EHAM]], here using the military truck]]


===Systems/pushback.xml===
Currently, pushback can be used on [[JSBSim]] planes and[[YASim]] aswell, but the method differs a bit depending of type of fdm.
Create the following directory, if not present:
* <tt>[[$FG_ROOT]]/Aircraft/.../Systems</tt>


== For JSBSim ==
=== Systems/pushback.xml ===
Create the following directory, if not present <code>[[$FG ROOT]]/Aircraft/.../Systems</code> and create a file named <code>pushback.xml</code> with the following content:
<syntaxhighlight lang="xml">
<?xml version='1.0' encoding='UTF-8' ?>
  <system name="pushback">
  <system name="pushback">
  <property>/sim/model/pushback/target-speed-fps</property>
   <channel name="Pushback">
   <channel name="Pushback">
   
   
  <switch name="systems/pushback/linked">
    <switch name="systems/pushback/linked">
    <default value="0"/>
      <default value="-1"/>
    <test logic="AND" value="1">
      <test value="0">
      /sim/model/pushback/position-norm == 1
        /sim/model/pushback/position-norm gt 0.95
      /gear/gear/wow == 1
        /gear/gear/wow == 1
     </test>
        gear/unit[0]/wheel-speed-fps lt 50
  </switch>
      </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>
      <output>/sim/model/pushback/force</output>
    </pid>
    <switch name="systems/pushback/force-output">
      <default value="0"/>
      <test value="systems/pushback/force">
        systems/pushback/linked == 0
      </test>
      <output>external_reactions/pushback/magnitude</output>
    </switch>
 
    <fcs_function name="Pushback Force X">
      <function>
        <cos>
          <toradians><property>fcs/steer-pos-deg[0]</property></toradians>
        </cos>
      </function>
      <output>external_reactions/pushback/x</output>
    </fcs_function>
 
    <fcs_function name="Pushback Force Y">
      <function>
        <sin>
          <toradians><property>fcs/steer-pos-deg[0]</property></toradians>
        </sin>
      </function>
      <output>external_reactions/pushback/y</output>
    </fcs_function>
   
   
  <switch name="systems/pushback/force">
    <default value="0"/>
    <test  logic="AND" value="/sim/model/pushback/magnitude">
      systems/pushback/linked == 1
      gear/unit[0]/wheel-speed-fps lt 500
    </test>
    <output>external_reactions/pushback/magnitude</output>
  </switch>
   </channel>
   </channel>
  </system>
  </system>
</syntaxhighlight>


===.xml===
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.
In the FDM file we have to add the pushback engine. You add it like every other engine, with the exception that the location should be somewhere near the nose wheel of the aircraft (where the pushback truck is connected).
 
<engine file="pushback">
...


After the </propulsion> tag we add a reference to the pushback system:
=== .xml (FDM) ===
After the <code><nowiki></propulsion></nowiki></code> tag we add a reference to the pushback system:


<syntaxhighlight lang="xml">
   <system file="pushback"/>
   <system file="pushback"/>
</syntaxhighlight>


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).
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).


<syntaxhighlight lang="xml">
  <external_reactions>
  <external_reactions>
   
   
Line 56: Line 98:
   
   
  </external_reactions>
  </external_reactions>
</syntaxhighlight>


===-set.xml===
=== -set.xml ===
Between the <model> tags in the -set.xml file we set three properties to false (0). 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, set linked and position-norm to 1.
Between the <code><nowiki><model></nowiki></code> tags in the <code><nowiki>-set.xml</nowiki></code> file add the definitions for the speed-hold controller:


<syntaxhighlight lang="xml">
  <model>
  <model>
   <pushback>
   <pushback>
   <magnitude>0</magnitude>
   <kp type="double">100</kp>
   <linked>0</linked>
  <ki type="double">25</ki>
   <position-norm>0</position-norm>
   <kd type="double">0</kd>
   <position-norm type="double">0</position-norm>
   </pushback>
   </pushback>
  </model>
  </model>
</syntaxhighlight>
The values for kp, ki and kd control how the cruise control reacts and may be adjusted depending on the mass of the aircraft.


Then below the </sim> tag, we add our [[Menubar|menu]] dialog. A generic one is available as <tt>$FG_ROOT/gui/Dialogs/pushback.xml</tt>. 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.
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, <code>position-norm</code> to 1.  


Below the <code><nowiki></sim></nowiki></code> tag, we add our [[Menubar|menu]] dialog. A generic one is available at <code>$FG_ROOT/gui/Dialogs/pushback.xml</code>. 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.
<syntaxhighlight lang="xml">
  <menubar>
  <menubar>
   <default>
   <default>
      
      
   <menu n="5">
   <menu n="5">
     <item>
     <item n="10">
     <label>Pushback</label>
     <label>Pushback</label>
     <name>pushback</name>
     <name>pushback</name>
Line 88: Line 137:
   </default>
   </default>
  </menubar>
  </menubar>
</syntaxhighlight>
=== 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).
Currently four different types are available:
; Goldhofert
: Used on medium sized to large airliners (for example [[737]], [[747]])
; Douglas
: Used on medium sized to large airliners
; Military
: Used on military and small aircraft (for example [[F-16]], [[Hansajet]])
; Forklift
: Used on general aviation or private jets
Both models can be found in the <code>$FG_ROOT/Models/Airport/Pushback</code> directory. The following example uses the Goldhofert, but by changing the path to <code>(Douglas|Military|Forklift).xml</code> the other trucks can be implemented.
Renders of the different models (order: Goldhofert, Douglas, Military, Forklift):
[[File:Pushbacks.png|thumb|left]]
<syntaxhighlight lang="xml">
<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>
</syntaxhighlight>
== For YASim ==
For YASim we have to fake the external forces with the thruster. A thruster in YASim is a very simple "thrust only" engine object which does not consume any fuel etc.
=== .xml (FDM) ===
So we add the following lines to our <code>yasim.xml</code>:
<syntaxhighlight lang="xml">
  <thruster x="19.246"  y="0.00" z="-2.7" vx="1" vy="0" vz="0" thrust="20000">
  <control-input axis="/sim/model/pushback/target-speed-fps" control="THROTTLE" src0="-1" src1="1" dst0="-1" dst1="1"/>
  </thruster>
</syntaxhighlight>


And at the end of the file we add an(other) [[nasal]] file. Note: if the nasal tags are already there, you do no need to add them again. Just place the pushback stuff between them.
For the coordinates use the same as the coordinates of the nosegear. The thrust itself is in lbs- don't set it too high! 1/3 of the aircraft's empty mass should be enough!


Then we just have to add our [[Menubar|menu]] dialog. A generic one is available at <code>$FG_ROOT/gui/Dialogs/pushback.xml</code>. 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 not need to add them again. Just place the stuff between them.


  <nasal>
<syntaxhighlight lang="xml">
  <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>
   
   
   <pushback>
   </default>
  <file>Nasal/pushback.nas</file>
</menubar>
  </pushback>
</syntaxhighlight>
</nasal>


===Models/ .xml===
=== 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 nosegear of the aircraft should be between the rear gear of the pushback, when it is connected.
And like in JSBSim, 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).


<syntaxhighlight lang="xml">
  <model>
  <model>
   <name>Pushback</name>
   <name>Pushback</name>
   <path>Models\Airport\Pushback\Goldhofert.xml</path>
   <path>Models/Airport/Pushback/Goldhofert.xml</path>
   <offsets>
   <offsets>
   <x-m>-25.0</x-m>
   <x-m>-25.0</x-m>
Line 112: Line 218:
   </offsets>
   </offsets>
  </model>
  </model>
</syntaxhighlight>
Note: If the aircraft author didn't use <code>gear/gear[0]/steering-norm</code> for ground steering, the pushback model won't be turned with the nosegear
Done! Now you have a Pushback on your favourite YASim-Model!
== Related content ==
* [[Autopush]] - A different pushback system


[[Category:Aircraft enhancement|Implent pushback]]
[[Category:Aircraft enhancement|Implement pushback]]
[[Category:Howto|Implent pushback]]
[[Category:Howto|Implement pushback]]

Revision as of 11:44, 28 March 2020

Note  This system does not work over the multiplayer network.
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.
A BA Boeing 777-200 being pushbacked at EHAM. 777-200 is YASim
A LH Boeing 727-230 being pushbacked at EHAM, here using the military truck

Currently, pushback can be used on JSBSim planes andYASim aswell, but the method differs a bit depending of type of fdm.

For JSBSim

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>
      <output>/sim/model/pushback/force</output>
    </pid>
 
    <switch name="systems/pushback/force-output">
      <default value="0"/>
      <test value="systems/pushback/force">
        systems/pushback/linked == 0
      </test>
      <output>external_reactions/pushback/magnitude</output>
    </switch>

    <fcs_function name="Pushback Force X">
      <function>
        <cos>
          <toradians><property>fcs/steer-pos-deg[0]</property></toradians>
        </cos>
      </function>
      <output>external_reactions/pushback/x</output>
    </fcs_function>

    <fcs_function name="Pushback Force Y">
      <function>
        <sin>
          <toradians><property>fcs/steer-pos-deg[0]</property></toradians>
        </sin>
      </function>
      <output>external_reactions/pushback/y</output>
    </fcs_function>
 
  </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.

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).

Currently four different types are available:

Goldhofert
Used on medium sized to large airliners (for example 737, 747)
Douglas
Used on medium sized to large airliners
Military
Used on military and small aircraft (for example F-16, Hansajet)
Forklift
Used on general aviation or private jets

Both models can be found in the $FG_ROOT/Models/Airport/Pushback directory. The following example uses the Goldhofert, but by changing the path to (Douglas|Military|Forklift).xml the other trucks can be implemented.

Renders of the different models (order: Goldhofert, Douglas, Military, Forklift):

Pushbacks.png
 <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>

For YASim

For YASim we have to fake the external forces with the thruster. A thruster in YASim is a very simple "thrust only" engine object which does not consume any fuel etc.

.xml (FDM)

So we add the following lines to our yasim.xml:

  <thruster x="19.246"  y="0.00" z="-2.7" vx="1" vy="0" vz="0" thrust="20000">
  <control-input axis="/sim/model/pushback/target-speed-fps" control="THROTTLE" src0="-1" src1="1" dst0="-1" dst1="1"/>
  </thruster>

For the coordinates use the same as the coordinates of the nosegear. The thrust itself is in lbs- don't set it too high! 1/3 of the aircraft's empty mass should be enough!

Then we just have to 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 not 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

And like in JSBSim, 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>

Note: If the aircraft author didn't use gear/gear[0]/steering-norm for ground steering, the pushback model won't be turned with the nosegear

Done! Now you have a Pushback on your favourite YASim-Model!

Related content