I'm trying to update pointcloud in real-time as it becomes available. I am using a separate thread for this purpose to spin the viewer but what i get is only black screen with busy cursor. I am using trunk version of the pcl compiled on vs2010 with cmake. To illustrate what i am trying to do i have a sample application as given below which is using the same concept as of visualization example but implementing it in a thread. I am chaning the pointcloud in the main thread and a separate thread is responsible for spinning. The problem is i think the thread is not working at all. If i am not wrong it was working in the installer version, but i would like to check if it is correct what i am doing and if yes then why don't it work?
// -----Create example point cloud-----
pcl::PointCloud<pcl::PointXYZ>::Ptr basic_cloud_ptr (new pcl::PointCloud<pcl::PointXYZ>);
std::cout << "Genarating example point clouds.\n\n";
// We're going to make an ellipse extruded along the z-axis. The colour for
// the XYZRGB cloud will gradually go from red to green to blue.
uint8_t r(255), g(15), b(15);
for (float z=zmin; z <= zmax; z += 0.05)
for (float angle=anglemin; angle <= anglemax; angle += 5.0)
basic_point.x = 0.5 * cosf (pcl::deg2rad(angle));
basic_point.y = sinf (pcl::deg2rad(angle));
basic_point.z = z;
Your example fails with an error from VTK on my laptop. The reason is that you do not lock the mutex in the viewerRunner() function. After I have added a scoped_lock there you example works fine. Does this solve your issue, or it still persists?
I have enveloped the call to spinOnce with mutex scoped lock as follows, although it didn't get better and still hangs. I do not get any error in the shell, maybe since you are in linux so you are getting the messages but here it just gets silent and i cant drag the window or do anything at all with it, although terminal window remain alive but program never quits and doesn't show anything at all.
Well, there is another problem in your sample. As soon as the main is done with the short while loop, it exits the program and the extra thread that it has created gets killed, I suppose (which might explain the observed behavior). So try adding
Could it be due to some changes in the new pcl 1.7 version which is i guess the default one at the svn trunk? Because i remember it used to work with all-in-one installer version available for windows. Now that i am using this svn version i am getting the hanging behavior.
Is the svn trunk version compatible with windows at all? Since i remember the visualization is unchecked by default when using cmake to compile which might notion that there is some work going on?
The visualization definitely works well in Windows. If something happened on your machine, try a different revision of
trunk if you think that helps, but in general I don't think there should be any problems with the basic
components/modules such as visualization.
Please remember that TRUNK is _UNSTABLE_ and only developers are supposed to be using it! Please revert to our official
PCL releases (e.g., 1.6) if you want to develop applications on top. Being on trunk as an user is NOT recommended! While
we'll do our best to support you, because you're basically beta testing our latest changes, things might be more painful
(than you think) on your end ;)
> Could it be due to some changes in the new pcl 1.7 version which is i guess
> the default one at the svn trunk? Because i remember it used to work with
> all-in-one installer version available for windows. Now that i am using this
> svn version i am getting the hanging behavior.
> Is the svn trunk version compatible with windows at all? Since i remember
> the visualization is unchecked by default when using cmake to compile which
> might notion that there is some work going on?
> View this message in context: http://www.pcl-users.org/PCL-viewer-hangs-with-busy-cursor-tp4021568p4021586.html > Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> [hidden email] / http://pointclouds.org > http://pointclouds.org/mailman/listinfo/pcl-users >
I moved to trunk because i needed kinfu application which was not in the windows distributed prebuilt libraries. I can't see 1.6 in the branches at http://svn.pointclouds.org/pcl/branches/ In 1.5 i dont even see gpu so kinfu couldn't be in that release.
Would you please take a look at the example and tell if it ought to work so that i should then concentrate on recompiling and reinstalling PCL? Compiling PCL is really toooo slow. Even i face problem with build times for applications using PCL taking usually upto 2-4 minutes for small applications such as above on my dual core.
You're right. KinFu or any other CUDA code hasn't reached the maturity that we want yet, so we haven't included it in an
official release, as we cannot guarantee support for it. All the CUDA code will most likely make its way into a release
when 2.0 comes out.
In the meantime, it is what it is. You cannot have both the newest unstable features from trunk, and not be exposed to
compiling from source. PCL is a voluntary open source project, and we try our best to move forward. If PCL takes too
long to compile on your machine, considering buying a more powerful machine, or compile only the parts that you want, or
use many of the compiler optimizations/tricks that we provide our web pages or support forums.
so i guess i should stick with the trunk version then :). what about running the visualizer in the separate thread as i tried to do in the sample application above? Is there a way to determine if it is because of the way i am doing it or it has something to do with the instability?