Skip to content

Commit

Permalink
Merge pull request #814 from frankpablo/cloud-composer-fix
Browse files Browse the repository at this point in the history
Fix Disappearing cloud from Selection
  • Loading branch information
taketwo committed Aug 12, 2014
2 parents e121b2a + 64a41bd commit ef91e11
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions apps/cloud_composer/src/merge_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po

pcl::ExtractIndices<pcl::PCLPointCloud2> filter;
pcl::PCLPointCloud2::Ptr merged_cloud (new pcl::PCLPointCloud2);
//To Save the pose of the first original item
Eigen::Vector4f source_origin;
Eigen::Quaternionf source_orientation;
bool pose_found = false;
foreach (const CloudItem* input_cloud_item, selected_item_index_map_.keys ())
{
//If this cloud hasn't been completely selected
Expand All @@ -72,8 +76,13 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po
filter.filter (*selected_points);

qDebug () << "Original minus indices is "<<original_minus_indices->width;
Eigen::Vector4f source_origin = input_cloud_item->data (ItemDataRole::ORIGIN).value<Eigen::Vector4f> ();
Eigen::Quaternionf source_orientation = input_cloud_item->data (ItemDataRole::ORIENTATION).value<Eigen::Quaternionf> ();

if (!pose_found)
{
source_origin = input_cloud_item->data (ItemDataRole::ORIGIN).value<Eigen::Vector4f> ();
source_orientation = input_cloud_item->data (ItemDataRole::ORIENTATION).value<Eigen::Quaternionf> ();
pose_found = true;
}
CloudItem* new_cloud_item = new CloudItem (input_cloud_item->text ()
, original_minus_indices
, source_origin
Expand All @@ -95,11 +104,13 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po
concatenatePointCloud (*merged_cloud, *input_cloud, *temp_cloud);
merged_cloud = temp_cloud;
}

CloudItem* cloud_item = new CloudItem ("Cloud from Selection"
, merged_cloud);
, merged_cloud
, source_origin
, source_orientation);

output.append (cloud_item);

return output;
}
}

0 comments on commit ef91e11

Please sign in to comment.