00001
00002
00008
00009
00011
00012 #ifndef __OSESSAME_GRAVITYFUNCTIONS_H__
00013 #define __OSESSAME_GRAVITYFUNCTIONS_H__
00014 #include "matrix/Matrix.h"
00015 #include "Time.h"
00016 #include "OrbitState.h"
00017 #include "Attitude.h"
00018 #include "Environment.h"
00019 #include <vector.h>
00020 using namespace std;
00021 using namespace O_SESSAME;
00022
00047 inline Vector GravityForceFunction(const ssfTime &_currentTime, const OrbitState &_currentOrbitState, const AttitudeState &_currentAttitudeState, const EnvFuncParamaterType &_parameterList)
00048 {
00049 static Vector Forces(3);
00050 static Vector Position(3);
00051 Position(_) = _currentOrbitState.GetState()(_(VectorIndexBase,VectorIndexBase+2));
00052 Forces = - *(reinterpret_cast<double*>(_parameterList[0])) / pow(norm2(Position),3) * Position;
00053 return Forces;
00054 }
00055
00082 inline Vector GravityGradientTorque(const ssfTime &_currentTime, const OrbitState &_currentOrbitState, const AttitudeState &_currentAttitudeState, const EnvFuncParamaterType &_parameterList)
00083 {
00084 static Matrix MOI(3,3); MOI = *(reinterpret_cast<Matrix*>(_parameterList[0]));
00085 static Vector o3(3); o3 = (_currentAttitudeState.GetRotation2Orbital(_currentOrbitState)).GetDCM()(_,3);
00086 static Vector Position(3); Position = (_currentOrbitState.GetStateRepresentation()->GetPositionVelocity())(_(1,3));
00087 return 3 * *(reinterpret_cast<double*>(_parameterList[1]))/(pow(norm2(Position),3)) * skew(o3) * MOI * o3;
00088 }
00089
00090 #endif
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123