1 // FGAILocalTraffic - AIEntity derived class with enough logic to
2 // fly and interact with the traffic pattern.
4 // Written by David Luff, started March 2002.
6 // Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef _FG_AIGAVFRTraffic_HXX
23 #define _FG_AIGAVFRTraffic_HXX
25 #include <simgear/math/point3d.hxx>
26 #include <Main/fg_props.hxx>
29 #include "AIPlane.hxx"
30 #include "ATCProjection.hxx"
32 #include "AILocalTraffic.hxx"
37 class FGAIGAVFRTraffic : public FGAILocalTraffic {
44 // Init en-route to destID at point pt. (lat, lon, elev) (elev in meters, lat and lon in degrees).
45 bool Init(Point3D pt, string destID, const string& callsign);
46 // Init at srcID to fly to destID
47 bool Init(string srcID, string destID, const string& callsign, OperatingState state = PARKED);
49 // Run the internal calculations
50 void Update(double dt);
52 // Return what type of landing we're doing on this circuit
53 //LandingType GetLandingOption();
55 void RegisterTransmission(int code);
57 // Process callbacks sent by base class
58 // (These codes are not related to the codes above)
59 void ProcessCallback(int code);
63 // Do what is necessary to land and parkup at home airport
64 void ReturnToBase(double dt);
66 //void GetRwyDetails(string id);
71 // This is purely for synactic convienience to avoid writing globals->get_ATC_mgr()-> all through the code!
74 OperatingState operatingState;
75 bool touchAndGo; //True if circuits should be flown touch and go, false for full stop
77 // Performance characteristics of the plane in knots and ft/min - some of this might get moved out into FGAIPlane
78 double best_rate_of_climb_speed;
79 double best_rate_of_climb;
80 double nominal_climb_speed;
81 double nominal_climb_rate;
82 double nominal_cruise_speed;
83 double nominal_circuit_speed;
84 double nominal_descent_rate;
85 double nominal_approach_speed;
86 double nominal_final_speed;
87 double stall_speed_landing_config;
89 // environment - some of this might get moved into FGAIPlane
90 SGPropertyNode* wind_from_hdg; //degrees
91 SGPropertyNode* wind_speed_knots; //knots
93 atc_type changeFreqType; // the service we need to change to
95 void CalculateSoD(double base_leg_pos, double downwind_leg_pos, bool pattern_direction);
98 bool _towerContactedIncoming;
100 bool _clearedStraightIn;
102 bool _clearedDownwindEntry;
103 Point3D _wp; // Next waypoint (ie. the one we're currently heading for)
109 double _cruise_climb_ias;
120 int GetQuadrangleAltitude(int dir, int des_alt);
122 Point3D GetPatternApproachPos();
124 void FlyPlane(double dt);
126 // HACK for testing - remove or comment out before CVS commit!!!
127 //bool _towerContactPrinted;
130 #endif // _FG_AILocalTraffic_HXX