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
185 AP_WINGSLEVEL_HOLD_ON
188 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
189 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
192 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
196 /** JSBSim Base class.
197 @author Jon S. Berndt
201 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
207 /// Constructor for FGJSBBase.
210 /// Destructor for FGJSBBase.
211 virtual ~FGJSBBase() {};
213 /// JSBSim Message structure
216 unsigned int messageId;
219 enum mType {eText, eInteger, eDouble, eBool} type;
225 ///@name JSBSim Enums.
228 enum {eL = 1, eM, eN };
230 enum {eP = 1, eQ, eR };
231 /// Velocities U, V, W
232 enum {eU = 1, eV, eW };
233 /// Positions X, Y, Z
234 enum {eX = 1, eY, eZ };
235 /// Euler angles Phi, Theta, Psi
236 enum {ePhi = 1, eTht, ePsi };
237 /// Stability axis forces, Drag, Side force, Lift
238 enum {eDrag = 1, eSide, eLift };
239 /// Local frame orientation Roll, Pitch, Yaw
240 enum {eRoll = 1, ePitch, eYaw };
241 /// Local frame position North, East, Down
242 enum {eNorth = 1, eEast, eDown };
245 ///@name JSBSim console output highlighting terms.
248 static char highint[5];
249 /// low intensity text
250 static char halfint[5];
251 /// normal intensity text
252 static char normint[6];
253 /// resets text properties
254 static char reset[5];
256 static char underon[5];
258 static char underoff[6];
260 static char fgblue[6];
262 static char fgcyan[6];
264 static char fgred[6];
266 static char fggreen[6];
268 static char fgdef[6];
271 ///@name JSBSim Messaging functions
273 /** Places a Message structure on the Message queue.
274 @param msg pointer to a Message structure
275 @return pointer to a Message structure */
276 Message* PutMessage(Message* msg);
277 /** Creates a message with the given text and places it on the queue.
278 @param text message text
279 @return pointer to a Message structure */
280 Message* PutMessage(string text);
281 /** Creates a message with the given text and boolean value and places it on the queue.
282 @param text message text
283 @param bVal boolean value associated with the message
284 @return pointer to a Message structure */
285 Message* PutMessage(string text, bool bVal);
286 /** Creates a message with the given text and integer value and places it on the queue.
287 @param text message text
288 @param iVal integer value associated with the message
289 @return pointer to a Message structure */
290 Message* PutMessage(string text, int iVal);
291 /** Creates a message with the given text and double value and places it on the queue.
292 @param text message text
293 @param dVal double value associated with the message
294 @return pointer to a Message structure */
295 Message* PutMessage(string text, double dVal);
296 /** Reads the message on the queue (but does not delete it).
297 @return pointer to a Message structure (or NULL if no mesage) */
298 Message* ReadMessage(void);
299 /** Reads the message on the queue and removes it from the queue.
300 @return pointer to a Message structure (or NULL if no mesage) */
301 Message* ProcessMessage(void);
303 string GetVersion(void) {return JSBSim_version;}
306 static Message localMsg;
308 static queue <Message*> Messages;
310 virtual void Debug(int from) {};
312 static short debug_lvl;
313 static unsigned int frame;
314 static unsigned int messageId;
316 static const double radtodeg;
317 static const double degtorad;
318 static const double hptoftlbssec;
319 static const double psftoinhg;
320 static const double fpstokts;
321 static const double ktstofps;
322 static const double inchtoft;
323 static const double in3tom3;
324 static const double Reng; // Specific Gas Constant,ft^2/(sec^2*R)
325 static const double SHRatio;
326 static const string needed_cfg_version;
327 static const string JSBSim_version;
330 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%