hfl110dcu.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 #ifndef IMAGE_PROCESSOR__HFL110DCU_H_
37 #define IMAGE_PROCESSOR__HFL110DCU_H_
38 
39 #include <base_hfl110dcu.h>
40 
41 #include <angles/angles.h>
42 #include <arpa/inet.h>
44 #include <cv_bridge/cv_bridge.h>
45 #include <geometry_msgs/TransformStamped.h>
48 #include <ros/package.h>
52 #include <geometry_msgs/Point.h>
53 #include <std_msgs/UInt16MultiArray.h>
54 #include <sensor_msgs/PointCloud2.h>
56 #include <visualization_msgs/Marker.h>
57 #include <visualization_msgs/MarkerArray.h>
60 
61 #include <string>
62 #include <vector>
63 #include <cmath>
64 #include <memory>
65 
66 #include "ros/ros.h"
67 
68 
69 #define HFL110_MAGIC_NUMBER_16_BIT 0.000762951 // 50 / 2^16
70 
71 const float NO_RETURN_DISTANCES = NAN;
72 
73 namespace hfl
74 {
77 {
78  uint16_t range;
79  uint16_t intensity;
80  uint16_t range2;
81  uint16_t intensity2;
82 };
83 
86 {
87  uint16_t udp_version;
88  uint16_t pca_version;
89  uint64_t timeStamp;
91  uint32_t image_row_number;
92 };
93 
96 {
97  float_t fx;
98  float_t fy;
99  float_t ux;
100  float_t uy;
101  float_t r1;
102  float_t r2;
103  float_t t1;
104  float_t t2;
105  float_t r3;
106 };
107 
110 {
111  float_t intrinsic_yaw;
113  float_t extrinsic_yaw;
115  float_t extrinsic_roll;
119  uint32_t status;
120 };
121 
123 struct UdpFrame
124 {
128  PointCloudReturn returns[128];
129  uint8_t pixel_type[128];
130 };
131 
133 struct objGeo
134 {
135  float x_rear_r;
136  float y_rear_r;
137  float x_rear_l;
138  float y_rear_l;
139  float x_front_l;
140  float y_front_l;
141  float height;
143  float fDistX;
144  float fDistY;
145  float yaw;
146 };
147 
149 struct objKin
150 {
151  float fVabsX;
152  float fVabsY;
153  float fVrelX;
154  float fVrelY;
155  float fAabsX;
156  float fDistXDistY;
157  float fDistXVx;
158  float fDistXVy;
159  float fDistXAx;
160  float fDistXAy;
161  float fDistYVx;
162  float fDistYVy;
163  float fDistYAx;
164  float fDistYAy;
165  float fVxVy;
166  float fVxAx;
167  float fVxAy;
168  float fVyAx;
169  float fVyAy;
170  float fAxAy;
171 };
172 
174 struct objState
175 {
176  unsigned TP_OBJ_MT_STATE_DELETED : 1;
177  unsigned TP_OBJ_MT_STATE_NEW : 1;
178  unsigned TP_OBJ_MT_STATE_MEASURED : 1;
179  unsigned TP_OBJ_MT_STATE_PREDICTED : 1;
180  unsigned TP_OBJ_MT_STATE_INACTIVE : 1;
181  unsigned TP_OBJ_MT_STATE_MAX_DIFF : 1;
182 };
183 
185 struct objDyn
186 {
187  unsigned EM_GEN_OBJECT_DYN_PROPERTY_MOVING : 1;
188  unsigned EM_GEN_OBJECT_DYN_PROPERTY_STATIONARY : 1;
189  unsigned EM_GEN_OBJECT_DYN_PROPERTY_ONCOMING : 1;
190  unsigned EM_GEN_OBJECT_DYN_PROPERTY_CROSSING_LEFT : 1;
191  unsigned EM_GEN_OBJECT_DYN_PROPERTY_CROSSING_RIGHT : 1;
192  unsigned EM_GEN_OBJECT_DYN_PROPERTY_UNKNOWN : 1;
193  unsigned EM_GEN_OBJECT_DYN_PROPERTY_STOPPED : 1;
194  unsigned EM_GEN_OBJECT_DYN_PROPERTY_MAX_DIFF_TYPES : 1;
195 };
196 
198 struct hflObj
199 {
204  uint8_t quality;
205  uint8_t classification;
206  uint8_t confidence;
207 };
208 
210 struct telemetry
211 {
213  float fSensorTemp;
214  float fHeaterTemp;
215  uint32_t uiFrameCounter;
216  float fADCUbattSW;
217  float fADCUbatt;
223  char au8SerialNumber[26];
224 };
225 
229 class HFL110DCU : public BaseHFL110DCU
230 {
231 public:
240  HFL110DCU(std::string model, std::string version,
241  std::string frame_id, ros::NodeHandle& node_handler);
242 
250  bool parseFrame(int start_byte, const std::vector<uint8_t>& packet) override;
251 
259  bool processFrameData(const std::vector<uint8_t>& data) override;
260 
268  //bool parsePDM(int start_byte, const std::vector<uint8_t>& packet) override;
269 
277  //bool processPDMData(const std::vector<uint8_t>& data) override;
278 
286  bool parseObjects(int start_byte, const std::vector<uint8_t>& packet) override;
287 
295  bool processObjectData(const std::vector<uint8_t>& data) override;
296 
304  bool processTelemetryData(const std::vector<uint8_t>& data) override;
305 
313  bool processSliceData(const std::vector<uint8_t>& data) override;
314 
316  cv::Mat initTransform(cv::Mat cameraMatrix, cv::Mat distCoeffs,
317  int width, int height, bool radial);
318 
320  void update_diagnostics(diagnostic_updater::DiagnosticStatusWrapper &stat);
321 
322 private:
325 
328 
330  std::shared_ptr<std_msgs::Header> frame_header_message_;
331 
333  std::shared_ptr<std_msgs::Header> pdm_header_message_;
334 
336  std::shared_ptr<std_msgs::Header> object_header_message_;
337 
339  std::shared_ptr<std_msgs::Header> tele_header_message_;
340 
342  std::shared_ptr<std_msgs::Header> slice_header_message_;
343 
345  std::shared_ptr<std_msgs::Header> tf_header_message_;
346 
348  uint8_t row_, col_;
349 
351  uint8_t expected_packet_ = 0;
352 
355 
356  // Camera info manager
358 
361 
364 
367 
370 
373 
376 
379 
382 
385 
388 
391 
394 
397 
400 
403 
406 
409 
412 
415 
418 
421 
424 
426  std::vector<hflObj> objects_;
427 
430 
432  telemetry telem_{};
433 
435  std::shared_ptr<sensor_msgs::PointCloud2> pointcloud_;
436 
438  std::shared_ptr<std_msgs::UInt16MultiArray> slices_;
439 
441  geometry_msgs::TransformStamped global_tf_;
442 
444  cv::Mat transform_;
445 
446  // Diagnostic Updater
448 
449 };
450 } // namespace hfl
451 #endif // IMAGE_PROCESSOR__HFL110DCU_H_
std::shared_ptr< std_msgs::Header > tele_header_message_
Telemetry Header message.
Definition: hfl110dcu.h:339
image_transport::CameraPublisher pub_depth_
Depth image publisher.
Definition: hfl110dcu.h:390
float fDistXAy
Definition: hfl110dcu.h:160
HFL110DCU v1 object geometry.
Definition: hfl110dcu.h:133
geometry_msgs::TransformStamped global_tf_
ROS Transform.
Definition: hfl110dcu.h:441
image_transport::CameraPublisher pub_depth2_
Depth image publisher second return 2.
Definition: hfl110dcu.h:393
HFL110DCU v1 object kinematics.
Definition: hfl110dcu.h:149
uint32_t uiHardwareRevision
Definition: hfl110dcu.h:212
uint8_t classification
Definition: hfl110dcu.h:205
objGeo geometry
Definition: hfl110dcu.h:200
HFL110DCU v1 frame struct.
Definition: hfl110dcu.h:76
float fSensorTemp
Definition: hfl110dcu.h:213
float fADCUbatt
Definition: hfl110dcu.h:217
image_transport::CameraPublisher pub_si_
Superimposed flag image publisher.
Definition: hfl110dcu.h:414
std::shared_ptr< std_msgs::Header > tf_header_message_
TF Header message.
Definition: hfl110dcu.h:345
float fVxAy
Definition: hfl110dcu.h:167
diagnostic_updater::Updater updater_
Definition: hfl110dcu.h:447
uint8_t quality
Definition: hfl110dcu.h:204
uint32_t upd_packet_number
Definition: hfl110dcu.h:90
HFL110DCU v1 ethernet packet header struct.
Definition: hfl110dcu.h:85
ros::Publisher pub_slices_
Slices publisher.
Definition: hfl110dcu.h:423
ros::Publisher pub_objects_
Objects publisher.
Definition: hfl110dcu.h:420
float fVxVy
Definition: hfl110dcu.h:165
HFL110DCU v1 ethernet extrinsics struct.
Definition: hfl110dcu.h:95
cv_bridge::CvImagePtr p_image_depth2_
Pointer to depth image second return.
Definition: hfl110dcu.h:366
float fVabsY
Definition: hfl110dcu.h:152
data
float y_front_l
Definition: hfl110dcu.h:140
cv_bridge::CvImagePtr p_image_crosstalk2_
Pointer to crosstalk2 flags.
Definition: hfl110dcu.h:381
float fDistYAy
Definition: hfl110dcu.h:164
image_transport::CameraPublisher pub_sat2_
Saturated2 flag image publisher.
Definition: hfl110dcu.h:411
cv::Mat transform_
Transform.
Definition: hfl110dcu.h:444
HFL110DCU v1 object dynamic property.
Definition: hfl110dcu.h:185
HFL110DCU v1 ethernet extrinsics struct.
Definition: hfl110dcu.h:109
float fDistYVx
Definition: hfl110dcu.h:161
float fADCHeaterLensHigh
Definition: hfl110dcu.h:219
float fADCHeaterLens
Definition: hfl110dcu.h:218
std::shared_ptr< std_msgs::Header > frame_header_message_
Frame Header message.
Definition: hfl110dcu.h:330
float fHeaterTemp
Definition: hfl110dcu.h:214
float fVxAx
Definition: hfl110dcu.h:166
float fVabsX
Definition: hfl110dcu.h:151
float height
Definition: hfl110dcu.h:141
UdpPacketHeader header
Definition: hfl110dcu.h:125
float fDistYAx
Definition: hfl110dcu.h:163
float fAcquisitionPeriod
Definition: hfl110dcu.h:221
float ground_offset
Definition: hfl110dcu.h:142
uint16_t pca_version
Definition: hfl110dcu.h:88
objState state
Definition: hfl110dcu.h:202
image_transport::CameraPublisher pub_ct2_
Crosstalk2 flag image publisher.
Definition: hfl110dcu.h:405
cv_bridge::CvImagePtr p_image_superimposed2_
Pointer to superimposed2 flags.
Definition: hfl110dcu.h:387
cv_bridge::CvImagePtr p_image_saturated_
Pointer to saturated flags.
Definition: hfl110dcu.h:375
HFL110DCU v1 ethernet object struct.
Definition: hfl110dcu.h:198
float fADCUbattSW
Definition: hfl110dcu.h:216
cv_bridge::CvImagePtr p_image_crosstalk_
Pointer to crosstalk flags.
Definition: hfl110dcu.h:372
const float NO_RETURN_DISTANCES
Definition: hfl110dcu.h:71
std::shared_ptr< std_msgs::Header > pdm_header_message_
PDM Header message.
Definition: hfl110dcu.h:333
uint16_t udp_version
Definition: hfl110dcu.h:87
float fDistXVx
Definition: hfl110dcu.h:157
objKin kinematics
Definition: hfl110dcu.h:201
cv_bridge::CvImagePtr p_image_intensity2_
Pointer to 16 bit intensity image second return.
Definition: hfl110dcu.h:369
float x_rear_l
Definition: hfl110dcu.h:137
image_transport::CameraPublisher pub_ct_
Crosstalk flag image publisher.
Definition: hfl110dcu.h:402
float_t extrinsic_distance
Definition: hfl110dcu.h:118
float y_rear_l
Definition: hfl110dcu.h:138
float yaw
Definition: hfl110dcu.h:145
float fVyAx
Definition: hfl110dcu.h:168
CameraIntrinsics camera_intrinsics
Definition: hfl110dcu.h:126
Implements the HFL110DCU camera image parsing and publishing.
Definition: hfl110dcu.h:229
float x_front_l
Definition: hfl110dcu.h:139
uint64_t timeStamp
Definition: hfl110dcu.h:89
Base class for the HFL110DCU cameras.
objDyn dynamic_props
Definition: hfl110dcu.h:203
float fVrelX
Definition: hfl110dcu.h:153
float y_rear_r
Definition: hfl110dcu.h:136
float fADCTemp0Lens
Definition: hfl110dcu.h:220
HFL110DCU v1 object state.
Definition: hfl110dcu.h:174
float focal_length_
Focal Length.
Definition: hfl110dcu.h:354
cv_bridge::CvImagePtr p_image_saturated2_
Pointer to saturated2 flags.
Definition: hfl110dcu.h:384
float_t extrinsic_horizontal
Definition: hfl110dcu.h:117
ros::NodeHandle node_handler_
ROS node handler.
Definition: hfl110dcu.h:324
float fVyAy
Definition: hfl110dcu.h:169
float_t extrinsic_vertical
Definition: hfl110dcu.h:116
image_transport::CameraPublisher pub_intensity_
16 bit Intensity image publisher
Definition: hfl110dcu.h:396
std::shared_ptr< std_msgs::Header > slice_header_message_
Slice Header message.
Definition: hfl110dcu.h:342
uint8_t row_
Row and column Counter.
Definition: hfl110dcu.h:348
image_transport::CameraPublisher pub_si2_
Superimposed flag image publisher.
Definition: hfl110dcu.h:417
float fAxAy
Definition: hfl110dcu.h:170
float fAabsX
Definition: hfl110dcu.h:155
float fDistXVy
Definition: hfl110dcu.h:158
uint8_t confidence
Definition: hfl110dcu.h:206
uint32_t image_row_number
Definition: hfl110dcu.h:91
uint32_t uiFrameCounter
Definition: hfl110dcu.h:215
std::shared_ptr< std_msgs::Header > object_header_message_
Object Header message.
Definition: hfl110dcu.h:336
float x_rear_r
Definition: hfl110dcu.h:135
HFL110DCU v1 telemetry struct.
Definition: hfl110dcu.h:210
camera_info_manager::CameraInfoManager * camera_info_manager_
Definition: hfl110dcu.h:357
float fDistXDistY
Definition: hfl110dcu.h:156
float fDistX
Definition: hfl110dcu.h:143
float fDistXAx
Definition: hfl110dcu.h:159
float fDistY
Definition: hfl110dcu.h:144
cv_bridge::CvImagePtr p_image_depth_
Pointer to depth image.
Definition: hfl110dcu.h:360
cv_bridge::CvImagePtr p_image_superimposed_
Pointer to superimposed flags.
Definition: hfl110dcu.h:378
CameraExtrinsics camera_extrinsics
Definition: hfl110dcu.h:127
std::shared_ptr< sensor_msgs::PointCloud2 > pointcloud_
Pointcloud msg.
Definition: hfl110dcu.h:435
cv_bridge::CvImagePtr p_image_intensity_
Pointer to 16 bit intensity image.
Definition: hfl110dcu.h:363
This file defines the HFL110DCU camera base class.
int bytes_received_
Received packet bytes from HFL110.
Definition: hfl110dcu.h:327
std::vector< hflObj > objects_
Objects vector;.
Definition: hfl110dcu.h:426
float fVrelY
Definition: hfl110dcu.h:154
image_transport::CameraPublisher pub_intensity2_
16 bit Intensity image publisher return 2
Definition: hfl110dcu.h:399
std::shared_ptr< std_msgs::UInt16MultiArray > slices_
Slices msg.
Definition: hfl110dcu.h:438
float fDistYVy
Definition: hfl110dcu.h:162
image_transport::CameraPublisher pub_sat_
Saturated flag image publisher.
Definition: hfl110dcu.h:408
HFL110DCU v1 ethernet frame struct.
Definition: hfl110dcu.h:123
unsigned uiTempSensorFeedback
Definition: hfl110dcu.h:222
ros::Publisher pub_points_
Pointcloud publisher.
Definition: hfl110dcu.h:429


hfl_driver
Author(s): Evan Flynn , Maxton Ginier , Gerardo Bravo , Moises Diaz
autogenerated on Sat Mar 20 2021 02:27:31