Tentative fix for accelerometers using YaSim properties in JSBSim or optionally generated properties
This commit is contained in:
parent
52e5592442
commit
a27a82b4ad
3 changed files with 926 additions and 962 deletions
|
@ -9,7 +9,7 @@
|
|||
## Todo: Tie in with Thorstens ALS greyout and tunnel vision filters ##
|
||||
## ##
|
||||
## ##
|
||||
## Version 2.03 License: GPL 2.0 ##
|
||||
## Version 2.04 License: GPL 2.0 ##
|
||||
## ##
|
||||
###################################################################################
|
||||
-->
|
||||
|
@ -34,16 +34,17 @@
|
|||
<onset-r>sim/rendering/redout/internal/log/onset-r</onset-r>
|
||||
<fast-r>sim/rendering/redout/internal/log/fast-r</fast-r>
|
||||
</log>
|
||||
<g-force>sim/rendering/redout/internal/g-force</g-force>
|
||||
<g-damp>accelerations/pilot-gdamped</g-damp>
|
||||
<g-force-inv>sim/rendering/redout/internal/g-force-inv</g-force-inv>
|
||||
<blackout>sim/rendering/redout/internal/blackout</blackout>
|
||||
<redout>sim/rendering/redout/internal/redout</redout>
|
||||
|
||||
<jsb>sim/rendering/redout/internal/jsb</jsb>
|
||||
<alpha>sim/rendering/redout/alpha</alpha>
|
||||
<red>sim/rendering/redout/red</red>
|
||||
<inside>sim/current-view/internal</inside>
|
||||
<sum>sim/rendering/redout/internal/sum</sum>
|
||||
<enable>sim/rendering/redout/enabled</enable>
|
||||
<g-force>accelerations/pilot-g[0]</g-force>
|
||||
</params>
|
||||
|
||||
<filter><!-- check for NaN -->
|
||||
|
@ -214,15 +215,10 @@
|
|||
<enable>
|
||||
<!-- check if JSBSim is the FDM. -->
|
||||
<condition>
|
||||
<property alias="/params/enable"/>
|
||||
<less-than>
|
||||
<property>fdm/jsbsim/aero/alpha-deg</property>
|
||||
<value>180.0</value>
|
||||
</less-than>
|
||||
<greater-than>
|
||||
<property>fdm/jsbsim/aero/alpha-deg</property>
|
||||
<value>-180.0</value>
|
||||
</greater-than>
|
||||
<equals>
|
||||
<property alias="/params/jsb"/>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
|
@ -237,28 +233,11 @@
|
|||
</filter>
|
||||
|
||||
<filter>
|
||||
<type>gain</type>
|
||||
<gain>1</gain>
|
||||
<enable>
|
||||
<!-- check if YaSim is the FDM. -->
|
||||
<condition>
|
||||
<property alias="/params/enable"/>
|
||||
<not>
|
||||
<less-than>
|
||||
<property>fdm/jsbsim/aero/alpha-deg</property>
|
||||
<value>180.0</value>
|
||||
</less-than>
|
||||
<greater-than>
|
||||
<property>fdm/jsbsim/aero/alpha-deg</property>
|
||||
<value>-180.0</value>
|
||||
</greater-than>
|
||||
</not>
|
||||
</condition>
|
||||
</enable>
|
||||
<input>
|
||||
<property>accelerations/pilot-g[0]</property>
|
||||
</input>
|
||||
<output alias="/params/g-force"/>
|
||||
<!-- for backwards compatibility for planes that use gdamped property -->
|
||||
<type>exponential</type>
|
||||
<filter-time>0.2</filter-time>
|
||||
<input alias="/params/g-force"/>
|
||||
<output alias="/params/g-damp"/>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
|
|
|
@ -14,35 +14,7 @@ var run = func {
|
|||
|
||||
if (running_compression)
|
||||
{
|
||||
var GCurrent = 1.0;
|
||||
|
||||
if (fdm == "jsb")
|
||||
{
|
||||
GCurrent = getprop("/accelerations/pilot/z-accel-fps_sec");
|
||||
if (GCurrent != nil) GCurrent = - GCurrent / 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
GCurrent = getprop("/accelerations/pilot-g[0]");
|
||||
}
|
||||
|
||||
if (GCurrent == nil)
|
||||
{
|
||||
GCurrent = 1.0;
|
||||
}
|
||||
|
||||
# Updated the GDamped using a filter.
|
||||
if (GDamped < 0)
|
||||
{
|
||||
# Redout happens faster and clears quicker
|
||||
GDamped = lp_red.filter(GCurrent);
|
||||
}
|
||||
else
|
||||
{
|
||||
GDamped = lp_black.filter(GCurrent);
|
||||
}
|
||||
|
||||
setprop("/accelerations/pilot-gdamped", GDamped);
|
||||
GDamped = getprop("/accelerations/pilot-gdamped");
|
||||
|
||||
if (internal)
|
||||
{
|
||||
|
@ -66,6 +38,14 @@ var fdm_init_listener = _setlistener("/sim/signals/fdm-initialized",
|
|||
func {
|
||||
removelistener(fdm_init_listener); # uninstall, so we're only called once
|
||||
fdm = getprop("/sim/flight-model");
|
||||
|
||||
if (fdm == "jsb") {
|
||||
# this is used in the g-force property rules.
|
||||
setprop("/sim/rendering/redout/internal/jsb", 1);
|
||||
} else {
|
||||
setprop("/sim/rendering/redout/internal/jsb", 0);
|
||||
}
|
||||
|
||||
running_compression = getprop("/sim/rendering/headshake/enabled");
|
||||
internal = getprop("/sim/current-view/internal");
|
||||
lp_black = aircraft.lowpass.new(0.2);
|
||||
|
|
|
@ -266,7 +266,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<recover-slow-sec type="double">15</recover-slow-sec>
|
||||
</parameters>
|
||||
<internal>
|
||||
<g-force type="double">1</g-force>
|
||||
<jsb type="bool">false</jsb>
|
||||
<g-force-inv type="double">1</g-force-inv>
|
||||
<blackout type="double">0</blackout>
|
||||
<redout type="double">0</redout>
|
||||
|
@ -919,6 +919,11 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<warp-easing-duration-secs type="double">10</warp-easing-duration-secs>
|
||||
</time>
|
||||
</sim>
|
||||
<!-- accelerations -->
|
||||
<accelerations>
|
||||
<pilot-gdamped type="double">1.0</pilot-gdamped>
|
||||
<pilot-g type="double">1.0</pilot-g>
|
||||
</accelerations>
|
||||
<!-- mouse mode -->
|
||||
<devices>
|
||||
<status>
|
||||
|
|
Loading…
Add table
Reference in a new issue