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

# schlangevelocity.h

Go to the documentation of this file.

    00001 /************************************************************************/
    00002 /*schlangevelocity.h                                                    */
    00003 /*Snake with powered by setting angular velocities                      */
    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 __SCHLANGEVELOCITY_H
    00030 #define __SCHLANGEVELOCITY_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 directly setting the angular velocities of the joints
    00040    **/
    00041   class SchlangeVelocity: public Schlange
    00042     {
    00043     private:
    00044       paramval factor_motors;
    00045       paramval factor_sensors;
    00046       paramval friction_joint;
    00047
    00048
    00049     public:
    00050       SchlangeVelocity ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00051                       const SchlangeConf& conf, const std::string& name);
    00052
    00053       static SchlangeConf getDefaultConf(){
    00054         SchlangeConf conf;
    00055         conf.segmNumber = 10;      //  number of snake elements
    00056         conf.segmLength = 0.8;     // length of one snake element
    00057         conf.segmDia    = 0.2;     //  diameter of a snake element
    00058         conf.segmMass   = 0.4;     //  mass of one snake element
    00059         conf.motorPower = 0.3;     //  power of motors
    00060         conf.jointLimit =  M_PI/4;
    00061         return conf;
    00062       }
    00063
    00064       virtual ~SchlangeVelocity();
    00065
    00066       /**
    00067        *Reads the actual motor commands from an array,
    00068        *an sets all motors of the snake to this values.
    00069        *It is an linear allocation.
    00070        *@param motors pointer to the array, motor values are scaled to [-1,1]
    00071        *@param motornumber length of the motor array
    00072        **/
    00073       virtual void setMotors ( const motor* motors, int motornumber );
    00074
    00075       /**
    00076        *Writes the sensor values to an array in the memory.
    00077        *@param sensors pointer to the array
    00078        *@param sensornumber length of the sensor array
    00079        *@return number of actually written sensors
    00080        **/
    00081       virtual int getSensors ( sensor* sensors, int sensornumber );
    00082
    00083       /** returns number of sensors
    00084        */
    00085       virtual int getSensorNumber() { assert(created); return joints.size() * 2; }
    00086
    00087       /** returns number of motors
    00088        */
    00089       virtual int getMotorNumber(){ assert(created); return joints.size() * 2; }
    00090
    00091     private:
    00092       virtual void create(const osg::Matrix& pose);
    00093       virtual void destroy();
    00094     };
    00095
    00096 }
    00097
    00098 #endif