@@ -318,6 +318,9 @@ PointCloudConcatenateDataSynchronizerComponent::combineClouds(
318
318
for (const auto & e : cloud_stdmap_) {
319
319
transformed_clouds[e.first ] = nullptr ;
320
320
if (e.second != nullptr ) {
321
+ if (e.second ->data .size () == 0 ) {
322
+ continue ;
323
+ }
321
324
pc_stamps.push_back (rclcpp::Time (e.second ->header .stamp ));
322
325
}
323
326
}
@@ -332,6 +335,9 @@ PointCloudConcatenateDataSynchronizerComponent::combineClouds(
332
335
// Step2. Calculate compensation transform and concatenate with the oldest stamp
333
336
for (const auto & e : cloud_stdmap_) {
334
337
if (e.second != nullptr ) {
338
+ if (e.second ->data .size () == 0 ) {
339
+ continue ;
340
+ }
335
341
sensor_msgs::msg::PointCloud2::SharedPtr transformed_cloud_ptr (
336
342
new sensor_msgs::msg::PointCloud2 ());
337
343
transformPointCloud (e.second , transformed_cloud_ptr);
@@ -479,16 +485,16 @@ void PointCloudConcatenateDataSynchronizerComponent::cloud_callback(
479
485
const sensor_msgs::msg::PointCloud2::ConstSharedPtr & input_ptr, const std::string & topic_name)
480
486
{
481
487
std::lock_guard<std::mutex> lock (mutex_);
488
+ sensor_msgs::msg::PointCloud2::SharedPtr xyzi_input_ptr (new sensor_msgs::msg::PointCloud2 ());
482
489
auto input = std::make_shared<sensor_msgs::msg::PointCloud2>(*input_ptr);
483
490
if (input->data .empty ()) {
484
491
RCLCPP_WARN_STREAM_THROTTLE (
485
492
this ->get_logger (), *this ->get_clock (), 1000 , " Empty sensor points!" );
486
- return ;
493
+ } else {
494
+ // convert to XYZI pointcloud if pointcloud is not empty
495
+ convertToXYZICloud (input, xyzi_input_ptr);
487
496
}
488
497
489
- sensor_msgs::msg::PointCloud2::SharedPtr xyzi_input_ptr (new sensor_msgs::msg::PointCloud2 ());
490
- convertToXYZICloud (input, xyzi_input_ptr);
491
-
492
498
const bool is_already_subscribed_this = (cloud_stdmap_[topic_name] != nullptr );
493
499
const bool is_already_subscribed_tmp = std::any_of (
494
500
std::begin (cloud_stdmap_tmp_), std::end (cloud_stdmap_tmp_),
0 commit comments