1
0
Fork 0
Commit graph

36 commits

Author SHA1 Message Date
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
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
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
4be621fbe9 Durk Talsma, Olaf Flebbe & Mathias Fröhlich:
Split up simple.cxx
2005-12-29 13:58:21 +00:00
ehofman
f057fd0d48 Martin Spott: Use standardized Sun directive. 2005-10-06 11:08:26 +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
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
408dcc38b1 Solaris fixes 2005-05-07 08:56:42 +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
ehofman
7a58ef58e7 MSVC fix 2004-12-05 09:34:03 +00:00
ehofman
c537267f96 Durk Talsma:
Okay, here's the latest update to the tarffic manager/AI Manager. AITraffic
can now fly multiple routes and be initialized while sitting statically at
airports.
2004-11-29 09:41:43 +00:00
ehofman
3b62b16fe9 Comment out the unalias code also. 2004-10-21 09:27:40 +00:00
ehofman
7d1ec00a2b Frederic Bouvier:
I think I found the problem in props.hxx. I have an exception when copying properties. An alias to a property that has no value trigger this exception. The code that generate that is in AIManager.cxx  :

void FGAIAircraft::bind() {
   FGAIBase::bind();

   props->tie("controls/gear/gear-down",
              SGRawValueMethods<FGAIAircraft,bool>(*this,
                                             &FGAIAircraft::_getGearDown));

   props->getNode("controls/lighting/landing-lights", true)
          ->alias("controls/gear/gear-down");
}

controls/gear/gear-down has no value ( _type == NONE ) and controls/lighting/landing-lights is copied somewhere.


Erik:

Frederic's fix was to change props.hxx but he has expressed his doubts.
For now I've commented out the line that causes the problem so we have more
time to look deeper into the problem.

cvs -z4 -q diff -u props.hxx (in directory I:\FlightGear\cvs\SimGear\simgear\props\)
Index: props.hxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/SimGear/simgear/props/props.hxx,v
retrieving revision 1.4
diff -u -r1.4 props.hxx
--- props.hxx	19 Sep 2004 09:08:12 -0000	1.4
+++ props.hxx	21 Oct 2004 07:10:54 -0000
@@ -622,7 +622,7 @@
   /**
    * Test whether this node contains a primitive leaf value.
    */
-  bool hasValue () const { return (_type != NONE); }
+  bool hasValue () const { return (_type != ALIAS && _type != NONE) || (_type == ALIAS && _value.alias->_type != NONE); }


   /**
2004-10-21 09:21:05 +00:00
ehofman
9e72a38165 Rearrange ID related code. The (this) pointer is now the unique ID of the AIModel which fixes a number of problems along the way. 2004-09-08 13:21:40 +00:00
ehofman
24820e6d5a Move the radar update code to the AIBase class. There seems to be a problem where all targets disappear whenever one of them disappears, but that was present in the previous update also. 2004-06-11 13:49:07 +00:00
ehofman
11290e8022 Remove an unnecessary property set. 2004-06-11 08:09:55 +00:00
ehofman
4fe886f008 Introduce a radar/in-range boolean property, end check this to see whether the CPU intensive radar calculations need to be done. If not, skip them. 2004-06-10 19:14:19 +00:00
ehofman
dda15ac488 David Culp:
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.
2004-06-06 08:50:17 +00:00
ehofman
3c1a7174fb David Culp:
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>
2004-05-29 11:39:10 +00:00
ehofman
b7acd97f2c Add the this pointer to the tied function calls. This makes it possible to make a distinction between the different aircraft models. 2004-05-27 13:16:53 +00:00
ehofman
22cd6dfb2a David Culp:
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.
2004-05-21 16:50:19 +00:00
ehofman
4d3e523f90 Add AI models enableing/disableing command line option and support code. 2004-05-19 13:55:49 +00:00
ehofman
0fda8efa03 Reduce the update delay from 500 ms to 100 ms. 2004-05-19 08:12:21 +00:00
ehofman
009fa7371d Some small updates that hopefully solve the segmentation fault at the end of the flightplan. 2004-05-18 09:09:08 +00:00
ehofman
1dfe93d550 David Culp:
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>.
2004-05-15 09:07:55 +00:00
curt
2acdd02879 Clean up various compiler warnings that have crept into the code. This
by no means get's them all, but it's a start.
2004-04-01 15:27:53 +00:00
ehofman
6a08c79fcc David Culp:
I added some things to the AI stuff to improve the AIThermal processing.
Before, all the thermals were processed in order, and the last one overwrote
the prior one.  Now, only the data from the nearest thermal is kept.  This
way a tile can be populated with many thermals, and (as long as they have the
same diameter) the one nearest the airplane correctly takes effect.  This
will make us ready for the next step, "auto-thermaling", where FlightGear's
tile manager can cover a tile with thermals, and set the thermal strength
based on land-use type.

I moved the enumerated object_type to the base class.  When an AI object is
created it now sets the _otype variable in the base class.  This lets the AI
manager find out what kind of AI object it is dealing with, using the base
pointer.  I also added a function isa() to the base class, so the manager can
process objects differently based on their type.

The AI manager now sends AIThermal processing to a different function, where
only the data from the nearest thermal is kept.  After the manager processes
all the AI objects, then the results from the nearest thermal are applied to
wind-from-down.
2004-03-07 12:08:46 +00:00
ehofman
85a1e5cc98 David Culp:
Here's a new batch of AI code which includes a working radar instrument.

I put the radar calculations into the existing AIAircraft class.  It was
easier that way, and it can always be migrated out later if we have to.
Every tenth sim cycle the AIManager makes a copy of the current user state
information.  When the AIAircraft updates it uses this information to
calculate the radar numbers.  It calculates:

1) bearing from user to target
2) range to target in nautical miles
3) "horizontal offset" to target.  This is the angle from the nose to the
   target, in degrees, from -180 to 180.  This will be useful later for a HUD.
4) elevation, in degrees (vertical angle from user's position to target
   position)
5) vertical offset, in degrees (this is elevation corrected for user's pitch)
6) rdot (range rate in knots, note:  not working yet, so I commented it out)

and three items used by the radar instrument to place the "blip"

7) y_shift, in nautical miles
8) x_shift, in nautical miles
9) rotation, in degrees

The radar instrument uses the above three items, and applies a scale factor to
the x-shift and y-shift in order to match the instrument's scale.  Changing
the display scale can be done entirely in the XML code for the instrument.
Right now it's set up only to display a 40 mile scale.

The radar is an AWACS view, which is not very realistic, but it is useful and
demonstrates the technology.  With just a little more work I can get a HUD
marker.  All I need to do there is make a bank angle adjustment to the
current values.
2004-02-27 10:20:17 +00:00
ehofman
863b0c9432 Make the AI models a bit more intelligent. The Gear should be extended and retracted automatically, the navigation lights turn on when sun-angle-rad > 1.57, strobe and beacon are always on and make sure all properties are returned in the right unit format. 2004-01-22 21:13:47 +00:00
ehofman
2d7a6e475d Split up model[] into ship[], aircraft[], ballistic[] and model[] (for unspecified models). 2003-12-22 12:30:35 +00:00
ehofman
298f53edef Tidy up the code a bit more, move /ai/model[] to /ai/models/model[] and make sure there can be more than one model subtree. 2003-12-22 10:24:15 +00:00
ehofman
9bc2517417 Make the AI model export it's internal state to the property tree under /ai/model[] using the same naming convention as used for the regular FDM. Also make sure the model animations are relative the the /ai/model[] node. 2003-12-21 20:12:55 +00:00
ehofman
4c01e0e76a Tidy up the code a bit 2003-12-21 13:42:01 +00:00
ehofman
cd0c447b43 Add David Culp's AI model manager code which is derived from David Luff's AI/ATC code. 2003-11-28 15:48:05 +00:00