Ask Your Question
0

PCL not updating

asked 2020-08-31 16:26:00 -0500

pnambiar gravatar image

updated 2020-08-31 16:27:30 -0500

I am able to view my lidar pointcloud using this script but not update it. viewer-> spin() does not seem to be work. Any help will be appreciated.

void callback(const ImageConstPtr& image1, const boost::shared_ptr<const sensor_msgs::PointCloud2>& input)

       pcl::PCLPointCloud2 pcl_pc2;
       pcl_conversions::toPCL(*input,pcl_pc2);
       pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud(new pcl::PointCloud<pcl::PointXYZ>);
       pcl::fromPCLPointCloud2(pcl_pc2,*temp_cloud);
       pcl::visualization::CloudViewer viewer ("Simple Cloud Viewer");
       viewer.showCloud(temp_cloud);
       while (!viewer.wasStopped ())
       {

       {
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-31 17:50:19 -0500

dtyugin gravatar image

It's not a good idea to run while() in callback. You have to leave callback function since it blocks ros internal event loop (the loop which handles new data and calls your callbacks). That is why you will not get update.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-08-31 16:26:00 -0500

Seen: 69 times

Last updated: Aug 31 '20