00001 /************************************************************************************************/ 00002 /*! \file ControlMomentGyro.h 00003 * \brief The ControlMomentGyro class provides the interface for h/w control moment gyros. 00004 * \author $Author: cakinli $ 00005 * \version $Revision: 1.14 $ 00006 * \date $Date: 2005/02/25 18:40:52 $ 00007 ************************************************************************************************/ 00008 /*! 00009 * 00010 ************************************************************************************************/ 00011 00012 #ifndef __SSSL_CONTROLMOMENTGYRO_H__ 00013 #define __SSSL_CONTROLMOMENTGYRO_H__ 00014 00015 #include <Base/Actuator.h> 00016 #include <matrix/Matrix.h> 00017 #include <string> 00018 #include <sstream> 00019 #include <sys/time.h> 00020 #include <sys/types.h> 00021 #include <sys/stat.h> 00022 #include <sys/fcntl.h> 00023 #include <sys/ioctl.h> 00024 #include <asm/ioctls.h> 00025 #include <bits/types.h> 00026 #include "PhysicalControlMomentGyro.h" 00027 00028 using namespace std; 00029 using namespace O_SESSAME; 00030 00031 /*! Class to interface with control moment gyros */ 00032 class ControlMomentGyro : public Actuator 00033 { 00034 public: 00035 // Contructors/Deconstructors 00036 00037 /*! Default Constructor */ 00038 ControlMomentGyro(); 00039 00040 /*! Constructor accepting a cfg object */ 00041 ControlMomentGyro(cfgBody& cfgdat); 00042 00043 /*! Default Deconstructor */ 00044 virtual ~ControlMomentGyro(); 00045 00046 // Facilitators 00047 00048 /*! Set the speed of the CMG wheel 00049 * \param wheelOmega Desired speed of the wheel in rad/sec */ 00050 void SetWheelSpeed(double wheelOmega); // will change wheelOmega if set different due to saturation 00051 00052 /*! Set the torque output to the wheel of the CMG 00053 * \param wheelTorque Desired torque put on the wheel in N-m */ 00054 void SetWheelTorque(double wheelTorque); // will change wheelTorque if set different due to saturation 00055 00056 /*! Set the angle of the wheel axis with respect to the center of its travel 00057 * \param wheelAngle The desired angle og the wjheel axis with respect to the center of the CMG's motion in radians */ 00058 void SetAngle(double wheelAngle); 00059 00060 /*! Set the gimbal angle rate of the CMG 00061 * \param gimbalrate The deisred gimbal angle rate in rad/sec */ 00062 void SetGimbalRate(double gimbalRate); 00063 00064 /*! Stop the CMG wheel */ 00065 int Stop(); 00066 00067 /*! Initialize the both the linear actuator and wheel on the CMG chain */ 00068 int Initialize(); 00069 00070 /*! Deinitialize all CMG components */ 00071 int Deinitialize(); 00072 00073 // Mutators 00074 00075 /*! Set the axis of the CMG with a 3x1 vector */ 00076 void SetWheelAxis(const Vector& newWheelAxis); 00077 00078 /*! Set communications port */ 00079 void SetPort(string Port); 00080 00081 // Inspectors 00082 00083 /*! Returns the current angular velocity of the CMG wheel in rad/sec */ 00084 double GetWheelSpeed(); 00085 00086 /*! Returns the current torque output to the CMG wheel in N-m */ 00087 double GetWheelTorque(); 00088 00089 /*! Returns the current angle of the wheel axis with respect to its center line in radians */ 00090 double GetAngle(); 00091 00092 /*! Returns a 3x1 vector of the CMG axis */ 00093 Vector GetCMGAxis() const; 00094 00095 /*! Returns the total number of CMGs instantiated */ 00096 int getGyroCount() const; 00097 00098 00099 protected: 00100 00101 00102 private: 00103 00104 /*! Static integer that holds the total number of CMGs instantiated */ 00105 static int gyroCount; 00106 00107 /*! Double that holds the current angular velocity of the CMG wheel in rad/sec */ 00108 double m_CurrentWheelSpeed; 00109 00110 /*! Double that holds the current torque output to the wheel in N-m */ 00111 double m_CurrentWheelTorque; 00112 00113 /*! Double that holds the current angle of the wheel axis with respect to its center point in radians */ 00114 double m_CurrentAngle; 00115 00116 /*! 3x1 Vector that holds axis of the CMG */ 00117 Vector m_CMGAxis; 00118 00119 /*! Double that holds the velocity setting for the linear actuator */ 00120 double m_CurrentLAVelocity; 00121 00122 /*! Double that holds the accelerations setting for the linear actuator */ 00123 double m_CurrentLAAcceleration; 00124 00125 /*! Memeber PhysicalControlMomentGyro object */ 00126 PhysicalControlMomentGyro m_PhysicalCMG; 00127 00128 }; 00129 00130 #endif 00131 // Do not change the comments below - they will be added automatically by CVS 00132 /***************************************************************************** 00133 * $Log: ControlMomentGyro.h,v $ 00134 * Revision 1.14 2005/02/25 18:40:52 cakinli 00135 * Created Makefiles and organized include directives to reduce the number of 00136 * include paths. Reorganized libraries so that there is now one per source 00137 * directory. Each directory is self-contained in terms of its Makefile. 00138 * The local Makefile in each directory includes src/config.mk, which has all 00139 * the definitions and general and pattern rules. So at most, to see what 00140 * goes into building a target, a person needs to examine the Makefile in 00141 * that directory, and ../config.mk. 00142 * 00143 * Revision 1.13 2003/12/16 17:20:26 bstreetman 00144 * A bit o' fall cleaning. Just look at how pretty it is. 00145 * 00146 * Revision 1.12 2003/10/27 17:04:16 bstreetman 00147 * Added manual wat to set the communications port in SetPort() 00148 * 00149 * Revision 1.11 2003/09/15 21:42:45 bstreetman 00150 * Added Config Parsing ability, removed extraneous construction/initialization functions, removed hardcoded parameters 00151 * 00152 * Revision 1.10 2003/08/22 18:18:03 bstreetman 00153 * Added the ability to set gimbal rate 00154 * 00155 * Revision 1.9 2003/08/04 21:25:23 bstreetman 00156 * Now with doxygen-style comments 00157 * 00158 * Revision 1.8 2003/08/01 20:21:20 bstreetman 00159 * Cleaned and streamlined all code. Reduced warning and outputs. CMG and Momentum Wheels now no longer accept a global integer in initialization. The file descriptor is now set and held internally. 00160 * 00161 * Revision 1.7 2003/07/16 21:39:35 bstreetman 00162 * Updated headers and continued function implementation 00163 * 00164 * Revision 1.6 2003/07/15 20:43:39 bstreetman 00165 * Updated CMG headers and began impletation 00166 * 00167 * Revision 1.5 2003/07/04 15:54:52 simpliciter 00168 * Fixed capitalization. 00169 * 00170 * Revision 1.4 2003/07/04 15:28:59 simpliciter 00171 * Fixed typo. 00172 * 00173 * Revision 1.3 2003/07/03 19:48:31 nicmcp 00174 * Added an Instance counter 00175 * 00176 * Revision 1.2 2003/06/19 21:30:23 simpliciter 00177 * Updated from Andy's generic layout. 00178 * 00179 * Revision 1.1.1.1 2003/06/06 18:44:15 simpliciter 00180 * Initial submission. 00181 * 00182 * 00183 ******************************************************************************/