Skip to content
Snippets Groups Projects
Commit 4c2361f3 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fixes #29 by not constructing window

parent dac4666c
No related branches found
No related tags found
No related merge requests found
Pipeline #10899 failed
...@@ -19,6 +19,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) { ...@@ -19,6 +19,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) {
#endif // HAVE_VIZ #endif // HAVE_VIZ
#if defined HAVE_PCL #if defined HAVE_PCL
if (config.value("points", false)) {
pclviz_ = pcl::visualization::PCLVisualizer::Ptr(new pcl::visualization::PCLVisualizer ("FTL Cloud: " + name)); pclviz_ = pcl::visualization::PCLVisualizer::Ptr(new pcl::visualization::PCLVisualizer ("FTL Cloud: " + name));
pclviz_->setBackgroundColor (255, 255, 255); pclviz_->setBackgroundColor (255, 255, 255);
pclviz_->addCoordinateSystem (1.0); pclviz_->addCoordinateSystem (1.0);
...@@ -74,6 +75,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) { ...@@ -74,6 +75,7 @@ Display::Display(nlohmann::json &config, std::string name) : config_(config) {
viewer->setCameraParameters(cam); viewer->setCameraParameters(cam);
}, (void*)&pclviz_); }, (void*)&pclviz_);
}
#endif // HAVE_PCL #endif // HAVE_PCL
active_ = true; active_ = true;
...@@ -210,7 +212,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const ftl::rgbd:: ...@@ -210,7 +212,7 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const ftl::rgbd::
#if defined HAVE_PCL #if defined HAVE_PCL
bool Display::render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr pc) { bool Display::render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr pc) {
pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pc); pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(pc);
if (!pclviz_->updatePointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction")) { if (pclviz_ && !pclviz_->updatePointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction")) {
pclviz_->addPointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction"); pclviz_->addPointCloud<pcl::PointXYZRGB> (pc, rgb, "reconstruction");
pclviz_->setCameraPosition(-878.0, -71.0, -2315.0, -0.1, -0.99, 0.068, 0.0, -1.0, 0.0); pclviz_->setCameraPosition(-878.0, -71.0, -2315.0, -0.1, -0.99, 0.068, 0.0, -1.0, 0.0);
pclviz_->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "reconstruction"); pclviz_->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "reconstruction");
...@@ -242,7 +244,7 @@ bool Display::render(const cv::Mat &img, style_t s) { ...@@ -242,7 +244,7 @@ bool Display::render(const cv::Mat &img, style_t s) {
void Display::wait(int ms) { void Display::wait(int ms) {
if (config_["points"]) { if (config_["points"]) {
#if defined HAVE_PCL #if defined HAVE_PCL
pclviz_->spinOnce(20); if (pclviz_) pclviz_->spinOnce(20);
#elif defined HAVE_VIZ #elif defined HAVE_VIZ
window_->spinOnce(1, true); window_->spinOnce(1, true);
#endif // HAVE_VIZ #endif // HAVE_VIZ
...@@ -258,7 +260,7 @@ void Display::wait(int ms) { ...@@ -258,7 +260,7 @@ void Display::wait(int ms) {
bool Display::active() const { bool Display::active() const {
#if defined HAVE_PCL #if defined HAVE_PCL
return active_ && !pclviz_->wasStopped(); return active_ && (!pclviz_ || !pclviz_->wasStopped());
#elif defined HAVE_VIZ #elif defined HAVE_VIZ
return active_ && !window_->wasStopped(); return active_ && !window_->wasStopped();
#else #else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment