00001 /* 00002 * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 00018 #ifndef __POWER_CUBE_CTRL_PARAMS_H_ 00019 #define __POWER_CUBE_CTRL_PARAMS_H_ 00020 00026 class PowerCubeCtrlParams 00027 { 00028 public: 00030 PowerCubeCtrlParams() 00031 { 00032 m_DOF = 0; 00033 m_UseMoveVel = true; 00034 }; 00035 00037 ~PowerCubeCtrlParams(); 00038 00040 int Init(std::string CanModule, std::string CanDevice, int Baudrate, std::vector<int> ModuleIDs) 00041 { 00042 SetCanModule(CanModule); 00043 SetCanDevice(CanDevice); 00044 SetBaudrate(Baudrate); 00045 SetDOF(ModuleIDs.size()); 00046 for (int i = 0; i < m_DOF; i++) 00047 { 00048 m_ModulIDs.push_back(ModuleIDs[i]); 00049 } 00050 return 0; 00051 } 00052 00054 void SetDOF(int DOF) 00055 { 00056 m_DOF = DOF; 00057 } 00058 00060 int GetDOF() 00061 { 00062 return m_DOF; 00063 } 00064 00066 void SetUseMoveVel(bool UseMoveVel) 00067 { 00068 m_UseMoveVel = UseMoveVel; 00069 } 00070 00072 int GetUseMoveVel() 00073 { 00074 return m_UseMoveVel; 00075 } 00076 00078 void SetCanModule(std::string CanModule) 00079 { 00080 m_CanModule = CanModule; 00081 } 00082 00084 std::string GetCanModule() 00085 { 00086 return m_CanModule; 00087 } 00088 00090 void SetCanDevice(std::string CanDevice) 00091 { 00092 m_CanDevice = CanDevice; 00093 } 00094 00096 std::string GetCanDevice() 00097 { 00098 return m_CanDevice; 00099 } 00100 00102 void SetBaudrate(int Baudrate) 00103 { 00104 m_Baudrate = Baudrate; 00105 } 00106 00108 int GetBaudrate() 00109 { 00110 return m_Baudrate; 00111 } 00112 00114 std::vector<int> GetModuleIDs() 00115 { 00116 return m_ModulIDs; 00117 } 00118 00120 int GetModuleID(int no) 00121 { 00122 if (no < GetDOF()) 00123 return m_ModulIDs[no]; 00124 else 00125 return -1; 00126 } 00127 00129 int SetModuleID(int no, int id) 00130 { 00131 if (no < GetDOF()) 00132 { 00133 m_ModulIDs[no] = id; 00134 return 0; 00135 } 00136 else 00137 return -1; 00138 } 00139 00141 std::vector<std::string> GetJointNames() 00142 { 00143 return m_JointNames; 00144 } 00145 00147 int SetJointNames(std::vector<std::string> JointNames) 00148 { 00149 if ((int)JointNames.size() == GetDOF()) 00150 { 00151 m_JointNames = JointNames; 00152 return 0; 00153 } 00154 else 00155 return -1; 00156 } 00157 // ToDo: Check the following 00158 00160 // Functions for angular constraints: // 00162 00164 int SetUpperLimits(std::vector<double> UpperLimits) 00165 { 00166 if ((int)UpperLimits.size() == GetDOF()) 00167 { 00168 m_UpperLimits = UpperLimits; 00169 return 0; 00170 } 00171 return -1; 00172 } 00173 00175 int SetLowerLimits(std::vector<double> LowerLimits) 00176 { 00177 if ((int)LowerLimits.size() == GetDOF()) 00178 { 00179 m_LowerLimits = LowerLimits; 00180 return 0; 00181 } 00182 return -1; 00183 } 00184 00186 int SetOffsets(std::vector<double> AngleOffsets) 00187 { 00188 if ((int)AngleOffsets.size() == GetDOF()) 00189 { 00190 m_Offsets = AngleOffsets; 00191 return 0; 00192 } 00193 return -1; 00194 } 00195 00197 int SetMaxVel(std::vector<double> MaxVel) 00198 { 00199 if ((int)MaxVel.size() == GetDOF()) 00200 { 00201 m_MaxVel = MaxVel; 00202 return 0; 00203 } 00204 return -1; 00205 } 00206 00208 int SetMaxAcc(std::vector<double> MaxAcc) 00209 { 00210 if ((int)MaxAcc.size() == GetDOF()) 00211 { 00212 m_MaxAcc = MaxAcc; 00213 return 0; 00214 } 00215 return -1; 00216 } 00217 00219 std::vector<double> GetUpperLimits() 00220 { 00221 return m_UpperLimits; 00222 } 00223 00225 std::vector<double> GetLowerLimits() 00226 { 00227 return m_LowerLimits; 00228 } 00229 00231 std::vector<double> GetOffsets() 00232 { 00233 return m_Offsets; 00234 } 00235 00237 std::vector<double> GetMaxAcc() 00238 { 00239 return m_MaxAcc; 00240 } 00241 00243 std::vector<double> GetMaxVel() 00244 { 00245 return m_MaxVel; 00246 } 00247 00248 private: 00249 int m_DOF; 00250 std::vector<int> m_ModulIDs; 00251 std::vector<std::string> m_JointNames; 00252 std::string m_CanModule; 00253 std::string m_CanDevice; 00254 int m_Baudrate; 00255 bool m_UseMoveVel; 00256 std::vector<double> m_Offsets; 00257 std::vector<double> m_UpperLimits; 00258 std::vector<double> m_LowerLimits; 00259 std::vector<double> m_MaxVel; 00260 std::vector<double> m_MaxAcc; 00261 }; 00262 00263 #endif