Robotsystem from Robot Group Leipzig: schlangeservo2.h Source File

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# 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 by Robot Group Leipzig                             *
    00009  *    martius@informatik.uni-leipzig.de                                    *
    00010  *    fhesse@informatik.uni-leipzig.de                                     *
    00011  *    der@informatik.uni-leipzig.de                                        *
    00012  *                                                                         *
    00013  *   This program is free software; you can redistribute it and/or modify  *
    00014  *   it under the terms of the GNU General Public License as published by  *
    00015  *   the Free Software Foundation; either version 2 of the License, or     *
    00016  *   (at your option) any later version.                                   *
    00017  *                                                                         *
    00018  *   This program is distributed in the hope that it will be useful,       *
    00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00021  *   GNU General Public License for more details.                          *
    00022  *                                                                         *
    00023  *   You should have received a copy of the GNU General Public License     *
    00024  *   along with this program; if not, write to the                         *
    00025  *   Free Software Foundation, Inc.,                                       *
    00026  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00027  *                                                                         *
    00028  *   $Log: schlangeservo2.h,v $
    00029  *   Revision 1.1.2.2  2006/03/30 12:34:56  martius
    00030  *   documentation updated
    00031  *
    00032  *   Revision 1.1.2.1  2006/02/01 18:33:40  martius
    00033  *   use Axis type for Joint axis. very important, since otherwise Vec3 * pose is not the right direction vector anymore
    00034  *
    00035  *                                                                 *
    00036  ***************************************************************************/
    00037 #ifndef __SCHLANGESERVO2_H
    00038 #define __SCHLANGESERVO2_H
    00039
    00040
    00041 #include "schlange.h"
    00042 #include "universalservo.h"
    00043
    00044 namespace lpzrobots {
    00045
    00046   /**
    00047    * This is a class, which models a snake like robot.
    00048    * It consists of a number of equal elements, each linked
    00049    * by a joint powered by 2 servos
    00050    **/
    00051   class SchlangeServo2: public Schlange
    00052   {
    00053   private:
    00054     vector <UniversalServo*> servos;
    00055
    00056   public:
    00057     SchlangeServo2 ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00058                     const SchlangeConf& conf, const char* name);
    00059
    00060
    00061     virtual ~SchlangeServo2();
    00062
    00063     /**
    00064      *Reads the actual motor commands from an array,
    00065      *an sets all motors of the snake to this values.
    00066      *It is an linear allocation.
    00067      *@param motors pointer to the array, motor values are scaled to [-1,1]
    00068      *@param motornumber length of the motor array
    00069      **/
    00070     virtual void setMotors ( const motor* motors, int motornumber );
    00071
    00072     /**
    00073      *Writes the sensor values to an array in the memory.
    00074      *@param sensors pointer to the array
    00075      *@param sensornumber length of the sensor array
    00076      *@return number of actually written sensors
    00077      **/
    00078     virtual int getSensors ( sensor* sensors, int sensornumber );
    00079
    00080     /** returns number of sensors
    00081      */
    00082     virtual int getSensorNumber() { assert(created); return 2*servos.size(); }
    00083
    00084     /** returns number of motors
    00085      */
    00086     virtual int getMotorNumber(){ assert(created); return 2*servos.size(); }
    00087
    00088     virtual bool setParam(const paramkey& key, paramval val);
    00089
    00090   private:
    00091     virtual void create(const osg::Matrix& pose);
    00092     virtual void destroy();
    00093   };
    00094
    00095 }
    00096
    00097 #endif