]> git.mxchange.org Git - flightgear.git/blob - src/ATC/AILocalTraffic.hxx
Patch from Julian Foad:
[flightgear.git] / src / ATC / AILocalTraffic.hxx
1 // FGAILocalTraffic - AIEntity derived class with enough logic to
2 // fly and interact with the traffic pattern.
3 //
4 // Written by David Luff, started March 2002.
5 //
6 // Copyright (C) 2002  David C. Luff - david.luff@nottingham.ac.uk
7 //
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.
12 //
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.
17 //
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.
21
22 /*****************************************************************
23 *
24 * WARNING - Curt has some ideas about AI traffic so anything in here
25 * may get rewritten or scrapped.  Contact Curt curt@flightgear.org 
26 * before spending any time or effort on this code!!!
27 *
28 ******************************************************************/
29
30 #ifndef _FG_AILocalTraffic_HXX
31 #define _FG_AILocalTraffic_HXX
32
33 #include <plib/sg.h>
34 #include <plib/ssg.h>
35 #include <simgear/math/point3d.hxx>
36
37 #include "tower.hxx"
38 #include "AIEntity.hxx"
39
40 typedef enum pattern_leg {
41     TAKEOFF_ROLL,
42     OUTWARD,
43     TURN1,
44     CROSSWIND,
45     TURN2,
46     DOWNWIND,
47     TURN3,
48     BASE,
49     TURN4,
50     FINAL,
51     LANDING_ROLL
52 };
53
54 class FGAILocalTraffic : public FGAIEntity {
55
56 public:
57
58     FGAILocalTraffic();
59     ~FGAILocalTraffic();
60
61     // Initialise
62     void Init();
63
64     // Run the internal calculations
65     void Update();
66
67 private:
68
69     char* airport;      // The ICAO code of the airport that we're operating around
70     double freq;        // The frequency that we're operating on - might not need this eventually
71     FGTower* tower;     // A pointer to the tower control.
72
73     double mag_hdg;     // degrees - the heading that the physical aircraft is pointing
74     double mag_var;     // degrees
75
76     double vel;         // velocity along track in m/s
77     double track;       // track - degrees relative to *magnetic* north
78     double slope;       // Actual slope that the plane is flying (degrees) - +ve is uphill
79     double AoA;         // degrees - difference between slope and pitch
80     // We'll assume that the plane doesn't yaw or slip - the track/heading difference is to allow for wind
81
82     // Performance characteristics of the plane in knots and ft/min
83     double Vr;
84     double best_rate_of_climb_speed;
85     double best_rate_of_climb;
86     double nominal_climb_speed;
87     double nominal_climb_rate;
88     double nominal_circuit_speed;
89     double min_circuit_speed;
90     double max_circuit_speed;
91     double nominal_descent_rate;
92     double nominal_approach_speed;
93     double stall_speed_landing_config;
94
95     // OK, what do we need to know whilst flying the pattern
96     pattern_leg leg;
97
98 };
99
100 #endif  // _FG_AILocalTraffic_HXX