]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim.hxx
Started integrating Jon's doc++ comments.
[flightgear.git] / src / FDM / JSBSim.hxx
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:        JSBSim.hxx
4  Author:        Curtis L. Olson
5  Maintained by: Tony Peden, Curt Olson
6  Date started:  02/01/1999
7
8 ------ Copyright (C) 1999 - 2000  Curtis L. Olson (curt@flightgear.org) ------
9
10  This program is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License as
12  published by the Free Software Foundation; either version 2 of the
13  License, or (at your option) any later version.
14
15  This program is distributed in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
24 HISTORY
25 --------------------------------------------------------------------------------
26 02/01/1999   CLO   Created
27 Additional log messages stored in CVS
28
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 SENTRY
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
32
33 #ifndef _JSBSIM_HXX
34 #define _JSBSIM_HXX
35
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40 #include <FDM/JSBSim/FGFDMExec.h>
41 #include <FDM/JSBSim/FGInitialCondition.h>
42 #undef MAX_ENGINES
43 #include <Aircraft/aircraft.hxx>
44
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 DEFINITIONS
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
49 #define ID_JSBSIMXX "$Header JSBSim.hxx,v 1.4 2000/10/22 14:02:16 jsb Exp $"
50
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 FORWARD DECLARATIONS
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 CLASS DOCUMENTATION
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
62
63 /** FGFS / JSBSim interface (aka "The Bus")
64     This class provides for an interface between FlightGear and its data
65     structures and JSBSim and its data structures. This is the class which is
66     used to command JSBSim when integrated with FlightGear. See the
67     documentation for main for direction on running JSBSim apart from FlightGear.
68     @author Curtis L. Olson (original)
69     @author Tony Peden (Maintained and refined)
70     @version $Id$
71     @see main in file JSBSim.cpp (use main() wrapper for standalone usage)
72 */
73
74 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 CLASS DECLARATION
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
77
78 class FGJSBsim: public FGInterface {
79
80     // The aircraft for this instance
81     FGFDMExec *fdmex;
82     FGInitialCondition *fgic;
83     bool needTrim;
84     
85     bool trimmed;
86     float trim_elev;
87     float trim_throttle;
88
89 public:
90     /// Constructor
91     FGJSBsim::FGJSBsim(void);
92     /// Destructor
93     FGJSBsim::~FGJSBsim();
94
95     /// copy FDM state to LaRCsim structures
96     bool copy_to_JSBsim();
97
98     /// copy FDM state from LaRCsim structures
99     bool copy_from_JSBsim();
100
101     /// Reset flight params to a specific position
102     bool init( double dt );
103     
104     // Positions
105     void set_Latitude(double lat);  // geocentric
106     void set_Longitude(double lon);    
107     void set_Altitude(double alt);        // triggers re-calc of AGL altitude
108     //void set_AltitudeAGL(double altagl); // and vice-versa
109     
110     // Speeds -- setting any of these will trigger a re-calc of the rest
111     void set_V_calibrated_kts(double vc);
112     void set_Mach_number(double mach);
113     void set_Velocities_Local( double north, double east, double down );
114     void set_Velocities_Wind_Body( double u, double v, double w);
115     
116     // Euler angles 
117     void set_Euler_Angles( double phi, double theta, double psi );
118     
119     // Flight Path
120     void set_Climb_Rate( double roc);
121     void set_Gamma_vert_rad( double gamma);
122     
123     // Earth
124     void set_Sea_level_radius(double slr);
125     void set_Runway_altitude(double ralt);
126     
127     // Atmosphere
128     void set_Static_pressure(double p);
129     void set_Static_temperature(double T);
130     void set_Density(double rho);
131     void set_Velocities_Local_Airmass (double wnorth, 
132                                        double weast, 
133                                        double wdown );
134
135     // update position based on inputs, positions, velocities, etc.
136     bool update( int multiloop );
137 };
138
139
140 #endif // _JSBSIM_HXX
141
142