ScannerInfo.cpp
Go to the documentation of this file.
1 //
2 // ScannerInfo.cpp
3 //
4 //
5 
6 #include "ScannerInfo.hpp"
7 
8 #include "Position3D.hpp"
9 #include "Scan.hpp"
10 #include <cassert>
11 #include "../tools/Time.hpp"
12 #include "../tools/errorhandler.hpp"
13 #include "../tools/toolbox.hpp"
14 
15 namespace datatypes
16 {
17 
19  : m_deviceID(0)
20  , m_scannerType(0)
21  , m_scanNumber(0)
22  , m_startAngle(NaN_double)
23  , m_endAngle(NaN_double)
24  , m_processingFlags(0)
25  , m_scanStartTime(Time())
26  , m_scanEndTime(Time())
27  , m_scanFrequency(NaN_double)
28  , m_beamTilt(0)
29  , m_scanFlags(0)
30  , m_mountingPosition()
31 {
33 }
34 
36 {
37 }
38 
40 {
41  switch (st)
42  {
44  return "UNKNOWN";
45  break;
46  case Scannertype_LMS1xx:
47  return "LMS1xx";
48  break;
49  default:
50  printError("scannerTypeToString: Unknown scanner type, code=" + ::toString((UINT16)st) + ".");
51  return "(error - unknown type)";
52  }
53 }
54 
55 
56 bool ScannerInfo::operator==(const ScannerInfo& other) const
57 {
58  return
59  m_deviceID == other.m_deviceID
60  && m_scannerType == other.m_scannerType
61  && m_scanNumber == other.m_scanNumber
62  && (m_startAngle == other.m_startAngle || (isNaN(m_startAngle) && isNaN(other.m_startAngle)))
63  && (m_endAngle == other.m_endAngle || (isNaN(m_endAngle) && isNaN(other.m_endAngle)))
65  && m_scanEndTime == other.m_scanEndTime
67  && m_beamTilt == other.m_beamTilt
68  && m_scanFlags == other.m_scanFlags
70  ;
71 }
72 
73 void ScannerInfo::setProcessingFlags(const UINT16 processingFlags)
74 {
75  m_processingFlags = processingFlags;
76 }
77 
79 {
80  if ((m_processingFlags & 0x0400) != 0)
81  {
82  return true;
83  }
84 
85  return false;
86 }
87 
89 {
90  return !isRearMirrorSide();
91 }
92 
93 
95 {
96  assert(v >= -PI);
97  assert(v < PI);
98  m_startAngle = v;
99 }
100 
102 {
103  assert(v >= -PI);
104  assert(v < PI);
105  m_endAngle = v;
106 }
107 
109 {
110  m_scannerType = v;
111 }
112 
114 {
115  assert(v >= -PI);
116  assert(v < PI);
117  m_beamTilt = v;
118 }
119 
124 void ScannerInfo::setTimestamps (const Time& start,
125  const Time& end)
126 {
127  assert(start < end);
128  m_scanStartTime = start;
129  m_scanEndTime = end;
130 }
131 
136 /*
137 void ScannerInfo::setDeviceTimestamps (const boost::posix_time::ptime& start,
138  const boost::posix_time::ptime& end)
139 {
140  assert(!start.is_not_a_date_time());
141  assert(!end.is_not_a_date_time());
142  assert(start < end);
143  m_scanStartDeviceTime = start;
144  m_scanEndDeviceTime = end;
145 }
146 */
147 
149 {
150  assert(freq >= 0);
151  m_scanFrequency = freq;
152 }
153 
154 
155 // bool ScannerInfo::isGroundLabeled() const { return (m_scanFlags & Scan::FlagGroundLabeled) != 0; }
156 // bool ScannerInfo::isDirtLabeled() const { return (m_scanFlags & Scan::FlagDirtLabeled ) != 0; }
157 // bool ScannerInfo::isRainLabeled() const { return (m_scanFlags & Scan::FlagRainLabeled) != 0; }
158 // bool ScannerInfo::isCoverageLabeled() const { return (m_scanFlags & Scan::FlagCoverageLabeled) != 0; }
159 // bool ScannerInfo::isBackgroundLabeled() const { return (m_scanFlags & Scan::FlagBackgroundLabeled) != 0; }
160 // bool ScannerInfo::isReflectorLabeled() const { return (m_scanFlags & Scan::FlagReflectorLabeled) != 0; }
161 // bool ScannerInfo::isUpsideDown() const { return (m_scanFlags & Scan::FlagUpsideDown) != 0; }
162 // bool ScannerInfo::isRearMirrorSide() const { return (m_scanFlags & Scan::FlagRearMirrorSide) != 0; }
163 
164 } // namespace datatypes
void setScannerType(UINT8 newScannerType)
void printError(std::string message)
std::string toString(const PositionWGS84::PositionWGS84SourceType &type)
const double NaN_double
Not-a-Number in double precision.
Definition: MathToolbox.cpp:13
bool operator==(const ScannerInfo &other) const
Equality predicate.
Definition: ScannerInfo.cpp:56
uint16_t UINT16
Definition: Time.hpp:44
void setEndAngle(double v)
void setScanFrequency(double freq)
Set the scanner&#39;s scan frequency in [Hz]. Must be non-negative.
double m_beamTilt
Beam tilt of this scanner in radians.
void setStartAngle(double v)
Definition: ScannerInfo.cpp:94
static std::string scannerTypeToString(UINT8 st)
Definition: ScannerInfo.cpp:39
ScannerInfo()
Empty constructor.
Definition: ScannerInfo.cpp:18
double m_scanFrequency
Scan frequency of this scanner.
Position3D m_mountingPosition
UINT32 m_scanFlags
Flags for the single scan belonging to this scanner info.
Time m_scanEndTime
End timestamp of the scan received by this scanner.
Time m_scanStartTime
Start timestamp of the scan received by this scanner.
void setBeamTilt(double tilt)
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...
bool isNaN(floatT x)
Checks if a floating point value is Not-a-Number (NaN)
Definition: MathToolbox.hpp:63
#define PI
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