Qt App with instances of PCLPlotter and PCLVisualizer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Qt App with instances of PCLPlotter and PCLVisualizer

Bernd
Hi all,

I'm trying to hookup an app with instances of PCLPlotter and PCLVisualizer,
like shown in the figure below:
<http://www.pcl-users.org/file/t499012/app.jpg>
The cloud data as well as the plotter data is changing over time.
As proof of concept I wrote a test console app (part of the source code):

<c++>
void visualize()
{
        // Visualizer
        boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new
pcl::visualization::PCLVisualizer("3D Viewer"));
        viewer->setBackgroundColor(255, 255, 255);
        pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>
rgb(cloud);
        viewer->addPointCloud<pcl::PointXYZRGB>(cloud, rgb, "cloud");

viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE,
3, "cloud");
        viewer->addCoordinateSystem(100);
        viewer->initCameraParameters();

        // Plotter
        boost::shared_ptr<pcl::visualization::PCLPlotter> plotter(new
pcl::visualization::PCLPlotter("My Plotter"));
                //setting some properties
        plotter->setShowLegend(true);
        plotter->setWindowSize(1024, 800);

        while (!viewer->wasStopped() && plotter->wasStopped())
        {
                viewer->spinOnce(0);
                plotter->spinOnce(50);
                plotter->clearPlots();

                // Get lock on the boolean update and check if cloud was updated
                boost::mutex::scoped_lock updateLock(updateModelMutex);
                if (update)
                {
                        if (!viewer->updatePointCloud(cloud, "cloud"))
                        {
                                viewer->addPointCloud(cloud, rgb, "cloud");
                        }
                        plotter->addPlotData(array_X, arrayTemp[29], Run, "Sensor",
vtkChart::POINTS);

                        update = false;
                }
                updateLock.unlock();
        }
}
</c++>

If I press q in the plotter window the app starts. But I think that is not
how one should write an app?
Do you have any suggestions for implementation?
I'am using VS 2013 and PCL 1.80.

Thanks,
Bernd



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users