Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
straightline.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __STRAIGHTLINE_H
25 #define __STRAIGHTLINE_H
26 
27 #include "abstracttracksection.h"
28 
29 /**
30  * Abstract class (interface) for obstacles
31  */
33 
34 public:
35 
36  /**
37  * Constructor
38  */
39  StraightLine(const Position& p,const double& angle);
40 
41  /**
42  * Constructor
43  */
44  StraightLine(const Matrix& pose);
45 
46  virtual ~StraightLine(){}
47 
48  void setCurveAngle(double alpha);
49 
50  /**
51  * gives the position and rotation(angle) of the segment at the
52  * end of the segment so that a new segment could be placed there
53  * if you want to place the new segment, you must muliplicate:
54  * getTransformedEndMatrix()*getPositionMatrix();
55  */
57 
58 
59  /**
60  * returns true if the real coordinates lay inside of the segment
61  */
62  virtual bool isInside(const Position& p);
63 
64 
65  virtual double getSectionIdValue(const Position& p);
66 
67  virtual double getWidthIdValue(const Position& p);
68 
69 
70  /**
71  * returns the length of the segment,
72  * here it is the length of the arc
73  * formula is: radius * angle;
74  */
75  virtual double getLength();
76 
77  /**
78  * returns the width of the segment,
79  */
80  virtual double getWidth();
81 
82  /**
83  * sets the width of the segment,
84  */
85  virtual void setWidth(double w);
86 
87 
88  /**
89  * draws the obstacle (4 boxes for the playground)
90  */
91  virtual void draw();
92 
93  virtual void create(dSpaceID space);
94 
95  virtual void destroy();
96 
97 protected:
98  // this is the length of the segment
99  double length;
100  // this is the width of the segment
101  // normally it should be the same like alle the other segments
102  double width;
103  dGeomID wallLeft; // the wall left to the street
104  dGeomID wallRight; // the wall right to the street
105  double widthWall;
106  double heightWall;
107  // angle is for straightline 0
108  double angle;
109  // determines if the curve goes right or left
110  double isLeft;
111 
113 
114  /**
115  * obstacle color
116  */
117  Color color;
118 
119  void setProperties();
120 };
121 
122 #endif
double heightWall
Definition: straightline.h:106
Matrix type.
Definition: matrix.h:65
Abstract class (interface) for obstacles.
Definition: abstracttracksection.h:37
StraightLine(const Position &p, const double &angle)
Constructor.
Definition: straightline.cpp:40
double length
Definition: straightline.h:99
dGeomID wallRight
Definition: straightline.h:104
void setCurveAngle(double alpha)
virtual double getLength()
returns the length of the segment, here it is the length of the arc formula is: radius * angle; ...
Definition: straightline.cpp:109
dGeomID wallLeft
Definition: straightline.h:103
virtual void destroy()
Definition: straightline.cpp:176
double angle
Definition: straightline.h:108
virtual void create(dSpaceID space)
Definition: straightline.cpp:148
virtual bool isInside(const Position &p)
returns true if the real coordinates lay inside of the segment
Definition: straightline.cpp:66
virtual double getWidth()
returns the width of the segment,
Definition: straightline.cpp:116
Definition: position.h:30
void setProperties()
Definition: straightline.cpp:28
double width
Definition: straightline.h:102
virtual void draw()
draws the obstacle (4 boxes for the playground)
Definition: straightline.cpp:134
Abstract class (interface) for obstacles.
Definition: straightline.h:32
double widthWall
Definition: straightline.h:105
virtual ~StraightLine()
Definition: straightline.h:46
bool obstacle_exists
Definition: straightline.h:112
Color color
obstacle color
Definition: straightline.h:117
double isLeft
Definition: straightline.h:110
virtual void setWidth(double w)
sets the width of the segment,
Definition: straightline.cpp:123
virtual Matrix getTransformedEndMatrix()
gives the position and rotation(angle) of the segment at the end of the segment so that a new segment...
Definition: straightline.cpp:58
virtual double getSectionIdValue(const Position &p)
returns a value between 0 and length that tells at which section you are on the segment.
Definition: straightline.cpp:80
virtual double getWidthIdValue(const Position &p)
returns a value between 0 and width that tells at which width you are on the segment, more to right or more to the left.
Definition: straightline.cpp:95