ScannerInfo.hpp
Go to the documentation of this file.
1 //
2 // ScannerInfo.hpp
3 //
4 
5 #ifndef SCANNERINFO_HPP
6 #define SCANNERINFO_HPP
7 
8 #include "../BasicDatatypes.hpp"
9 #include "Position3D.hpp"
10 #include "../tools/Time.hpp"
11 #include <vector>
12 
13 namespace datatypes
14 {
15 
17 {
20 };
21 
22 // Information about one Laserscanner which has sent a Scan
23 class ScannerInfo : public BasicData
24 {
25 public:
26 
28  ScannerInfo();
29  ~ScannerInfo();
30 
31  // Estimate the memory usage of this object
32  virtual const UINT32 getUsedMemory() const { return sizeof(*this); };
33 
34  static std::string scannerTypeToString(UINT8 st);
35 
37  bool operator==(const ScannerInfo& other) const;
38 
39  typedef std::vector<std::pair<double, double> > ResolutionMap;
40 
42  UINT8 getDeviceID() const { return m_deviceID; }
43  void setDeviceID(UINT8 v) { m_deviceID = v; }
44 
45  // Returns the type of scanner that has recorded this scan
46  UINT8 getScannerType() const { return m_scannerType; }
47 
48  // Set the type of the scanner that has recorded this scan
49  void setScannerType(UINT8 newScannerType);
50 
52  UINT16 getScanNumber() const { return m_scanNumber; }
54 
55  // Returns the start angle of this scan in radians.
56  //
57  // Field of view of one every single scanner given in its
58  // local coordinate system, in radians, and normalized to
59  // [-pi, pi[
60  //
61  double getStartAngle() const { return m_startAngle; }
62  void setStartAngle(double v);
63 
64  // Returns the end angle of this scan in radians.
65  //
66  // Field of view of one every single scanner given in its
67  // local coordinate system, in radians, and normalized to
68  // [-pi, pi[
69  double getEndAngle() const { return m_endAngle; }
70  void setEndAngle(double v);
71 
72  // Returns the start timestamp of the scan received by this scanner (in terms of the host computer clock)
73  const Time& getStartTimestamp() const { return m_scanStartTime; }
74 
76  const Time& getEndTimestamp() const { return m_scanEndTime; }
77 
79  void setTimestamps (const Time& start, const Time& end);
80 
81 
83 // const boost::posix_time::ptime& getStartDeviceTimestamp() const { return m_scanStartDeviceTime; }
84 
86 // const boost::posix_time::ptime& getEndDeviceTimestamp() const { return m_scanEndDeviceTime; }
87 
89 // void setDeviceTimestamps (const boost::posix_time::ptime& start, const boost::posix_time::ptime& end);
90 
92  double getScanFrequency() const { return m_scanFrequency; }
93 
95  void setScanFrequency(double freq);
96 
97  // Sets the processing flags of the MRS:
98  //
99  // Bit 0: ground detection performed: 0 = false, 1 = true
100  // Bit 1: dirt detection performed: 0 = false, 1 = true
101  // Bit 2: rain detection performed: 0 = false, 1 = true
102  // Bit 5: transparency detection performed: 0 = false, 1 = true
103  // Bit 6: horizontal angle offset added: 0 = false, 1 = true
104  // Bit 10: mirror side: 0=front (for 8-Layer, tilted downward), 1=rear (for 8-layer, tilted upward)
105  // All other flags are reserved-internal and should not be evaluated.
106  //
107  void setProcessingFlags(const UINT16 processingFlags);
108 
109  // Returns true if the scan was scanned with the rear mirror side. In 8-layer scanners, this
110  // side is usually tilted upward.
111  // This information is part of the processing flags.
112  bool isRearMirrorSide();
113 
114  // Returns true if the scan was scanned with the front mirror side. In 8-layer scanners, this
115  // side is usually tilted downward.
116  // This information is part of the processing flags.
117  bool isFrontMirrorSide();
118 
119  // Returns the angle by which the laser beam is tilted (pitched) in [rad].
120  //
121  // Returns the actual angle by which the laser beam is pitched up
122  // (negative angles) or down (positive angles) if this was an 8L
123  // scanner. The angle is measured relatively to the sensor's
124  // x-y-plane at a horizontal view angle of zero degree.
125  //
126  // Watch out: If this angle is nonzero, the actual beam tilt
127  // changes with the horizontal angle. The formula to obtain the
128  // actual pitch angle \f$\theta\f$ from the beam tilt \f$\beta\f$
129  // at horizontal angle \f$\psi\f$ is
130  // \f[
131  // \theta = \beta\sqrt{2}\sin\left(\frac{\pi}{4}-\frac{\psi}{2}\right)
132  // \f]
133  //
134  // or, written in C++ code,
135  // currentBeamTilt = getBeamTilt() * std::sqrt(2) * std::sin(0.25*::PI - 0.5*hAngle)
136  double getBeamTilt() const { return m_beamTilt; }
137 
138  // Set the beam tilt of this scanner in radians.
139  void setBeamTilt(double tilt);
140 
141  // Get the flags of the single scan belonging to this scanner info.
142  UINT32 getScanFlags() const { return m_scanFlags; }
143 
144  // Set the flags of the single scan belonging to this scanner info.
145  void setScanFlags(UINT32 flags) { m_scanFlags = flags; }
146 
147  // Mounting Position relative to vehicle reference point.
148  //
149  // All angle values in radians, and normalized to [-pi, pi[
150  //
151  // All distance values in [m]
152  //
155 
156  // Get the scanner's horizontal resolution.
157  //
158  // For each element in the returned vector, the \c first value is
159  // the start angle in radians. The \c second value is the
160  // horizontal angle resolution from the start angle onwards in
161  // radians. The returned vector of resolutions has at most 8
162  // elements, but it might have less elements.
163  //
164 // const ResolutionMap& getResolutionMap() const { return m_resolutionMap; }
165 
166  // Set the scanner's horizontal resolution.
167  //
168  // For each element, \c first is the start angle [rad] and \c
169  // second is the horizontal angle resolution [rad]. This vector
170  // must not have more than 8 elements, but it might have less
171  // elements.
172  //
173  // Elements at the end which are all-zero will be removed in the
174  // internally stored ResolutionMap so that only the non-zero
175  // elements will be returned on getResolutionMap().
176  //
177 // void setResolutionMap(const ResolutionMap& m);
178 
179  // Returns the ScannerProperties which belong to the laserscanner
180  // type of this object.
181  //
182  // If an unknown or unimplemented scanner type was set during
183  // setScannerType(), the returned ScannerProperties object has its
184  // values set to its defaults (NaN and zero).
185  //
186  //
187 // const ScannerProperties& getScannerProperties() const;
188 
190 // bool isGroundLabeled() const;
191 // bool isDirtLabeled() const;
192 // bool isRainLabeled() const;
193 // bool isCoverageLabeled() const;
194 // bool isBackgroundLabeled() const;
195 // bool isReflectorLabeled() const;
196 // bool isUpsideDown() const;
197 // bool isRearMirrorSide() const;
198 
199 
200 private:
202 // void updateScannerProperties();
203 
206 // void truncateResolutionMap();
207 
209 // void checkLegalBeamTilt();
210 
211 private:
215 // UINT32 m_scannerStatus;
216  double m_startAngle;
217  double m_endAngle;
218 // float m_syncAngle;
220 
225 
228 // boost::posix_time::ptime m_scanStartDeviceTime;
229 
232 // boost::posix_time::ptime m_scanEndDeviceTime;
233 
237  double m_beamTilt;
240 
242 
244 // ResolutionMap m_resolutionMap;
245 
247 // boost::shared_ptr<ScannerProperties> m_scannerProperties;
248 };
249 
250 } // namespace datatypes
251 
252 #endif // SCANNERINFO_HPP
void setScannerType(UINT8 newScannerType)
void setMountingPosition(const Position3D &v)
bool operator==(const ScannerInfo &other) const
Equality predicate.
Definition: ScannerInfo.cpp:56
double getScanFrequency() const
Returns the start timestamp of this scan as given by the measuring device (which most probably has a ...
Definition: ScannerInfo.hpp:92
uint16_t UINT16
A Position with orientation.
Definition: Position3D.hpp:149
UINT8 getDeviceID() const
Returns the ID of the device that has recorded this scan.
Definition: ScannerInfo.hpp:42
const Position3D & getMountingPosition() const
Definition: Time.hpp:44
double getBeamTilt() const
void setEndAngle(double v)
void setDeviceID(UINT8 v)
Definition: ScannerInfo.hpp:43
void setScanFrequency(double freq)
Set the scanner&#39;s scan frequency in [Hz]. Must be non-negative.
uint32_t UINT32
double m_beamTilt
Beam tilt of this scanner in radians.
void setStartAngle(double v)
Definition: ScannerInfo.cpp:94
const Time & getStartTimestamp() const
Definition: ScannerInfo.hpp:73
void setScanNumber(UINT16 v)
Definition: ScannerInfo.hpp:53
UINT8 getScannerType() const
Definition: ScannerInfo.hpp:46
double getEndAngle() const
Definition: ScannerInfo.hpp:69
UINT16 getScanNumber() const
Returns the scan counter from scanner device.
Definition: ScannerInfo.hpp:52
static std::string scannerTypeToString(UINT8 st)
Definition: ScannerInfo.cpp:39
std::vector< std::pair< double, double > > ResolutionMap
Definition: ScannerInfo.hpp:39
ScannerInfo()
Empty constructor.
Definition: ScannerInfo.cpp:18
double m_scanFrequency
Scan frequency of this scanner.
UINT32 getScanFlags() const
Position3D m_mountingPosition
virtual const UINT32 getUsedMemory() const
Definition: ScannerInfo.hpp:32
UINT32 m_scanFlags
Flags for the single scan belonging to this scanner info.
double getStartAngle() const
Definition: ScannerInfo.hpp:61
Time m_scanEndTime
End timestamp of the scan received by this scanner.
void setScanFlags(UINT32 flags)
Time m_scanStartTime
Start timestamp of the scan received by this scanner.
void setBeamTilt(double tilt)
const Time & getEndTimestamp() const
Returns the end timestamp of the scan (in terms of the host computer clock)
Definition: ScannerInfo.hpp:76
void setProcessingFlags(const UINT16 processingFlags)
Definition: ScannerInfo.cpp:73
void setTimestamps(const Time &start, const Time &end)
Set the start and end timestamp of the scan received by this scanner (in terms of the host computer c...
UINT8 m_deviceID
Accessor functions for scan flags.
uint8_t UINT8


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Sat Jun 8 2019 17:57:33