Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: [1] 2

Author Topic: Displaying JSBSim Values  (Read 10460 times)

alialiali

  • Jr. Member
  • *
  • Posts: 49
Displaying JSBSim Values
« on: July 19, 2014, 09:25:29 pm »

Is it possible, or can it be made possible, to show the values of various JSBSim bits? I'm trying to sort out the Boeing 727 on the coding side of things but I am really struggling with not knowing what values I'm working with.

For example:

this.geom.rotate_joint_orig(landing_gear_nose_id, (jsb["gear/unit[0]/compression-ft"]) * 3.14 / 1.7, {x:1,y:0,z:0});

Is it possible to get a real-time, in engine, readout of what the value of: jsb["gear/unit[0]/compression-ft"] actually is?

Thanks,
Ali
Logged
Boeing 727 - In Development (On Hold)

Intel Core i7 4790K 4.4GHz
Nvidia GTX 970
16GB RAM

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Displaying JSBSim Values
« Reply #1 on: July 19, 2014, 11:37:09 pm »

try to do it simply - put something like this in the "function update_frame" section and make the gear rise/lower. It should show you the changing value, or the static one at the extremes in the information log window.

Code: [Select]
var gearvalue =  ( jsb["gear/unit[0]/compression-ft"] );

this.log_inf(gearvalue);
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

alialiali

  • Jr. Member
  • *
  • Posts: 49
Re: Displaying JSBSim Values
« Reply #2 on: July 20, 2014, 04:53:48 am »

I'm not getting anything come up on screen when I use that code.
Logged
Boeing 727 - In Development (On Hold)

Intel Core i7 4790K 4.4GHz
Nvidia GTX 970
16GB RAM

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Displaying JSBSim Values
« Reply #3 on: July 20, 2014, 04:57:17 am »

I'm not getting anything come up on screen when I use that code.
Make sure you write those lines under function update_frame(dt){}, and then press 'P' to open the console, and you will see the values there.
Logged

alialiali

  • Jr. Member
  • *
  • Posts: 49
Re: Displaying JSBSim Values
« Reply #4 on: July 20, 2014, 07:57:17 am »

Got it, thanks guys. Finally getting close to getting the landing gear animations done! It would still be nice to be able to get a window that displays this information though.
Logged
Boeing 727 - In Development (On Hold)

Intel Core i7 4790K 4.4GHz
Nvidia GTX 970
16GB RAM

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Displaying JSBSim Values
« Reply #5 on: July 20, 2014, 08:10:23 am »

Got it, thanks guys. Finally getting close to getting the landing gear animations done! It would still be nice to be able to get a window that displays this information though.

Think that will be cod-able only after an API gets out, but still works this way .. helped me a ton of times.
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: Displaying JSBSim Values
« Reply #6 on: July 22, 2014, 07:12:33 pm »

Yeh I too need something like the property tree they have in flightgear...

Also could do with a better 'crash' report for moders, I'm regularly crashing to desktop as I try and get the jsbsim flightmodel working here, but at present there's very little pointers to where the error in my file is.
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: Displaying JSBSim Values
« Reply #7 on: July 23, 2014, 01:30:50 am »

Yeh I too need something like the property tree they have in flightgear...

Also could do with a better 'crash' report for moders, I'm regularly crashing to desktop as I try and get the jsbsim flightmodel working here, but at present there's very little pointers to where the error in my file is.

All reports get to the eng.log OT file. Not sure if ya can find it yourself, but post it here for Cameny after a crash occurs and he will let ya know whats going the wrong way ...
« Last Edit: July 23, 2014, 01:34:58 am by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: Displaying JSBSim Values
« Reply #8 on: July 23, 2014, 03:54:12 am »

I can find it.... I'll post it.
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Displaying JSBSim Values
« Reply #9 on: July 23, 2014, 06:05:07 am »

Today, while writing the script for the landing gear animation on the A380, I needed to print in the console several variables at the same time, but having the numbers without knowing which one is which, didn't helped too much. Then just came to my mind, to add a string in front of the number, like this:
Code: [Select]
this.log_inf("Gear position: "+gpos);
Then,  in the console you'll see something like this:
INFO:  Gear position: 1

I though this could be useful for others too, so why not share?  :)
Logged

alialiali

  • Jr. Member
  • *
  • Posts: 49
Re: Displaying JSBSim Values
« Reply #10 on: July 23, 2014, 06:16:32 am »

It'd be interesting to know how you've done the gear door animation sequencing. I found a way to make the doors close after the gear has retracted but it'd be nice to hear how you did it.
Logged
Boeing 727 - In Development (On Hold)

Intel Core i7 4790K 4.4GHz
Nvidia GTX 970
16GB RAM

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Displaying JSBSim Values
« Reply #11 on: July 23, 2014, 07:09:01 am »

It'd be interesting to know how you've done the gear door animation sequencing. I found a way to make the doors close after the gear has retracted but it'd be nice to hear how you did it.
Well, I don't really like how I did it on the Ilyushin because the animation's length fully depends on 'gear/gear-pos-norm', and I needed too much trial and error to know when open the doors, and when close them.

On the A-380, i'll do it in a different way using more variables. As the landing gear is more complex, I need more control over it.

This is the script for the nose gear doors:
Code: [Select]
//Nose doors
if (gpos < 0.2){
geom.rotate_joint_orig(n_gear_door_l2, (gpos*7), {x:-1,y:0,z:0});
geom.rotate_joint_orig(n_gear_door_r2, (gpos*7), {x:1,y:0,z:0});
}
else{
geom.rotate_joint_orig(n_gear_door_l2, 1.4, {x:-1,y:0,z:0});
geom.rotate_joint_orig(n_gear_door_r2, 1.4, {x:1,y:0,z:0});
}

if (gpos < 0.4){
geom.rotate_joint_orig(n_gear_door_l1, (gpos*3.5), {x:-1,y:0,z:0});
geom.rotate_joint_orig(n_gear_door_r1, (gpos*3.5), {x:1,y:0,z:0});
}
else{
geom.rotate_joint_orig(n_gear_door_l1, 1.4, {x:-1,y:0,z:0});
geom.rotate_joint_orig(n_gear_door_r1, 1.4, {x:1,y:0,z:0});
}

if (gpos > 0.8){
geom.rotate_joint_orig(n_gear_door_l2, 7-(gpos*7), {x:-1,y:0,z:0});
geom.rotate_joint_orig(n_gear_door_r2, 7-(gpos*7), {x:1,y:0,z:0});
}

n_gear_door_l2 and n_gear_door_r2 are the "special" ones.

I don't know how to explain it (i'm very bad explaining things, also English isn't my mother language), but you can try playing with the numbers and see what exactly they do.

Also i'm relatively new in this area (scripting), and maybe this could be done much easier.
« Last Edit: July 23, 2014, 07:14:37 am by Levi »
Logged

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: Displaying JSBSim Values
« Reply #12 on: July 23, 2014, 10:24:41 am »

Guys as flight simmers should we consider creating some naming convention standards for parts such that we need to do the minimum of code changes when cutting n pasting from our standards code repository ?
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

Levi

  • Hero Member
  • *****
  • Posts: 585
    • Outerra Mods Site!
Re: Displaying JSBSim Values
« Reply #13 on: July 23, 2014, 11:40:56 am »

Guys as flight simmers should we consider creating some naming convention standards for parts such that we need to do the minimum of code changes when cutting n pasting from our standards code repository ?
That would be nice. It's a great idea IMO.
Logged

Mossie

  • Jr. Member
  • *
  • Posts: 22
  • newbie
Re: Displaying JSBSim Values
« Reply #14 on: July 24, 2014, 02:38:15 am »

For a naming convention on controls in another flight simulator we used:
================================================================================
CONTROLS - where [%d] = a number
================================================================================

Flight Controls
---------------
/controls/flight/aileron
/controls/flight/aileron-trim
/controls/flight/elevator
/controls/flight/elevator-trim
/controls/flight/rudder
/controls/flight/rudder-trim
/controls/flight/flaps
/controls/flight/slats
/controls/flight/BLC         // Boundary Layer Control
/controls/flight/spoilers
/controls/flight/speedbrake
/controls/flight/wing-sweep
/controls/flight/wing-fold
/controls/flight/drag-chute

Engines
-------
/controls/engines/throttle_idle
/controls/engines/engine[%d]/throttle
/controls/engines/engine[%d]/starter
/controls/engines/engine[%d]/fuel-pump
/controls/engines/engine[%d]/fire-switch
/controls/engines/engine[%d]/fire-bottle-discharge
/controls/engines/engine[%d]/cutoff
/controls/engines/engine[%d]/mixture
/controls/engines/engine[%d]/propeller-pitch
/controls/engines/engine[%d]/magnetos
/controls/engines/engine[%d]/boost
/controls/engines/engine[%d]/WEP
/controls/engines/engine[%d]/cowl-flaps-norm
/controls/engines/engine[%d]/feather
/controls/engines/engine[%d]/ignition
/controls/engines/engine[%d]/augmentation
/controls/engines/engine[%d]/afterburner
/controls/engines/engine[%d]/reverser
/controls/engines/engine[%d]/water-injection
/controls/engines/engine[%d]/condition

Fuel
----
/controls/fuel/dump-valve
/controls/fuel/tank[%d]/fuel_selector
/controls/fuel/tank[%d]/to_engine
/controls/fuel/tank[%d]/to_tank
/controls/fuel/tank[%d]/boost-pump[%d]

/consumables/fuel/tank[%d]/level-lbs
/consumables/fuel/tank[%d]/level-gal_us
/consumables/fuel/tank[%d]/capacity-gal_us
/consumables/fuel/tank[%d]/density-ppg
/consumables/fuel/total-fuel-lbs
/consumables/fuel/total-gal_us


Gear
----
/controls/gear/brake-left
/controls/gear/brake-right
/controls/gear/brake-parking
/controls/gear/steering
/controls/gear/gear-down
/controls/gear/antiskid
/controls/gear/tailhook
/controls/gear/tailwheel-lock
/controls/gear/wheel[%d]/alternate-extension

Anti-Ice
--------
/controls/anti-ice/wing-heat
/controls/anti-ice/pitot-heat
/controls/anti-ice/wiper
/controls/anti-ice/window-heat
/controls/anti-ice/engine[%d]/carb-heat
/controls/anti-ice/engine[%d]/inlet-heat

Hydraulics
----------
/controls/hydraulic/system[%d]/engine-pump
/controls/hydraulic/system[%d]/electric-pump

Electric
--------
/controls/electric/battery-switch
/controls/electric/external-power
/controls/electric/APU-generator
/controls/electric/engine[%d]/generator
/controls/electric/engine[%d]/bus-tie

Pneumatic
---------
/controls/pneumatic/APU-bleed
/controls/pneumatic/engine[%d]/bleed

Pressurization
--------------
/controls/pressurization/mode
/controls/pressurization/dump
/controls/pressurization/outflow-valve
/controls/pressurization/pack[%d]/pack-on

Lights
------
/controls/lighting/landing-lights
/controls/lighting/turn-off-lights
/controls/lighting/formation-lights
/controls/lighting/taxi-light
/controls/lighting/logo-lights
/controls/lighting/nav-lights
/controls/lighting/beacon
/controls/lighting/strobe
/controls/lighting/panel-norm
/controls/lighting/instruments-norm
/controls/lighting/dome-norm

Armament
--------
/controls/armament/master-arm
/controls/armament/station-select
/controls/armament/release-all
/controls/armament/station[%d]/stick-size
/controls/armament/station[%d]/release-stick
/controls/armament/station[%d]/release-all
/controls/armament/station[%d]/jettison-all

Seat
----
/controls/seat/vertical-adjust
/controls/seat/fore-aft-adjust
/controls/seat/cmd_selector_valve
/controls/seat/eject[%d]/initiate
/controls/seat/eject[%d]/status

APU
---
/controls/APU/off-start-run
/controls/APU/fire-switch

Autoflight
----------
/controls/autoflight/autopilot[%d]/engage
/controls/autoflight/autothrottle-arm
/controls/autoflight/autothrottle-engage
/controls/autoflight/heading-select
/controls/autoflight/altitude-select
/controls/autoflight/bank-angle-select
/controls/autoflight/vertical-speed-select
/controls/autoflight/speed-select
/controls/autoflight/mach-select
/controls/autoflight/vertical-mode
/controls/autoflight/lateral-mode


/autopilot/settings/heading-bug-deg

==================================

It is by no means a full set. Some of you may recognize this as the Flight Gear's set, even so it is a nice starting point.

Also we have a conventional keyboard mapping, see attached. This was designed for combat aircraft.

For the various moving parts we also applied a convention:
  • Engines number left to right.
  • Control surfaces named: item_position_number(where more then one existed per side)
  • Standard names for all objects were possible

We also used a convention on our folder structure, as a large number of objects were shared, such as instruments, guns, weapons, crew, effects and even turrets. These also contained the base animations for the objects to speed up development.

Logged
Pages: [1] 2