pointcloud object comparision
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);
}
Is there any one can suggest me any solution for this.?
Do you simply want to check if the two pc are identical ? Then you would simply for-loop and check every point for equality.
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.
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.