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-2011 LpzRobots development team                    *
00009  *    Georg Martius  <georg dot martius at web dot de>                     *
00010  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
00011  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
00012  *    Ralf Der       <ralfder at mis dot mpg dot 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  ***************************************************************************/
00030 #ifndef __CATERPILLAR_H
00031 #define __CATERPILLAR_H
00032 
00033 #include "defaultCaterpillar.h"
00034 #include "twoaxisservo.h"
00035 #include "oneaxisservo.h"
00036 
00037 namespace lpzrobots {
00038 
00039   /**
00040    * This is a class, which models a snake like robot. 
00041    * It consists of a number of equal elements, each linked 
00042    * by a joint powered by 2 servos
00043    **/
00044   class CaterPillar : public DefaultCaterPillar
00045     {
00046   private:
00047     std::vector <UniversalServo*> universalServos;
00048     std::vector <SliderServo*> sliderServos;
00049 
00050   public:
00051       CaterPillar ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
00052                       const CaterPillarConf& conf, const std::string& name);
00053     
00054       virtual ~CaterPillar();
00055         
00056     /**
00057      *Reads the actual motor commands from an array, 
00058      *an sets all motors of the snake to this values.
00059      *It is an linear allocation.
00060      *@param motors pointer to the array, motor values are scaled to [-1,1] 
00061      *@param motornumber length of the motor array
00062      **/
00063     virtual void setMotors ( const motor* motors, int motornumber );
00064 
00065     /**
00066      *Writes the sensor values to an array in the memory.
00067      *@param sensors pointer to the array
00068      *@param sensornumber length of the sensor array
00069      *@return number of actually written sensors
00070      **/
00071     virtual int getSensors ( sensor* sensors, int sensornumber );
00072         
00073     /** returns number of sensors
00074      */
00075     virtual int getSensorNumber() { assert(created); return 2*universalServos.size()+sliderServos.size(); }
00076 
00077     /** returns number of motors
00078      */
00079     virtual int getMotorNumber(){ assert(created); return 2*universalServos.size()+sliderServos.size(); }
00080 
00081     /******** CONFIGURABLE ***********/
00082     virtual void notifyOnChange(const paramkey& key);
00083 
00084   private:
00085     virtual void create(const osg::Matrix& pose);
00086     virtual void destroy();
00087   };
00088 
00089 }
00090 
00091 #endif
Generated on Thu Jun 28 14:45:36 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3