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.13.4.5 2006/03/30 12:34:56 martius 00029 * documentation updated 00030 * 00031 * Revision 1.13.4.4 2006/02/01 18:33:40 martius 00032 * use Axis type for Joint axis. very important, since otherwise Vec3 * pose is not the right direction vector anymore 00033 * 00034 * Revision 1.13.4.3 2006/01/04 17:04:41 fhesse 00035 * comments originating from old file removed 00036 * 00037 * Revision 1.13.4.2 2006/01/04 14:46:00 fhesse 00038 * inherits from Schlange; moved to osg 00039 * 00040 * Revision 1.13.4.1 2005/11/14 17:37:18 martius 00041 * moved to selforg 00042 * 00043 * Revision 1.13 2005/11/14 12:48:43 martius 00044 * *** empty log message *** 00045 * 00046 * Revision 1.12 2005/11/09 13:24:42 martius 00047 * added GPL 00048 * 00049 * * 00050 ***************************************************************************/ 00051 #ifndef __SCHLANGEFORCE_H 00052 #define __SCHLANGEFORCE_H 00053 00054 #include "schlange.h" 00055 00056 namespace lpzrobots { 00057 00058 /** 00059 * This is a class, which models a snake like robot. 00060 * It consists of a number of equal elements, each linked 00061 * by a joint powered by torques added to joints 00062 **/ 00063 class SchlangeForce: public Schlange 00064 { 00065 public: 00066 SchlangeForce ( const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00067 const SchlangeConf& conf, const char* name); 00068 00069 00070 virtual ~SchlangeForce(); 00071 00072 /** 00073 *Reads the actual motor commands from an array, 00074 *an sets all motors of the snake to this values. 00075 *It is an linear allocation. 00076 *@param motors pointer to the array, motor values are scaled to [-1,1] 00077 *@param motornumber length of the motor array 00078 **/ 00079 virtual void setMotors ( const motor* motors, int motornumber ); 00080 00081 /** 00082 *Writes the sensor values to an array in the memory. 00083 *@param sensors pointer to the array 00084 *@param sensornumber length of the sensor array 00085 *@return number of actually written sensors 00086 **/ 00087 virtual int getSensors ( sensor* sensors, int sensornumber ); 00088 00089 /** returns number of sensors 00090 */ 00091 virtual int getSensorNumber() { assert(created); return joints.size() * 2; } 00092 00093 /** returns number of motors 00094 */ 00095 virtual int getMotorNumber(){ assert(created); return joints.size() * 2; } 00096 00097 private: 00098 virtual void create(const osg::Matrix& pose); 00099 virtual void destroy(); 00100 }; 00101 00102 } 00103 00104 #endif