hfl_driver  0.0.20
ROS driver for Continental's HFL110 3D Flash Lidar
hfl_interface.h
Go to the documentation of this file.
1 // Copyright 2020 Continental AG
2 // All rights reserved.
3 //
4 // Software License Agreement (BSD 2-Clause Simplified License)
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
8 // are met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 // POSSIBILITY OF SUCH DAMAGE.
29 
30 
36 
37 #ifndef HFL_INTERFACE_H_
38 #define HFL_INTERFACE_H_
39 #include <hfl_configs.h>
40 #include <hfl_frame.h>
41 
42 #ifdef _WIN32
43 #include <winsock2.h>
44 #elif __linux__
45 #include <arpa/inet.h> // ntohl()
46 #endif
47 
48 #include <string>
49 #include <vector>
50 #include <memory>
51 
52 namespace hfl
53 {
54 
55 static inline float big_to_native(float x)
56 {
57  return ntohl(x);
58 }
59 
60 static inline uint32_t big_to_native(uint32_t x)
61 {
62  return ntohl(x);
63 }
64 
65 static inline uint16_t big_to_native(uint16_t x)
66 {
67  return ntohs(x);
68 }
69 
70 static inline uint8_t big_to_native(uint8_t x)
71 {
72  return x;
73 }
74 
77 {
80  lut_data
81 };
82 
85 {
86  eight_bit = 0,
90 };
91 
96 {
97 protected:
99  std::string model_;
100 
102  std::string version_;
103 
105  std::string ip_address_;
106 
109 
112 
114  std::string parent_frame_;
115  double x_;
116  double y_;
117  double z_;
118  double roll_;
119  double pitch_;
120  double yaw_;
121 
123  double time_offset_;
124 
127 
129  double ch1_offset_;
130  double ch2_offset_;
131  double ch3_offset_;
132  double ch4_offset_;
133 
143 
145  std::shared_ptr<hfl::Frame> frame_;
146 
147 public:
153  std::string getModel() const;
154 
160  std::string getVersion() const;
161 
169  virtual bool setFrameRate(double rate) = 0;
170 
177  virtual double getFrameRate(bool reg_format = false) const = 0;
178 
186  virtual bool setGlobalRangeOffset(double offset) = 0;
187 
196  virtual bool setChannelRangeOffset(uint8_t ch, double offset) = 0;
197 
206  virtual bool setIntensityRangeOffset(uint8_t band, double offset) = 0;
207 
215  virtual bool parseFrame(int start_byte, const std::vector<uint8_t>& packet) = 0;
216 
224  virtual bool processFrameData(const std::vector<uint8_t>& data) = 0;
225 
233  virtual bool parseObjects(int start_byte, const std::vector<uint8_t>& packet) = 0;
234 
242  virtual bool processObjectData(const std::vector<uint8_t>& data) = 0;
243 
249  std::shared_ptr<Frame> frame();
250 };
251 
252 } // namespace hfl
253 #endif // HFL_INTERFACE_H_
Base class for all of the HFL cameras.
Definition: hfl_interface.h:96
std::string version_
Current camera model.
Definition: hfl_interface.h:102
virtual bool processFrameData(const std::vector< uint8_t > &data)=0
double y_
Definition: hfl_interface.h:116
double ch1_offset_
channel range offset
Definition: hfl_interface.h:129
virtual double getFrameRate(bool reg_format=false) const =0
double int3000_offset_
Definition: hfl_interface.h:140
virtual bool setGlobalRangeOffset(double offset)=0
std::string parent_frame_
current static tf values
Definition: hfl_interface.h:114
double int2000_offset_
Definition: hfl_interface.h:138
double ch3_offset_
Definition: hfl_interface.h:131
double int4096_offset_
Definition: hfl_interface.h:142
virtual bool parseFrame(int start_byte, const std::vector< uint8_t > &packet)=0
double roll_
Definition: hfl_interface.h:118
double int1500_offset_
Definition: hfl_interface.h:137
std::string getVersion() const
Definition: hfl_interface.cpp:52
bool publish_tf_
Current publish tf state.
Definition: hfl_interface.h:111
std::shared_ptr< hfl::Frame > frame_
Camera's frame configurations.
Definition: hfl_interface.h:145
std::string getModel() const
Definition: hfl_interface.cpp:47
double int3500_offset_
Definition: hfl_interface.h:141
std::string ip_address_
Camera's IP address.
Definition: hfl_interface.h:105
std::string model_
Current camera model.
Definition: hfl_interface.h:99
virtual bool setIntensityRangeOffset(uint8_t band, double offset)=0
double global_offset_
global range offset
Definition: hfl_interface.h:126
double time_offset_
time offset
Definition: hfl_interface.h:123
double int1000_offset_
Definition: hfl_interface.h:136
double pitch_
Definition: hfl_interface.h:119
double x_
Definition: hfl_interface.h:115
virtual bool setChannelRangeOffset(uint8_t ch, double offset)=0
virtual bool parseObjects(int start_byte, const std::vector< uint8_t > &packet)=0
std::shared_ptr< Frame > frame()
Definition: hfl_interface.cpp:57
uint16_t frame_data_port_
Camera's UDP frame data port.
Definition: hfl_interface.h:108
double int2500_offset_
Definition: hfl_interface.h:139
double int500_offset_
intensity range offset
Definition: hfl_interface.h:135
double ch4_offset_
Definition: hfl_interface.h:132
virtual bool processObjectData(const std::vector< uint8_t > &data)=0
virtual bool setFrameRate(double rate)=0
double ch2_offset_
Definition: hfl_interface.h:130
double z_
Definition: hfl_interface.h:117
double yaw_
Definition: hfl_interface.h:120
This file defines HFL cameras data and custom types.
This file defines the camera's Frame class.
Definition: camera_commander.h:56
udp_port_types
UDP ports types.
Definition: hfl_interface.h:77
@ lut_data
Definition: hfl_interface.h:80
@ frame_data
Definition: hfl_interface.h:78
@ object_data
Definition: hfl_interface.h:79
num_bits
Number of Bits.
Definition: hfl_interface.h:85
@ eight_bit
Definition: hfl_interface.h:86
@ twelve_bit
Definition: hfl_interface.h:88
@ ten_bit
Definition: hfl_interface.h:87
@ fourteen_bit
Definition: hfl_interface.h:89