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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef _FG_AIGAVFRTraffic_HXX
23 #define _FG_AIGAVFRTraffic_HXX
25 #include <simgear/math/point3d.hxx>
26 #include <Main/fg_props.hxx>
28 #include "AILocalTraffic.hxx"
33 class FGAIGAVFRTraffic : public FGAILocalTraffic {
40 // Init en-route to destID at point pt. (lat, lon, elev) (elev in meters, lat and lon in degrees).
41 bool Init(const Point3D& pt, const string& destID, const string& callsign);
42 // Init at srcID to fly to destID
43 bool Init(const string& srcID, const string& destID, const string& callsign, OperatingState state = PARKED);
45 // Run the internal calculations
46 void Update(double dt);
48 // Return what type of landing we're doing on this circuit
49 //LandingType GetLandingOption();
51 void RegisterTransmission(int code);
53 // Process callbacks sent by base class
54 // (These codes are not related to the codes above)
55 void ProcessCallback(int code);
59 // Do what is necessary to land and parkup at home airport
60 void ReturnToBase(double dt);
62 //void GetRwyDetails(string id);
67 // This is purely for synactic convienience to avoid writing globals->get_ATC_mgr()-> all through the code!
70 OperatingState operatingState;
71 bool touchAndGo; //True if circuits should be flown touch and go, false for full stop
73 // Performance characteristics of the plane in knots and ft/min - some of this might get moved out into FGAIPlane
74 double best_rate_of_climb_speed;
75 double best_rate_of_climb;
76 double nominal_climb_speed;
77 double nominal_climb_rate;
78 double nominal_cruise_speed;
79 double nominal_circuit_speed;
80 double nominal_descent_rate;
81 double nominal_approach_speed;
82 double nominal_final_speed;
83 double stall_speed_landing_config;
85 // environment - some of this might get moved into FGAIPlane
86 SGPropertyNode* wind_from_hdg; //degrees
87 SGPropertyNode* wind_speed_knots; //knots
89 atc_type changeFreqType; // the service we need to change to
91 void CalculateSoD(double base_leg_pos, double downwind_leg_pos, bool pattern_direction);
94 bool _towerContactedIncoming;
96 bool _clearedStraightIn;
98 bool _clearedDownwindEntry;
99 Point3D _wp; // Next waypoint (ie. the one we're currently heading for)
105 double _cruise_climb_ias;
116 int GetQuadrangleAltitude(int dir, int des_alt);
118 Point3D GetPatternApproachPos();
120 void FlyPlane(double dt);
122 // HACK for testing - remove or comment out before CVS commit!!!
123 //bool _towerContactPrinted;
126 #endif // _FG_AILocalTraffic_HXX