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 __DATASTRUCTS_MANIPULATOR_H_ 00019 #define __DATASTRUCTS_MANIPULATOR_H_ 00020 00021 #include <schunk_powercube_chain/Joint.h> 00022 #include <iostream> 00023 00024 // never in headerfiles! 00025 // using namespace std; 00026 00027 #ifdef SWIG 00028 %module PowerCubeCtrl 00029 %{ 00030 #include <schunk_powercube_chain/datastructsManipulator.h> 00031 %} 00032 #endif 00033 00039 struct Point3D 00040 { 00041 double x; 00042 double y; 00043 double z; 00044 }; 00045 00046 struct AbsPos 00047 { 00048 AbsPos() : Eulerx(0.0), Eulery(0.0), Eulerz(0.0), Transx(0.0), Transy(0.0), Transz(0.0) 00049 { 00050 ; 00051 } 00052 // Bitte beachten: Es werden von nun an XYZ-fixed Winkel benutzt 00053 // (Siehe Craig, S.45ff) 00054 // welche gleichbedeutend mit den Euler-ZYX Winkeln sind. 00055 // Die Bezeichnungen Eulerx, Eulery, Eulerz werden daher beibehalten. 00056 double Eulerx; 00057 double Eulery; 00058 double Eulerz; 00059 double Transx; 00060 double Transy; 00061 double Transz; 00062 void set(double* p); 00063 void setTransX(double transx) 00064 { 00065 Transx = transx; 00066 } 00067 void setTransY(double transy) 00068 { 00069 Transy = transy; 00070 } 00071 void setTransZ(double transz) 00072 { 00073 Transz = transz; 00074 } 00075 void setEulerX(double eulerx) 00076 { 00077 Eulerx = eulerx; 00078 } 00079 void setEulerY(double eulery) 00080 { 00081 Eulery = eulery; 00082 } 00083 void setEulerZ(double eulerz) 00084 { 00085 Eulerz = eulerz; 00086 } 00087 double getTransX() 00088 { 00089 return Transx; 00090 } 00091 double getTransY() 00092 { 00093 return Transy; 00094 } 00095 double getTransZ() 00096 { 00097 return Transz; 00098 } 00099 double getEulerX() 00100 { 00101 return Eulerx; 00102 } 00103 double getEulerY() 00104 { 00105 return Eulery; 00106 } 00107 double getEulerZ() 00108 { 00109 return Eulerz; 00110 } 00111 void angleScale(double s); 00112 void toDeg() 00113 { 00114 angleScale(57.295779524); 00115 } 00116 void toRad() 00117 { 00118 angleScale(0.017453292); 00119 } 00120 AbsPos operator*(double s) const; 00121 AbsPos operator+(const AbsPos& abs2) const; 00122 AbsPos operator-(const AbsPos& abs2) const; 00123 double getPosLength() const 00124 { 00125 return sqrt(Transx * Transx + Transy * Transy + Transz * Transz); 00126 } 00131 double distMeasure(AbsPos otherPos) const; 00132 }; 00133 00134 std::ostream& operator<<(std::ostream& os, const AbsPos& a); 00135 00136 inline AbsPos operator*(double s, const AbsPos& abs) 00137 { 00138 return abs * s; 00139 } 00140 00141 struct DH 00142 { 00143 Jointd a; 00144 Jointd d; 00145 Jointd alpha; 00146 Jointd theta; 00147 }; 00148 00149 struct LimitsTheta 00150 { 00151 Jointd max; 00152 Jointd min; 00153 }; 00154 00155 #endif //__DATASTRUCTS_MANIPULATOR_H_