straightline.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
00003  *    martius@informatik.uni-leipzig.de                                    *
00004  *    fhesse@informatik.uni-leipzig.de                                     *
00005  *    der@informatik.uni-leipzig.de                                        *
00006  *    frankguettler@gmx.de                                                 *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program; if not, write to the                         *
00020  *   Free Software Foundation, Inc.,                                       *
00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00022  *                                                                         *
00023  *   $Log: straightline.h,v $
00024  *   Revision 1.4  2005/12/12 13:44:41  martius
00025  *   barcodesensor is working
00026  *
00027  *   Revision 1.3  2005/12/03 16:57:12  martius
00028  *   setWidth is void
00029  *
00030  *   Revision 1.2  2005/11/22 15:51:23  robot3
00031  *   testing
00032  *
00033  *   Revision 1.1  2005/11/15 14:29:25  robot3
00034  *   first version
00035  *
00036  *                                                                         *
00037  ***************************************************************************/
00038 #ifndef __STRAIGHTLINE_H
00039 #define __STRAIGHTLINE_H
00040 
00041 #include "abstracttracksection.h"
00042 
00043 /**
00044  *  Abstract class (interface) for obstacles
00045  */
00046 class StraightLine : public AbstractTrackSection {
00047 
00048 public:
00049 
00050   /**
00051    * Constructor
00052    */
00053   StraightLine(const Position& p,const double& angle);
00054 
00055   /**
00056    * Constructor
00057    */
00058   StraightLine(const Matrix& pose);
00059 
00060   virtual ~StraightLine(){}
00061 
00062   void setCurveAngle(double alpha);
00063 
00064   /**
00065    * gives the position and rotation(angle) of the segment at the
00066    * end of the segment so that a new segment could be placed there
00067    * if you want to place the new segment, you must muliplicate:
00068    * getTransformedEndMatrix()*getPositionMatrix();
00069    */
00070   virtual Matrix getTransformedEndMatrix();
00071 
00072 
00073   /**
00074    * returns true if the real coordinates lay inside of the segment
00075    */
00076   virtual bool isInside(const Position& p);
00077 
00078 
00079   virtual double getSectionIdValue(const Position& p);
00080 
00081   virtual double getWidthIdValue(const Position& p);
00082 
00083 
00084   /**
00085    * returns the length of the segment,
00086    * here it is the length of the arc
00087    * formula is: radius * angle;
00088    */
00089   virtual double getLength();
00090   
00091   /**
00092    * returns the width of the segment,
00093    */
00094   virtual double getWidth();
00095   
00096   /**
00097    * sets the width of the segment,
00098    */
00099   virtual void setWidth(double w);
00100   
00101   
00102   /**
00103    * draws the obstacle (4 boxes for the playground)
00104    */
00105   virtual void draw();  
00106   
00107   virtual void create(dSpaceID space);
00108   
00109   virtual void destroy();
00110   
00111 protected:
00112   // this is the length of the segment
00113   double length;
00114   // this is the width of the segment
00115   // normally it should be the same like alle the other segments
00116   double width;
00117   dGeomID wallLeft; // the wall left to the street
00118   dGeomID wallRight; // the wall right to the street
00119   double widthWall;
00120   double heightWall;
00121   // angle is for straightline 0
00122   double angle;
00123   // determines if the curve goes right or left
00124   double isLeft;
00125 
00126   bool obstacle_exists;
00127 
00128   /**
00129    * obstacle color
00130    */
00131   Color color;
00132  
00133   void setProperties();
00134 };
00135 
00136 #endif

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