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

AttitudeHistory.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////////////////////////
00002 /*! \file AttitudeHistory.h
00003 *  \brief Interface to the Attitude History class.
00004 *  \author $Author: jayhawk_hokie $
00005 *  \version $Revision: 1.2 $
00006 *  \date    $Date: 2005/06/10 12:53:28 $
00007 *//////////////////////////////////////////////////////////////////////////////////////////////////
00008 /*  
00009 */
00010 //////////////////////////////////////////////////////////////////////////////////////////////////
00011 
00012 #ifndef __ATTITUDE_HISTORY_H__
00013 #define __ATTITUDE_HISTORY_H__
00014 
00015 #include <rotation/Rotation.h>
00016 #include <attitude/AttitudeState.h>
00017 #include <utils/Time.h>
00018 #include <datahandling/History.h>
00019 #include <vector>
00020 using namespace std;
00021 namespace O_SESSAME {
00022 
00023 /*! \brief Class for storing a time history of attitude states.
00024 * \ingroup StateHistory
00025 *
00026 *  The AttitudeHistory class provides a container of previous AttitudeState objects. The user
00027 *       may append new states, reset the collection of states, or return the attitude history 
00028 *       in a matrix. If the user appends attitude states at time which earlier than the end 
00029 *       of the current history, the current history is deleted from that point on, and the 
00030 *       new attitude states are appended.
00031 *
00032 * \par Examples:
00033 \code
00034     AttitudeState myAttitudeState;
00035     myAttitudeState.SetRotation(Rotation(Quaternion(0,0,0,1)));
00036     Vector initAngVelVector(3);
00037         initAngVelVector(1) = 0.1;
00038     myAttitudeState.SetAngularVelocity(initAngVelVector);
00039 
00040     AttitudeHistory myAttitudeHistory;                     // create an attitude history with an empty collection
00041     myAttitudeHistory.AppendHistory(0, myAttitudeState);   // add the state myAttitudeState which occured at t=0 to the history
00042 
00043     cout << myAttitudeHistory.GetHistory() << endl;  // Get a matrix of the stored state and output 
00044                                                      // [t0, attitude parameters @ t=0]
00045                                                      // [t1, attitude parameters @ t=1]
00046                                                      // [t2, attitude parameters @ t=2] etc...
00047 \endcode
00048 */
00049 class AttitudeHistory : public History
00050 {
00051 public:
00052     /*! \brief Constructs an empty attitude history.
00053         */
00054     AttitudeHistory();
00055     
00056     /*! \brief Default Deconstructor
00057         */
00058     ~AttitudeHistory();
00059     
00060     /*! \brief Add the attitude rotation and angular velocity, which occured at a time in seconds, to the history.
00061         *
00062         *  Appends the state at t=_appendTime. if the new state 
00063         *       occured at a time that is earlier than any of the stored values
00064         *       then the time history will be erased from the overlap point 
00065         *       and the new state will be appended.
00066         * @param _appendTime time (in seconds) to be added.
00067         * @param _appendRotation the new Rotation describing the attitude to be added (by default the rotation is stored with respect to the inertial frame).
00068         * @param _appendAngVel Angular Velocity vector (3-elements) to be appended. 
00069         */
00070     void AppendHistory(const double &_appendTime, const Rotation &_appendRotation, const Vector &_appendAngVel);
00071     
00072     /*! \brief Add the attitude rotation and angular velocity, which occured with an ssfTime object, to the history.
00073         *
00074         *  Appends the state at t=_appendTime. if the new state 
00075         *       occured at a time that is earlier than any of the stored values
00076         *       then the time history will be erased from the overlap point 
00077         *       and the new state will be appended.
00078         * @param _appendTime the ssfTime object specifying when the state occured.
00079         * @param _appendRotation the new Rotation describing the attitude to be added (by default the rotation is stored with respect to the inertial frame).
00080         * @param _appendAngVel Angular Velocity vector (3-elements) to be appended. 
00081         */
00082     void AppendHistory(const ssfTime &_appendTime, const Rotation &_appendRotation, const Vector &_appendAngVel);
00083 
00084     /*! \brief Add the attitude state that occured at a time in seconds to the history.
00085         *
00086         *  Appends the state at t=_appendTime. if the new state 
00087         *       occured at a time that is earlier than any of the stored values
00088         *       then the time history will be erased from the overlap point 
00089         *       and the new state will be appended.
00090         * @param _appendTime time (in seconds) to be added.
00091         * @param _appendAttitudeState the new attitude state to be added.
00092         */
00093     void AppendHistory(const double &_appendTime, const AttitudeState &_appendAttitudeState);
00094 
00095     /*! \brief Add the attitude state that occured with an ssfTime object to the history.
00096         *
00097         *  Appends the state at t=_appendTime. if the new state 
00098         *       occured at a time that is earlier than any of the stored values
00099         *       then the time history will be erased from the overlap point 
00100         *       and the new state will be appended.
00101         * @param _appendTime the ssfTime object specifying when the state occured.
00102         * @param _appendAttitudeState the new attitude state to be added.
00103         */
00104     void AppendHistory(const ssfTime &_appendTime, const AttitudeState &_appendAttitudeState);
00105     
00106     /*! \brief Add a vector of ssfTime and AttitudeState objects to the stored history.
00107         *
00108         *  if the beginning of the new state vector occured earlier than 
00109         *       any of the stored values then the attitude history will be erased 
00110         *       from the overlap point and the new attitude state vector will be appended.
00111         * @param _appendTime vector of ssfTime objects to be appended. 
00112         * @param _appendAttitudeState vector of AttitudeState objects describing the attitude to be appended. 
00113         */
00114     void AppendHistory(const vector<ssfTime> &_appendTime, const vector<AttitudeState> &_appendAttitudeState);
00115 
00116     /*! \brief Add a vector of ssfTime, Rotation, and Angular Velocity vector objects to the stored history.
00117         *
00118         *  if the beginning of the new state vector occured earlier than 
00119         *       any of the stored values then the attitude history will be erased 
00120         *       from the overlap point and the new attitude state vector will be appended.
00121         * @param _appendTime vector of ssfTime objects to be appended. 
00122         * @param _appendRotation vector of Rotation objects describing the attitude to be appended (stores by default with repect to inertial reference frame). 
00123         * @param _appendAngVel vector of Angular Velocity vectors (3-elements) to be appended. 
00124         */
00125     void AppendHistory(const vector<ssfTime> &_appendTime, const vector<Rotation> &_appendRotation, const vector<Vector> &_appendAngVel);
00126 
00127     /*! \brief Erases the attitude state history */
00128     void ResetHistory();
00129 
00130     /*! \brief Returns a matrix of the attitude state history
00131         *
00132         *  returns the matrix of the form:    // Get a matrix of the stored state and output 
00133                                                      // [t0, attitude parameters @ t=0]
00134                                                      // [t1, attitude parameters @ t=1]
00135                                                      // [t2, attitude parameters @ t=2] etc...
00136         * @param _rotType rotation type to return the state in (ie quaternion, MRP, DCM, Euler Angles, etc.). Default (ie no type specified) to quaternion elements.
00137         * @return nxm matrix of the state history, where n is the number of time states stored and m is the number of elements in the RotationType.
00138         */
00139     Matrix GetHistory(const RotationType &_rotType = Quaternion_Type);
00140     
00141     /*! \brief Returns the attitude state at the requested time.
00142         *
00143         * \warning Always interpolates using quaternions
00144         *  May require interpolation (see Interpolator).
00145         * @param _requestedTime requested state time. If it is not an integrated mesh point, interpolation will be used to determine the approximated value.
00146         *       The _requestedTime may be different due to errors (outside state bounds, uncalculable interpolation).
00147         * @param _returnRotation the rotation at the requested time.
00148         * @param _returnAngVelVector the angular velocity vector at the requested time. 
00149         */
00150     void GetState(const ssfTime& _requestedTime, Rotation& _returnRotation, Vector& _returnAngVelVector);
00151     
00152     /*! \brief Returns the Attitude state at the requested time.
00153         *
00154         * \warning Always interpolates using quaternions
00155         *  Performs the same functionality as GetState(ssfTime& _requestedTime, Rotation& _returnRotation, Vector& _returnAngVelVector), but returns the attitude state from the 
00156         *       function rather than by reference.
00157         * @param _requestedTime requested state time. If it is not an integrated mesh point, interpolation will be used to determine the approximated value.
00158         *       The _requestedTime may be different due to errors (outside state bounds, uncalculable interpolation).
00159         * @return the attitude state at the requested time 
00160         */
00161     AttitudeState GetState(const ssfTime& _requestedTime);
00162 private:
00163     /*! \brief internal vector container of the AttitudeState objects describing the state history */
00164     vector<AttitudeState> m_AttitudeHistory;
00165     /*! \brief internal vector of attitude interpolations */
00166     vector<Interpolator*> m_AttitudeInterpolations; 
00167 
00168 };
00169 } // close namespace O_SESSAME
00170 
00171 #endif
00172 
00173 
00174 // Do not change the comments below - they will be added automatically by CVS
00175 /*****************************************************************************
00176 *       $Log: AttitudeHistory.h,v $
00177 *       Revision 1.2  2005/06/10 12:53:28  jayhawk_hokie
00178 *       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).
00179 *       
00180 *       Revision 1.1.1.1  2005/04/26 17:40:56  cakinli
00181 *       Adding OpenSESSAME to DSACSS distrib to capture fixed version.
00182 *       
00183 *       Revision 1.11  2003/10/18 21:37:27  rsharo
00184 *       Removed "../utils" from all qmake project paths. Prepended "utils
00185 *       /" to all #include directives for utils. Removed ".h" extensions from STL header
00186 *       s and referenced STL components from "std::" namespace.  Overall, changed to be
00187 *       more portable.
00188 *       
00189 *       Revision 1.10  2003/05/22 21:01:01  nilspace
00190 *       Updated comments.
00191 *       
00192 *       Revision 1.9  2003/05/20 17:50:01  nilspace
00193 *       Updated comments.
00194 *       
00195 *       Revision 1.8  2003/05/13 18:45:35  nilspace
00196 *       Added interpolation functionality.
00197 *       
00198 *       Revision 1.7  2003/05/01 23:59:48  nilspace
00199 *       Commented the API.
00200 *       
00201 *       Revision 1.6  2003/04/29 20:57:46  nilspace
00202 *       Updated to work with Propagator.
00203 *       
00204 *       Revision 1.5  2003/04/28 20:11:52  nilspace
00205 *       Made Quaternion_Type the default GetHistory rotation return type.
00206 *       
00207 *       Revision 1.4  2003/04/27 22:04:33  nilspace
00208 *       Created the namespace O_SESSAME.
00209 *       
00210 *       Revision 1.3  2003/04/23 17:00:47  nilspace
00211 *       Changed to work with AttitudeState and not Rotation and AngVel seperately.
00212 *       Time is now stored as ssfTime.
00213 *       
00214 *       Revision 1.2  2003/04/23 16:30:58  nilspace
00215 *       Various bugfixes & uploading of all changed code for new programmers.
00216 *       
00217 *       Revision 1.1  2003/03/27 20:29:20  nilspace
00218 *       Initial Submission.
00219 *
00220 ******************************************************************************/

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