00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "testController.h"
00014
00015
00016 testController::testController( )
00017 {
00018 }
00019
00020
00021
00022
00023
00024 testController::testController( Whorl* ptr_whorl )
00025 {
00026 m_whorl = ptr_whorl;
00027
00028 Initialize( );
00029
00030 }
00031
00032
00033 testController::~testController( )
00034 {
00035 }
00036
00037
00038 int testController::Initialize( )
00039 {
00040
00041 m_controlTorque.initialize(3);
00042
00043
00044 m_uMax = 1.5;
00045
00046
00047 m_gainMatrix.initialize(3,3);
00048 m_gainMatrix(1,1) = 0;
00049 m_gainMatrix(2,2) = 0;
00050 m_gainMatrix(3,3) = 2;
00051
00052
00053 A = FindA( );
00054
00055
00056 MOI_sw = FindMOI_sw( );
00057
00058
00059 Quaternion qri( 0.0, 0.0, 0.0, 1.0 );
00060 m_quaternionReference(1) = qri(1);
00061 m_quaternionReference(2) = qri(2);
00062 m_quaternionReference(3) = qri(3);
00063 m_quaternionReference(4) = qri(4);
00064 m_mrpReference = ModifiedRodriguezParameters( qri );
00065 m_angularRateReference(1) = 0.0;
00066 m_angularRateReference(2) = 0.0;
00067 m_angularRateReference(3) = 0.0;
00068
00069 return( 0 );
00070 }
00071
00072 int testController::Run()
00073 {
00074
00075 cerr << "Start of testController algorithm" << endl;
00076
00077
00078
00079
00080 Vector angularRateError(3);
00081 ModifiedRodriguezParameters mrpError;
00082
00083
00084 m_whorl->SetMRPError( mrpError );
00085 m_whorl->SetAngularRateError( angularRateError );
00086
00087
00088 m_whorl->SetReferenceOmegaBL( m_angularRateReference );
00089 m_whorl->SetReferenceQuaternion( m_quaternionReference );
00090
00091
00092 static Vector wheelSpeed(3);
00093 double measurementTime;
00094 m_whorl->GetMomentumWheel("REACTION_X")->GetWheelSpeed( wheelSpeed(1), measurementTime );
00095 m_whorl->GetMomentumWheel("REACTION_Y")->GetWheelSpeed( wheelSpeed(2), measurementTime );
00096 m_whorl->GetMomentumWheel("REACTION_Z")->GetWheelSpeed( wheelSpeed(3), measurementTime );
00097
00098
00099 m_controlTorque(1) = 0;
00100 m_controlTorque(2) = 0;
00101 m_controlTorque(3) = 0;
00102
00103
00104 m_controlTorque = WheelSaturation( m_controlTorque );
00105
00106
00107 m_whorl->SetControl( m_controlTorque );
00108
00109
00110 SetWheelTorque( m_controlTorque );
00111
00112 cerr << "End of testController algorithm" << endl;
00113
00114 return( 0 );
00115 }
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126