1
0
Fork 0
Commit graph

166 commits

Author SHA1 Message Date
Tim Moore
bb419b588c Merge branch 'durk/traffic' 2009-12-22 00:15:13 +01:00
Tim Moore
c4e62cc69f Don't allocate string temporaries for comparisons. 2009-12-20 10:34:07 +01:00
durk
bfd3efde5c Allow flights that arrive at their departure airport. 2009-12-07 00:12:28 +01:00
jmt
daadb16370 Logging: less verbose traffic-manager startup. 2009-09-17 22:45:30 +02:00
frohlich
8676c2bbd8 Replace the SGVec*::sg() methods with the equivalent SGVec*::data() calls.
Modified Files:
	src/Traffic/Schedule.cxx src/Sound/fg_fx.cxx src/Main/main.cxx
	src/Instrumentation/navradio.cxx
	src/AIModel/AIFlightPlanCreateCruise.cxx
2009-09-09 08:56:30 +02:00
Tim Moore
d838ef5f40 compilation fixes for gcc -Wall -Werror
Most are cosmetic, but the changes in the FGATCInstruction constructor
fix unitialized members.
2009-08-24 17:13:31 +02:00
jmt
6c65a26ddf Switch some log message from the traffic code to SG_BULK (with Durk's permission) 2009-07-02 08:59:16 +02:00
jmt
52bac46535 Replace CourseAndDistance uses in traffic code with SGGeodesy calls. 2009-06-11 16:05:20 +02:00
frohlich
a99ea1c7b5 Port over remaining Point3D usage to the more type and unit safe SG* classes.
Remove leftover headers from plib/sg.

Modified Files:
 	src/AIModel/AIBase.cxx
 	src/AIModel/AIFlightPlanCreateCruise.cxx
 	src/ATCDCL/AIEntity.cxx src/ATCDCL/AIEntity.hxx
 	src/ATCDCL/AIGAVFRTraffic.cxx src/ATCDCL/AIGAVFRTraffic.hxx
 	src/ATCDCL/AILocalTraffic.cxx src/ATCDCL/AILocalTraffic.hxx
 	src/ATCDCL/AIMgr.cxx src/ATCDCL/ATC.hxx
 	src/ATCDCL/ATCDialog.cxx src/ATCDCL/ATCProjection.cxx
 	src/ATCDCL/ATCProjection.hxx src/ATCDCL/ATCutils.cxx
 	src/ATCDCL/ATCutils.hxx src/ATCDCL/approach.cxx
 	src/ATCDCL/commlist.cxx src/ATCDCL/ground.cxx
	src/ATCDCL/ground.hxx src/ATCDCL/tower.cxx
 	src/ATCDCL/tower.hxx src/Airports/calc_loc.cxx
 	src/Airports/dynamics.cxx src/Airports/groundnetwork.cxx
 	src/Airports/parking.cxx src/Airports/runwayprefs.cxx
 	src/Airports/simple.cxx src/Cockpit/cockpit.cxx
 	src/Cockpit/hud.hxx src/Cockpit/hud_card.cxx
 	src/Cockpit/hud_rwy.cxx src/Environment/environment.cxx
 	src/FDM/UFO.cxx src/FDM/SP/MagicCarpet.cxx src/GUI/dialog.hxx
 	src/Instrumentation/HUD/HUD.hxx
 	src/Instrumentation/HUD/HUD_runway.cxx
 	src/Instrumentation/KLN89/kln89.cxx src/Main/fg_init.cxx
 	src/Main/viewer.cxx src/Main/viewmgr.cxx
 	src/Model/panelnode.cxx src/MultiPlayer/mpmessages.hxx
 	src/Scenery/tilemgr.cxx src/Traffic/SchedFlight.cxx
 	src/Traffic/TrafficMgr.cxx
2009-03-18 08:00:08 +01:00
durk
d24fe19914 One step further toward better integration of AI and ATC systems.
* Changed the runway XX. ATC message to actually report the real
   designated departure runway
 * In case of multiple active runways, select the one with a heading that is
   closest to the direction of the ultimate departure destination / lines up
   with the arrival path.
2009-02-16 00:56:44 +01:00
durk
c6f88e5b9b Development for two new features:
* Some support for geometry information provided by the custom scenery
   project. Current support is for AI groundnets and runway use files only
   since this is a switch that involves a lot of data verification and
   updating, during the transistion the actual path where the data can be
   read from is user configurable. setting the property

   /sim/traffic-manager/use-custom-scenery-data to true

  will cause flightgear to read the ground networks from the scenery
  directory (--{fg-scenery}/Airports/[I]/[C]/[A]/[ICAO].groundnet.xml to be
  precise). Setting this property to false will retain the original
  behvior.
* For departing aircraft, runway takeoff calculations will be done on the
  basis of the performance database. For testing purposes, a performance
 estimate for a heavy jet has been added.
2009-02-01 23:44:10 +01:00
durk
63d224081e James Turner: Rewrite of the getSpeed function. Smaller and more elegant. 2009-01-07 10:32:25 +01:00
jmt
660d59a098 Another clean-up iteration: FGAirportList::search is gone, replaced by two
static FGAirport helpers. As a result, another global index goes away. Use
the helpers to avoid ugly FGPositioned down-casts in various places.

Also converts the environment/METAR code to deal with FGAirport pointers,
instead of string identifiers, and contains work-in-progress code to implement
the AirportList dialog using FGPositioned. This isn't enabled yet for various
reasons, but is the final piece to allow FGAirportList to be removed.
2008-12-26 15:26:42 +00:00
fredb
af8903b61c Comment out an unused non compilable function 2008-11-16 14:17:52 +00:00
durk
d8a2726894 Traffic Manager II source code changes
- Decouple aircraft entities from Flights
- Dynamic runtime flight assignment for each aircraft
2008-11-16 13:45:24 +00:00
ehofman
429f2530de James Turner:
* experimental clean-up / reduction on two of the FG headers:
   (I'm going to await feedback on the developers list before doing more of
    these, to avoiding going over files multiple times, but in principle it
    seems pretty straightforward.)

 * final fixes for SG_USING_STD removal
2008-07-29 08:27:48 +00:00
ehofman
667e64e1eb - remove the SG_GLxxxx_H #defines, since OSG provides its own versions
- this exposed a bizarre issue on Mac where dragging in <AGL/agl.h> in
   extensions.hxx was pulling in all of Carbon to the global namespace
   - very scary. As a result, I now need to explicitly include CoreFoundation
   in fg_init.cxx.
 - change SG_USING_STD(x) to using std::x
2008-07-27 16:25:13 +00:00
fredb
af879b8310 Fix Traffic Manager XML parser 2008-06-01 11:56:32 +00:00
durk
0e59cf4a08 - Add some DEBUG level log messages to help users in getting traffic files
to work.
 - Add the possibility to load only proportion of traffic in order to
   reduce some of the workload, in case of a slower computer.
2008-05-08 06:11:43 +00:00
durk
7783e64953 Some tweaks and finetuning made possible by the multihreaded modelloader
and the pushback code:
 - Traffic manager starts modelload requests immediately upon program
   loading
 - Only create legs 1 (push back) or five (cruise) of AI traffic.
 - AIAircraft's rather obsessive behavior to circle around a waypoint is
   largely resolved
 - More realistic ground steering for AI aircraft.
2008-04-02 19:01:48 +00:00
timoore
00f8463ab4 Another round of memory leak fixes from Till Busch 2008-01-24 23:05:58 +00:00
durk
e038ca1d76 Harald Johnsen: Change directory exists() logic to enable traffic loading
on Windows-XP machines.
2007-08-18 05:09:46 +00:00
frohlich
49779e64f0 Modified Files:
src/AIModel/AIFlightPlanCreateCruise.cxx
	src/Traffic/Schedule.cxx:
	SGGeoc::fromCart should now work correct.
2007-07-27 19:31:44 +00:00
durk
b452234cb2 Fixes and code clean-up:
- Airports Directory
Thomas Foerster: Pulls out the FGTaxiNode implementation into gnnode.cxx.
Melchior / Durk: Copy Constructor and assignment operator for FGTaxiRoute

- AIModels Directory
Durk / Melchior / Czaba Halasz: Ensure that all derived classes use AIBase
member 'callsign'. Adapted, moved and deleted getter/setter functions where
necessary
Czaba Halasz: Fix AIBase model path vs. submodel path consistency.

- Traffic Directory and AIModels CreateFlightPlanCruise
DT: Temporary revert parts of the position estimation code.
2007-07-15 14:08:31 +00:00
frohlich
c1e29d0998 Modified Files:
src/AIModel/AIFlightPlan.hxx
	src/AIModel/AIFlightPlanCreateCruise.cxx
	src/AIModel/AITanker.cxx src/Traffic/Schedule.cxx:
	Move member variables that should better be in function local
	scope into the functions. Make more use of SGMath functions.
2007-07-08 08:46:29 +00:00
durk
2c3dc5fca1 -Minor fix: Only read traffic from data/Traffic/fgtraffic.xml if that path really exists.
- Added a comment explaining why the first 1000 frames are skipped.
2007-05-31 19:53:53 +00:00
durk
5b6e0f6cc1 Don't fix what ain't broke. 2007-05-25 07:20:41 +00:00
mfranz
a4fde6c4d8 - don't abort just because of an unexpected "repeat period"! Complain and
recover instead
- it was apparently planned to run the updated loop only every 1000th
  frame, but the counter isn't reset, so it runs every frame
- use SG_LOG instead of cerr
- don't add redundant slashes in SGPath::append()
2007-05-10 14:28:17 +00:00
frohlich
82d4fc6583 Modified Files:
src/Traffic/Schedule.cxx: Add trailing semicolon ...
2006-12-27 12:42:01 +00:00
durk
e48409d136 New traffic manager initialization. Search for all files
data/AI/Aircraft/*/*.xml and read traffic information from these files.
Current code still mimicks old behavior by reading data/Traffic/fgtraffic.xml
The latter functionality will be disabled once we have some traffic containing
files in data/AI/Aircraft.
2006-12-27 11:53:54 +00:00
durk
bd34d34d16 Change the traffic manager's position calculations to use a spherical
earth model instead of WGS84. WGS84 precision is overkill for what the
traffic manager requires, and also keeps locking up while computing
course and distance for anti podal points in New Zealand vs. south west
france.
2006-12-27 10:02:13 +00:00
fredb
462dd6900c Remove unused variables 2006-12-17 18:40:55 +00:00
durk
8634b9124e Modified the model path verification to take advantage of Maik Justus's
AI search path patch.
2006-12-17 08:01:56 +00:00
durk
33037b2139 AI Update:
- Ground network slow-down finally works as expected
   (although occasionally causing a traffic jam)
 - Hold position instruction now really sets speed to zero, in addition
   it actually works now for crossing and two-way traffic
 - Attempt to limit execution time of ground network trace algorithm
   to make performance acceptable at high-density networks
 - Removed remaining terminal messages
 - Various minor tweaks and clean-ups
2006-11-11 10:52:05 +00:00
durk
666910a793 Major update of traffic manager and AI related airport facilities.
- Moved AIModels/Traffic Manager related AI functions to a new file
- Rewrote the traffic manager so that the containers use pointers to
  objects instead of the objects themselves, which will allow for a
  more flexible memory management.
- Rewrote parts of the airport groundnetwork code, also because the
  stl containers now contain object pointers instead of the objects
  themselves.
- Fixed an uninitialized iterator in the AI distance tracking code
- Fixed flawed logic in some of the traffic controller's while loops
- Added a tower controller, which paces take-off behavior of AITraffic
  in a more realistic way.
- Various other minor fixes and fine tuning.
2006-10-06 17:36:31 +00:00
durk
5b2e16ca73 Ground network distance tracking code. AIAircraft taxiing at airports
maintain a resonable distance from each other while taxiing on the same
route. The current code does not yet take crossing routes or aircraft
taxiing into opposite directions into account.
2006-08-26 07:22:20 +00:00
durk
8c2e595ff0 Spectacular improvement in traffic manager initialization and preparatory
work for ground based distance separation of AIAircraft.

Traffic manager initialization related changes:
- Schedules initialize "on the fly", instead of during initialization
- Invalid routes are no longer deleted, but marked as BOGUS and ignored
- Changed loading order from a distance based prioritization to a point-
  score based prioritization, resulting in a much faster establisment of
  AIAircraft near the user's plane.

Preparatory work for ground-based separation of Aircraft.
- The groundnetwork findShrortestRoute function not only returns a list
  of waypoints, but also a list of taxi "segments" (a.k.a. taxiways).
- The taxiway list is stored in the Flightplan, and updated everytime
  a new taxi leg is created.
2006-07-29 18:17:19 +00:00
durk
943b1b8e79 Enable the airway database parsing. 2006-07-27 14:49:41 +00:00
mfranz
885f3f9b3a - use proper error output method
- warnings--
2006-03-31 16:56:14 +00:00
durk
6f7a9a5b1b Fix for an AIFlightPlan initialization problem in the traffic manager. 2006-03-29 18:36:21 +00:00
durk
f8eb3d4309 Bugfix: Non-existent AIModels could trigger a request to load scenery tiles
at (lon, lat) coordinates -1000,0. This patch fixes the AIModels/Traffic
Manager side of things. The AIModels subsystems allowed the creation of
AIAircraft with non-existent 3D models. If such a model didn't exist, the
aip class didn't get initialized, resulting in the above-mentioned bogus
position information. Here I circumvent this problem by a) only interacting
with the tile loader if the model is visible (and hence has succesfully been
initialized) and b) by disallowing the traffic manager to create AIAircraft
objects if the path to the 3D model doesn't exist.
2006-03-11 18:14:48 +00:00
mfranz
b33d28cf4b warning-- 2006-03-04 22:05:19 +00:00
mfranz
c9813d1b5d new FSF address 2006-02-21 01:16:04 +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
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
curt
880a43bdbf John Ellson:
Changes require to compile with a Fedora-Core Development system running
on an X86_64 platform with gcc-4.1.0.
2005-12-29 16:22:38 +00:00
ehofman
9090fb5bf4 Olaf Flebbe:
The prototype of update_metar_properties does not match overridden func.
trafficmgr: iterators below begin() and after end().
tower.cxx : iterator incrementing beyond end().
2005-12-19 13:03:19 +00:00
ehofman
5956ade90c Mathias: silence some valgrind warnings so that you can concentrate better on the real problems. 2005-12-06 18:32:07 +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
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
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
curt
0bb1494452 David Luff:
Attached is a patch to the airport data storage that I would like committed
after review if acceptable.  Currently the storage of airports mapped by ID
is by locally created objects - about 12 Meg or so created on the stack if
I am not mistaken.  I've changed this to creating the airports on the heap,
and storing pointers to them - see FGAirportList.add(...) in
src/Airports/simple.cxx.  I believe that this is probably better practice,
and it's certainly cured some strange problems I was seeing when accessing
the airport data with some gps unit code.  Changes resulting from this have
cascaded through a few files which access the data - 11 files are modified
in all.  Melchior and Durk - you might want to test this and shout if there
are problems since the metar and traffic code are probably the biggest
users of the airport data.  I've also added a fuzzy search function that
returns the next matching airport code in ASCII sequence in order to
support gps units that have autocompletion of partially entered codes.

More generally, the simple airport class seems to have grown a lot with the
fairly recent addition of the parking, runway preference and schedule time
code.  It is no longer just an encapsulation of the global airport data
file, and has grown to 552 bytes in size when unpopulated (about 1/2 a K!).
 My personal opinion is that we should look to just store the basic data in
apt.dat for all global airports in a simple airport class, plus globally
needed data (metar available?), and then have the traffic, AI and ATC
subsystems create more advanced airports for themselves as needed in the
area of interest.  Once a significant number of airports worldwide have
ground networks and parking defined, it will be impractical and unnecessary
to store them all in memory.  That's just a thought for the future though.
2005-09-20 20:26:57 +00:00
ehofman
62bb2277bc MingW32 fixes. 2005-09-11 09:53:55 +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
d871ca845f Cygwin fixes. 2005-02-18 12:40:38 +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
a7139a816c Durk Talsma:
Fix a couple of places that were not yet using SGPath
2004-12-27 17:35:22 +00:00
curt
222446df29 Replace the data/Airports/basic.dat.gz and data/Airports/runways.dat.gz with
a single apt.dat.gz file which is in the native X-Plane format.

To do this I wrote a front end loader than builds the airport and runway
list.  Some of the changes I needed to make had a cascading effect, so there
are minor naming changes scattered throughout the code.
2004-12-22 23:57:07 +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
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
d158c8168d Make use of a pointer to a structure to pass multiple parameters around. 2004-09-07 09:53:23 +00:00
ehofman
025a1e2491 Durk Talsma:
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.
2004-07-22 18:50:29 +00:00
ehofman
38f5e2c1dd MSVC fixes 2004-06-06 08:35:09 +00:00
ehofman
0d3bd26188 Ingnore some generated files." 2004-06-05 08:51:29 +00:00
ehofman
b3e9697262 Add the AIModel based air traffic subsystem from Durk Talsma. 2004-06-03 17:59:14 +00:00