schlangevelocity.h

Go to the documentation of this file.
00001 /************************************************************************/
00002 /*schlangevelocity.h                                                    */
00003 /*Snake with powered by setting angular velocities                      */
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: schlangevelocity.h,v $
00028  *   Revision 1.3  2007/01/26 12:05:04  martius
00029  *   servos combinied into OneAxisServo
00030  *
00031  *   Revision 1.2  2006/07/14 12:23:42  martius
00032  *   selforg becomes HEAD
00033  *
00034  *   Revision 1.1.2.4  2006/06/25 16:57:16  martius
00035  *   abstractrobot is configureable
00036  *   name and revision
00037  *
00038  *   Revision 1.1.2.3  2006/03/30 12:34:57  martius
00039  *   documentation updated
00040  *
00041  *   Revision 1.1.2.2  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.1.2.1  2006/01/10 13:55:12  fhesse
00045  *   snake powered by directly setting angular velocities
00046  *                                             *
00047  *                                                                         *
00048  *                                                                         *
00049  ***************************************************************************/
00050 #ifndef __SCHLANGEVELOCITY_H
00051 #define __SCHLANGEVELOCITY_H
00052 
00053 #include "schlange.h"
00054 
00055 namespace lpzrobots {
00056 
00057   /**
00058    * This is a class, which models a snake like robot. 
00059    * It consists of a number of equal elements, each linked 
00060    * by a joint powered by directly setting the angular velocities of the joints
00061    **/
00062   class SchlangeVelocity: public Schlange
00063     {
00064     private:
00065       paramval factor_motors;
00066       paramval factor_sensors;
00067       paramval friction_joint;
00068 
00069 
00070     public:
00071       SchlangeVelocity ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
00072                       const SchlangeConf& conf, const std::string& name);
00073 
00074       static SchlangeConf getDefaultConf(){
00075         SchlangeConf conf;
00076         conf.segmNumber = 10;      //  number of snake elements
00077         conf.segmLength = 0.8;     // length of one snake element
00078         conf.segmDia    = 0.2;     //  diameter of a snake element
00079         conf.segmMass   = 0.4;     //  mass of one snake element
00080         conf.motorPower = 0.3;     //  power of motors
00081         conf.frictionGround = 0.1; // friction with ground
00082         conf.jointLimit =  M_PI/4;      
00083         return conf;
00084       }
00085 
00086       virtual ~SchlangeVelocity();
00087         
00088       /**
00089        *Reads the actual motor commands from an array, 
00090        *an sets all motors of the snake to this values.
00091        *It is an linear allocation.
00092        *@param motors pointer to the array, motor values are scaled to [-1,1] 
00093        *@param motornumber length of the motor array
00094        **/
00095       virtual void setMotors ( const motor* motors, int motornumber );
00096 
00097       /**
00098        *Writes the sensor values to an array in the memory.
00099        *@param sensors pointer to the array
00100        *@param sensornumber length of the sensor array
00101        *@return number of actually written sensors
00102        **/
00103       virtual int getSensors ( sensor* sensors, int sensornumber );
00104         
00105       /** returns number of sensors
00106        */
00107       virtual int getSensorNumber() { assert(created); return joints.size() * 2; }
00108 
00109       /** returns number of motors
00110        */
00111       virtual int getMotorNumber(){ assert(created); return joints.size() * 2; }
00112 
00113     private:
00114       virtual void create(const osg::Matrix& pose);
00115       virtual void destroy();
00116     };
00117 
00118 }
00119 
00120 #endif

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7