Commit 07ac8ad9 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #457 from thomasgubler/malolo_catapult

Flightgear Malolo catapult
parents 7e5acad9 fa672418
......@@ -63,9 +63,33 @@ dynamics model, and external 3D model.
<line>Approach speed: 15-25 mph</line>
<line>Stall speed (Vs): 10 mph</line>
</help>
<menubar>
<default>
<menu n="10">
<label>Malolo</label>
<enabled type="bool">true</enabled>
<item>
<label>Operate catapult</label>
<binding>
<command>nasal</command>
<script>
malolo1.launchCatapult();
</script>
</binding>
</item>
</menu>
</default>
</menubar>
</sim>
<nasal>
<malolo1>
<file>Aircraft/Malolo1/Nasal/catapult.nas</file>
</malolo1>
</nasal>
<controls>
<flight>
<aileron-trim>-0.01</aileron-trim> <!-- fixed -->
......@@ -100,4 +124,6 @@ dynamics model, and external 3D model.
</config>
</autopilot>
</PropertyList>
......@@ -543,4 +543,19 @@
</function>
</axis>
</aerodynamics>
<external_reactions>
<force name="catapult" frame="BODY">
<location unit="M">
<x> 0 </x>
<y> 0 </y>
<z> 0 </z>
</location>
<direction>
<x>1</x>
<y>0</y>
<z>0</z>
</direction>
</force>
</external_reactions>
</fdm_config>
var launchCatapult = func {
# time on catapult = 1/10 sec
# speed when leaving catapult = 50 km/h ?
var countdownRunning = 1;
var count = 3;
var countdown = func {
if (countdownRunning) {
if (count != 0) {
setprop("/sim/screen/white",count);
count = count - 1;
settimer(countdown, 1);
}
else {
countdownRunning = 0;
setprop("/sim/screen/yellow","Go!");
launch();
}
}
}
countdown();
var launchRunning = 1;
var magnitude = 230; # lbs, unrealisticly high, because the FDM is wrong
var launch = func {
if (launchRunning) {
if (magnitude == 0){
launchRunning = 0;
# remove launcher contact points
setprop("/fdm/jsbsim/contact/unit[6]/pos-norm",0);
setprop("/fdm/jsbsim/contact/unit[7]/pos-norm",0);
setprop("/fdm/jsbsim/contact/unit[8]/pos-norm",0);
}
setprop("/fdm/jsbsim/external_reactions/catapult/magnitude",magnitude);
print (magnitude);
magnitude = 0;
settimer(launch, 0.1);
}
}
}
This is the original Malolo1 model with added catapult functionality. The catapult is from https://gitorious.org/mavlab/x100/
-Thomas Gubler
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment