Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

QuaternionAngVelDynamics.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////////////////////////
00002 /*! \file AttituteDynamics_QuaternionAngVel.h
00003 *  \brief Attitude Dynamic equations using Quaternions and Angular Velocities.
00004 *  \author $Author: jayhawk_hokie $
00005 *  \version $Revision: 1.4 $
00006 *  \date    $Date: 2006/08/11 19:48:38 $
00007 *//////////////////////////////////////////////////////////////////////////////////////////////////
00008 /* 
00009 */
00010 //////////////////////////////////////////////////////////////////////////////////////////////////
00011 
00012 #ifndef __OSESSAME_ATTDYN_QUATANGVEL_H__
00013 #define __OSESSAME_ATTDYN_QUATANGVEL_H__
00014 
00015 #include <matrix/Matrix.h>
00016 #include <utils/Integrator.h>
00017 #include <utils/Time.h>
00018 #include <orbit/Orbit.h>
00019 #include <orbit/OrbitState.h>
00020 #include <attitude/Attitude.h>
00021 #include <vector.h>
00022 
00023 
00024 using namespace std;
00025 using namespace O_SESSAME;
00026 
00027 /*! \brief Attitude state conversion function from Quaternion and Angular Velocity state vector.
00028 * \relates AttituteDynamics_QuaternionAngVel 
00029 *
00030 * This function converts a matrix of states from the AttituteDynamics_QuaternionAngVel right-hand
00031 * side function into an AttitudeState object. This conversion function is necessary for propagators 
00032 * to store to an AttitudeHistory object regardless of the equations of motion state vector being
00033 * used.
00034 * @param _meshPoint State vector from integration mesh point, [Quaternion (4), AngularVelocity (3)].
00035 * @param _convertedAttitudeState AttitudeState object that is converted from the mesh point vector.
00036 */
00037 
00038 static void QuaternionAngVelConvFunc(const Matrix &_meshPoint, AttitudeState &_convertedAttitudeState)
00039 {
00040     static Vector tempQ(4); 
00041     static Vector tempAngVel(3); 
00042     
00043     tempQ(_) = ~_meshPoint(_,_(2, 5));
00044     tempAngVel(_) = ~_meshPoint(1, _(6, 8));
00045     _convertedAttitudeState.SetState(Rotation(Quaternion(tempQ)), tempAngVel);
00046     return;
00047 }
00048 
00049 
00050 /*! \brief Attitude Dynamics equation using Quaternions and Angular Velocities as the state variables
00051 * @ingroup AttitudeEquationsOfMotion
00052 * 
00053 *
00054 The rotation of a rigid body is described by the kinematic equations of motion and the kinetic equations 
00055 of motion. As discussed above, the kinematics specifically model the current attitude of the body with 
00056 respect to time. The dynamics are characterized by the absolute angular velocity vector, $\omega$.
00057 
00058 Each attitude representation has a set of equations that describe its time rate of change due to the 
00059 dynamics of the rigid body. 
00060 
00061 The propagation of the Quaternion kinematics is defined as:
00062 \f[
00063 \dot {\bar{\bf q}} = {Q}\left(\bar{\bf q}\right){\bf \omega}
00064 \f] 
00065 \f[
00066  = \frac{1}{2}\begin{bmatrix}
00067    {{\bf{q}}^{\times}  + q_4  {\bf 1}}  \\
00068    { - {\bf{q}}^T }  \\
00069 \end{bmatrix} {\bf \omega}
00070 \f]
00071 \par
00072 The differential equations for the angular velocity in the body frame are based on Euler's equation:
00073 \f[
00074 \bf{I}\dot{\bf \omega}  = \bf{g} - \omega  \times \bf{I}\omega
00075 \f]
00076 where \f$\textbf{I}\f$ is the spacecraft moment of inertia matrix, \f$\omega\f$ is the body angular 
00077 velocity, and \f$\textbf{g}\f$ are the spacecraft torques.
00078 
00079 This equation can be verified for an axis-symmetric body under torques about the 1,2 axes as follows:
00080 \f[
00081 \omega_{1} = \omega_{01}\cos{\omega_{p}t} + \omega_{02}\sin{\omega_{p}t} + \frac{1}{I_{T}}\int^{t}_{0}{[g_{1}(\tau)\cos{(\omega_{p}(t-\tau))}+g_{2}(\tau)\sin{(\omega_{p}(t-\tau))}]d\tau}
00082 \f]
00083 \f[
00084 \omega_{2} = -\omega_{01}\sin{\omega_{p}t} + \omega_{02}\cos{\omega_{p}t} + \frac{1}{I_{T}}\int^{t}_{0}{[-g_{1}(\tau)\sin{(\omega_{p}(t-\tau))}+g_{2}(\tau)\cos{(\omega_{p}(t-\tau))}]d\tau}
00085 \f]
00086 \f[
00087 \omega_{3} = \omega_{03}
00088 \f]
00089 
00090 * @param _time current time (in seconds)
00091 * @param _state vector of states, \f$\left[\bar{\bf q},\bf{\omega}\right]^{T}\f$ (-, radians/second)
00092 * @param _pOrbit pointer to the current Orbit instance
00093 * @param _pAttitude pointer to the current Attitude instance
00094 * @param _parameters additional parameters for integration \f$\left[MOI(3\times3); MOI^{-1}(3\times3)\right]\f$ 
00095 * @param _torqueFuncPtr pointer to the torque calculating function
00096 * @return This attitude dynamics RHS returns the 7-element vector of time derivatives of state \f$\left[\dot{\bar{\mathbf q}},\dot{\mathbf \omega}\right]^{T}\f$
00097 */
00098 
00099 static Vector AttituteDynamics_QuaternionAngVel(const ssfTime &_time, const Vector& _integratingState, Orbit *_Orbit, Attitude *_Attitude, const Matrix &_parameters, const Functor &_torqueFuncPtr)
00100 {
00101         static Vector stateDot(7);
00102         static Quaternion quaternion(4);
00103         static Vector angularRate(3);
00104         Matrix inertiaMatrix(3,3);
00105         quaternion  = _integratingState( _( VectorIndexBase, VectorIndexBase+3 ) );
00106         angularRate = _integratingState( _( VectorIndexBase+4, VectorIndexBase+6 ) ); 
00107         inertiaMatrix = _parameters;
00108 
00109         /* quaternion kinematic differential equation (vector form) */
00110         stateDot( _(VectorIndexBase, VectorIndexBase+2) ) =  0.5 * ( quaternion(4) * angularRate - skew(angularRate) * quaternion( _(1,3) )); 
00111         stateDot( _(4,4) ) = (-0.5 * ~angularRate * quaternion( _(1,3) ) ) ;
00112         
00113         /* Euler Equation */
00114         stateDot( _(VectorIndexBase+4, VectorIndexBase+6) ) =  inertiaMatrix.inverse()*( - skew(angularRate) * inertiaMatrix * angularRate );   
00115 
00116         return (stateDot);
00117 }
00118 
00119 #endif
00120 // Do not change the comments below - they will be added automatically by CVS
00121 /*****************************************************************************
00122 *       $Log: QuaternionAngVelDynamics.h,v $
00123 *       Revision 1.4  2006/08/11 19:48:38  jayhawk_hokie
00124 *       Modified kinematic and dynamic equations.
00125 *       
00126 *       Revision 1.3  2006/08/08 22:13:10  jayhawk_hokie
00127 *       Commented torque call.
00128 *       
00129 *       Revision 1.2  2005/06/10 12:53:27  jayhawk_hokie
00130 *       Changed header file format to make it easier to link to the spacecraft code by only having to specify dsacss/dep/spacecraft/src (ex. "file.h" changed to <dir/file.h> where dir is a folder in src).
00131 *       
00132 *       Revision 1.1.1.1  2005/04/26 17:40:56  cakinli
00133 *       Adding OpenSESSAME to DSACSS distrib to capture fixed version.
00134 *       
00135 *       Revision 1.3  2003/10/18 21:37:27  rsharo
00136 *       Removed "../utils" from all qmake project paths. Prepended "utils
00137 *       /" to all #include directives for utils. Removed ".h" extensions from STL header
00138 *       s and referenced STL components from "std::" namespace.  Overall, changed to be
00139 *       more portable.
00140 *       
00141 *       Revision 1.2  2003/06/12 20:51:14  nilspace
00142 *       Requires a precomputer MOI inverse.
00143 *       
00144 *       Revision 1.1  2003/06/12 19:17:42  nilspace
00145 *       Initial Submission.
00146 *       
00147 *
00148 ******************************************************************************/

Generated on Wed Sep 5 12:54:24 2007 for DSACSS Operational Code by  doxygen 1.3.9.1