Fields.hpp
Go to the documentation of this file.
1 //
2 // Fields.hpp
3 //
4 // Created on: 30.08.2011
5 // Author: wahnfla
6 //
7 
8 #ifndef FIELDS_HPP
9 #define FIELDS_HPP
10 
11 #include "Polygon2D.hpp"
12 #include <vector>
13 #include "../BasicDatatypes.hpp"
14 #include "FieldDescription.hpp"
15 #include "FieldParameter.hpp"
16 
17 namespace datatypes
18 {
19 
20 
21 
22 //
23 //
24 // *******************************************************************************
25 //
26 //
27 class Fields : public BasicData
28 {
29 public:
30  typedef std::vector<FieldParameter*> FieldVector;
31 
33 
34  virtual ~Fields() {}
35  const UINT32 getUsedMemory() const;
36 
37  void add(FieldParameter* field);
38 
39  const FieldParameter& getField(UINT16 fieldNumber) const;
40 
42 
43  const FieldVector& getFields() const
44  {
45  return m_fields;
46  }
47 
48 private:
49 
50  FieldVector m_fields;
51 };
52 
53 //
54 //
55 // *******************************************************************************
56 //
57 // Helper class for a point of a segmented field.
58 // Note that as with all internal data structures, units
59 // should be [rad] and [m].
60 //
62 {
63 public:
64  FieldSegmentedPoint(double angle, double startDist, double endDist) :
65  m_angle(angle),
66  m_startDist(startDist),
67  m_endDist(endDist)
68  {
69  }
71  {
72  m_angle = 0.0;
73  m_startDist = 0.0;
74  m_endDist = 0.0;
75  }
76 
77  double getAngle() const { return m_angle; }
78  double getStartDist() const { return m_startDist; }
79  double getEndDist() const { return m_endDist; }
80  void setAngle(double angle) { m_angle = angle; }
81  void setStartDist(double startDist) { m_startDist = startDist; }
82  void setEndDist(double endDist) { m_endDist = endDist; }
83 
84 private:
85  double m_angle;
86  double m_startDist;
87  double m_endDist;
88 };
89 
90 typedef std::vector<FieldSegmentedPoint> FieldSegmentedPoints;
91 
92 //
93 //
94 // *******************************************************************************
95 //
96 //
98 {
99 public:
101  {
102  m_fieldType = FieldDescription::Segmented;
103  }
104 
105  virtual ~FieldSegmented() {}
106 
107  void addPoint(const FieldSegmentedPoint& point)
108  {
109  m_points.push_back(point);
110  }
111 
112  virtual const UINT32 getUsedMemory() const
113  {
114  return sizeof(*this) + (m_points.size() * sizeof(FieldSegmentedPoints));
115  }
116 
117  UINT32 getNumberOfPoints();
118  void computePolygon();
119  FieldSegmentedPoints getPoints();
120 
121 private:
122  FieldSegmentedPoints m_points;
123 };
124 
125 //
126 //
127 // *******************************************************************************
128 //
129 //
131 {
132 public:
134  {
135  m_fieldType = FieldDescription::Rectangle;
136  }
137 
138  virtual ~FieldRectangle()
139  {
140  }
141 
142  virtual const UINT32 getUsedMemory() const
143  {
144  return sizeof(*this);
145  }
146 
147  void computePolygon();
148  double getLength() const;
149  double getRefPointAngle() const;
150  double getRefPointDist() const;
151  double getRotAngle() const;
152  double getWidth() const;
153  void setLength(double length);
154  void setRefPointAngle(double refPointAngle);
155  void setRefPointDist(double refPointDist);
156  void setRotAngle(double rotAngle);
157  void setWidth(double width);
158 
159 private:
161  double m_refPointDist;
162  double m_rotAngle;
163  double m_width;
164  double m_length;
165 };
166 
167 //
168 //
169 // *******************************************************************************
170 //
171 //
173 {
174 public:
175 
177  {
178  m_fieldType = FieldDescription::Radial;
179  }
180 
181  virtual ~FieldRadial()
182  {
183  }
184 
185  virtual const UINT32 getUsedMemory() const
186  {
187  return sizeof(*this);
188  }
189 
190  UINT16 getFirstAngle() const;
191  UINT16 getLastAngle() const;
192  UINT32 getMaxDist() const;
193  UINT32 getMinDist() const;
194  void setFirstAngle(UINT16 m_firstAngle);
195  void setLastAngle(UINT16 m_lastAngle);
196  void setMaxDist(UINT32 m_maxDist);
197  void setMinDist(UINT32 m_minDist);
198 
199  void computePolygon();
200 
201 private:
206 
207 };
208 
209 //
210 //
211 // *******************************************************************************
212 //
213 //
215 {
216 public:
218  {
219  m_fieldType = FieldDescription::Dynamic;
220  }
221 
222  virtual ~FieldDynamic()
223  {
224  }
225 
226  virtual const UINT32 getUsedMemory() const
227  {
228  return sizeof(*this);
229  }
230 
231  double getMaxLength() const;
232  double getSpeedMax() const;
233  void setMaxLength(double maxLength);
234  void setSpeedMax(double speedMax);
235 
236 private:
237  double m_maxLength;
238  double m_speedMax;
239 };
240 
241 } // namespace datatypes
242 
243 #endif // FIELDS
double getEndDist() const
Definition: Fields.hpp:79
virtual const UINT32 getUsedMemory() const
Definition: Fields.hpp:226
UINT16 m_lastAngle
index of last angle relative to AngleScale
Definition: Fields.hpp:203
FieldSegmentedPoint(double angle, double startDist, double endDist)
Definition: Fields.hpp:64
const FieldParameter & getField(UINT16 fieldNumber) const
Definition: Fields.cpp:254
const UINT32 getUsedMemory() const
Definition: Fields.cpp:283
UINT16 m_firstAngle
index of start angle relative to AngleScale
Definition: Fields.hpp:202
UINT16 getNumberOfValidFields()
Definition: Fields.cpp:298
uint16_t UINT16
virtual const UINT32 getUsedMemory() const
Definition: Fields.hpp:112
double m_rotAngle
[rad]
Definition: Fields.hpp:162
void addPoint(const FieldSegmentedPoint &point)
Definition: Fields.hpp:107
double m_refPointAngle
[rad]
Definition: Fields.hpp:160
double getAngle() const
Definition: Fields.hpp:77
double getStartDist() const
Definition: Fields.hpp:78
uint32_t UINT32
UINT32 m_maxDist
[mm]
Definition: Fields.hpp:205
double m_speedMax
[m/s]
Definition: Fields.hpp:238
void setStartDist(double startDist)
Definition: Fields.hpp:81
void setEndDist(double endDist)
Definition: Fields.hpp:82
virtual ~Fields()
Definition: Fields.hpp:34
UINT32 m_minDist
[mm]
Definition: Fields.hpp:204
FieldSegmentedPoints m_points
Definition: Fields.hpp:122
virtual const UINT32 getUsedMemory() const
Definition: Fields.hpp:142
std::vector< FieldSegmentedPoint > FieldSegmentedPoints
Definition: Fields.hpp:90
FieldVector m_fields
Definition: Fields.hpp:50
double m_refPointDist
[m]
Definition: Fields.hpp:161
virtual ~FieldDynamic()
Definition: Fields.hpp:222
std::vector< FieldParameter * > FieldVector
Definition: Fields.hpp:30
void setAngle(double angle)
Definition: Fields.hpp:80
virtual const UINT32 getUsedMemory() const
Definition: Fields.hpp:185
void add(FieldParameter *field)
Definition: Fields.cpp:278
virtual ~FieldRadial()
Definition: Fields.hpp:181
double m_maxLength
[m] extension at maximum speed to direction of RotAngle+90° relative to DistScale ...
Definition: Fields.hpp:237
const FieldVector & getFields() const
Definition: Fields.hpp:43


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30