-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathPacketBundleDecoder.h
More file actions
54 lines (47 loc) · 1.56 KB
/
Copy pathPacketBundleDecoder.h
File metadata and controls
54 lines (47 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Velodyne HDL Packet Bundle Decoder
// Nick Rypkema (rypkema@mit.edu), MIT 2017
// shared library to decode a bundle of velodyne packets
#ifndef PACKET_BUNDLE_DECODER_H_INCLUDED
#define PACKET_BUNDLE_DECODER_H_INCLUDED
#include <string>
#include <vector>
#include <deque>
#include "PacketDecoder.h"
class PacketBundleDecoder
{
public:
struct HDLFrame
{
std::vector<double> x;
std::vector<double> y;
std::vector<double> z;
std::vector<unsigned char> intensity;
std::vector<unsigned char> laser_id;
std::vector<unsigned short> azimuth;
std::vector<double> distance;
std::vector<unsigned int> ms_from_top_of_hour;
};
public:
PacketBundleDecoder();
virtual ~PacketBundleDecoder();
void SetMaxNumberOfFrames(unsigned int max_num_of_frames);
void DecodeBundle(std::string* bundle, unsigned int* bundle_length);
void SetCorrectionsFile(const std::string& corrections_file);
std::deque<HDLFrame> GetFrames();
void ClearFrames();
bool GetLatestFrame(HDLFrame* frame);
protected:
void UnloadData();
void InitTables();
void LoadCorrectionsFile(const std::string& correctionsFile);
void LoadHDL32Corrections();
void SetCorrectionsCommon();
void ProcessHDLPacket(unsigned char *data, unsigned int data_length);
void PushFiringData(unsigned char laserId, unsigned short azimuth, unsigned int timestamp, HDLLaserReturn laserReturn, HDLLaserCorrection correction);
private:
std::string _corrections_file;
unsigned int _max_num_of_frames;
HDLFrame* _frame;
std::deque<HDLFrame> _frames;
};
#endif // PACKET_BUNDLE_DECODER_H_INCLUDED