schlangeservo2.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 __SCHLANGESERVO2_H
00031 #define __SCHLANGESERVO2_H
00032 
00033 
00034 #include "schlange.h"
00035 #include "twoaxisservo.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 SchlangeServo2: public Schlange
00045   {
00046   private:
00047     std::vector <UniversalServo*> servos;
00048 
00049   public:
00050     SchlangeServo2 ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
00051                      const SchlangeConf& conf, 
00052                      const std::string& name, 
00053                      const std::string& revision = "" );
00054     
00055     virtual ~SchlangeServo2();
00056         
00057     /**
00058      *Reads the actual motor commands from an array, 
00059      *an sets all motors of the snake to this values.
00060      *It is an linear allocation.
00061      *@param motors pointer to the array, motor values are scaled to [-1,1] 
00062      *@param motornumber length of the motor array
00063      **/
00064     virtual void setMotors ( const motor* motors, int motornumber );
00065 
00066     /**
00067      *Writes the sensor values to an array in the memory.
00068      *@param sensors pointer to the array
00069      *@param sensornumber length of the sensor array
00070      *@return number of actually written sensors
00071      **/
00072     virtual int getSensors ( sensor* sensors, int sensornumber );
00073         
00074     /** returns number of sensors
00075      */
00076     virtual int getSensorNumber() { assert(created); return 2*servos.size(); }
00077 
00078     /** returns number of motors
00079      */
00080     virtual int getMotorNumber(){ assert(created); return 2*servos.size(); }
00081 
00082     /******** CONFIGURABLE ***********/
00083     virtual void notifyOnChange(const paramkey& key);
00084 
00085   private:
00086     virtual void create(const osg::Matrix& pose);
00087     virtual void destroy();
00088   };
00089 
00090 }
00091 
00092 #endif
Generated on Thu Jun 28 14:45:37 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3