00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file Thruster.cpp 00003 * \brief Implementation of the Thruster class 00004 * \author $Author: shaigunjoe $ 00005 * \version $Revision: 1.4 $ 00006 * \date $Date: 2004/06/15 14:58:45 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /*! 00009 */ 00010 ////////////////////////////////////////////////////////////////////////////////////////////////// 00011 00012 00013 #include "Thruster.h" 00014 00015 ////////////////////////////////////////////////////////////////////// 00016 // Construction/Destruction 00017 ////////////////////////////////////////////////////////////////////// 00018 00019 Thruster::Thruster() 00020 { 00021 00022 } 00023 Thruster::Thruster(cfgBody& cfgdat) 00024 { 00025 const char *myCommands[20] = {"Number", "Pressure"}; 00026 //const char *myCommands[20] = {"Number", "ThrustVect", "Position", "Pressure"}; 00027 Vector tmpVect; 00028 00029 for (int i = 0; cfgdat.keys[i][0]; i++){ 00030 switch(getCmdIndex(myCommands, cfgdat.keys[i])){ 00031 case 0: 00032 m_ThrusterNumber = atoi(cfgdat.vals[i][0]); 00033 break; 00034 case 1: 00035 m_CurrentAirPressure = atof(cfgdat.vals[i][0]); 00036 break; 00037 /* case 1: 00038 for (int cc = 0; cc < 3 && cfgdat.vals[i][cc][0]; cc++) 00039 tmpVect(cc+1) = atof(cfgdat.vals[i][cc]); 00040 m_ThrustVector= tmpVect; 00041 break; 00042 case 2: 00043 for (int cc = 0; cc < 3 && cfgdat.vals[i][cc][0]; cc++) 00044 tmpVect(cc+1) = atof(cfgdat.vals[i][cc]); 00045 m_PositionVector = tmpVect;*/ 00046 default: 00047 break; 00048 } 00049 } 00050 Initialize(); 00051 } 00052 00053 Thruster::~Thruster() 00054 { 00055 Stop(); 00056 Deinitialize(); 00057 } 00058 00059 int Thruster::Initialize() 00060 { 00061 m_PhysicalThruster.Initialize(); 00062 // m_DAQCard = DAQCard::Instance(); 00063 00064 SetThrustLevel(); 00065 00066 return 0; 00067 } 00068 00069 void Thruster::StartFire(BYTE signal) 00070 { 00071 m_PhysicalThruster.StartFire(signal); 00072 } 00073 00074 void Thruster::StopFire() 00075 { 00076 m_PhysicalThruster.StopFire(); 00077 } 00078 00079 void Thruster::SetThrustLevel() 00080 { 00081 // this assumes the burn time will be > 600 ms 00082 // so we have no burn time arguement as well. 00083 m_CurrentThrustMagnitude = m_PhysicalThruster.CalcThrustLevel(m_CurrentAirPressure); 00084 } 00085 00086 double Thruster::GetThrustLevel() const 00087 { 00088 return m_CurrentThrustMagnitude; 00089 } 00090 00091 double Thruster::GetCurrentPressure() const 00092 { 00093 return m_CurrentAirPressure; 00094 } 00095 00096 /* 00097 int Thruster::Initialize() 00098 { 00099 00100 return Actuator::Initialize(); 00101 } 00102 00103 int Thruster::Initialize(const string& _sInitString) 00104 { 00105 return Actuator::Initialize(); 00106 } 00107 00108 int Thruster::Deinitialize() 00109 { 00110 00111 return Actuator::Deinitialize(); 00112 } 00113 */ 00114 int Thruster::Stop() 00115 { 00116 return NO_ERROR; 00117 } 00118 00119 /*void SetThrustVector(const Vector& ThrustVect) 00120 { 00121 m_ThrustVector = ThrustVect; 00122 }*/ 00123 00124 // Do not change the comments below - they will be added automatically by CVS 00125 /***************************************************************************** 00126 * $Log: Thruster.cpp,v $ 00127 * Revision 1.4 2004/06/15 14:58:45 shaigunjoe 00128 * Added changes for digital signal 00129 * 00130 * Revision 1.3 2004/05/27 19:59:06 shoemaker 00131 * Made changes for analog output thruster control 00132 * 00133 * Revision 1.2 2003/06/17 15:55:55 simpliciter 00134 * Added blank line at end of file. 00135 * 00136 * Revision 1.1.1.1 2003/06/06 18:44:15 simpliciter 00137 * Initial submission. 00138 * 00139 * 00140 ******************************************************************************/