LidarDataMessage.h
Go to the documentation of this file.
1 
40 #ifndef LibMultiSense_LidarDataMessage
41 #define LibMultiSense_LidarDataMessage
42 
43 #include <typeinfo>
44 
46 
47 namespace crl {
48 namespace multisense {
49 namespace details {
50 namespace wire {
51 
53 public:
54 
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 // SENSORDPOD_FIRMWARE
63 
64  uint32_t scanCount;
65  uint32_t timeStartSeconds;
67  uint32_t timeEndSeconds;
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 
91 class LidarData : public LidarDataHeader {
92 public:
93 
94  //
95  // Constructors
96 
98  LidarData() {};
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
LidarData(utility::BufferStreamReader &r, VersionType v)
void serialize(Stream &stream, const T &t)
Definition: channel.cc:56
void serialize(Archive &message, const VersionType version)
#define WIRE_HEADER_ATTRIBS_
Definition: Protocol.h:64
static CRL_CONSTEXPR IdType ID_DATA_LIDAR_SCAN
Definition: Protocol.h:198
#define CRL_CONSTEXPR
Definition: Portability.hh:51


multisense_lib
Author(s):
autogenerated on Sun Mar 14 2021 02:34:50