Hallo curtis!
Due to compatibility issues with current cvs I had to update the
following files:
- readme-bone.txt
- B-1B-set.xml
- Nasal/b1b.nas
- Models/Instruments-3d/apmode.xml
please apply the attached files,
many thanks,
markus
<?xml version="1.0"?>
<!--
************************************************************************
B-1B set file.
2007-5-10 Markus Zojer
************************************************************************
-->
<PropertyList>
<sim>
<startup>
<splash-texture>Aircraft/B-1B/bone.rgb</splash-texture>
</startup>
<flight-model>yasim</flight-model>
<status>alpha</status>
<author>Markus Zojer</author>
<aero>B-1B-yasim</aero>
<fuel-fraction>1.0</fuel-fraction>
<description>Rockwell B-1B Lancer</description>
<number-views type="int" archive="y">6</number-views>
<chase-distance-m type="double" archive="y">-65.0</chase-distance-m>
<view n="0">
<internal archive="y">true</internal>
<config>
<x-offset-m archive="y">-0.67</x-offset-m><!-- left-/right+ -->
<y-offset-m archive="y">1.70</y-offset-m><!-- up+/down- -->
<z-offset-m archive="y">7.53</z-offset-m><!-- back+ -->
<pitch-offset-deg>0</pitch-offset-deg>
<default-field-of-view-deg>60</default-field-of-view-deg>
</config>
</view>
<!-- Shift the camera target point back -->
<view n="1">
<config>
<target-z-offset-m archive="y" type="double">20.0</target-z-offset-m>
</config>
</view>
<view n="2">
<config>
<x-offset-m archive="y" type="double">8.0</x-offset-m>
<z-offset-m archive="y">-19.7</z-offset-m>
<target-z-offset-m archive="y" type="double">20.0</target-z-offset-m>
</config>
</view>
<view n="3">
<config>
<target-z-offset-m archive="y" type="double">20.0</target-z-offset-m>
</config>
</view>
<view n="5">
<config>
<target-z-offset-m archive="y" type="double">2.0</target-z-offset-m>
</config>
</view>
<sound>
<audible>true</audible>
<path>Aircraft/B-1B/Sounds/b-1b-sound.xml</path>
</sound>
<submodels>
<serviceable type="bool">true</serviceable>
<path>Aircraft/B-1B/Submodels/sub_lancer.xml</path>
</submodels>
<!-- <panel>
<path>Aircraft/B-1B/Panels/there_is_no_spoon.747</path>
</panel>-->
<!--<hud>
<path>Aircraft/B-1B/Huds/B-52F-hud1.xml</path>
<visibility>true</visibility>
</hud>-->
<model>
<path>Aircraft/B-1B/Models/B-1B.xml</path>
<!-- <doors>
<fuelhatch/>
<hatch/>
</doors>-->
<!--<B-1B>
</B-1B>-->
</model>
<systems>
<autopilot>
<path>Aircraft/B-1B/Systems/b1b-autopilot.xml</path>
</autopilot>
<!--<electrical>
<path>Aircraft/B-1B/Systems/b1b-electrical.xml</path>
</electrical>-->
</systems>
<wing-sweep>
<setting>0.00</setting>
<setting>0.23</setting>
<setting>0.42</setting>
<setting>0.80</setting>
<setting>1.00</setting>
</wing-sweep>
<flaps>
<setting>0.0</setting>
<setting>0.5</setting>
<setting>1.0</setting>
</flaps>
<spoilers>
<setting>0.0</setting>
<setting>0.5</setting>
<setting>1.0</setting>
</spoilers>
<!-- AoA Indexer target 1.0 deg -->
<aoa-indexer>
<too-slow-deg>2.5</too-slow-deg> <!-- target +1.5 deg -->
<slow-deg>1.5</slow-deg> <!-- target +0.5 deg -->
<fast-deg>0.5</fast-deg> <!-- target -0.5 deg -->
<too-fast-deg>-0.5</too-fast-deg> <!-- target -1.5 deg -->
</aoa-indexer>
<help>
<title>B-1B Lancer</title>
<key>
<name>j/k</name>
<desc>decrease/increase spoilers</desc>
</key>
<key>
<name>o</name>
<desc>afterburner on</desc>
</key>
<key>
<name>O</name>
<desc>afterburner off</desc>
</key>
<key>
<name>d</name>
<desc>sweep wing back</desc>
</key>
<key>
<name>D</name>
<desc>sweep wing fwd</desc>
</key>
<!-- <key>
<name>CTRL B</name>
<desc>toggle airbrakes</desc>
</key>-->
<line>Afterburner(ab) used for TakeOff/Climb</line>
<line>For takeoff apply 1/2 flaps, full ab</line>
<line>Rotate at 160kts/takeoff at 170/180kts</line>
<line>---------------------------------------</line>
<line>It's OSG baby!</line>
<line>Terrain Following/Avoidance Systems:</line>
<line>1. Adjust clearance (SET CLEAR or CLR PLN)</line>
<line>2. Toggle master switch(es) on</line>
<line>3a. For TFS: switch PRTY to TERRAIN FOLLOW</line>
<line>3b. For TFS: over water switch PRTY to MAP</line>
<key>
<name>Ctrl D</name>
<desc>Flare out</desc>
</key>
<line>Good Luck!</line>
</help>
<!--<ai>
<enabled type="bool">true</enabled>
<scenario>refueling_demo</scenario>
</ai>-->
</sim>
<autopilot>
<settings>
<target-agl-ft type="float">1000</target-agl-ft>
<target-altitude-ft type="float">8000</target-altitude-ft>
<target-pitch-deg type="float">0</target-pitch-deg>
<target-vfps type="float">0</target-vfps>
<take-off-pitch-deg type="float">2.0</take-off-pitch-deg>
<target-speed-kt type="float">290.0</target-speed-kt>
<climb-out-initial-pitch-deg type="float">6.0</climb-out-initial-pitch-deg>
<climb-out-final-pitch-deg type="float">3.0</climb-out-final-pitch-deg>
<target-climb-rate-fpm type="float">2000.0</target-climb-rate-fpm>
<target-descent-rate-fpm type="float">2000.0</target-descent-rate-fpm>
<ground-roll-heading-deg type="float">-999.9</ground-roll-heading-deg>
<target-mach type="float">0.9</target-mach>
<target-aoa-deg type="float">1.0</target-aoa-deg>
<max-roll-deg type="float">60</max-roll-deg>
</settings>
<!-- <locks>
<aoa type="string">initialised</aoa>
<auto-take-off type="string">enabled</auto-take-off>
<auto-landing type="string">disabled</auto-landing>
<rudder-control type="string">initialised</rudder-control>
<take-off-phase type="string">initialised</take-off-phase>
</locks>-->
</autopilot>
<!-- Start with the Parking Brake on -->
<controls>
<gear>
<brake-parking type="double">1.0</brake-parking>
</gear>
<flight>
<wing-sweep type="double">0.0</wing-sweep>
<flaps type="double">0.0</flaps>
<elevator-incidence-deg type="double">0.0</elevator-incidence-deg>
</flight>
<engines>
<engine n="0">
<cutoff type="double">0</cutoff>
</engine>
<engine n="1">
<cutoff type="double">0</cutoff>
</engine>
<engine n="2">
<cutoff type="double">0</cutoff>
</engine>
<engine n="3">
<cutoff type="double">0</cutoff>
</engine>
</engines>
</controls>
<!-- Engine indexes -->
<engines>
<engine n="0">
<engine-num type="int">0</engine-num>
</engine>
<engine n="1">
<engine-num type="int">1</engine-num>
</engine>
<engine n="2">
<engine-num type="int">2</engine-num>
</engine>
<engine n="3">
<engine-num type="int">3</engine-num>
</engine>
</engines>
<!-- Fuel -->
<consumables>
<fuel>
<tank n="0">
<tank-num type="int">0</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
<tank n="1">
<tank-num type="int">1</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
<tank n="2">
<tank-num type="int">2</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
<tank n="3">
<tank-num type="int">3</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
<tank n="4">
<tank-num type="int">4</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
<tank n="5">
<tank-num type="int">5</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
<tank n="6">
<tank-num type="int">6</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
<tank n="7">
<tank-num type="int">7</tank-num>
<kill-when-empty type="bool">false</kill-when-empty>
</tank>
</fuel>
</consumables>
<instrumentation>
<radar>
<range type="int" archive="y">40</range>
<minimized type="bool" archive="y">true</minimized>
</radar>
</instrumentation>
<input>
<keyboard>
<!-- map keys for afterburner -->
<key n="79">
<name>O</name>
<desc>afterburner/off</desc>
<binding n="0">
<command>nasal</command>
<script>b1b.aftburn_off()</script>
</binding>
</key>
<key n="111">
<name>o</name>
<desc>afterburner/on</desc>
<binding n="0">
<command>nasal</command>
<script>b1b.aftburn_on()</script>
</binding>
</key>
<key n="2">
<name>Ctrl-B</name>
<desc>Toggle speedbrake.</desc>
<binding>
<command>property-toggle</command>
<property>controls/flight/speedbrake</property>
</binding>
</key>
<!-- map keys for wingsweep
<key n="100">
<name>d</name>
<desc>wing sweep aft</desc>
<binding>
<command>property-adjust</command>
<property>/controls/flight/wing-sweep</property>
<step type="double">-0.25</step>
</binding>
</key>
<key n="68">
<name>D</name>
<desc>wing sweep fwd</desc>
<binding>
<command>property-adjust</command>
<property>/controls/flight/wing-sweep</property>
<step type="double">0.25</step>
</binding>
</key>-->
<key n="100">
<name>d</name>
<desc>Increase sweep</desc>
<binding>
<command>nasal</command>
<script>flightcontrols.wingSweep(-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>flightcontrols.wingSweep(0)</script>
</binding>
</mod-up>
</key>
<key n="68">
<name>D</name>
<desc>Decrease sweep</desc>
<binding>
<command>nasal</command>
<script>flightcontrols.wingSweep(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>flightcontrols.wingSweep(0)</script>
</binding>
</mod-up>
</key>
<key n="4">
<name>Ctrl-D</name>
<desc>Flare out</desc>
<binding>
<command>property-toggle</command>
<property>controls/switches/flare</property>
</binding>
</key>
</keyboard>
</input>
<nasal>
<b1b>
<file>Aircraft/B-1B/Nasal/b1b.nas</file>
</b1b>
<b1b-fuel>
<module>fuel-aar</module>
<file>Aircraft/Generic/aar.nas</file>
</b1b-fuel>
<flightcontrols>
<file>Aircraft/B-1B/Nasal/flightcontrols.nas</file>
</flightcontrols>
</nasal>
</PropertyList>
Rockwell B-1B Lancer "The Bone"
XXXXXX Version Nr: 0009 14112007 XXXXXX
This aircraft model represents a hack of the B-1B variable wingsweep bomber.
The available sweep angles are 15 (takeoff) 25 (slow flight) 45 (high altitude
flight) 55/67 (low and high altitude fast flight). The wingsweep is simulated
by adding lift/drag to the inner wing part. The outer wing part always stays at
67 degrees and represents the most accurate hack ;-). Afterburner is used for
takeoff and for rapid climb maneuvers.
XXXX INSTRUCTIONS XXXX
Takeoff:
- swing wing to most forward position (15) --> button D/d (present at start)
- apply 1/2 flaps
- apply full throttle
- apply afterburners
- rotate at 160 - takeoff at 170/180 with full fuel weight
Flight:
- dependent on your altitude and speed choose 15/25/45/55/67 degrees wingweep
(d/D)
- max speed at sea level is mach 1.1, at altitude mach 1.3, because of
structural damage to engine inlets
- typical performance speed is around mach 0.8 - 0.95 @sea level and mach 0.9 -
1.1 at altitude.
- 15 degrees ws: used for takeoff/landing <290 knots @ sealevel
- 25 degrees ws: used for slow flight/refuelling < 360 knots @sealevel
- 45 degrees ws: used for cruise at high altitude (mach 0.6 - 0.75)
- 55 degrees ws: used for high/low alt flight (above mach 0.7)
- 67 degrees ws: used for high/low alt flight (above mach 0.8)
Landing:
- ws 15 degrees
- use 1/2 or 2/2 flaps
- touchdown speed is <180 knots with full fuel load, or 140 nearly empty
XXXX TERRAIN AVOIDANCE / FOLLOWING SYSTEMS XXXX
It's OSG baby!
Terrain Avoidance System (TAS)
Master switch activates terrain avoidance system (tas) (ON/OFF), range
knob(RNG) setting for short distance terrain recognition setting (2.5)nm used
for slow flying or a hard ride or switch to the medium setting (5)nm thats is
used when flying faster (above 400kts @sl) and/or u want a more comfortably
ride.
The CLR PLN settings are important as it clears terrain below the aircraft. The
settings are 0, 100ft, 300ft, 500ft and 1000ft.
When the terrain avoid system gets active, it adds the desired clearance
distance (CLR PLN) to your altitude and guides u over an obstacle. Afterwards
it stays in horizontal flying mode, if you want e.g.:altitude hold mode you
have to enable it manually again.
Terrain Following System (TFS)
There is a basic terrain following system (TFS) present. You have to enable the
master switch ON/OFF, then the PRTY switch to TERRAIN FOLLOW. The PRTY switch
toggles the build in tfs from flightgear named MAP(doesn't work very well with
with tas) or enables the new tfs, native to the bone, by switching to TERRAIN
FOLLOW especially when using the tas. The advantage of the new TFS system is
its ability to look forward to scan the terrain in front of the plane.
Note: Above water switch to MAP, over terrain back to TERRAIN FOLLOW.
The native tfs and the build in flightgear tfs(MAP) use the clearance settings
from SET CLR.
The clearance settings start from 0ft and increase in 200ft increments up to
2000ft. A=0ft, B=200ft, C=400ft,..., F=1000ft,..., K=2000ft.
XXXX BLAST, FLARES, STROBE XXXX
Based on preexisting osg files some eyecandy for engine blast, strobe and
flares was added.
It's OSG baby!
XXXX FEATURES XXXX
serial: none
name: none
j/k decrease/increase spoilers
o afterburner on
O afterburner off
d sweep wing backw
D sweep wing fwd
XXXX PROGRESS XXXX
FDM: alpha - in use / needs tuning 80%complete
3D model: alpha - in use / more accurate 50%complete
Textures: alpha - in use / too few 30%complete
Animations: alpha - in use / more to come 65%complete
Autopilot: alpha - in use / needs finetuning 85%complete
3Dcockpit: alpha - in use / needs completion 78%complete
Have Fun! Good Luck!
Markus Zojer, 07/11/2007
setlistener("/sim/signals/fdm-initialized", func {
init_b1b();
});
init_b1b = func {
setprop("sim/current-view/field-of-view", 60);
setprop("autopilot/settings/target-pitch-deg", 2);
setprop("controls/switches/terra-report", 0);
setprop("controls/switches/fltdir", 0.25);
setprop("controls/switches/radar-range", 0.25);
setprop("controls/switches/terrain-avoid-clrpln", 0);
setprop("controls/switches/terrain-avoid-rng", 0);
setprop("controls/switches/terrain-avoid-clr1000", 0);
setprop("instrumentation/teravd/target-vfpm", 0);
setprop("instrumentation/teravd/target-alt", 0);
setprop("controls/switches/terrain-avoid-rng-25", 0);
setprop("controls/switches/terrain-avoid-rng-50", 0);
setprop("controls/switches/terrain-follow-map", 0);
setprop("controls/switches/terrain-follow-clr", 0);
setprop("sim/panel-hotspots", 1);
setprop("controls/engines/engine[0]/cutoff", 0);#start with engines on
setprop("controls/engines/engine[1]/cutoff", 0);
setprop("controls/engines/engine[2]/cutoff", 0);
setprop("controls/engines/engine[3]/cutoff", 0);
wingSweep(1);
wingSweep(1);
wingSweep(1);
wingSweep(1);
#fuel_syst();
settimer(eng_state, 3);
print ("B-1B warming up!");
}
aftburn_on = func {
setprop("controls/engines/engine[0]/afterburner", 1);
setprop("controls/engines/engine[1]/afterburner", 1);
setprop("controls/engines/engine[2]/afterburner", 1);
setprop("controls/engines/engine[3]/afterburner", 1);
}
aftburn_off = func {
setprop("controls/engines/engine[0]/afterburner", 0);
setprop("controls/engines/engine[1]/afterburner", 0);
setprop("controls/engines/engine[2]/afterburner", 0);
setprop("controls/engines/engine[3]/afterburner", 0);
}
##
# Wrapper around stepProps() which emulates the "old" wing sweep behavior for
# configurations that aren't using the new mechanism.
#
wingSweep = func {
if(arg[0] == 0) { return; }
if(props.globals.getNode("/sim/wing-sweep") != nil) {
stepProps("/controls/flight/wing-sweep", "/sim/wing-sweep", arg[0]);
return;
}
# Hard-coded flaps movement in 3 equal steps:
val = 0.25 * arg[0] + getprop("/controls/flight/wing-sweep");
if(val > 1) { val = 1 } elsif(val < 0) { val = 0 }
setprop("/controls/flight/wing-sweep", val);
}
stepProps = func {
dst = props.globals.getNode(arg[0]);
array = props.globals.getNode(arg[1]);
delta = arg[2];
if(dst == nil or array == nil) { return; }
sets = array.getChildren("setting");
curr = array.getNode("current-setting", 1).getValue();
if(curr == nil) { curr = 0; }
curr = curr + delta;
if (curr < 0) { curr = 0; }
elsif(curr >= size(sets)) { curr = size(sets) - 1; }
array.getNode("current-setting").setIntValue(curr);
dst.setValue(sets[curr].getValue());
}
#
##### Terrain Follow Switch and Prty toggle switch
#
ter_follow = func(number){
terflw = getprop("controls/switches/terrain-follow");
terflwmap = getprop("controls/switches/terrain-follow-map");
if(terflw == 1) {
if(terflwmap == 0) {
setprop("autopilot/locks/altitude", "agl-hold");
setprop("controls/switches/terrain-follow-map-enabled", 0);#triggers
the submodels radarpulse off
} elsif (terflwmap == 1) {
setprop("autopilot/locks/altitude", "vertical-speed-hold");
setprop("controls/switches/terrain-follow-map-enabled", 1);#triggers
the submodels radarpulse on
}
} elsif(terflw == 0) {
setprop("autopilot/locks/altitude", "");
setprop("controls/switches/terrain-follow-map-enabled", 0);
}
} # End Function
#
##### Terrain Avoid Switch
#
ter_avoid_switch = func {
tas = getprop("controls/switches/terrain-avoid");
rs = getprop("controls/switches/terrain-avoid-rng");
if (tas == 1) {
if (rs == 0) {
setprop("controls/switches/terrain-avoid-rng-25", 1);
setprop("controls/switches/terrain-avoid-rng-50", 0);
} elsif (rs == 1) {
setprop("controls/switches/terrain-avoid-rng-25", 0);
setprop("controls/switches/terrain-avoid-rng-50", 1);
}
} else {
setprop("controls/switches/terrain-avoid-rng-25", 0);
setprop("controls/switches/terrain-avoid-rng-50", 0);
}
}
#
##### Terrain Avoid Toggle Radar Dist Switch
#
radar_switch = func {
rs = getprop("controls/switches/terrain-avoid-rng");
tas = getprop("controls/switches/terrain-avoid");
if(tas == 1) {
if(rs == 0) {
setprop("controls/switches/terrain-avoid-rng-25", 1);
setprop("controls/switches/terrain-avoid-rng-50", 0);
} elsif (rs == 1) {
setprop("controls/switches/terrain-avoid-rng-50", 1);
setprop("controls/switches/terrain-avoid-rng-25", 0);
}
}
}
#
##### Terrain Avoid Toggle Radar Clearance
#
radar_clrpln = func {
var rcs = getprop("controls/switches/terrain-avoid-clrpln");
if(rcs == 0) {
setprop("controls/switches/terrain-avoid-clr1000", 0);
}
if(rcs == 0.25) {
setprop("controls/switches/terrain-avoid-clr1000", 100);
}
if(rcs == 0.5) {
setprop("controls/switches/terrain-avoid-clr1000", 300);
}
if(rcs == 0.75) {
setprop("controls/switches/terrain-avoid-clr1000", 500);
}
if(rcs == 1.0) {
setprop("controls/switches/terrain-avoid-clr1000", 1000);
}
}
#
##### Terrain Follow Radar Clearance
#
radar_setclr = func(number) {
var sclr = getprop("controls/switches/terrain-follow-setclr");
oldclr = getprop("controls/switches/terrain-follow-clr");
if((number == 1) and (oldclr < 2000)) {
newclr = (oldclr + 200);
setprop("controls/switches/terrain-follow-clr", newclr);
setprop("autopilot/settings/target-agl-ft", newclr);
} elsif((number == 0) and (oldclr > 0)) {
newclr = (oldclr - 200);
setprop("controls/switches/terrain-follow-clr", newclr);
setprop("autopilot/settings/target-agl-ft", newclr);
}
}
#
##### Terrain Avoidance Radar Pulse (inspired from vulcanb2)
#
settimer(func {
# Add listener for radar pulse contactm0d
setlistener("sim/radar/teravd/contactm0d", func {
var contactm0d = cmdarg().getValue();
var solid = getprop(contactm0d ~ "/material/solid");
if (solid)
{
var long = getprop(contactm0d ~ "/impact/longitude-deg");
var lat = getprop(contactm0d ~ "/impact/latitude-deg");
var elev_m = getprop(contactm0d ~ "/impact/elevation-m");
var spd = getprop(contactm0d ~ "/impact/speed-mps");
var time = getprop(contactm0d ~ "/sim/time/elapsed-sec");
var elev_ft = int(elev_m * 3.28);
var dist_ft = int(spd * time * 3.28);
setprop("instrumentation/teravd/elevationm0d", elev_ft);
setprop("instrumentation/teravd/distancem0d", dist_ft);
settimer(teravd_m0d, 0);
}
});
}, 0);
settimer(func {
# Add listener for radar pulse contactm4d
setlistener("sim/radar/teravd/contactm4d", func {
var contactm4d = cmdarg().getValue();
var solid = getprop(contactm4d ~ "/material/solid");
if (solid)
{
var long = getprop(contactm4d ~ "/impact/longitude-deg");
var lat = getprop(contactm4d ~ "/impact/latitude-deg");
var elev_m = getprop(contactm4d ~ "/impact/elevation-m");
var spd = getprop(contactm4d ~ "/impact/speed-mps");
var time = getprop(contactm4d ~ "/sim/time/elapsed-sec");
var elev_ft = int(elev_m * 3.28);
var dist_ft = int(spd * time * 3.28);
setprop("instrumentation/teravd/elevationm4d", elev_ft);
setprop("instrumentation/teravd/distancem4d", dist_ft);
settimer(teravd_m4d, 0);
}
});
}, 0);
settimer(func {
# Add listener for radar pulse contactm20d
setlistener("sim/radar/teravd/contactm20d", func {
var contactm20d = cmdarg().getValue();
var solid = getprop(contactm20d ~ "/material/solid");
if (solid)
{
var long = getprop(contactm20d ~ "/impact/longitude-deg");
var lat = getprop(contactm20d ~ "/impact/latitude-deg");
var elev_m = getprop(contactm20d ~ "/impact/elevation-m");
var spd = getprop(contactm20d ~ "/impact/speed-mps");
var time = getprop(contactm20d ~ "/sim/time/elapsed-sec");
var elev_ft = int(elev_m * 3.28);
var dist_ft = int(spd * time * 3.28);
setprop("instrumentation/teravd/elevationm20d", elev_ft);
setprop("instrumentation/teravd/distancem20d", dist_ft);
settimer(teravd_m20d, 0);
}
});
}, 0);
settimer(func {
# Add listener for radar pulse contactm20dtf for terrain follow
setlistener("sim/radar/teravd/contactm20dtf", func {
var contactm20dtf = cmdarg().getValue();
var solid = getprop(contactm20dtf ~ "/material/solid");
if (solid)
{
var long = getprop(contactm20dtf ~ "/impact/longitude-deg");
var lat = getprop(contactm20dtf ~ "/impact/latitude-deg");
var elev_m = getprop(contactm20dtf ~ "/impact/elevation-m");
var spd = getprop(contactm20dtf ~ "/impact/speed-mps");
var time = getprop(contactm20dtf ~ "/sim/time/elapsed-sec");
var elev_ft = int(elev_m * 3.28);
var dist_ft = int(spd * time * 3.28);
setprop("instrumentation/teravd/elevationm20dtf", elev_ft);
setprop("instrumentation/teravd/distancem20dtf", dist_ft);
settimer(teravd_m20dtf, 0);
}
});
}, 0);
# control alt while climb and trigger end of climb
teravd_m0d = func {
calt = getprop("position/altitude-ft");
cspd = getprop("velocities/groundspeed-kt");
talt = getprop("autopilot/settings/target-altitude-ft");
tvfpm = getprop("autopilot/settings/vertical-speed-fpm");
rdist25 = getprop("controls/switches/terrain-avoid-rng-25");
rdist50 = getprop("controls/switches/terrain-avoid-rng-50");
elem0d = getprop("instrumentation/teravd/elevationm0d");
distm0d = getprop("instrumentation/teravd/distancem0d");
clr = getprop("controls/switches/terrain-avoid-clr1000");
if (rdist25 = 1) {
rdist = 15000;
} elsif (rdist50 = 1) {
rdist = 30000;
}
daltm0d = ((elem0d + clr) - calt);
if ((distm0d < rdist) and (daltm0d > 0)) {
talt = calt + daltm0d;
itime = distm0d / (cspd * 1.6878);
tvfpm = int((daltm0d) / (itime / 2)) * 60;
setprop("instrumentation/teravd/target-vfpm", tvfpm);
setprop("instrumentation/teravd/target-alt", talt);
setprop("controls/switches/terra-report", 1);
settimer(setvfpm, 0);
}
}
teravd_m4d = func {
#cpitch = getprop("orientation/pitch-deg");
calt = getprop("position/altitude-ft");
cspd = getprop("velocities/groundspeed-kt");
talt = getprop("autopilot/settings/target-altitude-ft");
tvfpm = getprop("autopilot/settings/vertical-speed-fpm");
rdist25 = getprop("controls/switches/terrain-avoid-rng-25");
rdist50 = getprop("controls/switches/terrain-avoid-rng-50");
elem4d = getprop("instrumentation/teravd/elevationm4d");
distm4d = getprop("instrumentation/teravd/distancem4d");
clr = getprop("controls/switches/terrain-avoid-clr1000");
evfpm = getprop("instrumentation/teravd/target-vfpm");
etalt = getprop("instrumentation/teravd/target-alt");
if (rdist25 = 1) {
rdist = 15000;
} elsif (rdist50 = 1) {
rdist = 30000;
}
daltm4d = ((elem4d + clr) - calt);
if ((distm4d < rdist) and (daltm4d > 0)) {
talt = calt + daltm4d;
itime = distm4d / (cspd * 1.6878);
tvfpm = int((daltm4d) / ((itime * 2) / 3)) * 60;
if (etalt < talt) {
setprop("instrumentation/teravd/target-alt", talt);
}
if (evfpm < tvfpm) {
setprop("instrumentation/teravd/target-vfpm", tvfpm);
}
setprop("controls/switches/terra-report", 1);
settimer(setvfpm, 0);
}
}
teravd_m20d = func {
calt = getprop("position/altitude-ft");
cspd = getprop("velocities/groundspeed-kt");
talt = getprop("autopilot/settings/target-altitude-ft");
tvfpm = getprop("autopilot/settings/vertical-speed-fpm");
rdist25 = getprop("controls/switches/terrain-avoid-rng-25");
rdist50 = getprop("controls/switches/terrain-avoid-rng-50");
evfpm = getprop("instrumentation/teravd/target-vfpm");
etalt = getprop("instrumentation/teravd/target-alt");
elem20d = getprop("instrumentation/teravd/elevationm20d");
distm20d = getprop("instrumentation/teravd/distancem20d");
clr = getprop("controls/switches/terrain-avoid-clr1000");
prty = getprop("controls/switches/terrain-follow-map-enabled");
if (rdist25 = 1) {
rdist2 = 15000;
} elsif (rdist50 = 1) {
rdist2 = 30000;
}
daltm20d = ((elem20d + clr) - calt);
if ((distm20d < rdist2) and (daltm20d > 0)) {
talt = calt + daltm20d;
itime = distm20d / (cspd * 1.6878);
tvfpm = int((daltm20d) / (itime / 2)) * 60;
if (etalt < talt) {
setprop("instrumentation/teravd/target-alt", talt);
}
if (evfpm < tvfpm) {
setprop("instrumentation/teravd/target-vfpm", tvfpm);
}
setprop("controls/switches/terra-report", 1);
settimer(setvfpm, 0);
}
}
teravd_m20dtf = func {
terrep = getprop("controls/switches/terra-report");
#if (terrep == 0) {
calt = getprop("position/altitude-ft");
cspd = getprop("velocities/groundspeed-kt");
talt = getprop("autopilot/settings/target-altitude-ft");
tvfpm = getprop("autopilot/settings/vertical-speed-fpm");
rdist25 = getprop("controls/switches/terrain-avoid-rng-25");
rdist50 = getprop("controls/switches/terrain-avoid-rng-50");
evfpm = getprop("instrumentation/teravd/target-vfpm");
etalt = getprop("instrumentation/teravd/target-alt");
elem20dtf = getprop("instrumentation/teravd/elevationm20dtf");
distm20dtf = getprop("instrumentation/teravd/distancem20dtf");
tfclr = getprop("controls/switches/terrain-follow-clr");
prty = getprop("controls/switches/terrain-follow-map-enabled");
if (rdist25 = 1) {
rdist2 = 60000;
} elsif (rdist50 = 1) {
rdist2 = 60000;
}
daltm20dtf = ((elem20dtf + tfclr) - calt);
if ((distm20dtf < rdist2) and (daltm20dtf > 0)) {
talt = calt + daltm20dtf;
itime = distm20dtf / (cspd * 1.6878);
tvfpm = int((daltm20dtf) / itime) * 60;
if (etalt < talt) {
setprop("instrumentation/teravd/target-alt", talt);
}
if (evfpm < tvfpm) {
setprop("instrumentation/teravd/target-vfpm", tvfpm);
}
#setprop("controls/switches/terra-report", 1);
settimer(setvfpmplus, 0);
}
# this is the terrain following part, terrain is lower than clr limit
if ((distm20dtf < rdist2) and (daltm20dtf < 0)) {
talt = calt + daltm20dtf;
itime = (distm20dtf / (cspd * 1.6878)) * (-1);
tvfpm = (int((daltm20dtf) / (itime * 2)) * 60) * (-1);
if ((evfpm <= 0) and (prty == 1)) {
setprop("instrumentation/teravd/target-alt", talt);
setprop("instrumentation/teravd/target-vfpm", tvfpm);
settimer(setvfpmminus, 0);
}
}
#}
}
setvfpm = func {
calt = getprop("position/altitude-ft");
talt = getprop("instrumentation/teravd/target-alt");
tvfpm = getprop("instrumentation/teravd/target-vfpm");
setprop("controls/switches/apmode/alt-hold", 0);
setprop("controls/switches/apmode/ptch-hold", 0);
setprop("controls/switches/apmode/vfpm-hold", 0);
setprop("autopilot/settings/vertical-speed-fpm", tvfpm);
setprop("autopilot/locks/altitude", "vertical-speed-hold");
if (calt > talt) {
setprop("autopilot/settings/vertical-speed-fpm", 0);
setprop("controls/switches/terra-report", 0);
setprop("instrumentation/teravd/target-vfpm", 0);
setprop("instrumentation/teravd/target-alt", 0);
#settimer(aglreinit, 0);
} else {
settimer(setvfpm, 0.5);
}
}
setvfpmplus = func {
terflw = getprop("controls/switches/terrain-follow");
if (terflw == 1) {
calt = getprop("position/altitude-ft");
talt = getprop("instrumentation/teravd/target-alt");
tvfpm = getprop("instrumentation/teravd/target-vfpm");
setprop("autopilot/settings/vertical-speed-fpm", tvfpm);
setprop("autopilot/locks/altitude", "vertical-speed-hold");
if (calt > talt) {
setprop("autopilot/settings/vertical-speed-fpm", 0);
setprop("instrumentation/teravd/target-vfpm", 0);
setprop("instrumentation/teravd/target-alt", 0);
#settimer(aglreinit, 0);
} else {
settimer(setvfpmplus, 0.5);
}
}
}
setvfpmminus = func {
tvfpm = getprop("instrumentation/teravd/target-vfpm");
setprop("autopilot/settings/vertical-speed-fpm", tvfpm);
setprop("autopilot/locks/altitude", "vertical-speed-hold");
}
# reinit previous flight params
aglreinit = func {
terflw = getprop("controls/switches/terrain-follow");
setprop("controls/switches/terra-report", 0);
if(terflw == 1) {
setprop("autopilot/locks/altitude", "agl-hold");
} else {
setprop("autopilot/locks/altitude", "vertical-speed-hold");
# setprop("autopilot/locks/altitude", "altitude-hold");
}
}
### end of terrain avoidance behaviour #########################
### engine on/off workaround adapted from Citation Bravo
eng_state = func {
if(getprop("controls/engines/engine[0]/cutoff") == 0){
setprop("controls/engines/engine[0]/throttle-lever",getprop("/controls/engines/engine[0]/throttle"));
setprop("sim/model/B-1B/n1[0]",getprop("/engines/engine/n1"));
setprop("sim/model/B-1B/n2[0]",getprop("/engines/engine/n2"));
}else{
setprop("controls/engines/engine[0]/throttle-lever", 0);
interpolate("sim/model/B-1B/n1[0]",0,10);
interpolate("sim/model/B-1B/n2[0]",0,10);
}
if(getprop("controls/engines/engine[1]/cutoff") == 0){
setprop("controls/engines/engine[1]/throttle-lever",getprop("/controls/engines/engine[1]/throttle"));
setprop("sim/model/B-1B/n1[1]",getprop("/engines/engine/n1"));
setprop("sim/model/B-1B/n2[1]",getprop("/engines/engine/n2"));
}else{
setprop("controls/engines/engine[1]/throttle-lever", 0);
interpolate("sim/model/B-1B/n1[1]",0,10);
interpolate("sim/model/B-1B/n2[1]",0,10);
}
if(getprop("controls/engines/engine[2]/cutoff") == 0){
setprop("controls/engines/engine[2]/throttle-lever",getprop("/controls/engines/engine[2]/throttle"));
setprop("sim/model/B-1B/n1[2]",getprop("/engines/engine/n1"));
setprop("sim/model/B-1B/n2[2]",getprop("/engines/engine/n2"));
}else{
setprop("controls/engines/engine[2]/throttle-lever", 0);
interpolate("sim/model/B-1B/n1[2]",0,10);
interpolate("sim/model/B-1B/n2[2]",0,10);
}
if(getprop("controls/engines/engine[3]/cutoff") == 0){
setprop("controls/engines/engine[3]/throttle-lever",getprop("/controls/engines/engine[3]/throttle"));
setprop("sim/model/B-1B/n1[3]",getprop("/engines/engine/n1"));
setprop("sim/model/B-1B/n2[3]",getprop("/engines/engine/n2"));
}else{
setprop("controls/engines/engine[3]/throttle-lever", 0);
interpolate("sim/model/B-1B/n1[3]",0,10);
interpolate("sim/model/B-1B/n2[3]",0,10);
}
settimer(eng_state, 0);
}
#fuel distribution system
#fuel_syst = func {
#var tank0 = getprop("consumables/fuel/tank[0]/level-gal_us");#wing left
#var tank1 = props.globals.getNode("consumables/fuel/tank[1]/level-gal_us",
1);#wing right
#var tank6 = getprop("consumables/fuel/tank[6]/level-gal_us");#collector left
#var tank7 = props.globals.getNode("consumables/fuel/tank[7]/level-gal_us",
1);#collector right
#if(tank6 < 1500){
# setprop("consumables/fuel/tank[6]/level-gal_us", tank6 + 80);
# setprop("consumables/fuel/tank[0]/level-gal_us", tank0 - 80);
# }
#settimer(fuel_syst, 0);
#}
# checks wing sweep/flaps and allow flaps only to be extended at minimum sweep
- adopted from limits.nas
checkFlaps = func {
flapsetting = cmdarg().getValue();
if (flapsetting == 0)
return;
sweep = getprop("controls/flight/wing-sweep");
if ((flapsetting != 0) and (sweep != 1)) {
controls.flapsDown(-1);
ltext = "Flaps can only be exteded at minimum wingsweep!";
screen.log.write(ltext);
}
}
setlistener("controls/flight/flaps", checkFlaps);
checkSweep = func {
sweepsetting = cmdarg().getValue();
if (sweepsetting == 1)
return;
flaps = getprop("controls/flight/flaps");
if ((sweepsetting != 1) and (flaps != 0)) {
b1b.wingSweep(1);
ltext = "Wings can only be swept with retracted flaps!";
screen.log.write(ltext);
}
}
setlistener("controls/flight/wing-sweep", checkSweep);
###
# apmode listeners to controls switches apmode
###
checkapmode = func {
althold = getprop("controls/switches/apmode/alt-hold");
vfpmhold = getprop("controls/switches/apmode/vfpm-hold");
ptchhold = getprop("controls/switches/apmode/ptch-hold");
bhdghold = getprop("controls/switches/apmode/bhdg-hold");
thdghold = getprop("controls/switches/apmode/thdg-hold");
spdhold = getprop("controls/switches/apmode/spd-hold");
spdptchhold = getprop("controls/switches/apmode/spdptch-hold");
aglhold = getprop("controls/switches/terrain-follow");
if (althold == 1) {
setprop("autopilot/locks/altitude", "altitude-hold");
} elsif (vfpmhold == 1) {
setprop("autopilot/locks/altitude", "vertical-speed-hold");
} elsif (ptchhold == 1) {
setprop("autopilot/locks/altitude", "pitch-hold");
} elsif ((ptchhold != 1) and (vfpmhold != 1) and (althold != 1) and (aglhold !=
1)) {
setprop("autopilot/locks/altitude", "");
}
if (bhdghold == 1) {
setprop("autopilot/locks/heading", "dg-heading-hold");
} elsif (thdghold == 1) {
setprop("autopilot/locks/heading", "true-heading-hold");
} elsif ((bhdghold != 1) and (thdghold != 1)) {
setprop("autopilot/locks/heading", "");
}
if (spdhold == 1) {
setprop("autopilot/locks/speed", "speed-with-throttle");
} elsif (spdptchhold == 1) {
setprop("autopilot/locks/speed", "speed-with-pitch-trim");
} elsif ((spdhold != 1) and (spdptchhold != 1)) {
setprop("autopilot/locks/speed", "");
}
}
###
# flight director modes selector
###
fltdir = func {
var fltd = getprop("controls/switches/fltdir");
if (fltd == 0.00) {
setprop("instrumentation/adf/serviceable", "0");
setprop("instrumentation/nav/serviceable", "0");
setprop("instrumentation/tacan/serviceable", "0");
} elsif (fltd == 0.25) {
setprop("instrumentation/adf/serviceable", "1");
setprop("instrumentation/nav/serviceable", "1");
setprop("instrumentation/tacan/serviceable", "1");
} elsif (fltd == 0.50) {
setprop("instrumentation/adf/serviceable", "1");
setprop("instrumentation/nav/serviceable", "1");
setprop("instrumentation/tacan/serviceable", "0");
} elsif (fltd == 0.75) {
setprop("instrumentation/adf/serviceable", "1");
setprop("instrumentation/nav/serviceable", "0");
setprop("instrumentation/tacan/serviceable", "0");
} elsif (fltd == 1.00) {
setprop("instrumentation/adf/serviceable", "0");
# setprop("instrumentation/nav/serviceable", "0");
setprop("instrumentation/tacan/serviceable", "1");
}
}
radar_range = func {
var radran = getprop("controls/switches/radar-range");
if (radran == 0.00) {
setprop("instrumentation/radar/range[0]", "20");
} elsif (radran == 0.25) {
setprop("instrumentation/radar/range[0]", "40");
} elsif (radran == 0.50) {
setprop("instrumentation/radar/range[0]", "80");
} elsif (radran == 0.75) {
setprop("instrumentation/radar/range[0]", "160");
} elsif (radran == 1.00) {
setprop("instrumentation/radar/range[0]", "320");
}
}
nuc = func {
if (getprop("controls/switches/nuc") == 1) {
ltext = "Sorry, Duke Nukem not available yet on this plane(t)!";
screen.log.write(ltext);
}
}
<?xml version="1.0"?>
<!--
sweat by maggse
-->
<PropertyList>
<path>apmode.ac</path>
<!-- apmode button animations -->
<animation>
<type>blend</type>
<object-name>apmode_alt</object-name>
<property>controls/switches/apmode/alt-hold</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
<!-- clickable buttons block (osg only!) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
<animation>
<type>pick</type>
<object-name>apmode_alt</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<interval-sec>0.5</interval-sec>
<binding>
<command>property-toggle</command>
<property>controls/switches/apmode/alt-hold</property>
</binding>
<binding>
<command>nasal</command>
<script>b1b.checkapmode()</script>
</binding>
</action>
</animation>
<animation>
<type>blend</type>
<object-name>apmode_vfpm</object-name>
<property>controls/switches/apmode/vfpm-hold</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
<!-- clickable buttons block (osg only!) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
<animation>
<type>pick</type>
<object-name>apmode_vfpm</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<interval-sec>0.5</interval-sec>
<binding>
<command>property-toggle</command>
<property>controls/switches/apmode/vfpm-hold</property>
</binding>
<binding>
<command>nasal</command>
<script>b1b.checkapmode()</script>
</binding>
</action>
</animation>
<animation>
<type>blend</type>
<object-name>apmode_ptch</object-name>
<property>controls/switches/apmode/ptch-hold</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
<!-- clickable buttons block (osg only!) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
<animation>
<type>pick</type>
<object-name>apmode_ptch</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<interval-sec>0.5</interval-sec>
<binding>
<command>property-toggle</command>
<property>controls/switches/apmode/ptch-hold</property>
</binding>
<binding>
<command>nasal</command>
<script>b1b.checkapmode()</script>
</binding>
</action>
</animation>
<animation>
<type>blend</type>
<object-name>apmode_bhdg</object-name>
<property>controls/switches/apmode/bhdg-hold</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
<!-- clickable buttons block (osg only!) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
<animation>
<type>pick</type>
<object-name>apmode_bhdg</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<interval-sec>0.5</interval-sec>
<binding>
<command>property-toggle</command>
<property>controls/switches/apmode/bhdg-hold</property>
</binding>
<binding>
<command>nasal</command>
<script>b1b.checkapmode()</script>
</binding>
</action>
</animation>
<animation>
<type>blend</type>
<object-name>apmode_thdg</object-name>
<property>controls/switches/apmode/thdg-hold</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
<!-- clickable buttons block (osg only!) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
<animation>
<type>pick</type>
<object-name>apmode_thdg</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<interval-sec>0.5</interval-sec>
<binding>
<command>property-toggle</command>
<property>controls/switches/apmode/thdg-hold</property>
</binding>
<binding>
<command>nasal</command>
<script>b1b.checkapmode()</script>
</binding>
</action>
</animation>
<animation>
<type>blend</type>
<object-name>apmode_spd</object-name>
<property>controls/switches/apmode/spd-hold</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
<!-- clickable buttons block (osg only!) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
<animation>
<type>pick</type>
<object-name>apmode_spd</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<interval-sec>0.5</interval-sec>
<binding>
<command>property-toggle</command>
<property>controls/switches/apmode/spd-hold</property>
</binding>
<binding>
<command>nasal</command>
<script>b1b.checkapmode()</script>
</binding>
</action>
</animation>
<animation>
<type>blend</type>
<object-name>apmode_spdptch</object-name>
<property>controls/switches/apmode/spdptch-hold</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
<!-- clickable buttons block (osg only!) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->
<animation>
<type>pick</type>
<object-name>apmode_spdptch</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<interval-sec>0.5</interval-sec>
<binding>
<command>property-toggle</command>
<property>controls/switches/apmode/spdptch-hold</property>
</binding>
<binding>
<command>nasal</command>
<script>b1b.checkapmode()</script>
</binding>
</action>
</animation>
<animation>
<type>blend</type>
<object-name>apmode_terrflw</object-name>
<property>controls/switches/terrain-follow</property>
<offset>0.6</offset>
<factor>-0.6</factor>
</animation>
</PropertyList>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel