LibMultiSense
LibMultiSense Documentation
Loading...
Searching...
No Matches
LidarDataMessage.hh
Go to the documentation of this file.
1
40#ifndef LibMultiSense_LidarDataMessage
41#define LibMultiSense_LidarDataMessage
42
43#include <typeinfo>
44
46
47namespace crl {
48namespace multisense {
49namespace details {
50namespace wire {
51
53public:
54
55 static CRL_CONSTEXPR IdType ID = ID_DATA_LIDAR_SCAN;
56 static CRL_CONSTEXPR VersionType VERSION = 1;
57 static CRL_CONSTEXPR uint32_t SCAN_POINTS = 1081;
58
59#ifdef SENSORPOD_FIRMWARE
60 IdType id;
61 VersionType version;
62#endif // SENSORPOD_FIRMWARE
63
64 uint32_t scanCount;
69 int32_t angleStart; // microradians
70 int32_t angleEnd;
71 uint32_t points;
72#ifdef SENSORPOD_FIRMWARE
73 uint32_t distanceP[SCAN_POINTS]; // millimeters
74 uint32_t intensityP[SCAN_POINTS];
75#else
76 uint32_t *distanceP;
77 uint32_t *intensityP;
78#endif // SENSORPOD_FIRMWARE
79
81 :
82#ifdef SENSORPOD_FIRMWARE
83 id(ID),
84 version(VERSION),
85#endif // SENSORPOD_FIRMWARE
86 points(0) {};
87};
88
89#ifndef SENSORPOD_FIRMWARE
90
91class LidarData : public LidarDataHeader {
92public:
93
94 //
95 // Constructors
96
99
100 //
101 // Serialization routine
102
103 template<class Archive>
104 void serialize(Archive& message,
105 const VersionType version)
106 {
107 (void) version;
108 message & scanCount;
109 message & timeStartSeconds;
110 message & timeStartMicroSeconds;
111 message & timeEndSeconds;
112 message & timeEndMicroSeconds;
113 message & angleStart;
114 message & angleEnd;
115 message & points;
116
117 const uint32_t rangeSize = sizeof(uint32_t) * points;
118 const uint32_t intensitySize = sizeof(uint32_t) * points;
119
120 if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
121
122 message.write(distanceP, rangeSize);
123 message.write(intensityP, intensitySize);
124
125 } else {
126
127 distanceP = (uint32_t *) message.peek();
128 message.seek(message.tell() + rangeSize);
129
130 intensityP = (uint32_t *) message.peek();
131 message.seek(message.tell() + intensitySize);
132 }
133 }
134};
135
136#endif // !SENSORPOD_FIRMWARE
137
138}}}} // namespaces
139
140#endif
Macros and symbols to help portability between different compiler versions.
#define CRL_CONSTEXPR
#define WIRE_HEADER_ATTRIBS_
Definition Protocol.hh:65
void serialize(Archive &message, const VersionType version)
LidarData(utility::BufferStreamReader &r, VersionType v)