uwo.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 * * 00022 * $Log: uwo.h,v $ 00023 * Revision 1.3 2006/12/21 11:43:05 martius 00024 * commenting style for doxygen //< -> ///< 00025 * new sensors for spherical robots 00026 * 00027 * Revision 1.2 2006/07/14 12:23:42 martius 00028 * selforg becomes HEAD 00029 * 00030 * Revision 1.1.2.2 2006/06/25 16:57:17 martius 00031 * abstractrobot is configureable 00032 * name and revision 00033 * 00034 * Revision 1.1.2.1 2006/06/10 20:13:33 martius 00035 * unknown walking object 00036 * 00037 * 00038 * * 00039 ***************************************************************************/ 00040 #ifndef __UWO_H 00041 #define __UWO_H 00042 00043 #include "oderobot.h" 00044 00045 namespace lpzrobots { 00046 00047 class Primitive; 00048 class Joint; 00049 class UniversalServo; 00050 00051 typedef struct { 00052 public: 00053 double size; ///< scaling factor for robot (diameter of body) 00054 double legLength; ///< length of the legs in units of size 00055 int legNumber; ///< number of snake elements 00056 bool radialLegs; ///< joint orientation is radial instead of cartesian 00057 double mass; ///< chassis mass 00058 double relLegmass; ///< relative overall leg mass 00059 double jointLimit; ///< angle range for legs 00060 double motorPower; ///< maximal force for motors 00061 double frictionGround; ///< friction with the ground 00062 } UwoConf; 00063 00064 00065 /** UWO: Unknown Walk Object :-), looks like a plate with a lot of legs 00066 */ 00067 class Uwo : public OdeRobot { 00068 public: 00069 00070 /** 00071 * constructor of uwo robot 00072 * @param odeHandle data structure for accessing ODE 00073 * @param osgHandle ata structure for accessing OSG 00074 * @param size scaling of robot 00075 * @param force maximal used force to realize motorcommand 00076 * @param radialLegs switches between cartensian and radial leg joints 00077 */ 00078 Uwo(const OdeHandle& odeHandle, const OsgHandle& osgHandle, const UwoConf& conf, 00079 const std::string& name); 00080 00081 virtual ~Uwo(){}; 00082 00083 static UwoConf getDefaultConf(){ 00084 UwoConf c; 00085 c.size = 1; 00086 c.legNumber = 8; 00087 c.legLength = 0.3; 00088 c.mass = 1; 00089 c.relLegmass = 1; 00090 c.motorPower = 0.5; 00091 c.jointLimit = M_PI/12; // +- 15 degree 00092 c.radialLegs = true; 00093 c.frictionGround = 1; 00094 return c; 00095 } 00096 00097 /** 00098 * updates the OSG nodes of the vehicle 00099 */ 00100 virtual void update(); 00101 00102 00103 /** sets the pose of the vehicle 00104 @param pose desired pose matrix 00105 */ 00106 virtual void place(const osg::Matrix& pose); 00107 00108 /** returns actual sensorvalues 00109 @param sensors sensors scaled to [-1,1] 00110 @param sensornumber length of the sensor array 00111 @return number of actually written sensors 00112 */ 00113 virtual int getSensors(sensor* sensors, int sensornumber); 00114 00115 /** sets actual motorcommands 00116 @param motors motors scaled to [-1,1] 00117 @param motornumber length of the motor array 00118 */ 00119 virtual void setMotors(const motor* motors, int motornumber); 00120 00121 /** returns number of sensors 00122 */ 00123 virtual int getSensorNumber(){ 00124 return conf.legNumber*2; 00125 }; 00126 00127 /** returns number of motors 00128 */ 00129 virtual int getMotorNumber(){ 00130 return conf.legNumber*2; 00131 }; 00132 00133 /** checks for internal collisions and treats them. 00134 * In case of a treatment return true (collision will be ignored by other objects 00135 * and the default routine) else false (collision is passed to other objects and 00136 * (if not treated) to the default routine). 00137 */ 00138 virtual bool collisionCallback(void *data, dGeomID o1, dGeomID o2); 00139 00140 /** this function is called in each timestep. It should perform robot-internal checks, 00141 like space-internal collision detection, sensor resets/update etc. 00142 @param globalData structure that contains global data from the simulation environment 00143 */ 00144 virtual void doInternalStuff(const GlobalData& globalData); 00145 00146 00147 /** The list of all parameters with there value as allocated lists. 00148 */ 00149 virtual paramlist getParamList() const; 00150 00151 virtual paramval getParam(const paramkey& key) const;; 00152 00153 virtual bool setParam(const paramkey& key, paramval val); 00154 00155 00156 protected: 00157 /** the main object of the robot, which is used for position and speed tracking */ 00158 virtual Primitive* getMainPrimitive() const { return objects[0]; } 00159 00160 /** creates vehicle at desired pose 00161 @param pose 4x4 pose matrix 00162 */ 00163 virtual void create(const osg::Matrix& pose); 00164 00165 /** destroys vehicle and space 00166 */ 00167 virtual void destroy(); 00168 00169 UwoConf conf; 00170 double legmass; // leg mass 00171 00172 bool created; // true if robot was created 00173 00174 std::vector<Primitive*> objects; // 1 body, legs 00175 std::vector<Joint*> joints; // joints between cylinder and each legs 00176 std::vector <UniversalServo*> servos; // motors 00177 00178 }; 00179 00180 } 00181 00182 #endif

Generated on Tue Jan 16 02:14:38 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8