From: Andy R. <an...@fl...> - 2006-08-24 22:29:40
|
Update of /var/cvs/FlightGear-0.9/data/Aircraft/harrier In directory baron:/tmp/cvs-serv25863/Aircraft/harrier Modified Files: harrier-set.xml harrier.xml harrierAAR.nas Log Message: [Yes, Andy's writing code again. The world is ending.] An IRC discussion about shavlir's (really nice) harrier model showed that it had its own version of something like the Fuel & Weight dialog, developed because the existing subsystem only supported sliders and not "combo box" style selection for specific external stores. That seemed sub-optimal, so I spent a few hours extending the F&W dialog to do this and forward-ported the harrier to use it. Check the harrier-set.xml file for an example. Basically, the weight dialog reads a list of options for each weight listed under /sim/weight[n] and manages a "selected" proprty telling us which one is in use. The FDM code can then read out the weight-lb property as before, and the model animations can use the selected option to predicate drawing the appropriate 3D content. It seems to work pretty well. Index: harrier-set.xml =================================================================== RCS file: /var/cvs/FlightGear-0.9/data/Aircraft/harrier/harrier-set.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C 2 -r1.5 -r1.6 *** harrier-set.xml 24 Aug 2006 19:15:28 -0000 1.5 --- harrier-set.xml 24 Aug 2006 22:29:16 -0000 1.6 *************** *** 2,206 **** <PropertyList> ! <sim> ! <description>British Aerospace Harrier (YASim)</description> ! <author>Andy Ross(FDM), Steve Havlir(3d Model, Panel)</author> ! <flight-model>yasim</flight-model> ! <aero>harrier</aero> ! ! <fuel-fraction>0.5</fuel-fraction> ! ! <startup> ! <splash-texture>Aircraft/harrier/harrier-splash.rgb</splash-texture> ! </startup> ! ! <sound> ! <path>Aircraft/harrier/Sound/harrier-sound.xml</path> ! </sound> ! ! <hud> ! <path n="1">Aircraft/harrier/Panel/Hud/NTPS.xml</path> ! <visibility n="0" type="bool">false</visibility> ! <visibility n="1" type="bool">true</visibility> ! <current-color>0</current-color> ! <color> ! <transparent type="bool">true</transparent> ! <antialiased type="bool">true</antialiased> ! <brightness type="float">1.0</brightness> ! <alpha type="float">0.70</alpha> ! </color> ! <palette> ! <color n="0"> ! <red type="float">0.50</red> ! <green type="float">1.0</green> ! <blue type="float">0.00</blue> ! </color> ! <color n="1"> ! <red type="float">1.0</red> ! <green type="float">0.0</green> ! <blue type="float">0.0</blue> ! </color> ! </palette> ! </hud> ! ! <model> ! <path>Aircraft/harrier/Models/harrier-model.xml</path> ! </model> ! ! <view n="0"> ! <internal archive="y">true</internal> ! <config> ! <!-- x/y/z == right/up/back --> ! <x-offset-m archive="y">0.00</x-offset-m> ! <y-offset-m archive="y">0.68</y-offset-m> ! <z-offset-m archive="y">3.98</z-offset-m> ! <pitch-offset-deg archive="y">-11</pitch-offset-deg> ! </config> ! </view> ! <view n="1"> ! <config> ! <!-- x/y/z == right/up/back --> ! <target-z-offset-m archive="y">8</target-z-offset-m> ! <pitch-offset-deg archive="y">10</pitch-offset-deg> ! </config> ! </view> ! <view n="2"> ! <config> ! <!-- x/y/z == right/up/back --> ! <target-z-offset-m archive="y">8</target-z-offset-m> ! <pitch-offset-deg archive="y">10</pitch-offset-deg> ! </config> ! </view> ! <view n="5"> ! <config> ! <!-- x/y/z == right/up/back --> ! <target-z-offset-m archive="y">8</target-z-offset-m> ! <pitch-offset-deg archive="y">10</pitch-offset-deg> ! </config> ! </view> ! ! <help> ! <title>British Aerospace Harrier</title> ! <key> ! <name>m/M</name> ! <desc>Thrust Vector</desc> ! </key> ! <key> ! <name>Tab</name> ! <desc>Armament Selection</desc> ! </key> ! <key> ! <name>j/k</name> ! <desc>Decrease/Increase Air Brake</desc> ! </key> ! <text> ! Tips: ! ____Horizontal Take Off____ ! Disengage the parking brake. Keep the stick pulled back while steering down the runway. ! _____Vertical Take Off_____ ! Set the thrust vector to about 75 degrees. When you have gained about a hundred feet in altitude and are stable, slowly decrease the thrust vector back down to 0. As you pick up speed, your wings will keep you airborne. Do not decrease the thrust vector too quickly. ! ____Vertical Landing____ ! This is very difficult. Increase the thrust vector to about 85 degrees fairly early. You may use greater than 90 degree thrust vector to slow down, but don't forget about it, or else you may end up flying backwards(bad!). Flaps and air brake are optional. As you lose speed, your wings will no longer be able to support your weight. Keep your hand close to the throttle, and if you ever feel yourself dropping like a rock, slam the throttle to 100% right away. The slower you go, the more vertical thrust you will need. Once you are under 100 kts, your throttle will remain at about 80% or above. Find a good decent rate that isn't too fast and be patient. Right before you hit the ground, point the nose upwards to about 8 degrees to accomodate the front landing gear being longer. ! ! </text> ! </help> ! <systems> ! <autopilot> <path>Aircraft/harrier/harrier-autopilot.xml</path> ! </autopilot> ! </systems> ! <menubar> ! <default> ! <menu n="10"> ! <label>Harrier</label> ! <enabled type="bool">true</enabled> ! <item> ! <label>Equipment Selection</label> ! <binding> ! <command>nasal</command> ! <script> ! equipment.showDialog(); ! </script> ! </binding> ! </item> ! </menu> ! </default> ! </menubar> ! </sim> ! ! <!-- set a few properties --> ! <instrumentation> ! <enav><selected type="int">4</selected></enav> ! <radar> ! <range type="int" archive="y">20</range> ! <range-factor type="double" archive="n">0.001888</range-factor> ! <minimized type="bool" archive="y">false</minimized> ! <selected type="int">0</selected> ! </radar> ! </instrumentation> ! ! <systems> ! <equipment> ! <Pylon1> ! <object type="string">Sidewinder AAM</object> ! <reset type="string">Sidewinder AAM</reset> ! <weight-lbs>155.2</weight-lbs> ! </Pylon1> ! <Pylon2> ! <object type="string">External Fuel Tanks</object> ! <reset type="string">External Fuel Tanks</reset> ! <weight-lbs>0</weight-lbs> ! </Pylon2> ! <Pylon3> ! <object type="string">none</object> ! <reset type="string">none</reset> ! <weight-lbs>0.00</weight-lbs> ! </Pylon3> ! <Pylon4> ! <object type="string">External Fuel Tanks</object> ! <weight-lbs>0</weight-lbs> ! </Pylon4> ! <Pylon5> ! <object type="string">Sidewinder AAM</object> ! <weight-lbs>155.2</weight-lbs> ! </Pylon5> ! <GunPod1> ! <object type="string">ADEN Cannons</object> ! <reset type="string">ADEN Cannons</reset> ! <weight-lbs>87</weight-lbs> ! </GunPod1> ! <GunPod2> ! <object type="string">ADEN Cannons</object> ! <weight-lbs>87</weight-lbs> ! </GunPod2> ! <AARBoom type="string">1</AARBoom> ! </equipment> ! </systems> ! ! <!-- keyboard--> ! <input> ! <keyboard> ! <key n="9"> ! <name>Tab</name> ! <desc>Show Equipment dialog</desc> ! <binding> ! <command>nasal</command> ! <script>equipment.showDialog()</script> ! </binding> ! </key> ! <key n="104"> ! <name>h</name> ! <desc>toggle HUD</desc> ! <binding> ! <command>property-toggle</command> ! <property>sim[0]/hud/visibility[1]</property> ! </binding> ! </key> ! ! </keyboard> ! </input> ! <!-- load nasal scripts --> <nasal> <aar> --- 2,224 ---- <PropertyList> ! <sim> ! <description>British Aerospace Harrier (YASim)</description> ! <author>Andy Ross(FDM), Steve Havlir(3d Model, Panel)</author> ! <flight-model>yasim</flight-model> ! <aero>harrier</aero> ! ! <fuel-fraction>0.5</fuel-fraction> ! ! <startup> ! <splash-texture>Aircraft/harrier/harrier-splash.rgb</splash-texture> ! </startup> ! ! <sound> ! <path>Aircraft/harrier/Sound/harrier-sound.xml</path> ! </sound> ! ! <hud> ! <path n="1">Aircraft/harrier/Panel/Hud/NTPS.xml</path> ! <visibility n="0" type="bool">false</visibility> ! <visibility n="1" type="bool">true</visibility> ! <current-color>0</current-color> ! <color> ! <transparent type="bool">true</transparent> ! <antialiased type="bool">true</antialiased> ! <brightness type="float">1.0</brightness> ! <alpha type="float">0.70</alpha> ! </color> ! <palette> ! <color n="0"> ! <red type="float">0.50</red> ! <green type="float">1.0</green> ! <blue type="float">0.00</blue> ! </color> ! <color n="1"> ! <red type="float">1.0</red> ! <green type="float">0.0</green> ! <blue type="float">0.0</blue> ! </color> ! </palette> ! </hud> ! ! <model> ! <path>Aircraft/harrier/Models/harrier-model.xml</path> ! </model> ! ! <view n="0"> ! <internal archive="y">true</internal> ! <config> ! <!-- x/y/z == right/up/back --> ! <x-offset-m archive="y">0.00</x-offset-m> ! <y-offset-m archive="y">0.68</y-offset-m> ! <z-offset-m archive="y">3.98</z-offset-m> ! <pitch-offset-deg archive="y">-11</pitch-offset-deg> ! </config> ! </view> ! <view n="1"> ! <config> ! <!-- x/y/z == right/up/back --> ! <target-z-offset-m archive="y">8</target-z-offset-m> ! <pitch-offset-deg archive="y">10</pitch-offset-deg> ! </config> ! </view> ! <view n="2"> ! <config> ! <!-- x/y/z == right/up/back --> ! <target-z-offset-m archive="y">8</target-z-offset-m> ! <pitch-offset-deg archive="y">10</pitch-offset-deg> ! </config> ! </view> ! <view n="5"> ! <config> ! <!-- x/y/z == right/up/back --> ! <target-z-offset-m archive="y">8</target-z-offset-m> ! <pitch-offset-deg archive="y">10</pitch-offset-deg> ! </config> ! </view> ! ! <help> ! <title>British Aerospace Harrier</title> ! <key> ! <name>m/M</name> ! <desc>Thrust Vector</desc> ! </key> ! <key> ! <name>Tab</name> ! <desc>Armament Selection</desc> ! </key> ! <key> ! <name>j/k</name> ! <desc>Decrease/Increase Air Brake</desc> ! </key> ! <text> ! Tips: ! ____Horizontal Take Off____ ! Disengage the parking brake. Keep the stick pulled back while steering down the runway. ! _____Vertical Take Off_____ ! Set the thrust vector to about 75 degrees. When you have gained about a hundred feet in altitude and are stable, slowly decrease the thrust vector back down to 0. As you pick up speed, your wings will keep you airborne. Do not decrease the thrust vector too quickly. ! ____Vertical Landing____ ! This is very difficult. Increase the thrust vector to about 85 degrees fairly early. You may use greater than 90 degree thrust vector to slow down, but don't forget about it, or else you may end up flying backwards(bad!). Flaps and air brake are optional. As you lose speed, your wings will no longer be able to support your weight. Keep your hand close to the throttle, and if you ever feel yourself dropping like a rock, slam the throttle to 100% right away. The slower you go, the more vertical thrust you will need. Once you are under 100 kts, your throttle will remain at about 80% or above. Find a good decent rate that isn't too fast and be patient. Right before you hit the ground, point the nose upwards to about 8 degrees to accomodate the front landing gear being longer. ! ! </text> ! </help> ! <systems> ! <autopilot> <path>Aircraft/harrier/harrier-autopilot.xml</path> ! </autopilot> ! </systems> ! ! <weight n="0"> ! <name>Left Wingtip</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name><lbs>0</lbs></opt> ! <opt><name>AIM-9L Sidewinder</name><lbs>155.2</lbs></opt> ! </weight> ! <weight n="1"> ! <name>Left Wingroot</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name> <lbs>0</lbs> </opt> ! <opt><name>AIM-9L Sidewinder</name> <lbs>155.2</lbs></opt> ! <opt><name>AIM-120 AMRAAM</name> <lbs>335</lbs> </opt> ! <opt><name>ALARM Anti-radar Missile</name> <lbs>590</lbs> </opt> ! <opt><name>500lb Laser Guided Bomb</name> <lbs>606</lbs> </opt> ! <opt><name>External Fuel Tank</name> <lbs>190</lbs> </opt> ! </weight> ! <weight n="2"> ! <name>Left Gun Pod</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name> <lbs>0</lbs> </opt> ! <opt><name>ADEN Cannon</name> <lbs>87</lbs> </opt> ! </weight> ! <weight n="3"> ! <name>Centerline</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name> <lbs>0</lbs> </opt> ! <opt><name>1000lb Laser Guided Bomb</name> <lbs>1092</lbs> </opt> ! <opt><name>Sea Eagle Anti-ship Missile</name><lbs>1323</lbs> </opt> ! </weight> ! <weight n="4"> ! <name>Right Gun Pod</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name> <lbs>0</lbs> </opt> ! <opt><name>ADEN Cannon</name> <lbs>87</lbs> </opt> ! </weight> ! <weight n="5"> ! <name>Right Wingroot</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name> <lbs>0</lbs> </opt> ! <opt><name>AIM-9L Sidewinder</name> <lbs>155.2</lbs></opt> ! <opt><name>AIM-120 AMRAAM</name> <lbs>335</lbs> </opt> ! <opt><name>ALARM Anti-radar Missile</name> <lbs>590</lbs> </opt> ! <opt><name>500lb Laser Guided Bomb</name> <lbs>606</lbs> </opt> ! <opt><name>External Fuel Tank</name> <lbs>190</lbs> </opt> ! </weight> ! <weight n="6"> ! <name>Right Wingtip</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name><lbs>0</lbs></opt> ! <opt><name>AIM-9L Sidewinder</name><lbs>155.2</lbs></opt> ! </weight> ! <weight n="7"> ! <name>Refueling Boom</name> ! <weight-lb>0</weight-lb> ! <selected>none</selected> ! <opt><name>none</name><lbs>0</lbs></opt> ! <opt><name>Refueling Boom Attached</name><lbs>60</lbs></opt> ! </weight> ! ! </sim> ! ! <!-- set a few properties --> ! <instrumentation> ! <enav><selected type="int">4</selected></enav> ! <radar> ! <range type="int" archive="y">20</range> ! <range-factor type="double" archive="n">0.001888</range-factor> ! <minimized type="bool" archive="y">false</minimized> ! <selected type="int">0</selected> ! </radar> ! </instrumentation> ! ! <!-- keyboard--> ! <input> ! <keyboard> ! <key n="104"> ! <name>h</name> ! <desc>toggle HUD</desc> ! <binding> ! <command>property-toggle</command> ! <property>sim[0]/hud/visibility[1]</property> ! </binding> ! </key> ! ! </keyboard> ! </input> ! ! <consumables> ! <fuel> ! <tank n="0"> ! <name>Internal</name> ! </tank> ! <tank n="1"> ! <name>Left External</name> ! </tank> ! <tank n="2"> ! <name>Right External</name> ! </tank> ! </fuel> ! </consumables> ! <!-- load nasal scripts --> <nasal> <aar> *************** *** 213,219 **** <file>Aircraft/harrier/Panel/radar/radar.nas</file> </radar> - <equipment> - <file>Aircraft/harrier/Models/equipment.nas</file> - </equipment> <hud> <file>Aircraft/harrier/Panel/Hud/hud.nas</file> --- 231,234 ---- Index: harrier.xml =================================================================== RCS file: /var/cvs/FlightGear-0.9/data/Aircraft/harrier/harrier.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C 2 -r1.3 -r1.4 *** harrier.xml 24 Aug 2006 17:49:31 -0000 1.3 --- harrier.xml 24 Aug 2006 22:29:16 -0000 1.4 *************** *** 167,183 **** configuration of the main tank is. Just put it all at the wing root. --> ! <tank x="-7.32" y="0" z="0.5" jet="true" capacity="5049"/> ! <tank x="-7.22" y="0" z="-0.40" jet="true" capacity="2607"/> ! <tank x="-7.22" y="0" z="-0.40" jet="true" capacity="2607"/> <ballast x="-2" y="0" z="0" mass="600"/> ! <weight x="-7.32" y="-2.83" z="-0.60" size="0.18" mass-prop="systems/equipment/Pylon1/weight-lbs"/> ! <weight x="-7.60" y="-1.86" z="-0.40" size="0.18" mass-prop="systems/equipment/Pylon2/weight-lbs"/> ! <weight x="-7.90" y="0.00" z="-1.00" size="0.18" mass-prop="systems/equipment/Pylon3/weight-lbs"/> ! <weight x="-7.60" y="1.86" z="-0.40" size="0.18" mass-prop="systems/equipment/Pylon4/weight-lbs"/> ! <weight x="-7.32" y="2.83" z="-0.60" size="0.18" mass-prop="systems/equipment/Pylon5/weight-lbs"/> ! <weight x="-7.60" y="-0.60" z="-1.0" size="0.18" mass-prop="systems/equipment/GunPod1/weight-lbs"/> ! <weight x="-7.60" y="0.60" z="-1.0" size="0.18" mass-prop="systems/equipment/GunPod2/weight-lbs"/> </airplane> --- 167,184 ---- configuration of the main tank is. Just put it all at the wing root. --> ! <tank x="-7.32" y="0" z="0.5" jet="1" capacity="5049"/> ! <tank x="-7.22" y="0" z="-0.40" jet="1" capacity="2607"/> ! <tank x="-7.22" y="0" z="-0.40" jet="1" capacity="2607"/> <ballast x="-2" y="0" z="0" mass="600"/> ! <weight x="-7.32" y="-2.83" z="-0.60" size="0.18" mass-prop="sim/weight[0]/weight-lb"/> ! <weight x="-7.60" y="-1.86" z="-0.40" size="0.18" mass-prop="sim/weight[1]/weight-lb"/> ! <weight x="-7.60" y="-0.60" z="-1.0" size="0.18" mass-prop="sim/weight[2]/weight-lb"/> ! <weight x="-7.90" y="0.00" z="-1.00" size="0.18" mass-prop="sim/weight[3]/weight-lb"/> ! <weight x="-7.60" y="0.60" z="-1.0" size="0.18" mass-prop="sim/weight[4]/weight-lb"/> ! <weight x="-7.60" y="1.86" z="-0.40" size="0.18" mass-prop="sim/weight[5]/weight-lb"/> ! <weight x="-7.32" y="2.83" z="-0.60" size="0.18" mass-prop="sim/weight[6]/weight-lb"/> ! <weight x="-3.15" y="1.00" z="1.00" size="0.05" mass-prop="sim/weight[7]/weight-lb"/> </airplane> Index: harrierAAR.nas =================================================================== RCS file: /var/cvs/FlightGear-0.9/data/Aircraft/harrier/harrierAAR.nas,v retrieving revision 1.2 retrieving revision 1.3 diff -C 2 -r1.2 -r1.3 *** harrierAAR.nas 24 Aug 2006 19:15:28 -0000 1.2 --- harrierAAR.nas 24 Aug 2006 22:29:16 -0000 1.3 *************** *** 99,104 **** } ! hasAARBoom = getprop("systems/equipment/AARBoom"); ! if ( size(selectedTankers) >= 1 and hasAARBoom=="1"){ Refueling.setBoolValue(1); addFuel(); --- 99,104 ---- } ! hasAARBoom = getprop("sim/weight[7]/selected") != "none"; ! if ( size(selectedTankers) >= 1 and hasAARBoom){ Refueling.setBoolValue(1); addFuel(); *************** *** 133,135 **** # Fire it up if (!initialized) {initialize();} ! settimer(updateTanker,10); \ No newline at end of file --- 133,135 ---- # Fire it up if (!initialized) {initialize();} ! settimer(updateTanker,10); |