00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <iostream.h>
00015 #include <iomanip.h>
00016 #include <fstream.h>
00017
00018
00019 #include "Base/Whorl.h"
00020 #include "Base/WhorlSim.h"
00021 #include "Logging/WhorlHistory.h"
00022
00023
00024 #include <dsacssinterface.h>
00025
00026 using namespace O_SESSAME;
00027
00028
00029 const char *fileName = "./DSACSSConfig.xml";
00030
00031 int main()
00032 {
00033
00034
00035
00036
00037
00038
00039 TiXmlDocument config( fileName );
00040
00041 bool loadOkay = config.LoadFile();
00042 checkLoadFile(loadOkay, fileName, config);
00043
00044 TiXmlHandle docHandle( &config );
00045
00046
00047
00048
00049
00050
00051
00052 WhorlHistory WhorlData( docHandle, "WHORL-I" );
00053
00054
00055 Whorl whorlOne;
00056
00057 whorlOne.Initialize( docHandle );
00058
00059
00060 WhorlSim whorlOneSim( &whorlOne );
00061
00062 whorlOneSim.Initialize( docHandle );
00063
00064
00065 ssfTime currentTime;
00066
00067
00068 Vector attitudeState(7);
00069 Vector attitudeControl(3);
00070 Vector MRP(3);
00071 Vector referenceAttitudeState(7);
00072 Vector referenceMRP(3);
00073 Vector controlError(6);
00074
00075
00076
00077
00078 cerr << "\n--------------------------------------------------------------" << endl;
00079 cerr << "Start of Program " << endl;
00080 cerr << "--------------------------------------------------------------" << endl;
00081
00082 for ( int ii = 0; ii <= 200 ; ii++ )
00083 {
00084
00085 whorlOneSim.Observe();
00086
00087
00088 whorlOneSim.Control();
00089
00090
00091 currentTime = Now( );
00092
00093
00094 attitudeState = whorlOne.GetState( );
00095
00096
00097 attitudeControl = whorlOne.GetControl( );
00098
00099
00100 MRP = whorlOne.GetMRP( );
00101
00102
00103 referenceAttitudeState( _(1,4) ) = whorlOne.GetReferenceQuaternion( );
00104 referenceAttitudeState( _(5,7) ) = whorlOne.GetReferenceOmegaBL( );
00105 referenceMRP = whorlOne.GetReferenceMRP( );
00106
00107
00108 controlError = whorlOne.GetControlError( );
00109
00110 cerr << "Error Vector: " << ~controlError << endl;
00111
00112
00113 WhorlData.AppendHistory( currentTime, attitudeState, attitudeControl, MRP,
00114 referenceAttitudeState, referenceMRP, controlError );
00115
00116
00117 usleep( 500000 );
00118 };
00119
00120 cout << "END of program " << endl;
00121
00122 return( 0 );
00123 }
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135