00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file DemoWhorl2.cpp 00003 * \brief Runs momentum wheels, thrusters and cmg on Whorl-II. 00004 * \author $Author: jayhawk_hokie $ 00005 * \version $Revision: 1.1 $ 00006 * \date $Date: 2005/09/18 17:14:30 $ 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 // Initialize Momentum Wheels 00034 MomentumWheel WheelX; 00035 MomentumWheel WheelY; 00036 MomentumWheel WheelZ; 00037 WheelX.SetPort("USB4"); 00038 WheelY.SetPort("USB5"); 00039 WheelZ.SetPort("USB6"); 00040 WheelX.Initialize(); 00041 WheelY.Initialize(); 00042 00043 sleep(50); // pause for 50 seconds 00044 // Thrusters 00045 Thruster t1; 00046 Thruster t2; 00047 t1.StartFire(8); // fire thruster 1 for 8 seconds 00048 sleep(10); // pause for 10 seconds 00049 t1.StopFire(); 00050 // Momentum Wheel Control 00051 WheelX.SetWheelSpeed(55); // rates (deg/s) 00052 sleep(45); 00053 WheelZ.SetWheelSpeed(20); 00054 WheelY.SetWheelSpeed(20); 00055 sleep(5); 00056 WheelX.SetWheelSpeed(0); 00057 sleep(10); 00058 //WheelY.SetWheelSpeed(20); 00059 sleep(10); 00060 //WheelX.SetWheelSpeed(-30); 00061 WheelZ.SetWheelSpeed(0); 00062 WheelY.SetWheelSpeed(0); 00063 sleep(15); 00064 //WheelX.SetWheelSpeed(0); 00065 00066 WheelX.Stop(); 00067 WheelY.Stop(); 00068 WheelZ.Deinitialize(); 00069 WheelX.Deinitialize(); 00070 WheelY.Deinitialize(); 00071 00072 cout << "Whorl-II demo COMPLETE" << endl; // display to screen 00073 00074 return 0; // terminate program 00075 00076 } 00077 00078 // Do not change the comments below - they will be added automatically by CVS 00079 /***************************************************************************** 00080 * $Log: DemoWhorl2.cpp,v $ 00081 * Revision 1.1 2005/09/18 17:14:30 jayhawk_hokie 00082 * Initial Addition of Test programs 00083 * 00084 * Revision 1.1 2005/06/17 18:07:28 jayhawk_hokie 00085 * Initial submission. 00086 * 00087 * 00088 ******************************************************************************/ 00089 00090 00091