]> git.mxchange.org Git - flightgear.git/blob - src/ATC/AIPlane.hxx
Preliminary support for AI planes from Dave Luff. This works only at
[flightgear.git] / src / ATC / AIPlane.hxx
1 // FGAIPlane - abstract base class for an AI plane
2 //
3 // Written by David Luff, started 2002.
4 //
5 // Copyright (C) 2002  David C. Luff - david.luff@nottingham.ac.uk
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 /*****************************************************************
22 *
23 * WARNING - Curt has some ideas about AI traffic so anything in here
24 * may get rewritten or scrapped.  Contact Curt curt@flightgear.org 
25 * before spending any time or effort on this code!!!
26 *
27 ******************************************************************/
28
29 #ifndef _FG_AI_PLANE_HXX
30 #define _FG_AI_PLANE_HXX
31
32 #include <Model/model.hxx>
33 #include <plib/sg.h>
34 #include <plib/ssg.h>
35 #include <simgear/math/point3d.hxx>
36
37 #include "AIEntity.hxx"
38
39
40 /*****************************************************************
41 *
42 *  FGAIPlane - this class is derived from FGAIEntity and adds the 
43 *  practical requirement for an AI plane - the ability to send radio
44 *  communication, and simple performance details for the actual AI
45 *  implementation to use.  The AI implementation is expected to be
46 *  in derived classes - this class does nothing useful on its own.
47 *
48 ******************************************************************/
49 class FGAIPlane : public FGAIEntity {
50
51 public:
52
53     virtual ~FGAIPlane();
54
55     // Run the internal calculations
56     virtual void Update(double dt);
57
58 protected:
59
60     double mag_hdg;     // degrees - the heading that the physical aircraft is *pointing*
61     double track;       // track that the physical aircraft is *following* - degrees relative to *true* north
62     double yaw;
63     double mag_var;     // degrees
64     double IAS;         // Indicated airspeed in knots
65     double vel;         // velocity along track in knots
66     double vel_si;      // velocity along track in m/s
67     double slope;       // Actual slope that the plane is flying (degrees) - +ve is uphill
68     double AoA;         // degrees - difference between slope and pitch
69     // We'll assume that the plane doesn't yaw or slip - the track/heading difference is to allow for wind
70
71     double freq;        // The comm frequency that we're operating on
72
73     // We need some way for this class to display its radio transmissions if on the 
74     // same frequency and in the vicinity of the user's aircraft
75     // This may need to be done independently of ATC eg CTAF
76     // Make radio transmission - this simply sends the transmission for physical rendering if the users
77     // aircraft is on the same frequency and in range.  It is up to the derived classes to let ATC know
78     // what is going on.
79     void Transmit(string msg);
80
81     void Bank(double angle);
82     void LevelWings(void);
83
84 };
85
86 #endif  // _FG_AI_PLANE_HXX
87