|
17 | 17 |
|
18 | 18 | #include "lidar_transfusion/utils.hpp"
|
19 | 19 |
|
20 |
| -#include <autoware_point_types/types.hpp> |
21 |
| - |
22 | 20 | #include <autoware_perception_msgs/msg/detected_object_kinematics.hpp>
|
23 | 21 | #include <autoware_perception_msgs/msg/detected_objects.hpp>
|
24 | 22 | #include <autoware_perception_msgs/msg/object_classification.hpp>
|
25 | 23 | #include <autoware_perception_msgs/msg/shape.hpp>
|
26 |
| -#include <sensor_msgs/msg/point_field.hpp> |
27 | 24 |
|
28 |
| -#include <cstdint> |
29 | 25 | #include <string>
|
30 | 26 | #include <vector>
|
31 | 27 |
|
32 |
| -#define CHECK_OFFSET(offset, structure, field) \ |
33 |
| - static_assert( \ |
34 |
| - offsetof(structure, field) == offset, \ |
35 |
| - "Offset of " #field " in " #structure " does not match expected offset.") |
36 |
| -#define CHECK_TYPE(type, structure, field) \ |
37 |
| - static_assert( \ |
38 |
| - std::is_same<decltype(structure::field), type>::value, \ |
39 |
| - "Type of " #field " in " #structure " does not match expected type.") |
40 |
| -#define CHECK_FIELD(offset, type, structure, field) \ |
41 |
| - CHECK_OFFSET(offset, structure, field); \ |
42 |
| - CHECK_TYPE(type, structure, field) |
43 |
| - |
44 | 28 | namespace lidar_transfusion
|
45 | 29 | {
|
46 |
| -using sensor_msgs::msg::PointField; |
47 |
| - |
48 |
| -CHECK_FIELD(0, float, autoware_point_types::PointXYZIRCAEDT, x); |
49 |
| -CHECK_FIELD(4, float, autoware_point_types::PointXYZIRCAEDT, y); |
50 |
| -CHECK_FIELD(8, float, autoware_point_types::PointXYZIRCAEDT, z); |
51 |
| -CHECK_FIELD(12, uint8_t, autoware_point_types::PointXYZIRCAEDT, intensity); |
52 |
| - |
53 |
| -struct CloudInfo |
54 |
| -{ |
55 |
| - uint32_t x_offset{0}; |
56 |
| - uint32_t y_offset{sizeof(float)}; |
57 |
| - uint32_t z_offset{sizeof(float) * 2}; |
58 |
| - uint32_t intensity_offset{sizeof(float) * 3}; |
59 |
| - uint8_t x_datatype{PointField::FLOAT32}; |
60 |
| - uint8_t y_datatype{PointField::FLOAT32}; |
61 |
| - uint8_t z_datatype{PointField::FLOAT32}; |
62 |
| - uint8_t intensity_datatype{PointField::UINT8}; |
63 |
| - uint8_t x_count{1}; |
64 |
| - uint8_t y_count{1}; |
65 |
| - uint8_t z_count{1}; |
66 |
| - uint8_t intensity_count{1}; |
67 |
| - uint32_t point_step{sizeof(autoware_point_types::PointXYZIRCAEDT)}; |
68 |
| - bool is_bigendian{false}; |
69 |
| - |
70 |
| - bool operator!=(const CloudInfo & rhs) const |
71 |
| - { |
72 |
| - return x_offset != rhs.x_offset || y_offset != rhs.y_offset || z_offset != rhs.z_offset || |
73 |
| - intensity_offset != rhs.intensity_offset || x_datatype != rhs.x_datatype || |
74 |
| - y_datatype != rhs.y_datatype || z_datatype != rhs.z_datatype || |
75 |
| - intensity_datatype != rhs.intensity_datatype || x_count != rhs.x_count || |
76 |
| - y_count != rhs.y_count || z_count != rhs.z_count || |
77 |
| - intensity_count != rhs.intensity_count || is_bigendian != rhs.is_bigendian; |
78 |
| - } |
79 |
| - |
80 |
| - friend std::ostream & operator<<(std::ostream & os, const CloudInfo & info) |
81 |
| - { |
82 |
| - os << "x_offset: " << static_cast<int>(info.x_offset) << std::endl; |
83 |
| - os << "y_offset: " << static_cast<int>(info.y_offset) << std::endl; |
84 |
| - os << "z_offset: " << static_cast<int>(info.z_offset) << std::endl; |
85 |
| - os << "intensity_offset: " << static_cast<int>(info.intensity_offset) << std::endl; |
86 |
| - os << "x_datatype: " << static_cast<int>(info.x_datatype) << std::endl; |
87 |
| - os << "y_datatype: " << static_cast<int>(info.y_datatype) << std::endl; |
88 |
| - os << "z_datatype: " << static_cast<int>(info.z_datatype) << std::endl; |
89 |
| - os << "intensity_datatype: " << static_cast<int>(info.intensity_datatype) << std::endl; |
90 |
| - os << "x_count: " << static_cast<int>(info.x_count) << std::endl; |
91 |
| - os << "y_count: " << static_cast<int>(info.y_count) << std::endl; |
92 |
| - os << "z_count: " << static_cast<int>(info.z_count) << std::endl; |
93 |
| - os << "intensity_count: " << static_cast<int>(info.intensity_count) << std::endl; |
94 |
| - os << "is_bigendian: " << static_cast<int>(info.is_bigendian) << std::endl; |
95 |
| - return os; |
96 |
| - } |
97 |
| -}; |
98 | 30 |
|
99 | 31 | void box3DToDetectedObject(
|
100 | 32 | const Box3D & box3d, const std::vector<std::string> & class_names,
|
|
0 commit comments