00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file DemoWhorl1.cpp 00003 * \brief Runs momentum wheels, thrusters and cmg on Whorl-I. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.2 $ 00006 * \date $Date: 2007/07/24 09:43:46 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /*! 00009 */ 00010 ////////////////////////////////////////////////////////////////////////////////////////////////// 00011 00012 // include control devices 00013 #include <Actuators/MomentumWheel.h> 00014 #include <Actuators/Thruster.h> 00015 #include <Actuators/ControlMomentGyro.h> 00016 // include time 00017 #include <utils/Time.h> 00018 // include math 00019 #include <matrix/Matrix.h> 00020 // include standard output 00021 #include <iostream.h> 00022 #include <unistd.h> 00023 #include <string.h> 00024 #include <fstream.h> 00025 #include <fstream> 00026 00027 using namespace std; // shortcut for std::cout, std::endl, etc 00028 00029 // The main routine 00030 int main() 00031 { 00032 00033 cout << "start program" << endl; 00034 00035 // Initialize CMG 00036 ControlMomentGyro CMG; 00037 00038 CMG.Initialize(); 00039 00040 // Initialize Momentum Wheels 00041 MomentumWheel WheelX; 00042 MomentumWheel WheelY; 00043 MomentumWheel WheelZ; 00044 WheelX.SetPort("USB4"); 00045 WheelY.SetPort("USB5"); 00046 WheelZ.SetPort("USB6"); 00047 WheelX.Initialize(); 00048 WheelY.Initialize(); 00049 WheelZ.Initialize(); 00050 00051 00052 /* sleep(50); // pause for 50 seconds 00053 // Thrusters 00054 Thruster t1; 00055 Thruster t2; 00056 t1.StartFire(8); // fire thruster 1 for 8 seconds 00057 sleep(10); // pause for 10 seconds 00058 t2.StartFire(16); // fire thruster 2 for 16 seconds 00059 sleep(10); // pause for 10 seconds 00060 t1.StopFire(); 00061 t2.StopFire(); 00062 */ 00063 00064 // CMG Control 00065 00066 cout << "Start CMG" << endl; 00067 00068 CMG.SetAngle(5); 00069 CMG.SetWheelSpeed(20); 00070 00071 sleep(20); 00072 00073 CMG.Stop(); 00074 CMG.Deinitialize(); 00075 00076 /* 00077 // Momentum Wheel Control 00078 WheelZ.SetWheelSpeed(40); // rates (deg/s) 00079 sleep(25); 00080 WheelX.SetWheelSpeed(30); 00081 sleep(10); 00082 WheelY.SetWheelSpeed(30); 00083 sleep(10); 00084 00085 WheelZ.Stop(); 00086 WheelX.Stop(); 00087 WheelY.Stop(); 00088 00089 */ 00090 WheelZ.Deinitialize(); 00091 WheelX.Deinitialize(); 00092 WheelY.Deinitialize(); 00093 00094 cout << "Whorl-I demo COMPLETE" << endl; // display to screen 00095 00096 return 0; // terminate program 00097 } 00098 00099 // Do not change the comments below - they will be added automatically by CVS 00100 /***************************************************************************** 00101 * $Log: DemoWhorl1.cpp,v $ 00102 * Revision 1.2 2007/07/24 09:43:46 jayhawk_hokie 00103 * Updated. 00104 * 00105 * Revision 1.1 2005/09/18 17:14:30 jayhawk_hokie 00106 * Initial Addition of Test programs 00107 * 00108 * Revision 1.1 2005/06/17 18:07:28 jayhawk_hokie 00109 * Initial submission. 00110 * 00111 * 00112 ******************************************************************************/ 00113 00114