1
0
Fork 0
Commit graph

134 commits

Author SHA1 Message Date
mfranz
5ebd1a18f3 add <load>/<unload> support to AI models, including aircraft models. For
aircraft models this is only called if they are loaded as AI, not if they
are the model flown by the human pilot. This has technical reasons (too
soon for Nasal/fg), but is useful to distinguish AI and non-AI use, for
example to set a different livery for AI models, or to set different
animation properties.
2006-03-09 11:14:16 +00:00
ehofman
479d4d7484 Mathias Fröhlich:
Fix the AI-Radar code.
2006-03-04 12:49:30 +00:00
durk
395ea07252 Bugfix: variable fp was deleted in both AIBase::~AIBase() and AIAircraft::AIAircraft(), resulting in a segmentation fault.
Here the delete fp; statement is removed from the AIAircraft() destructor.
2006-02-23 21:42:11 +00:00
mfranz
c9813d1b5d new FSF address 2006-02-21 01:16:04 +00:00
ehofman
5fe860750e Mathias Fröhlich:
This patch makes use of the vectors now available in simgear with that past
patch. And using that it simplyfies the carrier code somehow.

- Small additional factory's to the quaternion code are done in the simgear
  part. Also more explicit unit names in the factory functions.
- The flightgear part makes use of them and simplyfies some computations
  especially in the carrier code.
- The data part fixes the coordinate frames I used for the park positions in
  the carrier to match the usual ones. I believed that I had done so, but it
  was definitly different. Also there are more parking positions avaliable now.
2006-02-19 17:28:31 +00:00
fredb
36e4045810 Add missing include files needed by the new math code under windows 2006-02-18 13:58:09 +00:00
ehofman
da6568ad50 Mathias Fröhlich:
The new multiplayer patch with an extension to transmit some properties with
the base package. The properties are transmitted in a way that will not
immediately brake the packet format if we need new ones.
Even if the maxmimum number needs to be limited somehow, that format might
work well until we have an improoved packet format which is even more compact
and that does not require to retransmit redundant information with each
packet.

That part is relatively fresh and based on that what Oliver provides on his
multiplayer server web page.

The properties are transferred to the client and I have modified the seahawks
rudder animation property to use a relative property path to verify that it
works appart from the fact that you can see it changing in the property
browser.

The movement is still a bit jerky, but that can be fixed/tuned later without
again braking the packet format.
2006-02-17 09:43:33 +00:00
ehofman
3894dc75a7 Remove empty files. 2006-02-11 13:57:40 +00:00
ehofman
4bfd1722df Mathias Froehlich:
This patch removes some useless indirection when creating AIModels. It
obsolets AIScenario*.

AIEntities are just an intermediate copy of an other intermediate copy of an
xml file on the way from the ai scenario configuration file to the AIModels.
As such the AImodels can now be created directly from the property tree read
from the scenario file.

This reduces the amount of work needed to add an other AIModel and reduces the
amount of copy operations done during initialization.

It also moves internal knowledge of special AI models into these special AI
models class instead of spreading that into the whole AIModel subdirectory
which in turn enables to use carrier internal data structures for carrier
internal data ...

Also some unused variables are removed from the AIModel classes.
I believe that there are still more of them, but that is what I stumbled
accross ...

Tested, like the other splitouts these days in a seperate tree and using the
autopilot for some time, and in this case with a carrier start ...
2006-02-11 13:16:56 +00:00
ehofman
5bd2ef1edb Vivian Meazza:
This patch is a combined effort by Gregor Richards, Oliver Schroeder, and
Vivian Meazza (and code cleanups and improvements by Erik Hofman). It corrects
the bug in which a Multiplayer model responds to local inputs, and the view
number bug which caused certain aircraft to appear as cockpit only models. It
passes remote properties over the net, and all major control surfaces and gear
are now animated correctly, providing that the local ~model.xml file contains
no leading "/" in the <property></property> data entries. MP objects
are now extrapolated using 1st and 2nd derivatives to make their movement
appear more smooth. The sim is now halted while a new client joins the net.

Known problems with MP are non-display of the remote client under certain
circumstances of starting/resetting, and a freeze on starting. These bugs are
long standing, and are not addressed by this patch.

Special thanks must go to AJ Macleod for his patient testing of this patch over many evenings.

We have also moved part of multiplayer into AIModels as part of the ongoing
development of MP.
2006-02-09 12:29:05 +00:00
ehofman
a47725e92f Mathias Fröhlich:
Make use of the automatic reference counting class for ssg* data in flightgear.
2006-02-08 10:25:56 +00:00
mfranz
d1ad73558f Vivian MEAZZA:
"Implement the repeat function for submodels. Default value is 'false' "
2006-01-30 22:08:53 +00:00
ehofman
bd1f711b51 Durk Talsma:
- Feet to meter conversion mistake (in AI getGround elev)
- Improved ground following code (not yet perfect, but for now no one will
  notice it within the marginal altitiude differences at the taxitrack or
  runway)
- Exclusion of the "AI" directory witihin data/Aircraft in
  main/init/fgSearchAircraft, to prevent AI aircraft to be picked up by the
  aircraft search function
2006-01-30 13:29:49 +00:00
ehofman
713ddd05dd Olaf Flebbe: Make sure the model gets deleted when it's not referenced anymore. 2005-12-30 09:34:29 +00:00
ehofman
4be621fbe9 Durk Talsma, Olaf Flebbe & Mathias Fröhlich:
Split up simple.cxx
2005-12-29 13:58:21 +00:00
mfranz
1caefda2a0 - fix typos
- fix indentation (there were 2, 3, 4, 7(!) space indents as well as tab
  indents, all mixed together)
- no code changes, except one "if (foo) {}" changed to "if (!foo) return; ..."
2005-12-08 15:03:08 +00:00
mfranz
9c28ed0257 Vivian MEAZZA:
"Remove redundant code, tidy up and improve output properties"
make elevator work
2005-11-29 16:38:49 +00:00
mfranz
03bf631765 ban not so informative message 2005-11-28 10:18:39 +00:00
ehofman
388ddb244f Mathias Fröhlich:
While digging in flightgears lost memory, I found that endless loop.
2005-11-27 09:50:26 +00:00
ehofman
9df7af3924 David Culp:
Here's a fix for a bug I introduced when I updated the AIStorm with
turbulence.  The change I made to the FGAIEntity struct was overriding the
thermal <strength-fps> data.
2005-11-16 15:23:18 +00:00
mfranz
853d19e09b Harald JOHNSEN:
"the model is deref'd and deleted when the refcount is null *but* it is
still referenced in the ai model list, so next time you ask for it you will
have a reference on something deleted"
2005-10-30 10:50:36 +00:00
ehofman
b24dbb3f8b Alex Romosan:
I tried to make sure accessor functions which return by reference act
on const objects. also replaced some iterators with const_iterator
and a few return/pass by reference that were missed the first time
around.
2005-10-26 09:03:49 +00:00
ehofman
62a359cc4a Alex Romosan:
* Use "const string&" rather than "string" in function calls when appropriate.
* Use "const Point3D&" instead of "Pint3D" in function calls when appropriate.
* Improved course calculation in calc_gc_course_dist()
* Safer thread handling code.

Vassilii Khachaturov:

Dont use "const Point3D&" for return types unless you're absolutely sure.

Erik Hofman:

* Use SGD_(2)PI(_[24]) as defined in simgear/constants.h rather than
  calculating it by hand every time.
2005-10-25 13:49:55 +00:00
mfranz
abf558620b this may be informative on first sight, but not when output in a loop 2005-10-22 19:33:32 +00:00
ehofman
54594e5219 Durk Talsma:
Auf Niederlandisch:
Bij deze de patch voor de taxiway code. Deze code is nog gebaseerd
op de bestaaande architectuur, gebaseerd op de FGAirport class in simple.[ch]xx
Ik heb me voornamelijk gericht op nieuwe functionaliteit; de volgende
submissie zal waarschijnlijk bestaan uit opschoning, opsplitsing en een
implementatie van de nieuwe airport architectuur, zoals voorgesteld door
David Luff.

En Anglais:
Here is the patch for the taxiway code. This code is still based on the
exsisting architecture, which is based on the FGAirport class in simple.[ch]xx
I've aimed mostly at new functionality; The next batch will probably contain
code cleanups, splitups and the implementation fo the new airport architecture,
as proposed by David Luff.
2005-10-18 18:44:37 +00:00
mfranz
13945c6cd4 Mathias Froehlich: fix refcounting problem that caused submodel crashes 2005-10-18 18:01:43 +00:00
ehofman
5c0dbf7b65 Don't use the this pointer for referencing the AIModels anymore, this
turns out to get problematic on 64-bit systems. Instead use a regular
int based approach.
2005-10-15 14:55:51 +00:00
ehofman
54a33c3899 Mathias Fröhlich:
I had a quick view over the ssgBase::ref() calls in flightgear.
I made them all symmetric and used ssgDeRefDelete to dereference them.
This has the basic advantage that ssgDeRefDelete additionaly deletes the
memory instead of just decrementing the reference cound without deletion ...

This includes an incorrect deref instead of a ssgDeRefDelete in the placement
transform registration I introduced earlier. I believe that this causes the
problems with long flights (unverified, but with a big propability).
2005-10-15 14:51:52 +00:00
ehofman
f057fd0d48 Martin Spott: Use standardized Sun directive. 2005-10-06 11:08:26 +00:00
ehofman
1c3e2d4942 Vivian Meazza:
This adds a TACAN instrument to the inventory. Range and bearing are calculated
to the TACAN or VORTAC beacon selected by means of the Channel Selector in the E
quipment/Radio pull-down menu.

A TACAN beacon has also been added to the aircraft carrier Nimitz (channel #029Y
).
2005-10-01 09:56:53 +00:00
ehofman
fad67bda10 Mathias Fröhölöiööhlich:
There was a patch from Manuel Masing a few months ago which cleaned up
SGLocation's way depending on input values. That means that with that patch
SGLocation does no longer have calls with unneeded input arguments.
I took his patch and integrated that into flightgear and made maximum use of
that changes.


Erik Hofman:
Remove some duplicate code that was moved to simgear/compiler.h
2005-09-05 13:25:09 +00:00
ehofman
99276dd060 MSVC fix. 2005-08-18 09:17:39 +00:00
ehofman
b92f034550 Vivian Meazza:
Some quite extensive changes to the AIModel code:

1. Mathias has made major changes to the AICarrier code to provide better
alignment of an aircraft on deck with the carrier - this feature is a major
improvement on the existing, but has a bug which might cause it to fail when
the computer carries out other tasks - changing window size is a known
example. This bug is outwith this code.

2.  I have made significant changes to the AIShip code to enable a ship the
turn and roll smoothly.

3. I have added some simple AI which enables the carrier to remain within,
or return to, an operating box.

4. An automated turn into wind for flying operations.

5. A simplistic implementation of TACAN within AICarrier. I am in the course
of implementing this as a generic instrument, but this is some time off
completion.
2005-08-16 09:37:23 +00:00
ehofman
7b824755ee Mathias Fröhlich:
I have prepared a patch that:
- Introduces a FGTileMgr::scenery_available method which asks the tilemanager
  if scenery for a given range around a lat/lon pair is already loaded and make
  use of that method at some -9999 meter checks.
- Introduces a FGScenery::get_elevation_m method which queries the altitude at
  a given position. In constrast to the groundcache functions this is the best
  choice if you ask for one *single* altitude value. Make use of that thing in
  AI/ATC classes and for the current views ground level. At the current views
  part the groundcache is reused if possible.
- The computation of the 'current groundlevel' is no longer done on the
  tilemanagers update since the required functions are now better seperated.

Alltogether it eliminates somehow redundant terrain level computations which
are now superseeded by that more finegrained functions and the existence of
the groundcache. Additionally it introduces an api to commonly required
functions which was very complex to do prevously.
2005-08-14 12:57:12 +00:00
ehofman
15f3ef3cfb Harald JOHNSEN:
- AIManager.cxx :
  - we can now have multiple <scenario> entries in the sim/ai entry in preferences.xml
- AIBase.cxx :
  - added an exception handler around the loading of the 3D model to not exit FG
    if the model is not found
- AIScenario.cxx :
  - removed a duplicated read of the xml file, this was also exiting FG is the xml file
    does not exist
2005-07-24 14:05:28 +00:00
ehofman
1869b30b58 Mathias Fröhlich:
I have traced that reset on carrier problem down to several problems. One of
them is the fact that on reset the carrier is updated while the aircraft is
not. That made the aircraft drop down an elevator sometimes. Depending on the
passed realtime while loading some parts of the scenery.
2005-07-13 12:25:16 +00:00
ehofman
4df7a3e9f8 Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.

With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.

That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
 FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
 FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.

Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.

The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.

Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
mfranz
9f0397a720 - replace one SGPropertyNode* by SGPropertyNode_ptr to avoid crash with
temporary removeChild(); should be done even after reverting; the node
  is accessed after removal
- cleanup:  if (foo) delete foo  -->  delete foo
2005-06-30 18:34:20 +00:00
ehofman
ab83702c16 David Culp:
I added an AIStatic object to my OV-10 sim for use in putting city signs,
vehicles, or anything else that will be static, but that I don't want to put
in the scenery files.  It's inexpensive.  Before, I was making such things
from AIShip.

I also added the ability to set flight plans to repeat, so that when an
airplane reaches the end it just starts over at the beginning.  This is
useful for my OV-10 sim.  I have C-141 and KC-135 traffic flying approaches
to Ramstein, and I only have to define two AI objects to do this.

Also, I found an inefficiency in AIBase, where every AI object was calculating
Mach number at every dt.  Now only AIBallistic objects do this.
2005-06-04 09:38:52 +00:00
ehofman
9c146d5527 MSVC fix. 2005-05-22 07:36:26 +00:00
ehofman
4b5a80129d David Culp:
1)  The AIStorm sets the properties:
         /environment/turbulence/magnitude-norm
         /environment/turbulence/rate-hz

    The actual turbulence effects are handled by the FDM.
    If the effects are deemed unrealistic, then that will
    have to be fixed in the FDM(s).


2)  The zone of turbulence is cylindrical, and is centered
    at the AIStorm's lat/lon.  The diameter is set with
    <diameter-ft>, the top with <height-msl>, the bottom is
    assumed to be at <altitude> minus 1000 feet.

3)  Note that the zone of turbulence may not match well with
    the visual model of the storm.  In this case I had to
    x-offset the storm model by 4700 meters to match the zone
    of turbulence. (i.e. the storm model is 4700m off center).

4)  While I was in there I also increased the speed of the
    lightning flashes to look more realistic.
2005-05-16 09:48:00 +00:00
ehofman
408dcc38b1 Solaris fixes 2005-05-07 08:56:42 +00:00
ehofman
2d9108e253 Add lightning support from David Culp. 2005-05-02 12:29:13 +00:00
ehofman
4c10ef139c Mathias:
I have done a patch to eliminate the jitter of 3D-objects near the viewpoint
(for example 3D cockpit objects).
The problem is the roundoff accuracy of the float values used in the
scenegraph together with the transforms of the eyepoint relative to the
scenery center.

The solution will be to move the scenery center near the view point.
This way floats relative accuracy is enough to show a stable picture.

To get that right I have introduced a transform node for the scenegraph which
is responsible for that shift and uses double values as long as possible.
The scenery subsystem now has a list of all those transforms required to place
objects in the world and will tell all those transforms that the scenery
center has changed when the set_scenery_center() of the scenery subsystem is
called.
The problem was not solvable by SGModelPlacement and SGLocation, since not all
objects, especially the scenery, are placed using these classes.

The first approach was to have the scenery center exactly at the eyepoint.
This works well for the cockpit.
But then the ground jitters a bit below the aircraft. With our default views
you can't see that, but that F-18 has a camera view below the left engine
intake with the nose gear and the ground in its field of view, here I could
see that.
Having the scenery center constant will still have this roundoff problems, but
like it is now too, the roundoff error here is exactly the same in each
frame, so you will not notice any jitter.

The real solution is now to keep the scenery center constant as long as it is
in a ball of 30m radius around the view point. If the scenery center is
outside this ball, just put it at the view point.

As a sideeffect of now beeing able to switch the scenery center in the whole
scenegraph with one function call, I was able to remove a one half of a
problem when switching views, where the scenery center was far off for one or
two frames past switching from one view to the next. Also included is a fix
to the other half of this problem, where the view position was not yet copied
into a view when it is switched (at least under glut). This was responsible
for the 'Error: ...' messages of the cloud subsystem when views were
switched.
2005-04-29 14:38:24 +00:00
ehofman
3b5512f573 David Culp:
I'm looking through the AI code, trying to find the bug that's killing the
thermals.  The following things don't look right:

1)  AIManager::101  ,   the Traffic Manager pointer is searched for by name at
every dt.   I'll leave this for you to look at.

2)  AIManager::295  ,  the thermal height is not being set.  We need to
restore the line:         ai_thermal->setHeight(entity->height_msl);
This fixes the thermal problem.

3)  AIManager::328  ,  I changed the fetching of the user state to occur every
sim cycle, and changed the fetching function from by-name lookup to a lookup
by node pointer.  It should be faster now, and more accurate too.  This helps
the air-refueling.
2005-04-19 12:52:26 +00:00
ehofman
d461e7868f Melchior FRANZ:
- don't treat *every* child in the xml as submodel, especially not a "param"
  block
- do not only *enable* the contrail flag above some altitude, but also
  disable it below
2005-03-31 08:54:04 +00:00
ehofman
50bdf6098a Mathias Fröhlich:
I have done some cleanup where I moved some values out of classes where they
do not belong and such stuff.
Also the fols offsets are now named in the carrier xml file with a more
verbose name (flols-pos/offset-*) than before (only offset-*).
There is a little preparation for definitions of parking positions on the
carrier which should later be used for starting flightgear directly on the
carrier.
2005-03-19 09:57:18 +00:00
ehofman
7cc58da6a9 Vivian Meazza:
I attach the long-promised improved version of the USS Nimitz.

It includes an improved version of the FLOLS, which requires the attached
diff to be applied to AICarrier.cxx and AICArrier.hxx.

I've made lots of eye-candy in the form or the flightdeck crew.
Unfortunately, it about doubles the size of the tarball. I'll send it to you
later; when I've figured out some way of only loading on request (any advice
would be very welcome).

I could provide a \u2018bare\u2019 version to cut down on the vertex count for
less capable systems however, the count isn\u2019t huge in the first place.
I've cut the textures down as far as I can without losing definition.
2005-02-24 15:05:56 +00:00
ehofman
02a757f9e6 MSVC (warning) fixes. 2005-02-18 10:16:30 +00:00
ehofman
5bc15d7a69 Durk Talsma:
I just heard from John Wojnaroski that you and he are going to work on getting
a flightgear demo machine up for the linux expo thursday and Friday. John
indicated that he would very much like to get a CVS version with the new
traffic code up and running before the expo.
2005-02-10 09:01:51 +00:00