caterpillar.h

Go to the documentation of this file.
00001 /**************************************************************************/
00002 /*schlangeservo.h                                                         */
00003 /*Snake with PID Servo motors (just motor per joint)                      */
00004 /*@author Georg Martius                                                   */
00005 /*                                                                        */
00006 /**************************************************************************/
00007 /***************************************************************************
00008  *   Copyright (C) 2005 by Robot Group Leipzig                             *
00009  *    martius@informatik.uni-leipzig.de                                    *
00010  *    fhesse@informatik.uni-leipzig.de                                     *
00011  *    der@informatik.uni-leipzig.de                                        *
00012  *    frankguettler@gmx.de                                                 *
00013  *                                                                         *
00014  *   This program is free software; you can redistribute it and/or modify  *
00015  *   it under the terms of the GNU General Public License as published by  *
00016  *   the Free Software Foundation; either version 2 of the License, or     *
00017  *   (at your option) any later version.                                   *
00018  *                                                                         *
00019  *   This program is distributed in the hope that it will be useful,       *
00020  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00021  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00022  *   GNU General Public License for more details.                          *
00023  *                                                                         *
00024  *   You should have received a copy of the GNU General Public License     *
00025  *   along with this program; if not, write to the                         *
00026  *   Free Software Foundation, Inc.,                                       *
00027  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00028  *                                                                         *
00029  *   $Log: caterpillar.h,v $
00030  *   Revision 1.5  2007/02/12 13:28:38  martius
00031  *   twoaxiservos
00032  *
00033  *   Revision 1.4  2007/01/26 12:05:04  martius
00034  *   servos combinied into OneAxisServo
00035  *
00036  *   Revision 1.3  2006/07/20 17:19:44  martius
00037  *   removed using namespace std from matrix.h
00038  *
00039  *   Revision 1.2  2006/07/14 12:23:39  martius
00040  *   selforg becomes HEAD
00041  *
00042  *   Revision 1.1.2.3  2006/05/09 08:46:47  robot3
00043  *   getSensors() and getMotors() modified
00044  *
00045  *   Revision 1.1.2.2  2006/04/11 13:27:00  robot3
00046  *   caterpillar is using now methods from schlangeservo2
00047  *
00048  *   Revision 1.1.2.1  2006/04/11 08:07:43  robot3
00049  *   first version
00050  *
00051  *                                                                         *
00052  ***************************************************************************/
00053 #ifndef __CATERPILLAR_H
00054 #define __CATERPILLAR_H
00055 
00056 #include "defaultCaterpillar.h"
00057 #include "twoaxisservo.h"
00058 #include "oneaxisservo.h"
00059 
00060 namespace lpzrobots {
00061 
00062   /**
00063    * This is a class, which models a snake like robot. 
00064    * It consists of a number of equal elements, each linked 
00065    * by a joint powered by 2 servos
00066    **/
00067   class CaterPillar : public DefaultCaterPillar
00068     {
00069   private:
00070     std::vector <UniversalServo*> universalServos;
00071     std::vector <SliderServo*> sliderServos;
00072 
00073   public:
00074       CaterPillar ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
00075                       const CaterPillarConf& conf, const std::string& name);
00076     
00077       virtual ~CaterPillar();
00078         
00079     /**
00080      *Reads the actual motor commands from an array, 
00081      *an sets all motors of the snake to this values.
00082      *It is an linear allocation.
00083      *@param motors pointer to the array, motor values are scaled to [-1,1] 
00084      *@param motornumber length of the motor array
00085      **/
00086     virtual void setMotors ( const motor* motors, int motornumber );
00087 
00088     /**
00089      *Writes the sensor values to an array in the memory.
00090      *@param sensors pointer to the array
00091      *@param sensornumber length of the sensor array
00092      *@return number of actually written sensors
00093      **/
00094     virtual int getSensors ( sensor* sensors, int sensornumber );
00095         
00096     /** returns number of sensors
00097      */
00098     virtual int getSensorNumber() { assert(created); return 2*universalServos.size()+sliderServos.size(); }
00099 
00100     /** returns number of motors
00101      */
00102     virtual int getMotorNumber(){ assert(created); return 2*universalServos.size()+sliderServos.size(); }
00103 
00104     virtual bool setParam(const paramkey& key, paramval val);
00105 
00106   private:
00107     virtual void create(const osg::Matrix& pose);
00108     virtual void destroy();
00109   };
00110 
00111 }
00112 
00113 #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