00001 /**************************************************************** 00002 * 00003 * Copyright (c) 2010 00004 * 00005 * Fraunhofer Institute for Manufacturing Engineering 00006 * and Automation (IPA) 00007 * 00008 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 * 00010 * Project name: care-o-bot 00011 * ROS stack name: cob_driver 00012 * ROS package name: cob_powercube_chain 00013 * Description: Class definition of the datastructsManipulator. 00014 * 00015 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00016 * 00017 * Author: Felix Geibel, email:Felix.Geibel@gmx.de 00018 * Supervised by: Alexander Bubeck, email:alexander.bubeck@ipa.fhg.de 00019 * 00020 * Date of creation: Nov 2006 00021 * ToDo: 00022 * 00023 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00024 * 00025 * Redistribution and use in source and binary forms, with or without 00026 * modification, are permitted provided that the following conditions are met: 00027 * 00028 * * Redistributions of source code must retain the above copyright 00029 * notice, this list of conditions and the following disclaimer. 00030 * * Redistributions in binary form must reproduce the above copyright 00031 * notice, this list of conditions and the following disclaimer in the 00032 * documentation and/or other materials provided with the distribution. 00033 * * Neither the name of the Fraunhofer Institute for Manufacturing 00034 * Engineering and Automation (IPA) nor the names of its 00035 * contributors may be used to endorse or promote products derived from 00036 * this software without specific prior written permission. 00037 * 00038 * This program is free software: you can redistribute it and/or modify 00039 * it under the terms of the GNU Lesser General Public License LGPL as 00040 * published by the Free Software Foundation, either version 3 of the 00041 * License, or (at your option) any later version. 00042 * 00043 * This program is distributed in the hope that it will be useful, 00044 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00045 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00046 * GNU Lesser General Public License LGPL for more details. 00047 * 00048 * You should have received a copy of the GNU Lesser General Public 00049 * License LGPL along with this program. 00050 * If not, see <http://www.gnu.org/licenses/>. 00051 * 00052 ****************************************************************/ 00053 00054 #ifndef __DATASTRUCTS_MANIPULATOR_H_ 00055 #define __DATASTRUCTS_MANIPULATOR_H_ 00056 00057 #include <cob_powercube_chain/Joint.h> 00058 #include <iostream> 00059 00060 // never in headerfiles! 00061 // using namespace std; 00062 00063 #ifdef SWIG 00064 %module PowerCubeCtrl 00065 %{ 00066 #include <cob_powercube_chain/datastructsManipulator.h> 00067 %} 00068 #endif 00069 00070 00076 struct Point3D { 00077 double x; 00078 double y; 00079 double z; 00080 }; 00081 00082 struct AbsPos { 00083 AbsPos() : Eulerx(0.0), Eulery(0.0), Eulerz(0.0), Transx(0.0), Transy(0.0), Transz(0.0) {;} 00084 // Bitte beachten: Es werden von nun an XYZ-fixed Winkel benutzt 00085 // (Siehe Craig, S.45ff) 00086 // welche gleichbedeutend mit den Euler-ZYX Winkeln sind. 00087 // Die Bezeichnungen Eulerx, Eulery, Eulerz werden daher beibehalten. 00088 double Eulerx; 00089 double Eulery; 00090 double Eulerz; 00091 double Transx; 00092 double Transy; 00093 double Transz; 00094 void set(double* p); 00095 void setTransX(double transx) {Transx=transx;} 00096 void setTransY(double transy) {Transy=transy;} 00097 void setTransZ(double transz) {Transz=transz;} 00098 void setEulerX(double eulerx) {Eulerx=eulerx;} 00099 void setEulerY(double eulery) {Eulery=eulery;} 00100 void setEulerZ(double eulerz) {Eulerz=eulerz;} 00101 double getTransX() {return Transx;} 00102 double getTransY() {return Transy;} 00103 double getTransZ() {return Transz;} 00104 double getEulerX() {return Eulerx;} 00105 double getEulerY() {return Eulery;} 00106 double getEulerZ() {return Eulerz;} 00107 void angleScale(double s); 00108 void toDeg() { angleScale(57.295779524); } 00109 void toRad() { angleScale(0.017453292); } 00110 AbsPos operator*(double s) const; 00111 AbsPos operator+(const AbsPos& abs2) const; 00112 AbsPos operator-(const AbsPos& abs2) const; 00113 double getPosLength() const { return sqrt(Transx*Transx + Transy*Transy + Transz*Transz); } 00118 double distMeasure(AbsPos otherPos) const; 00119 }; 00120 00121 std::ostream& operator<< (std::ostream& os, const AbsPos& a); 00122 00123 00124 inline AbsPos operator* (double s, const AbsPos& abs) { return abs * s; } 00125 00126 00127 00128 struct DH { 00129 Jointd a; 00130 Jointd d; 00131 Jointd alpha; 00132 Jointd theta; 00133 }; 00134 00135 struct LimitsTheta { 00136 Jointd max; 00137 Jointd min; 00138 }; 00139 00140 00141 #endif //__DATASTRUCTS_MANIPULATOR_H_ 00142