1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 2001 Jon S. Berndt (jsb@hal-pc.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 # include <simgear/compiler.h>
54 # if defined(sgi) && !defined(__GNUC__)
65 # include <simgear/constants.h>
69 #ifdef __FreeBSD__ // define gcvt on FreeBSD
73 static char *gcvt(double number, size_t ndigit, char *buf)
75 sprintf(buf, "%f", number);
80 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
84 #define ID_JSBBASE "$Id$"
86 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
123 FG_ALEFT_AILERON_POS,
124 FG_NLEFT_AILERON_POS,
125 FG_RIGHT_AILERON_POS,
126 FG_ARIGHT_AILERON_POS,
127 FG_NRIGHT_AILERON_POS,
160 FG_LBARH, //normalized horizontal tail arm
161 FG_LBARV, //normalized vertical tail arm
164 FG_VBARH, //horizontal tail volume
165 FG_VBARV, //vertical tail volume
171 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
175 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
179 /** JSBSim Base class.
180 @author Jon S. Berndt
184 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
190 /// Constructor for FGJSBBase.
193 /// Destructor for FGJSBBase.
194 virtual ~FGJSBBase() {};
196 /// JSBSim Message structure
199 unsigned int messageId;
202 enum mType {eText, eInteger, eDouble, eBool} type;
208 ///@name JSBSim Enums.
211 enum {eL = 1, eM, eN };
213 enum {eP = 1, eQ, eR };
214 /// Velocities U, V, W
215 enum {eU = 1, eV, eW };
216 /// Positions X, Y, Z
217 enum {eX = 1, eY, eZ };
218 /// Euler angles Phi, Theta, Psi
219 enum {ePhi = 1, eTht, ePsi };
220 /// Stability axis forces, Drag, Side force, Lift
221 enum {eDrag = 1, eSide, eLift };
222 /// Local frame orientation Roll, Pitch, Yaw
223 enum {eRoll = 1, ePitch, eYaw };
224 /// Local frame position North, East, Down
225 enum {eNorth = 1, eEast, eDown };
228 ///@name JSBSim console output highlighting terms.
231 static char highint[5];
232 /// low intensity text
233 static char halfint[5];
234 /// normal intensity text
235 static char normint[6];
236 /// resets text properties
237 static char reset[5];
239 static char underon[5];
241 static char underoff[6];
243 static char fgblue[6];
245 static char fgcyan[6];
247 static char fgred[6];
249 static char fggreen[6];
251 static char fgdef[6];
254 ///@name JSBSim Messaging functions
256 /** Places a Message structure on the Message queue.
257 @param msg pointer to a Message structure
258 @return pointer to a Message structure */
259 Message* PutMessage(Message* msg);
260 /** Creates a message with the given text and places it on the queue.
261 @param text message text
262 @return pointer to a Message structure */
263 Message* PutMessage(string text);
264 /** Creates a message with the given text and boolean value and places it on the queue.
265 @param text message text
266 @param bVal boolean value associated with the message
267 @return pointer to a Message structure */
268 Message* PutMessage(string text, bool bVal);
269 /** Creates a message with the given text and integer value and places it on the queue.
270 @param text message text
271 @param iVal integer value associated with the message
272 @return pointer to a Message structure */
273 Message* PutMessage(string text, int iVal);
274 /** Creates a message with the given text and double value and places it on the queue.
275 @param text message text
276 @param dVal double value associated with the message
277 @return pointer to a Message structure */
278 Message* PutMessage(string text, double dVal);
279 /** Reads the message on the queue (but does not delete it).
280 @return pointer to a Message structure (or NULL if no mesage) */
281 Message* ReadMessage(void);
282 /** Reads the message on the queue and removes it from the queue.
283 @return pointer to a Message structure (or NULL if no mesage) */
284 Message* ProcessMessage(void);
286 string GetVersion(void) {return JSBSim_version;}
289 static Message localMsg;
291 static queue <Message*> Messages;
293 virtual void Debug(int from) {};
295 static short debug_lvl;
296 static unsigned int frame;
297 static unsigned int messageId;
299 static const double radtodeg;
300 static const double degtorad;
301 static const double hptoftlbssec;
302 static const double fpstokts;
303 static const double ktstofps;
304 static const double inchtoft;
305 static const double Reng; // Specific Gas Constant,ft^2/(sec^2*R)
306 static const double SHRatio;
307 static const string needed_cfg_version;
308 static const string JSBSim_version;
311 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%