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  message & scanCount;
108  message & timeStartSeconds;
109  message & timeStartMicroSeconds;
110  message & timeEndSeconds;
111  message & timeEndMicroSeconds;
112  message & angleStart;
113  message & angleEnd;
114  message & points;
115 
116  const uint32_t rangeSize = sizeof(uint32_t) * points;
117  const uint32_t intensitySize = sizeof(uint32_t) * points;
118 
119  if (typeid(Archive) == typeid(utility::BufferStreamWriter)) {
120 
121  message.write(distanceP, rangeSize);
122  message.write(intensityP, intensitySize);
123 
124  } else {
125 
126  distanceP = (uint32_t *) message.peek();
127  message.seek(message.tell() + rangeSize);
128 
129  intensityP = (uint32_t *) message.peek();
130  message.seek(message.tell() + intensitySize);
131  }
132  }
133 };
134 
135 #endif // !SENSORPOD_FIRMWARE
136 
137 }}}}; // namespaces
138 
139 #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:55
static CRL_CONSTEXPR IdType ID_DATA_LIDAR_SCAN
Definition: Protocol.h:187
#define CRL_CONSTEXPR
Definition: Portability.hh:38


multisense_lib
Author(s):
autogenerated on Sat Apr 6 2019 02:16:46