ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

PCLVisualizer point cloud ID

asked 2011-03-14 03:34:28 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi,

first the code, than the question:

while (!viewer.wasStopped()) {
[...get coordinates...]
if (counter = true) {
    viewer.removePointCloud("1");
    viewer.addPointCloud(point_cloud, "2");
    counter = false;
}else {
    viewer.removePointCloud("2");
    viewer.addPointCloud(point_cloud, "1");
    counter = 1;
}
viewer.spinOnce();

Here the question: If I run this programm, I get "[addPointCloud] A PointCloud with id <2> already exists! Please choose a different id and retry". So my question is, if there is any possibility to free the old point cloud ID and write a new point cloud to the previous, now free, ID?

Thanks for the help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-03-23 04:02:09 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Are you sure you did not want to write

if (counter == true) {
     ... code goes here
}

In your code snippet, you accidentally used the assignment operator in C++ and the expression always evaluates to true. Fixing that should resolve matters.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-03-14 03:34:28 -0500

Seen: 2,093 times

Last updated: Mar 23 '11