00001 00060 #ifndef __POWER_CUBE_CTRL_PARAMS_H_ 00061 #define __POWER_CUBE_CTRL_PARAMS_H_ 00062 00068 class PowerCubeCtrlParams 00069 { 00070 00071 public: 00072 00074 PowerCubeCtrlParams() 00075 { 00076 m_DOF = 0; 00077 m_UseMoveVel = true; 00078 }; 00079 00081 ~PowerCubeCtrlParams(); 00082 00084 int Init(std::string CanModule, std::string CanDevice, int Baudrate, std::vector<int> ModuleIDs) 00085 { 00086 SetCanModule(CanModule); 00087 SetCanDevice(CanDevice); 00088 SetBaudrate(Baudrate); 00089 SetDOF(ModuleIDs.size()); 00090 for (int i = 0; i < m_DOF; i++) 00091 { 00092 m_ModulIDs.push_back(ModuleIDs[i]); 00093 } 00094 return 0; 00095 } 00096 00098 void SetDOF(int DOF) 00099 { 00100 m_DOF = DOF; 00101 } 00102 00104 int GetDOF() 00105 { 00106 return m_DOF; 00107 } 00108 00110 void SetUseMoveVel(bool UseMoveVel) 00111 { 00112 m_UseMoveVel = UseMoveVel; 00113 } 00114 00116 int GetUseMoveVel() 00117 { 00118 return m_UseMoveVel; 00119 } 00120 00122 void SetCanModule(std::string CanModule) 00123 { 00124 m_CanModule = CanModule; 00125 } 00126 00128 std::string GetCanModule() 00129 { 00130 return m_CanModule; 00131 } 00132 00134 void SetCanDevice(std::string CanDevice) 00135 { 00136 m_CanDevice = CanDevice; 00137 } 00138 00140 std::string GetCanDevice() 00141 { 00142 return m_CanDevice; 00143 } 00144 00146 void SetBaudrate(int Baudrate) 00147 { 00148 m_Baudrate = Baudrate; 00149 } 00150 00152 int GetBaudrate() 00153 { 00154 return m_Baudrate; 00155 } 00156 00158 std::vector<int> GetModuleIDs() 00159 { 00160 return m_ModulIDs; 00161 } 00162 00164 int GetModuleID(int no) 00165 { 00166 if (no < GetDOF()) 00167 return m_ModulIDs[no]; 00168 else 00169 return -1; 00170 } 00171 00173 int SetModuleID(int no, int id) 00174 { 00175 if (no < GetDOF()) 00176 { 00177 m_ModulIDs[no] = id; 00178 return 0; 00179 } 00180 else 00181 return -1; 00182 } 00183 00185 std::vector<std::string> GetJointNames() 00186 { 00187 return m_JointNames; 00188 } 00189 00191 int SetJointNames(std::vector<std::string> JointNames) 00192 { 00193 if ((int)JointNames.size() == GetDOF()) 00194 { 00195 m_JointNames = JointNames; 00196 return 0; 00197 } 00198 else 00199 return -1; 00200 } 00201 // ToDo: Check the following 00202 00204 // Functions for angular constraints: // 00206 00208 int SetUpperLimits(std::vector<double> UpperLimits) 00209 { 00210 if ((int)UpperLimits.size() == GetDOF()) 00211 { 00212 m_UpperLimits = UpperLimits; 00213 return 0; 00214 } 00215 return -1; 00216 } 00217 00219 int SetLowerLimits(std::vector<double> LowerLimits) 00220 { 00221 if ((int)LowerLimits.size() == GetDOF()) 00222 { 00223 m_LowerLimits = LowerLimits; 00224 return 0; 00225 } 00226 return -1; 00227 } 00228 00230 int SetOffsets(std::vector<double> AngleOffsets) 00231 { 00232 if ((int)AngleOffsets.size() == GetDOF()) 00233 { 00234 m_Offsets = AngleOffsets; 00235 return 0; 00236 } 00237 return -1; 00238 } 00239 00241 int SetMaxVel(std::vector<double> MaxVel) 00242 { 00243 if ((int)MaxVel.size() == GetDOF()) 00244 { 00245 m_MaxVel = MaxVel; 00246 return 0; 00247 } 00248 return -1; 00249 } 00250 00252 int SetMaxAcc(std::vector<double> MaxAcc) 00253 { 00254 if ((int)MaxAcc.size() == GetDOF()) 00255 { 00256 m_MaxAcc = MaxAcc; 00257 return 0; 00258 } 00259 return -1; 00260 } 00261 00263 std::vector<double> GetUpperLimits() 00264 { 00265 return m_UpperLimits; 00266 } 00267 00269 std::vector<double> GetLowerLimits() 00270 { 00271 return m_LowerLimits; 00272 } 00273 00275 std::vector<double> GetOffsets() 00276 { 00277 return m_Offsets; 00278 } 00279 00281 std::vector<double> GetMaxAcc() 00282 { 00283 return m_MaxAcc; 00284 } 00285 00287 std::vector<double> GetMaxVel() 00288 { 00289 return m_MaxVel; 00290 } 00291 00292 private: 00293 int m_DOF; 00294 std::vector<int> m_ModulIDs; 00295 std::vector<std::string> m_JointNames; 00296 std::string m_CanModule; 00297 std::string m_CanDevice; 00298 int m_Baudrate; 00299 bool m_UseMoveVel; 00300 std::vector<double> m_Offsets; 00301 std::vector<double> m_UpperLimits; 00302 std::vector<double> m_LowerLimits; 00303 std::vector<double> m_MaxVel; 00304 std::vector<double> m_MaxAcc; 00305 }; 00306 00307 #endif