Skip to content

Commit

Permalink
Merge pull request #1891 from tier4/cherry-pick/10196
Browse files Browse the repository at this point in the history
fix(segmentation_pointcloud_fusion): set valid pointcloud field for output pointcloud (autowarefoundation#10196)
  • Loading branch information
SakodaShintaro authored Mar 4, 2025
2 parents 8e70a0b + 98cfc96 commit 63f668e
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void SegmentPointCloudFusionNode::postprocess(
std::unique_ptr<ScopedTimeTrack> st_ptr;
if (time_keeper_) st_ptr = std::make_unique<ScopedTimeTrack>(__func__, *time_keeper_);

output_msg = pointcloud_msg;
output_msg.header = pointcloud_msg.header;
output_msg.data.clear();
output_msg.data.resize(pointcloud_msg.data.size());
Expand All @@ -165,8 +166,14 @@ void SegmentPointCloudFusionNode::postprocess(
}

output_msg.data.resize(output_pointcloud_size);
output_msg.row_step = output_pointcloud_size / output_msg.height;
output_msg.width = output_pointcloud_size / output_msg.point_step / output_msg.height;
if (output_msg.height != 0 && output_msg.point_step != 0) {
output_msg.row_step = output_pointcloud_size / output_msg.height;
output_msg.width = output_pointcloud_size / output_msg.point_step / output_msg.height;
} else {
RCLCPP_ERROR(this->get_logger(), "output_msg.height or output_msg.point_step is 0");
output_msg.row_step = 0;
output_msg.width = 0;
}

filter_global_offset_set_.clear();
return;
Expand Down

0 comments on commit 63f668e

Please sign in to comment.