pointcloud object comparision

asked 2016-10-06 08:40:10 -0500

rasoo gravatar image

updated 2016-10-12 17:36:11 -0500

Hello, I want to comapre two pointcloud object. Below is the sample code to describe my issue.

typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;
PointCloud pcl_current, pcl_previous;

//below is the ros callback

void callback(const PointCloud::ConstPtr& msg){
  if(time == (t+1))
    pcl_previous = *msg; //
  if(time == (t+2))
    pcl_current = *msg; //

///now compare the current and previous  --- here is my question how to comapre this in the next line? I am c#.net ///programmer and it is very easily can be done using .net framework

//please help me -- implementing this line below. I will only compare the points of type pcl::PointXYZ&
  if(pcl_current.points == pcl_previous.points)  
    Print("here goes my decission... both are equal");


int main()
  ros::Subscriber sub = nh.subscribe<PointCloud>("/camera/depth/poiints", 10, callback);
edit retag flag offensive close merge delete


Is there any one can suggest me any solution for this.?

rasoo gravatar imagerasoo ( 2016-10-12 17:36:05 -0500 )edit

Do you simply want to check if the two pc are identical ? Then you would simply for-loop and check every point for equality.

gpldecha gravatar imagegpldecha ( 2016-10-13 03:33:43 -0500 )edit

I did that simple aproach, but after entering to the loop it iterates 3 or 4 times then the either the process got killed or my laptop become non-responsive and get hanged. I have to simply restart machine.I think simply doing for loop is not a good solution.

rasoo gravatar imagerasoo ( 2016-10-13 06:15:11 -0500 )edit

There is no other way if you want to compare the points. There is probably something wrong with your for-loop. If you would to add your solution it would be easier to debug what is wrong with it.

gpldecha gravatar imagegpldecha ( 2016-10-13 06:32:30 -0500 )edit