Ask Your Question
3

Running PCL in Hydro

asked 2013-10-12 08:52:40 -0600

Hi,

It took me a while to run the sample code for down-sampling a point cloud using voxel grid, as given in tutorial page at : http://wiki.ros.org/pcl/Tutorials?action=AttachFile&do=view&target=example_voxelgrid.cpp, tutorial link : http://wiki.ros.org/pcl/Tutorials
I am using ROS Hydro on Ubuntu12.04, and catkin build. I am thinking of updating these links and add code for Hydro. Kindly let me know if some changes I made are redundent etc. Specifically I made the following changes:-

  1. Code :
    • Deleted : #include <pcl/ros/conversions.h>
      Added: #include <pcl_conversions/pcl_conversions.h>
        #include <sensor_msgs/PointCloud2.h>
    • Modified the callback function to use pcl::PCLPointCloud2 instead of sensor_msgs::PointCloud2 as:-
      (It's given at hydro migration : http://wiki.ros.org/hydro/Migration)
      void 
      cloud_cb (const pcl::PCLPointCloud2ConstPtr& input)
      {
        pcl::PCLPointCloud2 cloud_filtered;
        pcl::VoxelGrid<pcl::PCLPointCloud2> sor;
        sor.setInputCloud (input);
        sor.setLeafSize (0.01, 0.01, 0.01);
        sor.filter (cloud_filtered);
      
        // Publish the dataSize 
        pub.publish (cloud_filtered);
      }
      
  2. IN package.xml (from http://wiki.ros.org/hydro/Migration
    (....pcl is no longer packaged by the ROS community as a catkin package, so any packages which directly depend on pcl should instead use the new rosdep rules libpcl-all and libpcl-all-dev...... )
    and understood it (I think) by seeing the post at http://www.pcl-users.org/How-do-I-use-PCL-from-ROS-Hydro-td4029613.html (3rd comment : given by, Matteo Munaro Sep 12, 2013; 3:46pm), and also https://github.com/ros-perception/pcl_conversions/commit/a868e1a16e442c135f66a9738619d290bc4ee896)
    Removed: build_depend>pcl</build_depend>
           <run_depend>pcl</run_depend>
    Added: <build_depend>libpcl-all-dev</build_depend>
           <run_depend>libpcl-all</run_depend>
    I am wondering if the addition of libpcl-all-dev and libpcl-all, could automatically be done while creting the package.
  3. In CMakeList.txt
    Removed: pcl dependency Added: pcl_conversions dependency
    Again seeing the above mentioned link. Note: This could also be achieved by changing the package creation line to : catkin_create_pkg my_pcl_tutorial pcl_conversions pcl_ros roscpp sensor_msgs

I am quite sure that these changes must be done by many ppl who have run this tutorial and quite sad that they were not updated. Changes are a bit trivial once you understand, but still tutoral should run without giving any error, so that ppl like me could understand things easily :-).
Also is there a way to get libpcl-all-dev and libpcl-all directly in package.xml while creating the package.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2013-11-04 01:44:19 -0600

updated 2014-01-26 06:33:43 -0600

I have updated the tutorial, kindly let me know if it is correct.


The zip for my project it at: http://wiki.ros.org/pcl/Tutorials?action=AttachFile&do=view&target=my_pcl_tutorial2.tar.gz

edit flag offensive delete link more

Comments

Thank you very much for posting your solution. Do you mind if you could post your CMakelists.txt? I'm still getting linker errors even with the changes that you suggested.

mortonjt gravatar image mortonjt  ( 2014-01-10 19:18:35 -0600 )edit

Hi, Sorry for the late reply, its running fine for me. I tried for pcl::PCLPointCloud2, and not pcl/PointCloud<t>. I am uploading the zip file of my pcl project (named it 2 (my_pcl_tutorial2) as previous one was already there, which I have to move as example.cpp was in both). Link updated in answer.

aknirala gravatar image aknirala  ( 2014-01-26 06:21:46 -0600 )edit

Hello aknirala, i followed your tutorial and is working for me. But now, I can't save one input Point Cloud 2 to a PCD File. I think I need to follow some conversions first. My code is here: http://answers.ros.org/question/121856/write-pcd-file-from-a-topic-hydro-pcl-migration/ Thank you!

lfelipesv gravatar image lfelipesv  ( 2014-01-26 18:17:28 -0600 )edit

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: 2013-10-12 08:52:40 -0600

Seen: 1,524 times

Last updated: Jan 26 '14