Robot Simulator of the Robotics Group for Self-Organization of Control: schlangeforce.h Source File

# schlangeforce.h

Go to the documentation of this file.

    00001 /************************************************************************/
    00002 /*schlangeforce.h                                                       */
    00003 /*Snake with torque added to joints                                     */
    00004 /*                                                                      */
    00005 /************************************************************************/
    00006 /***************************************************************************
    00007  *   Copyright (C) 2005-2011 LpzRobots development team                    *
    00008  *    Georg Martius  <georg dot martius at web dot de>                     *
    00009  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
    00010  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
    00011  *    Ralf Der       <ralfder at mis dot mpg dot 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  ***************************************************************************/
    00029 #ifndef __SCHLANGEFORCE_H
    00030 #define __SCHLANGEFORCE_H
    00031
    00032 #include "schlange.h"
    00033
    00034 namespace lpzrobots {
    00035
    00036   /**
    00037    * This is a class, which models a snake like robot.
    00038    * It consists of a number of equal elements, each linked
    00039    * by a joint powered by torques added to joints
    00040    **/
    00041   class SchlangeForce: public Schlange
    00042     {
    00043     public:
    00044       SchlangeForce ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00045                       const SchlangeConf& conf,
    00046                       const std::string& name, const std::string& revision);
    00047
    00048
    00049       virtual ~SchlangeForce();
    00050
    00051       /**
    00052        *Reads the actual motor commands from an array,
    00053        *an sets all motors of the snake to this values.
    00054        *It is an linear allocation.
    00055        *@param motors pointer to the array, motor values are scaled to [-1,1]
    00056        *@param motornumber length of the motor array
    00057        **/
    00058       virtual void setMotors ( const motor* motors, int motornumber );
    00059
    00060       /**
    00061        *Writes the sensor values to an array in the memory.
    00062        *@param sensors pointer to the array
    00063        *@param sensornumber length of the sensor array
    00064        *@return number of actually written sensors
    00065        **/
    00066       virtual int getSensors ( sensor* sensors, int sensornumber );
    00067
    00068       /** returns number of sensors
    00069        */
    00070       virtual int getSensorNumber() { assert(created); return joints.size() * 2; }
    00071
    00072       /** returns number of motors
    00073        */
    00074       virtual int getMotorNumber(){ assert(created); return joints.size() * 2; }
    00075
    00076     private:
    00077       virtual void create(const osg::Matrix& pose);
    00078       virtual void destroy();
    00079     };
    00080
    00081 }
    00082
    00083 #endif