Skip to content

Commit a27b32d

Browse files
committed
Add info whether a point was ignored for clustering to ROS PointCloud2 message
1 parent a88aa7b commit a27b32d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/continuous_clustering/ros/ros_utils.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct PointCloud2Iterators
4949
std::optional<sensor_msgs::PointCloud2Iterator<uint8_t>> iter_gp_label_out;
5050
std::optional<sensor_msgs::PointCloud2Iterator<uint8_t>> iter_dbg_gp_label_out;
5151
std::optional<sensor_msgs::PointCloud2Iterator<float>> iter_height_over_ground_out;
52+
std::optional<sensor_msgs::PointCloud2Iterator<uint8_t>> iter_ignore_for_clustering_out;
5253

5354
// continuous clustering
5455
std::optional<sensor_msgs::PointCloud2Iterator<double>> iter_finished_at_azimuth_angle;

src/ros/ros_utils.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ PointCloud2Iterators prepareMessageAndCreateIterators(sensor_msgs::PointCloud2&
117117
else if (fill_fields_up_to_stage == RANGE_IMAGE_GENERATION)
118118
up_to_field = 15;
119119
else if (fill_fields_up_to_stage == GROUND_POINT_SEGMENTATION)
120-
up_to_field = 18;
120+
up_to_field = 19;
121121
else if (fill_fields_up_to_stage == CONTINUOUS_CLUSTERING)
122-
up_to_field = 25;
122+
up_to_field = 26;
123123

124124
// Some point fields below should be actually UINT64. Unfortunately, this type is not available for a PointCloud2
125125
// message: http://docs.ros.org/en/melodic/api/sensor_msgs/html/msg/PointField.html. Therefore, we use FLOAT64 which
@@ -181,6 +181,9 @@ PointCloud2Iterators prepareMessageAndCreateIterators(sensor_msgs::PointCloud2&
181181
"height_over_ground",
182182
1,
183183
sensor_msgs::PointField::FLOAT32,
184+
"ignore_for_clustering",
185+
1,
186+
sensor_msgs::PointField::UINT8,
184187
"finished_at_continuous_azimuth_angle",
185188
1,
186189
sensor_msgs::PointField::FLOAT64,
@@ -226,6 +229,7 @@ PointCloud2Iterators prepareMessageAndCreateIterators(sensor_msgs::PointCloud2&
226229
iterators.iter_gp_label_out = {msg, "ground_point_label"};
227230
iterators.iter_dbg_gp_label_out = {msg, "debug_ground_point_label"};
228231
iterators.iter_height_over_ground_out = {msg, "height_over_ground"};
232+
iterators.iter_ignore_for_clustering_out = {msg, "ignore_for_clustering"};
229233
if (fill_fields_up_to_stage == GROUND_POINT_SEGMENTATION)
230234
return iterators;
231235
iterators.iter_finished_at_azimuth_angle = {msg, "finished_at_continuous_azimuth_angle"};
@@ -278,6 +282,7 @@ void addPointToMessage(PointCloud2Iterators& container,
278282
*(*container.iter_gp_label_out + data_index_message) = point.ground_point_label;
279283
*(*container.iter_dbg_gp_label_out + data_index_message) = point.debug_ground_point_label;
280284
*(*container.iter_height_over_ground_out + data_index_message) = point.height_over_ground;
285+
*(*container.iter_ignore_for_clustering_out + data_index_message) = point.is_ignored ? BLUE : ORANGE;
281286
if (fill_fields_up_to_stage == GROUND_POINT_SEGMENTATION)
282287
return;
283288

0 commit comments

Comments
 (0)