Robotsystem of the Robot Group Leipzig: schlangevelocity.h Source File

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

- Search for |

- File List
- File Members

# 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 by Robot Group Leipzig                             *
    00008  *    martius@informatik.uni-leipzig.de                                    *
    00009  *    fhesse@informatik.uni-leipzig.de                                     *
    00010  *    der@informatik.uni-leipzig.de                                        *
    00011  *                                                                         *
    00012  *   This program is free software; you can redistribute it and/or modify  *
    00013  *   it under the terms of the GNU General Public License as published by  *
    00014  *   the Free Software Foundation; either version 2 of the License, or     *
    00015  *   (at your option) any later version.                                   *
    00016  *                                                                         *
    00017  *   This program is distributed in the hope that it will be useful,       *
    00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00020  *   GNU General Public License for more details.                          *
    00021  *                                                                         *
    00022  *   You should have received a copy of the GNU General Public License     *
    00023  *   along with this program; if not, write to the                         *
    00024  *   Free Software Foundation, Inc.,                                       *
    00025  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00026  *                                                                         *
    00027  *   $Log: schlangevelocity.h,v $
    00028  *   Revision 1.2  2006/07/14 12:23:42  martius
    00029  *   selforg becomes HEAD
    00030  *
    00031  *   Revision 1.1.2.4  2006/06/25 16:57:16  martius
    00032  *   abstractrobot is configureable
    00033  *   name and revision
    00034  *
    00035  *   Revision 1.1.2.3  2006/03/30 12:34:57  martius
    00036  *   documentation updated
    00037  *
    00038  *   Revision 1.1.2.2  2006/02/01 18:33:40  martius
    00039  *   use Axis type for Joint axis. very important, since otherwise Vec3 * pose is not the right direction vector anymore
    00040  *
    00041  *   Revision 1.1.2.1  2006/01/10 13:55:12  fhesse
    00042  *   snake powered by directly setting angular velocities
    00043  *                                             *
    00044  *                                                                         *
    00045  *                                                                         *
    00046  ***************************************************************************/
    00047 #ifndef __SCHLANGEVELOCITY_H
    00048 #define __SCHLANGEVELOCITY_H
    00049
    00050 #include "schlange.h"
    00051
    00052 namespace lpzrobots {
    00053
    00054   /**
    00055    * This is a class, which models a snake like robot.
    00056    * It consists of a number of equal elements, each linked
    00057    * by a joint powered by directly setting the angular velocities of the joints
    00058    **/
    00059   class SchlangeVelocity: public Schlange
    00060     {
    00061     private:
    00062       paramval factor_motors;
    00063       paramval factor_sensors;
    00064       paramval friction_joint;
    00065
    00066
    00067     public:
    00068       SchlangeVelocity ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00069                       const SchlangeConf& conf, const std::string& name);
    00070
    00071       static SchlangeConf getDefaultConf(){
    00072         SchlangeConf conf;
    00073         conf.segmNumber = 10;      //  number of snake elements
    00074         conf.segmLength = 0.8;     // length of one snake element
    00075         conf.segmDia    = 0.2;     //  diameter of a snake element
    00076         conf.segmMass   = 0.4;     //  mass of one snake element
    00077         conf.motorPower = 0.3;     //  power of motors
    00078         conf.frictionGround = 0.1; // friction with ground
    00079         conf.jointLimit =  M_PI/4;
    00080         return conf;
    00081       }
    00082
    00083       virtual ~SchlangeVelocity();
    00084
    00085       /**
    00086        *Reads the actual motor commands from an array,
    00087        *an sets all motors of the snake to this values.
    00088        *It is an linear allocation.
    00089        *@param motors pointer to the array, motor values are scaled to [-1,1]
    00090        *@param motornumber length of the motor array
    00091        **/
    00092       virtual void setMotors ( const motor* motors, int motornumber );
    00093
    00094       /**
    00095        *Writes the sensor values to an array in the memory.
    00096        *@param sensors pointer to the array
    00097        *@param sensornumber length of the sensor array
    00098        *@return number of actually written sensors
    00099        **/
    00100       virtual int getSensors ( sensor* sensors, int sensornumber );
    00101
    00102       /** returns number of sensors
    00103        */
    00104       virtual int getSensorNumber() { assert(created); return joints.size() * 2; }
    00105
    00106       /** returns number of motors
    00107        */
    00108       virtual int getMotorNumber(){ assert(created); return joints.size() * 2; }
    00109
    00110     private:
    00111       virtual void create(const osg::Matrix& pose);
    00112       virtual void destroy();
    00113     };
    00114
    00115 }
    00116
    00117 #endif