1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser 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 Lesser General Public License for more
19 You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41 #include "models/FGModel.h"
42 #include "math/FGColumnVector3.h"
43 #include "math/FGLocation.h"
44 #include "math/FGQuaternion.h"
45 #include "math/FGMatrix33.h"
48 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 #define ID_PROPAGATE "$Id: FGPropagate.h,v 1.41 2010/07/09 04:11:45 jberndt Exp $"
54 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61 class FGInitialCondition;
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 /** Models the EOM and integration/propagation of state.
68 The Equations of Motion (EOM) for JSBSim are integrated to propagate the
69 state of the vehicle given the forces and moments that act on it. The
70 integration accounts for a rotating Earth.
72 The general execution of this model follows this process:
74 -Calculate the angular accelerations
75 -Calculate the translational accelerations
76 -Calculate the angular rate
77 -Calculate the translational velocity
79 -Integrate accelerations and rates
81 Integration of rotational and translation position and rate can be
82 customized as needed or frozen by the selection of no integrator. The
83 selection of which integrator to use is done through the setting of
84 the associated property. There are four properties which can be set:
87 simulation/integrator/rate/rotational
88 simulation/integrator/rate/translational
89 simulation/integrator/position/rotational
90 simulation/integrator/position/translational
93 Each of the integrators listed above can be set to one of the following values:
96 0: No integrator (Freeze)
104 @author Jon S. Berndt, Mathias Froehlich
105 @version $Id: FGPropagate.h,v 1.41 2010/07/09 04:11:45 jberndt Exp $
108 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
112 class FGPropagate : public FGModel {
115 /** The current vehicle state vector structure contains the translational and
116 angular position, and the translational and angular velocity. */
117 struct VehicleState {
118 /** Represents the current location of the vehicle in Earth centered Earth
121 FGLocation vLocation;
123 /** The velocity vector of the vehicle with respect to the ECEF frame,
124 expressed in the body system.
126 FGColumnVector3 vUVW;
128 /** The angular velocity vector for the vehicle relative to the ECEF frame,
129 expressed in the body frame.
131 FGColumnVector3 vPQR;
133 /** The angular velocity vector for the vehicle body frame relative to the
134 ECI frame, expressed in the body frame.
136 FGColumnVector3 vPQRi;
138 /** The current orientation of the vehicle, that is, the orientation of the
139 body frame relative to the local, NED frame. */
140 FGQuaternion qAttitudeLocal;
142 /** The current orientation of the vehicle, that is, the orientation of the
143 body frame relative to the inertial (ECI) frame. */
144 FGQuaternion qAttitudeECI;
146 FGColumnVector3 vInertialVelocity;
148 FGColumnVector3 vInertialPosition;
150 deque <FGColumnVector3> dqPQRdot;
151 deque <FGColumnVector3> dqUVWdot;
152 deque <FGColumnVector3> dqInertialVelocity;
153 deque <FGQuaternion> dqQtrndot;
157 The constructor initializes several variables, and sets the initial set
158 of integrators to use as follows:
159 - integrator, rotational rate = Adams Bashforth 2
160 - integrator, translational rate = Adams Bashforth 2
161 - integrator, rotational position = Trapezoidal
162 - integrator, translational position = Trapezoidal
163 @param Executive a pointer to the parent executive object */
164 FGPropagate(FGFDMExec* Executive);
169 /// These define the indices use to select the various integrators.
170 enum eIntegrateType {eNone = 0, eRectEuler, eTrapezoidal, eAdamsBashforth2, eAdamsBashforth3, eAdamsBashforth4};
172 /// These define the indices use to select the gravitation models.
173 enum eGravType {gtStandard, gtWGS84};
175 /** Initializes the FGPropagate class after instantiation and prior to first execution.
176 The base class FGModel::InitModel is called first, initializing pointers to the
177 other FGModel objects (and others). */
178 bool InitModel(void);
180 /** Runs the Propagate model; called by the Executive.
181 @return false if no error */
184 void CalculatePQRdot(void);
185 void CalculateQuatdot(void);
186 void CalculateInertialVelocity(void);
187 void CalculateUVWdot(void);
188 const FGQuaternion& GetQuaterniondot(void) const {return vQtrndot;}
190 /** Retrieves the velocity vector.
191 The vector returned is represented by an FGColumnVector reference. The vector
192 for the velocity in Local frame is organized (Vnorth, Veast, Vdown). The vector
193 is 1-based, so that the first element can be retrieved using the "()" operator.
194 In other words, vVel(1) is Vnorth. Various convenience enumerators are defined
195 in FGJSBBase. The relevant enumerators for the vector returned by this call are,
196 eNorth=1, eEast=2, eDown=3.
198 @return The vehicle velocity vector with respect to the Earth centered frame,
199 expressed in Local horizontal frame.
201 const FGColumnVector3& GetVel(void) const { return vVel; }
203 /** Retrieves the body frame vehicle velocity vector.
204 The vector returned is represented by an FGColumnVector reference. The vector
205 for the velocity in Body frame is organized (Vx, Vy, Vz). The vector
206 is 1-based, so that the first element can be retrieved using the "()" operator.
207 In other words, vUVW(1) is Vx. Various convenience enumerators are defined
208 in FGJSBBase. The relevant enumerators for the vector returned by this call are,
211 @return The body frame vehicle velocity vector in ft/sec.
213 const FGColumnVector3& GetUVW(void) const { return VState.vUVW; }
215 /** Retrieves the body axis acceleration.
216 Retrieves the computed body axis accelerations based on the
217 applied forces and accounting for a rotating body frame.
218 The vector returned is represented by an FGColumnVector reference. The vector
219 for the acceleration in Body frame is organized (Ax, Ay, Az). The vector
220 is 1-based, so that the first element can be retrieved using the "()" operator.
221 In other words, vUVWdot(1) is Ax. Various convenience enumerators are defined
222 in FGJSBBase. The relevant enumerators for the vector returned by this call are,
225 @return Body axis translational acceleration in ft/sec^2.
227 const FGColumnVector3& GetUVWdot(void) const { return vUVWdot; }
229 /** Retrieves the body angular rates vector, relative to the ECEF frame.
230 Retrieves the body angular rates (p, q, r), which are calculated by integration
231 of the angular acceleration.
232 The vector returned is represented by an FGColumnVector reference. The vector
233 for the angular velocity in Body frame is organized (P, Q, R). The vector
234 is 1-based, so that the first element can be retrieved using the "()" operator.
235 In other words, vPQR(1) is P. Various convenience enumerators are defined
236 in FGJSBBase. The relevant enumerators for the vector returned by this call are,
239 @return The body frame angular rates in rad/sec.
241 const FGColumnVector3& GetPQR(void) const {return VState.vPQR;}
243 /** Retrieves the body angular rates vector, relative to the ECI (inertial) frame.
244 Retrieves the body angular rates (p, q, r), which are calculated by integration
245 of the angular acceleration.
246 The vector returned is represented by an FGColumnVector reference. The vector
247 for the angular velocity in Body frame is organized (P, Q, R). The vector
248 is 1-based, so that the first element can be retrieved using the "()" operator.
249 In other words, vPQR(1) is P. Various convenience enumerators are defined
250 in FGJSBBase. The relevant enumerators for the vector returned by this call are,
253 @return The body frame inertial angular rates in rad/sec.
255 const FGColumnVector3& GetPQRi(void) const {return VState.vPQRi;}
257 /** Retrieves the body axis angular acceleration vector.
258 Retrieves the body axis angular acceleration vector in rad/sec^2. The
259 angular acceleration vector is determined from the applied forces and
260 accounts for a rotating frame.
261 The vector returned is represented by an FGColumnVector reference. The vector
262 for the angular acceleration in Body frame is organized (Pdot, Qdot, Rdot). The vector
263 is 1-based, so that the first element can be retrieved using the "()" operator.
264 In other words, vPQRdot(1) is Pdot. Various convenience enumerators are defined
265 in FGJSBBase. The relevant enumerators for the vector returned by this call are,
268 @return The angular acceleration vector.
270 const FGColumnVector3& GetPQRdot(void) const {return vPQRdot;}
272 /** Retrieves the Euler angles that define the vehicle orientation.
273 Extracts the Euler angles from the quaternion that stores the orientation
274 in the Local frame. The order of rotation used is Yaw-Pitch-Roll. The
275 vector returned is represented by an FGColumnVector reference. The vector
276 for the Euler angles is organized (Phi, Theta, Psi). The vector
277 is 1-based, so that the first element can be retrieved using the "()" operator.
278 In other words, the returned vector item with subscript (1) is Phi.
279 Various convenience enumerators are defined in FGJSBBase. The relevant
280 enumerators for the vector returned by this call are, ePhi=1, eTht=2, ePsi=3.
282 @return The Euler angle vector, where the first item in the
283 vector is the angle about the X axis, the second is the
284 angle about the Y axis, and the third item is the angle
285 about the Z axis (Phi, Theta, Psi).
287 const FGColumnVector3& GetEuler(void) const { return VState.qAttitudeLocal.GetEuler(); }
289 /** Retrieves a body frame velocity component.
290 Retrieves a body frame velocity component. The velocity returned is
291 extracted from the vUVW vector (an FGColumnVector). The vector for the
292 velocity in Body frame is organized (Vx, Vy, Vz). The vector is 1-based.
293 In other words, GetUVW(1) returns Vx. Various convenience enumerators
294 are defined in FGJSBBase. The relevant enumerators for the velocity
295 returned by this call are, eX=1, eY=2, eZ=3.
297 @param idx the index of the velocity component desired (1-based).
298 @return The body frame velocity component.
300 double GetUVW (int idx) const { return VState.vUVW(idx); }
302 /** Retrieves a body frame acceleration component.
303 Retrieves a body frame acceleration component. The acceleration returned
304 is extracted from the vUVWdot vector (an FGColumnVector). The vector for
305 the acceleration in Body frame is organized (Ax, Ay, Az). The vector is
306 1-based. In other words, GetUVWdot(1) returns Ax. Various convenience
307 enumerators are defined in FGJSBBase. The relevant enumerators for the
308 acceleration returned by this call are, eX=1, eY=2, eZ=3.
310 @param idx the index of the acceleration component desired (1-based).
311 @return The body frame acceleration component.
313 double GetUVWdot(int idx) const { return vUVWdot(idx); }
315 /** Retrieves a Local frame velocity component.
316 Retrieves a Local frame velocity component. The velocity returned is
317 extracted from the vVel vector (an FGColumnVector). The vector for the
318 velocity in Local frame is organized (Vnorth, Veast, Vdown). The vector
319 is 1-based. In other words, GetVel(1) returns Vnorth. Various convenience
320 enumerators are defined in FGJSBBase. The relevant enumerators for the
321 velocity returned by this call are, eNorth=1, eEast=2, eDown=3.
323 @param idx the index of the velocity component desired (1-based).
324 @return The body frame velocity component.
326 double GetVel(int idx) const { return vVel(idx); }
328 /** Retrieves the total inertial velocity in ft/sec.
330 double GetInertialVelocityMagnitude(void) const { return VState.vInertialVelocity.Magnitude(); }
332 /** Retrieves the inertial velocity vector in ft/sec.
334 const FGColumnVector3& GetInertialVelocity(void) const { return VState.vInertialVelocity; }
336 /** Retrieves the inertial position vector.
338 const FGColumnVector3& GetInertialPosition(void) const { return VState.vInertialPosition; }
340 /** Returns the current altitude above sea level.
341 This function returns the altitude above sea level.
343 @return The current altitude above sea level in feet.
345 double GetAltitudeASL(void) const { return VState.vLocation.GetRadius() - SeaLevelRadius; }
347 /** Returns the current altitude above sea level.
348 This function returns the altitude above sea level.
350 @return The current altitude above sea level in meters.
352 double GetAltitudeASLmeters(void) const { return GetAltitudeASL()*fttom;}
354 /** Retrieves a body frame angular velocity component relative to the ECEF frame.
355 Retrieves a body frame angular velocity component. The angular velocity
356 returned is extracted from the vPQR vector (an FGColumnVector). The vector
357 for the angular velocity in Body frame is organized (P, Q, R). The vector
358 is 1-based. In other words, GetPQR(1) returns P (roll rate). Various
359 convenience enumerators are defined in FGJSBBase. The relevant enumerators
360 for the angular velocity returned by this call are, eP=1, eQ=2, eR=3.
362 @param axis the index of the angular velocity component desired (1-based).
363 @return The body frame angular velocity component.
365 double GetPQR(int axis) const {return VState.vPQR(axis);}
367 /** Retrieves a body frame angular velocity component relative to the ECI (inertial) frame.
368 Retrieves a body frame angular velocity component. The angular velocity
369 returned is extracted from the vPQR vector (an FGColumnVector). The vector
370 for the angular velocity in Body frame is organized (P, Q, R). The vector
371 is 1-based. In other words, GetPQR(1) returns P (roll rate). Various
372 convenience enumerators are defined in FGJSBBase. The relevant enumerators
373 for the angular velocity returned by this call are, eP=1, eQ=2, eR=3.
375 @param axis the index of the angular velocity component desired (1-based).
376 @return The body frame angular velocity component.
378 double GetPQRi(int axis) const {return VState.vPQRi(axis);}
380 /** Retrieves a body frame angular acceleration component.
381 Retrieves a body frame angular acceleration component. The angular
382 acceleration returned is extracted from the vPQRdot vector (an
383 FGColumnVector). The vector for the angular acceleration in Body frame
384 is organized (Pdot, Qdot, Rdot). The vector is 1-based. In other words,
385 GetPQRdot(1) returns Pdot (roll acceleration). Various convenience
386 enumerators are defined in FGJSBBase. The relevant enumerators for the
387 angular acceleration returned by this call are, eP=1, eQ=2, eR=3.
389 @param axis the index of the angular acceleration component desired (1-based).
390 @return The body frame angular acceleration component.
392 double GetPQRdot(int axis) const {return vPQRdot(axis);}
394 /** Retrieves a vehicle Euler angle component.
395 Retrieves an Euler angle (Phi, Theta, or Psi) from the quaternion that
396 stores the vehicle orientation relative to the Local frame. The order of
397 rotations used is Yaw-Pitch-Roll. The Euler angle with subscript (1) is
398 Phi. Various convenience enumerators are defined in FGJSBBase. The
399 relevant enumerators for the Euler angle returned by this call are,
400 ePhi=1, eTht=2, ePsi=3 (e.g. GetEuler(eTht) returns Theta).
402 @return An Euler angle.
404 double GetEuler(int axis) const { return VState.qAttitudeLocal.GetEuler(axis); }
406 /** Retrieves the cosine of a vehicle Euler angle component.
407 Retrieves the cosine of an Euler angle (Phi, Theta, or Psi) from the
408 quaternion that stores the vehicle orientation relative to the Local frame.
409 The order of rotations used is Yaw-Pitch-Roll. The Euler angle
410 with subscript (1) is Phi. Various convenience enumerators are defined in
411 FGJSBBase. The relevant enumerators for the Euler angle referred to in this
412 call are, ePhi=1, eTht=2, ePsi=3 (e.g. GetCosEuler(eTht) returns cos(theta)).
414 @return The cosine of an Euler angle.
416 double GetCosEuler(int idx) const { return VState.qAttitudeLocal.GetCosEuler(idx); }
418 /** Retrieves the sine of a vehicle Euler angle component.
419 Retrieves the sine of an Euler angle (Phi, Theta, or Psi) from the
420 quaternion that stores the vehicle orientation relative to the Local frame.
421 The order of rotations used is Yaw-Pitch-Roll. The Euler angle
422 with subscript (1) is Phi. Various convenience enumerators are defined in
423 FGJSBBase. The relevant enumerators for the Euler angle referred to in this
424 call are, ePhi=1, eTht=2, ePsi=3 (e.g. GetSinEuler(eTht) returns sin(theta)).
426 @return The sine of an Euler angle.
428 double GetSinEuler(int idx) const { return VState.qAttitudeLocal.GetSinEuler(idx); }
430 /** Returns the current altitude rate.
431 Returns the current altitude rate (rate of climb).
433 @return The current rate of change in altitude.
435 double Gethdot(void) const { return -vVel(eDown); }
437 /** Returns the "constant" LocalTerrainRadius.
438 The LocalTerrainRadius parameter is set by the calling application or set to
439 sea level + terrain elevation if JSBSim is running in standalone mode.
441 @return distance of the local terrain from the center of the earth.
443 double GetLocalTerrainRadius(void) const;
445 double GetSeaLevelRadius(void) const { return SeaLevelRadius; }
446 double GetTerrainElevation(void) const;
447 double GetDistanceAGL(void) const;
448 double GetRadius(void) const {
449 if (VState.vLocation.GetRadius() == 0) return 1.0;
450 else return VState.vLocation.GetRadius();
452 double GetLongitude(void) const { return VState.vLocation.GetLongitude(); }
453 double GetLatitude(void) const { return VState.vLocation.GetLatitude(); }
455 double GetGeodLatitudeRad(void) const { return VState.vLocation.GetGeodLatitudeRad(); }
456 double GetGeodLatitudeDeg(void) const { return VState.vLocation.GetGeodLatitudeDeg(); }
458 double GetGeodeticAltitude(void) const { return VState.vLocation.GetGeodAltitude(); }
460 double GetLongitudeDeg(void) const { return VState.vLocation.GetLongitudeDeg(); }
461 double GetLatitudeDeg(void) const { return VState.vLocation.GetLatitudeDeg(); }
462 const FGLocation& GetLocation(void) const { return VState.vLocation; }
464 /** Retrieves the local-to-body transformation matrix.
465 The quaternion class, being the means by which the orientation of the
466 vehicle is stored, manages the local-to-body transformation matrix.
467 @return a reference to the local-to-body transformation matrix. */
468 const FGMatrix33& GetTl2b(void) const { return VState.qAttitudeLocal.GetT(); }
470 /** Retrieves the body-to-local transformation matrix.
471 The quaternion class, being the means by which the orientation of the
472 vehicle is stored, manages the body-to-local transformation matrix.
473 @return a reference to the body-to-local matrix. */
474 const FGMatrix33& GetTb2l(void) const { return VState.qAttitudeLocal.GetTInv(); }
476 /** Retrieves the ECEF-to-body transformation matrix.
477 @return a reference to the ECEF-to-body transformation matrix. */
478 const FGMatrix33& GetTec2b(void) const { return Tec2b; }
480 /** Retrieves the body-to-ECEF transformation matrix.
481 @return a reference to the body-to-ECEF matrix. */
482 const FGMatrix33& GetTb2ec(void) const { return Tb2ec; }
484 /** Retrieves the ECI-to-body transformation matrix.
485 @return a reference to the ECI-to-body transformation matrix. */
486 const FGMatrix33& GetTi2b(void) const { return VState.qAttitudeECI.GetT(); }
488 /** Retrieves the body-to-ECI transformation matrix.
489 @return a reference to the body-to-ECI matrix. */
490 const FGMatrix33& GetTb2i(void) const { return VState.qAttitudeECI.GetTInv(); }
492 /** Retrieves the ECEF-to-ECI transformation matrix.
493 @return a reference to the ECEF-to-ECI transformation matrix. */
494 const FGMatrix33& GetTec2i(void);
496 /** Retrieves the ECI-to-ECEF transformation matrix.
497 @return a reference to the ECI-to-ECEF matrix. */
498 const FGMatrix33& GetTi2ec(void);
500 /** Retrieves the ECEF-to-local transformation matrix.
501 Retrieves the ECEF-to-local transformation matrix. Note that the so-called
502 local from is also know as the NED frame (for North, East, Down).
503 @return a reference to the ECEF-to-local matrix. */
504 const FGMatrix33& GetTec2l(void) const { return VState.vLocation.GetTec2l(); }
506 /** Retrieves the local-to-ECEF transformation matrix.
507 Retrieves the local-to-ECEF transformation matrix. Note that the so-called
508 local from is also know as the NED frame (for North, East, Down).
509 @return a reference to the local-to-ECEF matrix. */
510 const FGMatrix33& GetTl2ec(void) const { return VState.vLocation.GetTl2ec(); }
512 /** Retrieves the local-to-inertial transformation matrix.
513 @return a reference to the local-to-inertial transformation matrix. */
514 const FGMatrix33& GetTl2i(void) { return VState.vLocation.GetTl2i(); }
516 /** Retrieves the inertial-to-local transformation matrix.
517 @return a reference to the inertial-to-local matrix. */
518 const FGMatrix33& GetTi2l(void) { return VState.vLocation.GetTi2l(); }
520 VehicleState* GetVState(void) { return &VState; }
522 void SetVState(VehicleState* vstate) {
523 VState.vLocation = vstate->vLocation;
524 VState.vUVW = vstate->vUVW;
525 VState.vPQR = vstate->vPQR;
526 VState.qAttitudeLocal = vstate->qAttitudeLocal;
527 VState.qAttitudeECI = vstate->qAttitudeECI;
529 VState.dqPQRdot.resize(4, FGColumnVector3(0.0,0.0,0.0));
530 VState.dqUVWdot.resize(4, FGColumnVector3(0.0,0.0,0.0));
531 VState.dqInertialVelocity.resize(4, FGColumnVector3(0.0,0.0,0.0));
532 VState.dqQtrndot.resize(4, FGColumnVector3(0.0,0.0,0.0));
535 void SetInertialOrientation(FGQuaternion Qi);
536 void SetInertialVelocity(FGColumnVector3 Vi);
538 const FGQuaternion GetQuaternion(void) const { return VState.qAttitudeLocal; }
540 void SetPQR(unsigned int i, double val) {
541 if ((i>=1) && (i<=3) )
542 VState.vPQR(i) = val;
545 void SetUVW(unsigned int i, double val) {
546 if ((i>=1) && (i<=3) )
547 VState.vUVW(i) = val;
552 void SetLongitude(double lon) { VState.vLocation.SetLongitude(lon); }
553 void SetLongitudeDeg(double lon) {SetLongitude(lon*degtorad);}
554 void SetLatitude(double lat) { VState.vLocation.SetLatitude(lat); }
555 void SetLatitudeDeg(double lat) {SetLatitude(lat*degtorad);}
556 void SetRadius(double r) { VState.vLocation.SetRadius(r); }
557 void SetLocation(const FGLocation& l) { VState.vLocation = l; }
558 void SetAltitudeASL(double altASL);
559 void SetAltitudeASLmeters(double altASL) {SetAltitudeASL(altASL/fttom);}
560 void SetSeaLevelRadius(double tt) { SeaLevelRadius = tt; }
561 void SetTerrainElevation(double tt);
562 void SetDistanceAGL(double tt);
563 void SetInitialState(const FGInitialCondition *);
564 void RecomputeLocalTerrainRadius(void);
566 void NudgeBodyLocation(FGColumnVector3 deltaLoc) {
567 vDeltaXYZEC = GetTb2ec()*deltaLoc;
568 VState.vLocation -= vDeltaXYZEC;
575 struct VehicleState VState;
577 FGColumnVector3 vVel;
578 FGColumnVector3 vPQRdot;
579 FGColumnVector3 vUVWdot;
580 FGColumnVector3 vInertialVelocity;
581 FGColumnVector3 vLocation;
582 FGColumnVector3 vDeltaXYZEC;
583 FGColumnVector3 vGravAccel;
584 FGColumnVector3 vOmegaEarth; // The Earth angular velocity vector
585 FGQuaternion vQtrndot;
588 FGMatrix33 Tl2b; // local to body frame matrix copy for immediate local use
589 FGMatrix33 Tb2l; // body to local frame matrix copy for immediate local use
590 FGMatrix33 Tl2ec; // local to ECEF matrix copy for immediate local use
591 FGMatrix33 Tec2l; // ECEF to local frame matrix copy for immediate local use
592 FGMatrix33 Tec2i; // ECEF to ECI frame matrix copy for immediate local use
593 FGMatrix33 Ti2ec; // ECI to ECEF frame matrix copy for immediate local use
594 FGMatrix33 Ti2b; // ECI to body frame rotation matrix
595 FGMatrix33 Tb2i; // body to ECI frame rotation matrix
598 FGLocation contactloc;
601 double LocalTerrainRadius, SeaLevelRadius, VehicleRadius;
603 eIntegrateType integrator_rotational_rate;
604 eIntegrateType integrator_translational_rate;
605 eIntegrateType integrator_rotational_position;
606 eIntegrateType integrator_translational_position;
609 void Integrate( FGColumnVector3& Integrand,
610 FGColumnVector3& Val,
611 deque <FGColumnVector3>& ValDot,
613 eIntegrateType integration_type);
615 void Integrate( FGQuaternion& Integrand,
617 deque <FGQuaternion>& ValDot,
619 eIntegrateType integration_type);
622 void Debug(int from);
625 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
627 #include "initialization/FGInitialCondition.h"