schlangeservo.h

Go to the documentation of this file.
00001 /************************************************************************/
00002 /*schlangeservo.h                                                       */
00003 /*Snake with PID Servo motors (just one 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: schlangeservo.h,v $
00029  *   Revision 1.10  2009/05/11 15:44:30  martius
00030  *   new velocity servos used
00031  *
00032  *   Revision 1.9  2007/01/26 12:05:04  martius
00033  *   servos combinied into OneAxisServo
00034  *
00035  *   Revision 1.8  2006/09/20 12:56:17  martius
00036  *   Snakes have CreateSegment
00037  *
00038  *   Revision 1.7  2006/07/20 17:19:44  martius
00039  *   removed using namespace std from matrix.h
00040  *
00041  *   Revision 1.6  2006/07/14 12:23:41  martius
00042  *   selforg becomes HEAD
00043  *
00044  *   Revision 1.5.4.7  2006/06/25 16:57:15  martius
00045  *   abstractrobot is configureable
00046  *   name and revision
00047  *
00048  *   Revision 1.5.4.6  2006/03/30 12:34:56  martius
00049  *   documentation updated
00050  *
00051  *   Revision 1.5.4.5  2006/02/01 18:33:40  martius
00052  *   use Axis type for Joint axis. very important, since otherwise Vec3 * pose is not the right direction vector anymore
00053  *
00054  *   Revision 1.5.4.4  2005/12/29 16:46:24  martius
00055  *   inherits from Schlange
00056  *   moved to osg
00057  *
00058  *   Revision 1.5.4.3  2005/11/16 11:26:53  martius
00059  *   moved to selforg
00060  *
00061  *   Revision 1.5.4.2  2005/11/15 12:29:27  martius
00062  *   new selforg structure and OdeAgent, OdeRobot ...
00063  *
00064  *   Revision 1.5.4.1  2005/11/14 17:37:18  martius
00065  *   moved to selforg
00066  *
00067  *   Revision 1.5  2005/11/09 13:24:42  martius
00068  *   added GPL
00069  *
00070  *                                                                 *
00071  ***************************************************************************/
00072 #ifndef __SCHLANGESERVO_H
00073 #define __SCHLANGESERVO_H
00074 
00075 
00076 #include "schlange.h"
00077 #include "oneaxisservo.h"
00078 
00079 namespace lpzrobots {
00080 
00081   /**
00082    * This is a class, which models a snake like robot. 
00083    * It consists of a number of equal elements, each linked 
00084    * by a joint hinge powered by 1 servos
00085    **/
00086   class SchlangeServo: public Schlange
00087   {
00088   private:
00089     std::vector <HingeServo*> servos;
00090 
00091   public:
00092     SchlangeServo ( const OdeHandle& odeHandle, const OsgHandle& osgHandle,
00093                     const SchlangeConf& conf, 
00094                     const std::string& name, const std::string& revision="");
00095 
00096     
00097     virtual ~SchlangeServo();
00098         
00099     /**
00100      *Reads the actual motor commands from an array, 
00101      *an sets all motors of the snake to this values.
00102      *It is an linear allocation.
00103      *@param motors pointer to the array, motor values are scaled to [-1,1] 
00104      *@param motornumber length of the motor array
00105      **/
00106     virtual void setMotors ( const motor* motors, int motornumber );
00107 
00108     /**
00109      *Writes the sensor values to an array in the memory.
00110      *@param sensors pointer to the array
00111      *@param sensornumber length of the sensor array
00112      *@return number of actually written sensors
00113      **/
00114     virtual int getSensors ( sensor* sensors, int sensornumber );
00115         
00116     /** returns number of sensors
00117      */
00118     virtual int getSensorNumber() { assert(created); return servos.size(); }
00119 
00120     /** returns number of motors
00121      */
00122     virtual int getMotorNumber(){ assert(created); return servos.size(); }
00123 
00124     virtual bool setParam(const paramkey& key, paramval val);
00125 
00126   private:
00127     virtual void create(const osg::Matrix& pose);
00128     virtual void destroy();
00129   };
00130 
00131 }
00132 
00133 /*
00134 Parameters for invertmotornstep controller:
00135 motorpower=5
00136 sensorfactor=5
00137 
00138 controller->setParam("adaptrate", 0.000);
00139 controller->setParam("epsC", 0.01);
00140 controller->setParam("epsA", 0.01);
00141 controller->setParam("dampA", 0.0001);
00142 controller->setParam("rootE", 1);
00143 controller->setParam("steps", 1);
00144 controller->setParam("s4avg", 1);
00145 controller->setParam("s4del", 5);
00146 global.odeConfig.setParam("controlinterval",4);
00147 
00148 
00149 High frequency modes and then low-dim modes occur with
00150 controller->setParam("adaptrate", 0.0001);
00151 controller->setParam("nomupdate", 0.0007);
00152 controller->setParam("epsC", 0.01);
00153 controller->setParam("epsA", 0.01);
00154 controller->setParam("dampA", 0.0001);
00155 controller->setParam("rootE", 1);
00156 controller->setParam("steps", 1);
00157 controller->setParam("s4avg", 1);
00158 controller->setParam("s4del", 1);
00159 global.odeConfig.setParam("controlinterval",1);
00160     
00161 
00162 */
00163 
00164 
00165 #endif
00166 

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7