00001 00002 #include <Base/Whorl.h> 00003 #include <Base/WhorlSim.h> 00004 #include <Utils/CfgParse.h> 00005 #include <Utils/Measurement.h> 00006 #include <iostream> 00007 #include <fstream> 00008 using namespace std; 00009 00010 int main() { 00011 00012 /** Prepare for parsing */ 00013 cfgBody *cfgDat; 00014 CfgParse parser; 00015 00016 /** Parse out configuration files */ 00017 cfgDat = parser.go("whorl.cfg"); 00018 00019 Whorl whorlOne; 00020 whorlOne.Initialize(cfgDat); 00021 00022 Vector state(3); 00023 Vector params(9); params(1) = 2.0; params(4) = 3.0; params(6) = 4.0; 00024 Vector control(3); 00025 timeval t; 00026 whorlOne.GetRateGyro(string("dmu_rg1"))->GetMeasurement().GetTime(t); 00027 whorlOne.SetState(state); 00028 whorlOne.SetControl(control); 00029 whorlOne.SetParameter(params); 00030 whorlOne.SetTimeOfEstimate(t); 00031 00032 cfgDat = parser.go("sim.cfg"); 00033 00034 WhorlSim whorlOneSim(&whorlOne); 00035 whorlOneSim.Initialize(cfgDat); 00036 00037 for ( int ii = 0; ii <= 250; ii++ ) { 00038 cout << "Start loop" << endl; 00039 whorlOneSim.Observe(); 00040 whorlOneSim.Control(); 00041 cout << "End loop" << endl; 00042 }; 00043 00044 whorlOne.GetMomentumWheel(string("Wheel1"))->SetWheelTorque(0.0); 00045 whorlOne.GetMomentumWheel(string("Wheel2"))->SetWheelTorque(0.0); 00046 whorlOne.GetMomentumWheel(string("Wheel3"))->SetWheelTorque(0.0); 00047 00048 return 0; 00049 00050 };