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

Attitude.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////////////////////////////
00002 /*! \file Attitude.h
00003 *  \brief Interface to the Attitude class.
00004 *  \author $Author: jayhawk_hokie $
00005 *  \version $Revision: 1.2 $
00006 *  \date    $Date: 2005/06/10 12:53:24 $
00007 //////////////////////////////////////////////////////////////////////////////////////////////////
00008 * \todo Make Attitude derivable for diff't types of attitude representations (point-to, etc)
00009 * \todo Implement export & import plug-ins (STK, matlab, excel...)
00010 * \todo Add Attitude history storage
00011 */
00012 //////////////////////////////////////////////////////////////////////////////////////////////////
00013 
00014 #ifndef __ATTITUDE_H__
00015 #define __ATTITUDE_H__
00016 
00017 #include <rotation/Rotation.h>
00018 #include <utils/Integrator.h>
00019 #include <dynamics/Propagator.h>
00020 #include <datahandling/AttitudeHistory.h>
00021 #include <attitude/AttitudeState.h>
00022 namespace O_SESSAME {
00023 class Propagator; // forward declaration
00024 
00025 /*! \brief Defined function pointer to integrated attitude state conversion function.
00026     * \ingroup PropagatorToolkit
00027     *
00028     *  Converts a vector of meshpoints (from integrated states) to the corresponding generalized AttitudeState.
00029     * @param _meshPoint vector of values of the meshpoint to be converted
00030     * @param _convertedAttitudeState Calculated AttitudeState from the converted meshpoint that is returned to the caller.
00031     */
00032 typedef void (*IntegratedAttitudeStateConversionFunction)(const Matrix &_meshPoint, AttitudeState &_convertedAttitudeState);
00033 
00034 //////////////////////////////////////////////////////////////////////////////////////////////////
00035 /*! @defgroup AttitudeToolkit Attitude Toolkit 
00036 *
00037 */
00038 /*! @defgroup AttitudeEquationsOfMotion Attitude Equations of Motion
00039 * @ingroup AttitudeToolkit
00040 * 
00041 */
00042 
00043 /*! \brief Class encapsulating the rotational attitude of a rigid body frame with respect to another frame.
00044 * \ingroup AttitudeToolkit
00045 *
00046 * \detail The Attitude class allows for the attitude to be stored, retrieved, history logged, 
00047 * \todo Verify attitude is inheritable.
00048 * \example testAttitudeIntegration.cpp
00049 * \example testPropagation.cpp
00050 */
00051 class Attitude
00052 {
00053 public:
00054     /*! Default Constructor */
00055     Attitude();
00056     /*! Default Deconstructor */
00057     virtual ~Attitude();
00058     
00059 public:    
00060     void SetStateObject(const AttitudeState &_newAttitudeState);
00061     AttitudeState GetStateObject() const;
00062 
00063 private:
00064     AttitudeState m_AttitudeState; 
00065 
00066 // ***************************** 
00067 // ********** TORQUES ********** 
00068 // ***************************** 
00069 public:
00070     /*! Set the control torques
00071         * @param _ControlTorques 3-element vector of control torques applied about body primary axes [N-m]
00072         */
00073     void SetControlTorques(const Vector &_ControlTorques);
00074     
00075     /*! Returns the current set of control torques
00076         * @return 3-element vector of current control torques applied about body primary axes [N-m]
00077         */
00078     Vector GetControlTorques() const;
00079     
00080     
00081     /*! Return total sum of torques applied to the rigid body
00082         * @return 3-element vector of current torques applied about body primary axes [N-m]
00083         */
00084     Vector GetTorques() const;
00085 private:
00086     /*! 3-element vector of current control torques applied about body primary axes [N-m] */
00087     Vector m_ControlTorques;
00088     
00089 // ***************************** 
00090 // ******** PROPAGATION ******** 
00091 // ***************************** 
00092 public:    
00093     /*! Set the Dynamics Equation right-hand side file.
00094         * Also makes the attitude integrateable.
00095         * @param _AttDynEqFuncPtr pointer to the right-hand side dynamics equation
00096         */
00097     void SetDynamicsEq(odeFunctor _AttDynEqFuncPtr);    
00098     
00099     /*! Return the pointer to the Dynamics Equation right-hand side
00100         * @return _AttDynEqFuncPtr pointer to the right-hand side dynamics equation
00101         */
00102     odeFunctor GetDynamicsEq() const;
00103 
00104     
00105     /*! \brief Set the Attitude state conversion function.
00106         * @param _ConversionFunction pointer to the conversion function (takes a meshpoint and returns a Rotation object and Angular Velocity vector).
00107         */
00108     void SetStateConversion(IntegratedAttitudeStateConversionFunction _ConversionFunction);
00109 
00110     /*! \brief Get the Attitude state conversion function.
00111         * @return pointer to the conversion function (takes a meshpoint and returns a Rotation object and Angular Velocity vector).
00112         */
00113     IntegratedAttitudeStateConversionFunction GetStateConversion() const;
00114     
00115     /*! Propagates the rigid body attitude forward in time.
00116         * @param _time 3-element vector specifying the initial, final and stepsize of times to be integrated [timeInitial, timeStep, timeFinal] (s)
00117         * @return matrix of integrated states.
00118         */
00119     Matrix Propagate(const vector<ssfTime> &_time);
00120     
00121     /*!
00122         * \brief Sets the propagator used for integrating the attitude.
00123         * @param _pPropagator Pointer to the propagator to be used.
00124         */
00125     void SetPropagator(Propagator *_pPropagator);
00126         
00127     /*! \brief Returns whether the attitude is integrateable or not.
00128         * Determined if there is a dynamics equation present.
00129         * @return true if the attitude can be integrated, false if it can't.
00130         */
00131     bool IsIntegrateable();
00132 private:
00133     /*! pointer to the right-hand side dynamics equation */
00134     odeFunctor m_AttDynEqFuncPtr;
00135     
00136     /*! Conversion function for converting from the integrated states to a Rotation and Angular Velocity. */
00137     IntegratedAttitudeStateConversionFunction m_AttitudeStateConversionFunction;
00138     
00139     /*! Pointer to the propagator */
00140     Propagator *m_pPropagator;
00141 
00142     /*! \brief Is the attitude integrateable? (true if it is, false if is not) */
00143     bool m_Integrateable;
00144     
00145 // ***************************** 
00146 // ********* Physical ********** 
00147 // ***************************** 
00148 public:
00149     void SetParameters(const Matrix &_Parameters);
00150     Matrix GetParameters() const;
00151     
00152 private:
00153     Matrix m_Parameters;
00154     
00155 // ***************************** 
00156 // ******** ENVIRONMENT ********
00157 // *****************************  
00158 public:
00159     /*! \brief Assign the environment to be used when evaluating attitude disturbance torques.
00160         * The environment contains the list of torque disturbance functions, environment parameters, and
00161         * central body definition of the spacecraft. This functions sets the pointer (reference) to the 
00162         * environment object. This environment should be the same as the orbit's environment if there is an 
00163         * orbit being modeled.
00164         * @param _pNewEnvironment this variable is a pointer to the environment object to be stored.
00165         */
00166     void SetEnvironment(Environment* _pNewEnvironment);
00167     /*! \brief Return the reference to the environment object of the attitude.
00168         * This function is useful for returning the current environment that is being used by the attitude.
00169         *  It can be used to inspect and set the environment variables (such as adding torque disturbance 
00170         *  functions, setting the central body, or changing environment parameters), or to use the reference 
00171         *  for setting another environment (the coupled orbit, or another spacecraft's orbit and attitude 
00172         *  that are in the same environment as this spacecraft.
00173         * @return this function returns a pointer to the environment object that is currently stored in the attitude.
00174         */
00175     Environment* GetEnvironment() const;
00176     
00177     /*! \brief Returns the function reference (functor) to the function that evaluates the environment disturbance torques.
00178         * This function is used to get the reference, or function pointer, to the environmental disturbance torque function.
00179         * The reference may then be evalauated (\sa ObjectFunctor) to calculate the disturbance torques at a specified 
00180         * time, attitude, and possibly orbit, if applicable for the defined disturbance function (such as magnetic or gravity-gradient 
00181         * with a higher-order gravity model). 
00182         * @return this function returns a functor, or function reference of an object's member function, that refers to the disturbance function.
00183         */
00184     ObjectFunctor<Environment> GetEnvironmentForcesFunctor();
00185 private:
00186     /*! \brief Pointer to the Environment object */
00187     Environment *m_pEnvironment;
00188     /*! \brief Pointer to the Environment forces function */
00189     ObjectFunctor<Environment> m_EnvironmentForcesFunctor;
00190 // *************************
00191 // ******** HISTORY ******** 
00192 // ************************* 
00193 public:
00194     /*! \brief Retrieve a reference to the attitude's state history.
00195         * By returning a reference, no copy is made, which is more efficient than copying a large matrix of 
00196         * states. The user can then inspect the history (\sa History, \sa AttitudeHistory).
00197         * @return this function returns a reference, which acts as an object, but is also like a pointer.
00198         */
00199     AttitudeHistory& GetHistoryObject();
00200     
00201 private:
00202     /*! \brief This private data member is the stored attitude state, including [time, rotation, angular velocity] */
00203     AttitudeHistory m_AttitudeHistory;
00204 
00205 
00206 };
00207 } // close namespace O_SESSAME
00208 #endif
00209 /*!***************************************************************************
00210 *       $Log: Attitude.h,v $
00211 *       Revision 1.2  2005/06/10 12:53:24  jayhawk_hokie
00212 *       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).
00213 *       
00214 *       Revision 1.1.1.1  2005/04/26 17:40:55  cakinli
00215 *       Adding OpenSESSAME to DSACSS distrib to capture fixed version.
00216 *       
00217 *       Revision 1.11  2003/10/18 21:37:27  rsharo
00218 *       Removed "../utils" from all qmake project paths. Prepended "utils
00219 *       /" to all #include directives for utils. Removed ".h" extensions from STL header
00220 *       s and referenced STL components from "std::" namespace.  Overall, changed to be
00221 *       more portable.
00222 *       
00223 *       Revision 1.10  2003/06/10 14:51:42  nilspace
00224 *       Changed GetHistory to GetHistoryObject
00225 *       
00226 *       Revision 1.9  2003/05/20 17:46:25  nilspace
00227 *       Updated comments.
00228 *       
00229 *       Revision 1.8  2003/05/13 18:50:47  nilspace
00230 *       Fixed comments.
00231 *       
00232 *       Revision 1.7  2003/04/28 20:12:45  nilspace
00233 *       GetHistory return by reference.
00234 *       
00235 *       Revision 1.6  2003/04/27 22:11:51  nilspace
00236 *       Moved all of the function definitions out of the class interface definition.
00237 *       
00238 *       Revision 1.5  2003/04/27 22:04:31  nilspace
00239 *       Created the namespace O_SESSAME.
00240 *       
00241 *       Revision 1.4  2003/04/25 13:44:58  nilspace
00242 *       Updated to work with current History, Environment & Propagator objects.
00243 *       
00244 *       Revision 1.3  2003/04/23 21:54:33  nilspace
00245 *       Updated to work with AttitudeState, Environment.
00246 *       Removed the setting and getting of AngVel, AngAccel, Rotation.
00247 *       
00248 *       Revision 1.4  2003/03/27 20:25:17  nilspace
00249 *       Implemented calling the propagator & history objects.
00250 *       
00251 *       Revision 1.3  2003/03/27 02:48:54  nilspace
00252 *       Added the Propagator object functionality. Documented some of the new functions.Fixed history storage.
00253 *       
00254 *       Revision 1.2  2003/03/25 19:43:37  nilspace
00255 *       fixed to pre-ruined state.
00256 *       Changed enum to be auto number defining.
00257 *       
00258 *       Revision 1.1  2003/03/25 02:41:05  nilspace
00259 *       initial Submission. Attitude.h may not be current due to lost copy from ProjectBuilder crash.
00260 *       
00261 *       Revision 1.1  2003/02/27 18:37:26  nilspace
00262 *       Initial submission of Attitude class implementation.
00263 *       
00264 *
00265 ******************************************************************************/

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