Silly me. I was starting the timer at zero, so the first tracer didn't fly
until 0.25 seconds after pulling the trigger. Now the timer starts at the
same value as "delay", so the first round comes out immediately.
Also, I've added an optional configuration attribute that allows you to change
the ballistics of the submodel. This allows parachutes, or anything else
that has ballistics different from a bullet. The attribute is called "eda",
which is the equivalent drag area. Default value is 0.007, which gives the
same ballistics as the current tracers. Increasing this value gives more
drag. A value of 2.0 looks good for a parachute.
math stuff
########################################################################
The deceleration of the ballictic object is now given by:
[ (rho) (Cd) ] / [ (1/2) (m) ] * A * (V * V)
where rho is sea-level air density, and Cd and m are fixed, bullet-like
values. So the calculation is:
0.0116918 * A * (V * V)
The value "A" is what I'm calling the "eda" (equivalent drag area).
########################################################################
A parachute model will have to be built so that the parachutist's feet
are in the forward x-direction.
Here is the submodel.xml config I use for "parachutes":
<submodel>
<name>flares</name>
<model>Models/Geometry/flare.ac</model>
<trigger>systems/submodels/submodel[0]/trigger</trigger>
<speed>0.0</speed>
<repeat>true</repeat>
<delay>0.85</delay>
<count>4</count>
<x-offset>0.0</x-offset>
<y-offset>0.0</y-offset>
<z-offset>-4.0</z-offset>
<yaw-offset>0.0</yaw-offset>
<pitch-offset>0.0</pitch-offset>
<eda>2.0</eda>
</submodel>
Last night I sent these new files to Vivian to fix a problem he found. Since
we can have more than one submodel we need more than one "count" property.
The new code creates a property systems/submodels/submodel[n]/count for each
submodel. Vivian is using this count property for his sound.
Here is an update for the submodel system. This will allow submodels to be
defined for any aircraft, and there are no default submodels. To use this
submodel system you need to set up a binding (slight change in property name
from last one, but you can use any property name you like, as long as it
matches the name in the submodels.xml file, see below):
<button n="0">
<desc>Trigger</desc>
<binding>
<command>property-assign</command>
<property>/systems/submodels/trigger</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/systems/submodels/trigger</property>
<value type="bool">false</value>
</binding>
</mod-up>
</button>
Then in your *-set.xml file you need to define a path to the configuration
file (similar to the way the electrical system is now done):
<sim>
...
<systems>
<electrical>
<path>Aircraft/Generic/generic-electrical.xml</path>
</electrical>
<submodels>
<serviceable type="bool">true</serviceable>
<path>Aircraft/FW190/submodels.xml</path>
</submodels>
</systems>
...
</sim>
Then you put the submodel configuration file in your aircraft's directory.
I've attached a file, submodels.xml, that can be used to define a gun that
works just like the former one did.
There are two things remaining to be done. One is to change the function
SubmodelSystem::transform() to properly position the submodel. This will
require some complicated matrix code that I might borrow from Yasim.
Well here's some tracer stuff. If fiddled around with submodel.cxx. It now
does what it says - you need to put this:
<!-- trial gun system -->
<systems>
<submodel>
<serviceable type="bool">true</serviceable>
<amount type="int">120</amount>
</submodel>
</systems>
In the *-set.xml file NOT within <sim></sim>. Trouble is it still defaults
to serviceable=true, but it also defaults to amount=0. Unless this bit of
code is included it wont run, so other models can't fire inappropriate
tracer. Revised submodel.cxx file attached.
I've changed to a non-billboard solution. I tried to make the viewing angle
of the tracer less than 180 degs, but failed. Close enough I think. It's
still a bit big, but a reasonable compromise. .AC file attached.
I remain concerned about the tracer colour. In practice, red is better (and
it's what I am used to) but David seems set on white, and I don't want to
upset him. I'm going to adjust the texture a bit more tomorrow.
Right now the code is not very configurable, and there is only one submodel per airplane possible. It is implemented as an SGSubSystem, just like the electrics, vacuum, etc. systems. To make it work you need to make a release binding like this (for my joystick trigger):
<button n="0">
<desc>Trigger</desc>
<binding>
<command>property-assign</command>
<property>/systems/submodel/trigger</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/systems/submodel/trigger</property>
<value type="bool">false</value>
</binding>
</mod-up>
</button>
Then, each airplane that uses the system should have something like this added to its *-set.xml file (note that this does *not* go within the <sim></sim> tags):
<systems>
<submodel>
<serviceable type="bool">true</serviceable>
<amount type="int">70</amount>
</submodel>
</systems>
Future improvements will include:
1) more configurability, so the user can create multiple submodels, and can assign them different locations, and pitch and yaw adjustments, and nitial velocity.
2) sound?
3) a more accurate calculation of the submodels location at any pitch/roll/yaw.
4) a way to pre-load the model, so the AI code doesn't have to parse the model every time it creates an instance.
I think that's all of it.
All necessary elements for an ADF gauge had been migrated from
Cockpit/kr_87.cxx to Instrumentation/adf.cxx. Migrating the sound
related elements was apparently planned, but not done yet. This
intermediate state broke the ident morse sound: it couldn't get
turned off and it always indicated "SF", regardless of the tuned-in
frequency. The following patches continue the migration:
adf-radio.diff => Base/Aircraft/Instruments/adf-radio.xml:
---------------------------------------------------------------
* sets maximum volume to 1 (rather than 2); Not only is 1
loud enough (and 2 unpleasantly noisy), it also prevents
the knob from being turned to non-existant positions. :-)
* fixes wrong use of /instrumentation/adf/ident
* the voice/ident selector(?) remains unchanged, but as it's
not switched to "IDENT", there'll be no ident sound by default
this is consistent with other sounds and DME.
radiostack.diff => src/Cockpit/radiostack.[ch]xx:
---------------------------------------------------------------
* comment out use of FGKR_87 class. kr_87.[ch]xx is now no
longer used. kr-87adf.xml would no longer work, either, but
isn't used anywhere, anyway. Future adf radios have to use
the adf instrument, using xml/Nasal for specific hardware
implementation details.
adf.diff => src/Instrumentation/adf.[ch]xx:
---------------------------------------------------------------
* adds ident morse sound capability using two new input
properties:
- /instrumentation/adf/volume-norm (double)
- /instrumentation/adf/ident-audible (bool)
this was always only meant to be a test program for the metar lib, but now
that people are referring to it as a means to get metar reports, I think a
usage info is desirable. The list of test ids, on the other hand, isn't
necessary any more. This can still be handled by a Makefile or the commandline.
I'm all for keeping this tool in cvs, however. And also the not-used stuff
therein is a welcome source for how to use the SGMetar class.
This is a workaround for an issue where the xml dialogs were shrinking on
subsequent pops.
Andy Ross says:
That looks like it should be fine for a release-time workaround. The
2 pixel border on dialogs is at best a minor feature, and probably
invisible since the sub-frames all have their own padding.
Clearly the right fix would be to find out where the code is getting
confused by the previous layout. In principle, the layout should be
idempotent: if you don't change the layout constraints, it shouldn't
change its layout. There's still a bug in there somewhere.
I've included the latest fixes to the Traffic Manager/AI flightplan generation
code. Most of the code changes are in AIFllightplan.cxx. This is the code
that runs without depending on predefined FlightPlans in
#FG_ROOT/Data/AI/Flightplans.i
As suggested by Dave, I've also added a new property in
preferences.xml: /sim/traffic-manager/enabled, which is used to control
whether or not the traffic manager is active.
I'm still working on a few more 737 traffic patterns, those are going to take
a little longer, so I didn't want to wait sending in this code.
Finally, I haven't put much effort into ensuring "aeronautical correctness" in
this version yet. The code works on my system, but what the AI plane do may
actaully be quite rediculous. But I'd like to leave that for the next
version.
Stub in hooks for Propeller feathering controls and the turbo prop "condition"
lever.
I added a line in FGFDM.cpp to force control properties to exist if they
don't already. This way you can specify anything you want and find them
in the property browser, otherwise no one else may create them and you are
stuck.
In PropEngine::solve() the code original sets _running = true at the
beginning and then sets running = false at the end. I changed this to
save the current value at the start, set to true, solve(), and then
restore the original value at the end. That way if we start off with
_running = true, we don't have to hack up the calc() routine which wasn't
using the value anyway.
Finally I added some very initial support to shut down a turbine engine
(_running = false) when the condition lever goes to zero.
for localizers. I further hacked this to support GS and DME transmitters
(although Robin's DME transmitter data doesn't convey orientation
unfortunately.)
I have 3 issues that are fixed by this set of patches.
1. In extensions.cxx
#else if !defined( WIN32 ) must be changed by
#elif !defined( WIN32 ) because the text after #else
seems to be ignored
2. banner is not available on windows, only cygwin
3. ANSI escape sequences are not interpreted on the
windows console. We just have garbage that is hard
to read.
motion.
- Track a timeout value so we can optionally hide the mouse pointer after
some user specified timeout period.
- in doMouseMotion() always update m.x and m.y even if we return early because
pui wanted the event. Without this, we can't reliably detect motion vs.
inactivity.
- in _update_mouse() add a dt parameter so we can decriment the timeout value
in "real" time.
- in _update_mouse() optionally hide the mouse pointer if m.timeout goes to
zero. Restore the pointer (and the timeout counter) if the mouse is moved.
will delay it's reply by 50ms. The ground station can change it's reply delay
to trick the airborn dme unit into reporting a distance that is offset from
the true distance by some constant value. In FG we model this by subtracting
a fixed distance from the actual distance.
It is thus possible in our implimentation for the displayed distance to become
negative. This patch clamp DME distance to a minimum value of 0.00 so it can
never go negative.
A good elevation is critical for proper glide slope modeling. This patch
assigns the average field elevation to any ILS component that doesn't have
a valid elevation.
Also, for an ILS approach, use the GS transmitter elevation for glide slope
calculations rather than the localizer elevation, in some cases this can
make a big difference.
Wouldn't it be better to prepare the whole list of paths (or two
separate ones for Terrain/Objects if necessary) in FGGlobals::set_fg_scenery,
and to pass the vector<string>s to FGTileEntry::load? It doesn't seem to make
a lot of sense to split the path up, modify it, mount it together to one string
again, and then let FGTileEntry::load split it up again.
Here we go:
Main/globals.cxx
================
As fg_scenery is now a string_list, we don't need initialization. Furthermore,
this list is cleared with every set_fg_scenery() call.
ctor: create default dir from fg_root if necessary. Otherwise check all paths
of --fg-scenery/FG_SCENERY: If the path doesn't exist, ignore it. If it contains
a dir Terrain and/or Objects, then only add that to the list. If it contains
neither, then use the path as is.
Scenery/tileentry.cxx
=====================
Trivial: don't split a "base path", but use the given path_list as is.
(I considered a variable name "path_list" better suited than "search".)
Scenery/FGTileLoader.cxx
========================
No more fiddling with sub-paths. This has to be delivered by get_fg_scenery
already.
Here's some additions to AI that allow refueling from an AI tanker (the actual
onload of fuel must be handled by the user's FDM of course, this just lets
the FDM know that the user is in position to refuel).
I've added a new class of AIAircraft called "tanker". It uses the same
performance struct as a jet transport. An AI tanker is just like an AI jet
transport, except it uses the already-existing radar data to control the
boolean property systems/refuel/contact. The code change was minimal.
An AI tanker can be created like this:
<entry>
<callsign>Esso 1</callsign>
<type>aircraft</type>
<class>tanker</class>
<model>Aircraft/737/Models/boeing733.xml</model>
<latitude>37.61633</latitude>
<longitude>-122.38334</longitude>
<altitude>3000</altitude>
<heading>020</heading>
<speed>280</speed>
<roll>-15</roll>
</entry>
This puts a tanker over KSFO at 3000 feet, in a left-hand orbit. When the
user gets within refueling range (contact position) then the property
systems/refuel/contact will be true. Otherwise it is false.
The dimensions of the refueling envelope are pretty rough right now, but still
usable. The user must be behind the tanker (ie. radar y_offset > 0). The
user must be at or below the tanker's altitude (ie. radar elevation > 0).
The user's lat/lon must be within 250 feet of the tanker's lat/lon (ie. radar
range_ft < 250). This last requirement is loose because the radar data is
only updated every 100 ms, which is accurate enough for radar use, but
which is sloppy for air refueling. This could be tightened up by increasing
the radar update rate to once every sim cycle.
I'm going to add a light to the T-38 instrument panel that will monitor the
property systems/refuel/contact. This will make it easier to explore the
boundaries of the refueling envelope.
Here's some new AI stuff.
1) AI objects must now be defined in a scenario file, not in preferences.xml
or a *-set file. (Of course this doesn't prevent objects from being created
dynamically, as with Durk's traffic manager).
2) A new demo_scenario file is attached. It creates 3 aircraft, a sailboat,
and a thunderstorm.
3) Objects without flightplans live forever.
4) FGAIShip::ProcessFlightplan() is not yet implemented.
5) preferences.xml should now define only <enabled> and <scenario>
These change add some code that at initialization time will snap all
localizers into perfect alignment with their runways. It's my experience
that the DAFIF/FAA data reports runway and localizer headings to a level
of precision that is great for making charts, or adjusting your OBS, etc.
But the level of precision of this data can be far enough off to make you
visibly *un*aligned with the runway when the CDI needle is centered.
There are probably cases where the localizer isn't really perfectly
aligned with the runway, or intentionally misaligned to avoid obstacles
or terrain. So I have made this configurable for those that trust the
data more than I do. Just set "/sim/navdb/auto-align-localizers" to
true/false in the preferences file to turn this feature on or off in the
code.
- FG now directly supports Robin's native nav database file format.
- His latest data now separates out dme, gs, loc, and marker beacon
transmitters rather than lumping them all into a single "ILS" record.
- These new data structure changes prompted me to do some code restructuring
so that internally these different types of navaids are all kept as
separate lists and searched and handled separately.
- This structural change had a cascading affect on any code that
references or uses the nav databases. I've gone and "touched" a lot of
nav related code in a lot of places.
- As an added bonus, the new data (and code) adds DME bias so these will
all now read as they do in real life.
- Added Navaids/navdb.cxx and Navaids/navdb.hxx which provide a front
end loaders for the nav data.
- Added Navaids/navrecord.hxx which is a new "generic" nav data record.
- Removed Navaids/ils.hxx, Navaids/ilslist.cxx, Navaids/ilslist.hxx,
Navaids/mkrbeacons.cxx, and Navaids/mkrbeacons.hxx which are all now
depricated.
1. Removed aircraft roll on ground.
2. Decreased descent pitch angle.
3. Updated flightplans to include <on-ground>
4. Fixed property indexing, so all AI aircraft have their own property branch
The default value of <on-ground> is false, so you only need to specify it when
on the ground. For takeoff you need to specify <on-ground>true</on-ground>
for the first waypoint, and for the acceleration waypoint. For landing you
need to specify it for the touchdown point and any taxi points.
One problem. WARNING **** There is a bug in the way the property system
works, which causes a segfault, but I don't know if the problem is in the
property code, or in how I'm using it. After an AI object terminates, if you
access the property tree through the property browser the sim will segfault.
First, preferences.xml will define the scenario filename.
For now, the other way of defining ai objects still works, so the sailboat
stays in preferences.xml. Later, I'll move the sailboat into the demo
scenario. If no scenario filename is given, then no scenario will be
processed.
I changed the demo scenario to create two 737's, one takes off on runway 01L,
and the other takes off on runway 01R. This will make a good demo for the ai
system. One problem, if you takeoff on 28L/R right away, you might run into
the taking-off 737's, or be scared.
Here's the newest AI stuff.
The AIManager at init() creates a new scenario. Right now the
default_scenario is hard coded in, but eventually the AIManager should get
the scenario filename from preferences.xml.
The scenario defines which AI objects will be created. Right now it only
creates AIAircraft, but this is easily extended. The scenario also defines
which flightplan will be assigned to the airplane. Scenario config files go
in data/Data/AI.
The Airplane gets a pointer to a FlightPlan object. Each airplane should get
its own flightplan object, even if two airplanes have the same flight plan.
This is because the flightplan maintains the iterator pointing to the
current waypoint, and two airplanes might be at different locations (for
instance if they were created at different times). The flight plan files go
in data/Data/AI/FlightPlans.
When the airplane gets to the waypoint named "END" it vanishes. The
AIAircraft destructor deletes its flight plan (if it has one).
The last waypoint is a place holder only. I called mine
<WPT><NAME>"EOF"</NAME></WPT>.
little larger.
The text widget can now be meaningfully associated with a property; in
PUI, it's "value" isn't the same thing as its label, but we can hack
things to treat them symmetrically.
Commit an experimental "live" property that can be set on widgets to
cause them to update their values every frame. This works great for
text widgets, as above. Note that this synchronization is input-only:
no support is provided (or needed -- the GUI only changes when the
user does something) for writing those properties out every frame.
the 30 seconds that Maik had originally intended, according to the comment.
This is important for the pending sound and rotor disc changes (and of course
for realism).
Fix the leg distance calculation to display nautical miles instead of meters.
It turns out that Simgear already has a range normalize function, so I use
that one instead.
for a while, it turned out to be pretty easy to implement. Also, the
property picker is now non-modal, I presume the modality wasn't an
intentional feature.
I've added a vertical navigation capability to the GPS module. One can input
two waypoints, wp[0] and wp[1], with altitude. If the altitudes differ, then
the altitude deviation from a "straigth" line from wp[0] to wp[1] is
calculated. The true course and course deviation from wp[0] to wp[1] is also
calculated. All this can be found in the wp subdir where one also finds the
wp[0] and wp[1] subdirs.
All this has to be done through the property browser. Maybe I should make a
gui window for the GPS!
"slow/windmilling propeller" regime. I'm happy with the foundations
of the solution, but this hasn't been complete tested yet. The
solution behavior seems fine on the planes I tried.
PistonEngine class has grown an "Engine" superclass. Some other stuff
moved around too, and I cleaned up some property naming while I was in
there. This hasn't been tested very thorougly, hopefully I didn't
break anything.
configure and compile out-of-the-box on a MinGW target:
Use -lSDL instead of -lglut32 on windows builds when --enable-sdl
is set.
Link against alut.dll in addition to openal32.dll.
Replace BSD bcopy() with ANSI C memmove() in a few places. This is
simpler than trying to abstract it out as a platform dependency in a
header file; bcopy() has never been standard.
The ENABLE_THREADS handling has changed to be set to 0 when threads
are not in use. This breaks expressions like #ifdef ENABLE_THREADS.
Replace with a slightly more complicated expression. It might have
been better to fix the configure.ac script, but I didn't know how and
this whole setting is likely to go away soon anyway.
The MinGW C runtime actually does include snprintf, so only MSVC
builds (and not all WIN32 ones) need _snprintf in JSBSim/FGState.cpp
Building on a platform with no glut at all exposed some spots where
plib/pu.h was being included without a toolkit setting (it defaults to
glut). Include fg_os.hxx first.
And when still using glut, glut.h has a bizarre dependency on a
_WCHAR_T_DEFINED symbol. It it's not defined, it tries to redefine
(!!) wchar_t to disasterous effect.
anymore. Instead Frederic Bouvier suggests to add a <number> tag to
the axis definition which accepts values for <windows> and <unix>
for now but which can be extended later on:
<axis>
<desc>Rudder</desc>
<number>
<unix>2</unix>
<windows>3</windows>
</number>
<binding>
<command>property-scale</command>
<property>/controls/flight/rudder</property>
<offset type="double">0.0</offset>
<factor type="double">1.0</factor>
<power type="double">2.0</power>
</binding>
</axis>
1. The listener is always positioned at the origin.
2. All sounds eminate from the aircraft's model position.
3. Sound positions are relative to the listener location.
I've added a tracking bug to the gps. This is of course very similar to a
heading bug for a DG. I don't know if this is the common name, but I feel
that for a gps the name tracking bug is more accurate than heading bug. A
true bug error and a magnetic bug error is calculated and shifted into the
-180 to 180 range so that they can be used by autopilots.
I've also fixed a property name that crept in when I had to change back to
indicated-***. Back then I accidentally changed the desired course name to
"indicated-course". The property that is supposed to be the input for the
desired course should naturally be named something like "desired-course", and
definitely _not_ "indicated-course". If this name change breaks anything it
should be fixed in the other end.
I've also commented out a lot of #includes that I don't think is needed. I'm
on Suse 9.0 now, and it builds fine here, but this might be a problem for
different platforms I guess we have to cross our fingers.
my code was accidentally drawing the cockpit twice
in view 0. This patch should fix the problem of
lights not seen through canopies or prop discs.
It was also drawing the lights ( ground and rw )
after the clouds, so they were not obscured by
them.
command bindings accessible from XML. This still probably isn't a final
solution (which would drive the HUD from propery values), but it's a step
in the right direction anyway.
This update contains a change to not overwrite the altitude-ft preset during
"onground" start. The change also prevents a ground trim issue with the
JSBSim fdm when a "reset" is done by FlightGear.
this patch is to clear a problem that I sometimes
encounter : FG locks when hitting the cancel button
of a dialog. In fact, an interator is always invalid
when it was used to erase a member of a collection.
The braces are here to help my debugger, and I also
removed a warning about unused variable.
I restored the output to cout / cerr
for the options and the warning for the version mismatch.
There is a dummy SG_LOG to allow the windows version to
popup the console.
The snapshot rendering use multipass now.
- We need to be able to support a per engine master bat/alt switch.
- Forgot to write the gear level state into the network structure.
native_fdm:
- renamed EGT->egt for consistancy.
- added manifold pressure to the structure.
FG_ENABLE_MULTIPASS_CLOUDS must be defined to enable
the algorithm. I made this because the stencil buffer
must be initialized at the beginning of the program and
OpenGL can fallback to software rendering if it can't
find a visual with stencil buffer. I didn't touch the
configure script, so CXXFLAGS=-DFG_ENABLE_MULTIPASS_CLOUDS
must be set before running ./configure.
If FG_ENABLE_MULTIPASS_CLOUDS is defined, the main render
loop begins by reading the /sim/rendering/multi-pass-clouds
property. It is a boolean property so there are only two
quality levels. false means no multi pass and no use of
the stencil buffer, true means an additionnal pass for
both upper and lower cloud layers.
The algorithms are as follow :
/sim/rendering/multi-pass-clouds=false
1. draw sky dome
2. draw terrain only
3. draw clouds above the viewer
4. draw models except the aircraft
5. draw clouds below the viewer
6. draw the aircraft.
The cloud rendering doesn't update the depth buffer.
This means that models overwrite clouds above the viewer.
This is only noticeable for tall buildings and when
flying very low. Also, drawing low clouds after models
means that they are not blended with models' translucent
surfaces. Large transparent area require alpha test
enabled and AI aircraft canopy are making holes. The
pilot's aircraft being rendered at the end, there is no
problem with canopy or prop disc.
/sim/rendering/multi-pass-clouds=true
1. draw the sky dome
2. draw the terrain only
3. draw all clouds
4. draw models except the aircraft
5. redraw the clouds where the models where drawn ( stencil
test on )
6. draw the aircraft
The assumptions made by this algoritm are that the terrain
is not transparent ( should be true in all cases and
that there are no clouds between the aircraft and the viewer.
Assuming these facts, there should be no blending bugs.
The screenshot rendering is not updated yet.
the keyboard modifiers outside of a key event handler, so adding the
fgGetKeyModifiers() call to doMouseMotion was broken. The user could
see "phantom" modifier keys.
trying the --show-aircraft option, I noticed that I had
no output. This is because there are still output to
cout or cerr, that are not triggering my console patch
for windows. The patch attached use SG_LOG instead.
A request to hit a key is also added because otherwise,
the console window will disappear as soon as the program
stop.
This problem is minor though given the fact that fgfs.exe
is shipped with fgrun that do show the available aircraft
in a much nicer manner.
work on the pa28 idle and without creating ridiculous side effects
(like being able to fly the aircraft with the starter motor, heh).
This one looks pretty good for now, pending work on the propeller to
get its low speed drag in line with reality.
reads the /consumables tree for input to determine weights, but
places output only in /engines/engine[n]/fuel-consumed-lbs where
it gets picked up by the Nasal code.