Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Author Topic: Working JSBSim Parachutes  (Read 7809 times)

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Working JSBSim Parachutes
« on: January 26, 2015, 11:20:59 am »

I was easily able to implement parachutes from the jsbsim/ball_chute example. In this example there is the parachute external_force, which is added to the FDM .xml file. Then there is the script I developed which uses a combination of JSB properties, that were suggested by Levi, to automatically deploy a drogue and main braking parachute in sequence. All three conditions must be met for each parachute to deploy. For the drogue chute to deploy, either of the two rear wheels [number 1] or [number 2] must be touching the ground, the speed above 100 kts, and the throttle position = 0 (Off). For the main braking chute to deploy, the front wheel [number 0] must be touching the ground, speed above 100 kts, throttle = 0. I find this works very well, but you can experiment with what works best for you. Implement this on any aircraft you like, add as many parachutes are you like. I don't have a joystick, and have rarely been able to successfully land aircraft in OT using the keyboard. As soon as I tried with the parachutes, I landed perfectly three times in a row. The drogue chute is meant to stabilize the aircraft before the main braking chute is deployed. I figured that the back wheels touching would be best for the drogue, and as soon as the front wheel hits the ground the main chute deploys. That fraction of a second delay works far better than the main parachute deploying without the drogue. Instead of front wheel contact, you could use a delay timer instead. I found this works best. Remember you have to throttle all the way to 0% right before touching down to deploy chutes. This is so they don't deploy during take off or taxi.

The only thing left is I still need to figure out how to make the chutes only deploy once. Currently you can deploy the parachutes and land, take-off and do it again. This is not realistic and must be corrected. In a more advanced OT flight sim, maybe you would have to taxi to the hanger before you would get new parachutes.

EDIT: You can add another 'and' operator (&&) to the if statement for the main chute, so that it is dependent on the drogue chute to open. This way, if the front wheel touches down, the main chute does not deploy. Like so:

Code: [Select]
//Deploy Main Braking Parachute (Drogue opened)

var front_wheel_gnd = (jsb['gear/unit[0]/compression-ft']);
        var drogue_chute = (jsb['fcs/parachute2_reef_pos_norm']);

if (front_wheel_gnd > 0.05 && vel_kts > 100 && throttle_pos == 0.0 && drogue_chute == 1){
var deploy2 = 1;
}

Or likewise, make it so the main chute only deploys when all three wheels are touching the ground. Like so:

Code: [Select]
//Deploy Main Braking Parachute (Drogue opened + three point touch down)

var front_wheel_gnd = (jsb['gear/unit[0]/compression-ft']);
    var left_wheel_gnd = (jsb['gear/unit[1]/compression-ft']);
    var right_wheel_gnd = (jsb['gear/unit[2]/compression-ft']);
    var drogue_chute = (jsb['fcs/parachute2_reef_pos_norm']);

if (front_wheel_gnd > 0.05 && left_wheel_gnd > 0.05 && right_wheel_gnd > 0.05 && vel_kts > 100 && throttle_pos == 0.0 && drogue_chute == 1){
var deploy2 = 1;
}

Enjoy!

Best regards,
Uriah George

.js Script:
Code: [Select]
//Automatically Deployed Parachute

var wheel_gnd = (jsb['gear/unit[1]/compression-ft'] + jsb['gear/unit[2]/compression-ft']);
var vel_kts = jsb['velocities/vc-kts'];
var throttle_pos = jsb["fcs/throttle-cmd-norm[0]"];

//Deploy Drouge Parachute
if (wheel_gnd > 0.1 && vel_kts > 100 && throttle_pos == 0.0){
var deploy1 = 1;
}

if (deploy1 == 1){
jsb['fcs/parachute2_reef_pos_norm']=1;
}

//Deploy Main Braking Parachute

var front_wheel_gnd = (jsb['gear/unit[0]/compression-ft']);

if (front_wheel_gnd > 0.05 && vel_kts > 100 && throttle_pos == 0.0){
var deploy2 = 1;
}

if (deploy2 == 1){
jsb['fcs/parachute_reef_pos_norm']=1;
}


if (throttle_pos > 0){
jsb['fcs/parachute_reef_pos_norm']=0;
jsb['fcs/parachute2_reef_pos_norm']=0;
}

if (jsb['fcs/parachute_reef_pos_norm'] == 1.0 && vel_kts < 15) {
jsb['fcs/parachute_reef_pos_norm']=0;
}

if (jsb['fcs/parachute2_reef_pos_norm'] == 1.0 && vel_kts < 15) {
jsb['fcs/parachute2_reef_pos_norm']=0;
}

//Manually Deployed Parachute NOT WORKING WITH AUTO MODE!!!
// jsb['fcs/parachute_reef_pos_norm']=jsb['fcs/speedbrake-cmd-norm'];

////Debug
this.log_inf(jsb['gear/unit[0]/compression-ft']);
this.log_inf(jsb['gear/unit[1]/compression-ft']);
this.log_inf(jsb['gear/unit[2]/compression-ft']);
this.log_inf(jsb['gear/unit[3]/compression-ft']);
this.log_inf("Parachute: " + jsb['fcs/parachute_reef_pos_norm']);
this.log_inf("Drogue Chute: " + jsb['fcs/parachute2_reef_pos_norm']);
this.log_inf("Velocity KTS: " + jsb['velocities/vc-kts']);
this.log_inf("Vel. True KTS: " + jsb['velocities/vtrue-kts']);
this.log_inf("Throttle: " + jsb["fcs/throttle-cmd-norm[0]"]);

.xml FDM external_force for parachutes:

Code: [Select]
<external_reactions>
      <!-- "Declare" the reefing term -->
      <property>fcs/parachute_reef_pos_norm</property>
      <property>fcs/parachute2_reef_pos_norm</property>

      <force name="parachute" frame="WIND">
        <function>
          <product>
            <property>aero/qbar-psf</property>
            <property>fcs/parachute_reef_pos_norm</property>
            <value> 1.0 </value>  <!-- Full drag coefficient -->
            <value> 400.0 </value> <!-- Full parachute area -->
          </product>
        </function>
        <!-- The location below is in structural frame (x positive
             aft), so this location describes a point 1 foot aft
             of the origin. In this case, the origin is the center. -->
        <location unit="FT">
          <x>25</x>
          <y>0</y>
          <z>0</z>
        </location>
        <!-- The direction describes a unit vector. In this case, since
             the selected frame is the WIND frame, the "-1" x component
             describes a direction exactly opposite of the direction
             into the wind vector. That is, the direction specified below
             is the direction that the drag force acts in. -->
        <direction>
          <x>-1</x>
          <y>0</y>
          <z>0</z>
        </direction>
      </force>

      <force name="parachute2" frame="WIND">
        <function>
          <product>
            <property>aero/qbar-psf</property>
            <property>fcs/parachute2_reef_pos_norm</property>
            <value> 1.0 </value>  <!-- Full drag coefficient -->
            <value> 40.0 </value> <!-- Full parachute area -->
          </product>
        </function>
        <!-- The location below is in structural frame (x positive
             aft), so this location describes a point 1 foot aft
             of the origin. In this case, the origin is the center. -->
        <location unit="FT">
          <x>30</x>
          <y>0</y>
          <z>0</z>
        </location>
        <!-- The direction describes a unit vector. In this case, since
             the selected frame is the WIND frame, the "-1" x component
             describes a direction exactly opposite of the direction
             into the wind vector. That is, the direction specified below
             is the direction that the drag force acts in. -->
        <direction>
          <x>-1</x>
          <y>0</y>
          <z>0</z>
        </direction>
      </force>
    </external_reactions>
« Last Edit: January 27, 2015, 01:39:20 am by Uriah509 »
Logged

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2520
  • #1 Outerra Fan Boy
    • My Youtube
Re: Working JSBSim Parachutes
« Reply #1 on: January 26, 2015, 01:52:02 pm »

This is going to come in really handy when it gets coded into cars I keep hurling off of very very VERY tall mountains.
Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo

KW71

  • Outerra Developer
  • Hero Member
  • *****
  • Posts: 762
  • Love OT!
Re: Working JSBSim Parachutes
« Reply #2 on: January 26, 2015, 03:43:04 pm »

Here is Uriah509, working on rockets, parachutes, shaders for roads, Display real-time data... All one guy!!!



Bravo!!!
Logged
"A man who is contented with what he has done, will never become famous for what he will do".

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: Working JSBSim Parachutes
« Reply #3 on: January 27, 2015, 01:04:43 am »

Oh quality! ;)

(CAN ANYONE TELL ME HOW KW71 GOT A PICTURE OF ME?!)  8)

I'm working on Outerra full time now, what do you expect? I've only really learned JavaScript in the last two months, and I have no formal programming/coding experience. There are people on this forum with far more skills and experience than me, it is all a matter of effort, patience and time.

Looking into key binding for bomber next! http://forum.outerra.com/index.php?topic=2804.0

ZeosPantera, I'm not sure about parachutes for vehicles. I haven't experimented with Bullet or vehicle scripts at all, but I  am sure it is possible.

Regards,
Uriah
« Last Edit: January 27, 2015, 01:07:35 am by Uriah509 »
Logged

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: Working JSBSim Parachutes
« Reply #4 on: January 27, 2015, 03:48:50 am »

I implemented drogue and brake parachute for the Mig29. Just replace the .js and .xml files with the ones below. You can adjust the parachute area in the .xml

./Anteworld/packages/outerra/mig29/
http://www.mediafire.com/view/0uq85689q5bl276/mig29.js

./Anteworld/packages/outerra/mig29/aircraft/mig29/
http://www.mediafire.com/view/7l9xbllg88n6ylo/mig29.xml
Logged