00001 /************************************************************************/ 00002 /*schlangeforce.h */ 00003 /*Snake with torque added to joints */ 00004 /* */ 00005 /************************************************************************/ 00006 /*************************************************************************** 00007 * Copyright (C) 2005 by Robot Group Leipzig * 00008 * martius@informatik.uni-leipzig.de * 00009 * fhesse@informatik.uni-leipzig.de * 00010 * der@informatik.uni-leipzig.de * 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 * This program is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU General Public License * 00023 * along with this program; if not, write to the * 00024 * Free Software Foundation, Inc., * 00025 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00026 * * 00027 * $Log: schlangeforce.h,v $ 00028 * Revision 1.15 2006/07/20 17:19:44 martius 00029 * removed using namespace std from matrix.h 00030 * 00031 * Revision 1.14 2006/07/14 12:23:41 martius 00032 * selforg becomes HEAD 00033 * 00034 * Revision 1.13.4.6 2006/06/25 16:57:15 martius 00035 * abstractrobot is configureable 00036 * name and revision 00037 * 00038 * Revision 1.13.4.5 2006/03/30 12:34:56 martius 00039 * documentation updated 00040 * 00041 * Revision 1.13.4.4 2006/02/01 18:33:40 martius 00042 * use Axis type for Joint axis. very important, since otherwise Vec3 * pose is not the right direction vector anymore 00043 * 00044 * Revision 1.13.4.3 2006/01/04 17:04:41 fhesse 00045 * comments originating from old file removed 00046 * 00047 * Revision 1.13.4.2 2006/01/04 14:46:00 fhesse 00048 * inherits from Schlange; moved to osg 00049 * 00050 * Revision 1.13.4.1 2005/11/14 17:37:18 martius 00051 * moved to selforg 00052 * 00053 * Revision 1.13 2005/11/14 12:48:43 martius 00054 * *** empty log message *** 00055 * 00056 * Revision 1.12 2005/11/09 13:24:42 martius 00057 * added GPL 00058 * 00059 * * 00060 ***************************************************************************/ 00061 #ifndef __SCHLANGEFORCE_H 00062 #define __SCHLANGEFORCE_H 00063 00064 #include "schlange.h" 00065 00066 namespace lpzrobots { 00067 00068 /** 00069 * This is a class, which models a snake like robot. 00070 * It consists of a number of equal elements, each linked 00071 * by a joint powered by torques added to joints 00072 **/ 00073 class SchlangeForce: public Schlange 00074 { 00075 public: 00076 SchlangeForce ( const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00077 const SchlangeConf& conf, const std::string& name); 00078 00079 00080 virtual ~SchlangeForce(); 00081 00082 /** 00083 *Reads the actual motor commands from an array, 00084 *an sets all motors of the snake to this values. 00085 *It is an linear allocation. 00086 *@param motors pointer to the array, motor values are scaled to [-1,1] 00087 *@param motornumber length of the motor array 00088 **/ 00089 virtual void setMotors ( const motor* motors, int motornumber ); 00090 00091 /** 00092 *Writes the sensor values to an array in the memory. 00093 *@param sensors pointer to the array 00094 *@param sensornumber length of the sensor array 00095 *@return number of actually written sensors 00096 **/ 00097 virtual int getSensors ( sensor* sensors, int sensornumber ); 00098 00099 /** returns number of sensors 00100 */ 00101 virtual int getSensorNumber() { assert(created); return joints.size() * 2; } 00102 00103 /** returns number of motors 00104 */ 00105 virtual int getMotorNumber(){ assert(created); return joints.size() * 2; } 00106 00107 private: 00108 virtual void create(const osg::Matrix& pose); 00109 virtual void destroy(); 00110 }; 00111 00112 } 00113 00114 #endif
1.4.7