Error running organized_segmentation_demo

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Error running organized_segmentation_demo

Hugo
Hi,

I am trying to run organized_segmentation_demo provided with pcl 1.6 in Qt.

Program compiles without errors, but when i try to grab a frame, the following message is shown in Qt application output:

starting grabber
MPS+Refine took: 0.144414
MPS+Refine took: 0.142976
Average framerate(computation): 2.95888 Hz
organized_segmentation_demo: /usr/include/eigen3/Eigen/src/Core/DenseStorage.h:69: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = float, int Size = 4, int MatrixOrArrayOptions = 0]: Assertion `(reinterpret_cast<size_t>(array) & 0xf) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed.
The program has unexpectedly finished.


Once in a while 2 or 3 frames are grabbed and computed, and clouds could be visualized before program crashes.

Is this a known error?? (running on Ubuntu 12.04, intel core duo)
Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Sergey
Administrator
Hi Hugo,

I was experiencing a similar problem a while ago, and it turned out that PlanarPolygon class (which is in use is segmentation demo) was missing proper alignment options. However I have submitted the patch which solves that, and I believe it was included in 1.6 release (see this thread on developers list).

Such problems are usually hard to reproduce, for example the one that I was experiencing only showed up on 64-bit CPU running 32-bit version of Ubuntu. It is therefore hard to help you remotely. If you are comfortable with gdb, I would suggest you to compile PCL with debug info and check the backtrace to find out where exactly the assertion fires.

Regards,
Sergey
Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Hugo
Hi Sergey,

thanks for the reply.

I'm not at all familiar with gdb. yesterday, i was trying to find the error, but no luck... program seemed to crash randomly to me.

tryed gdb just now, on the run, as i said i was not familiar with this. here's the crash backtrace result:

(gdb) backtrace
#0  0xb7fdd424 in __kernel_vsyscall ()
#1  0xb45361ef in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb4539835 in __GI_abort () at abort.c:91
#3  0xb452f095 in __assert_fail_base (fmt=0xb46688b8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=0x80822b4 "(reinterpret_cast<size_t>(array) & 0xf) == 0 && \"this assertion is explained here: \" \"http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html\" \" **** READ THIS WEB PAGE !!! ****\"", file=0x8082280 "/usr/include/eigen3/Eigen/src/Core/DenseStorage.h", line=69,
    function=0x8083140 "Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = float, int Size = 4, int MatrixOrArrayOptions = 0]")
    at assert.c:94
#4  0xb452f147 in __GI___assert_fail (
    assertion=0x80822b4 "(reinterpret_cast<size_t>(array) & 0xf) == 0 && \"this assertion is explained here: \" \"http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html\" \" **** READ THIS WEB PAGE !!! ****\"", file=0x8082280 "/usr/include/eigen3/Eigen/src/Core/DenseStorage.h", line=69,
    function=0x8083140 "Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = float, int Size = 4, int MatrixOrArrayOptions = 0]")
    at assert.c:103
#5  0x0806016f in Eigen::internal::plain_array<float, 4, 0, 16>::plain_array() [clone .part.531] ()
#6  0x08071176 in boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> > boost::make_shared<pcl::PointCloud<pcl::PointXYZRGBA>, pcl::PointCloud<pcl::PointXYZRGBA> >(pcl::PointCloud<pcl::PointXYZRGBA> const&) ()
#7  0x08066d2a in MainWindow::timeoutSlot() ()
#8  0x08080fc8 in MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) [clone .part.58] ()
#9  0xb498b6b1 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#10 0xb49de625 in QTimer::timeout() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#11 0xb4994566 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#12 0xb498fac4 in QObject::event(QEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#13 0xb4c0fed4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#14 0xb4c1530d in QApplication::notify(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#15 0xb497497e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#16 0xb49a9990 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#17 0xb49a70f8 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#18 0xb1fbbd86 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#19 0xb1fbc125 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#20 0xb1fbc201 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#21 0xb49a7887 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#22 0xb4cc8aaa in ?? () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#23 0xb497350d in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#24 0xb49737a9 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#25 0xb4978eba in QCoreApplication::exec() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#26 0xb4c0da74 in QApplication::exec() () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#27 0x0806056f in main ()


I'm running on 32-bit CPU running 32-bit Ubuntu 12.04.
Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Sergey
Administrator
Hugo,

I am no expert in debugging either. All I see is that the assertion fails it timeoutSlot() function, during the call to boost::make_shared. The argument is a standard point cloud. According to the source code, it seems to be some "prev_cloud_" variable all the time.

Well... it seems unlikely that there exists an alignment issue with such basic and ubiquitous types as PointCloud and PointXYZRGBA, but who knows!

Let's see if this crash is reproducible on other machines. Could you post your point cloud data?

Sergey

Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Hugo
Sergey,

I can try and save the point cloud before it crashes, but this particular program uses clouds captured on the fly with the kinect, all computations are done frame by frame updating the visualizer with that prev_cloud_.

If it is what you're saying... the make_shared call on this blockon the timeoutSlot (),:

         if (!vis_->updatePointCloud (boost::make_shared<pcl::PointCloud<PointT> >(prev_cloud_), "cloud"))
         {
           vis_->addPointCloud (boost::make_shared<pcl::PointCloud<PointT> >(prev_cloud_), "cloud");
           vis_->resetCameraViewpoint ("cloud");
         }

is what's causing it.
I think i can change this... why is it used the make_shared call here?!? i don't understand.

Sergey, can i get to you tomorrow? Sorry, need to rest, it's late on this timezone.
thanks for the help.
Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Sergey
Administrator
Hugo,

make_shared is used because visualizer's methods expect a (boost shared) pointer, not the cloud itself. What I can not understand though is why do they prefer to create shared pointers based on prev_cloud_ all the time instead of doing it once? Or perhaps even having declared prev_cloud_ as a cloud pointer.

Unfortunately (or fortunately) I can not reproduce your crash, and the app runs fine on my machine. I modified the sources so that prev_cloud_ in now a pointer. It compiles and works for me, so you may try this out and see what happens. Just apply the attached patch from the top of your PCL checkout.

Sergey

make_shared.patch

Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Hugo
Hi Sergey,

Sorry for getting back to you so late, thanks for the patch i'll feedback you as soon as i get to the machine i was working on.

Cheers,
Hugo

Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Hugo
In reply to this post by Sergey
well, no luck.

Program compiled with no problems, but the same thing happened while running it, as soon as i try to capture frames.. one time i got to see a frame on the visualizer but it crashes everytime. here's the crash backtrace:

 Program received signal SIGABRT, Aborted.
0xb7fdd424 in __kernel_vsyscall ()
(gdb) backtrace
#0  0xb7fdd424 in __kernel_vsyscall ()
#1  0xb44ba1ef in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb44bd835 in __GI_abort () at abort.c:91
#3  0xb44b3095 in __assert_fail_base (fmt=0xb45ec8b8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x80a3f00 "px != 0",
    file=0x80a3e94 "/usr/include/boost/smart_ptr/shared_ptr.hpp", line=412,
    function=0x80a8420 "boost::shared_ptr<T>::reference boost::shared_ptr<T>::operator*() const [with T = const pcl::PointCloud<pcl::PointXYZRGBA>, boost::shared_ptr<T>::reference = const pcl::PointCloud<pcl::PointXYZRGBA>&]") at assert.c:94
#4  0xb44b3147 in __GI___assert_fail (assertion=0x80a3f00 "px != 0", file=0x80a3e94 "/usr/include/boost/smart_ptr/shared_ptr.hpp", line=412,
    function=0x80a8420 "boost::shared_ptr<T>::reference boost::shared_ptr<T>::operator*() const [with T = const pcl::PointCloud<pcl::PointXYZRGBA>, boost::shared_ptr<T>::reference = const pcl::PointCloud<pcl::PointXYZRGBA>&]") at assert.c:103
#5  0x08075d03 in boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const>::operator* (this=0xbfffe2d0) at /usr/include/boost/smart_ptr/shared_ptr.hpp:412
#6  0x080724aa in pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGBA>::PointCloudColorHandlerRGBField (this=0xbfffe260, cloud=...)
    at /usr/include/pcl-1.6/pcl/visualization/impl/point_cloud_handlers.hpp:107
#7  0x08070321 in pcl::visualization::PCLVisualizer::updatePointCloud (this=0x8308328, cloud=..., id=...) at /usr/include/pcl-1.6/pcl/visualization/pcl_visualizer.h:778
#8  0x0806b00d in MainWindow::timeoutSlot (this=0xbfffeba0) at ../organized_segmentation_demo/mainwindow.cpp:379
#9  0x080a1979 in MainWindow::qt_static_metacall (_o=0xbfffeba0, _c=QMetaObject::InvokeMetaMethod, _id=12, _a=0xbfffe420) at moc_mainwindow.cpp:85
#10 0xb490f6b1 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#11 0xb4962625 in QTimer::timeout() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#12 0xb4918566 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#13 0xb4913ac4 in QObject::event(QEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#14 0xb4b93ed4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#15 0xb4b9930d in QApplication::notify(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#16 0xb48f897e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#17 0xb492d990 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#18 0xb492b0f8 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#19 0xb1facd86 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#20 0xb1fad125 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#21 0xb1fad201 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#22 0xb492b887 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#23 0xb4c4caaa in ?? () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#24 0xb48f750d in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#25 0xb48f77a9 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#26 0xb48fceba in QCoreApplication::exec() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#27 0xb4b91a74 in QApplication::exec() () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#28 0x0806404e in main (argc=1, argv=0xbffff194) at ../organized_segmentation_demo/main.cpp:16

making
-    pcl::PointCloud<PointT> prev_cloud_;
+    pcl::PointCloud<PointT>::Ptr prev_cloud_;

and then change
-    prev_cloud_ = *cloud;
+    prev_cloud_ = cloud->makeShared();

-      if (!vis_->updatePointCloud (boost::make_shared<pcl::PointCloud<PointT> >(prev_cloud_), "cloud"))
+      if (!vis_->updatePointCloud (prev_cloud_, "cloud"))

This coding made more sense to me, same thing could be done to prev_normals_.
Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Sergey
Administrator
Hugo,

This time the crash is in a different place and has no relation with Eigen. Seems like dereferencing of prev_cloud_ pointer fails.

Try to insert an assertion in the "timeoutSlot" function, somewhere before the call to "updatePointCloud" to check whether prev_cloud_ carries any pointer at all.

What about the other demo applications that use openni grabber (i.e. have online input)? Do they run fine?

Cheers,
Sergey
Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Hugo
Hi Sergey sorry about the delay on the response, i've been working on something else, and kind of quit on this one, for some time.
Yes any other program using OpenNi works fine, i've tryed many of them on my discovery on pcl.

the assertion on:

         assert (prev_cloud_);
         if (!vis_->updatePointCloud (prev_cloud_, "cloud"))

in the timeoutSlot fails, so i guess it is not passing anything to the prev_cloud_!

organized_segmentation_demo: ../organized_segmentation_demo/mainwindow.cpp:380: void MainWindow::timeoutSlot(): Assertion `prev_cloud_' failed.

Thanks a lot for the help, i'm sorry i didn't respond earlier, i'll try and fix this now i know what it is wrong... the passthrough OpenNi example that i set up on Qt is working perfectly, so i'll build up a similar application using the passthrough as base.

Cheers,
hugo
Reply | Threaded
Open this post in threaded view
|

Re: Error running organized_segmentation_demo

Sergey
Administrator
Hi Hugo,

As far as I understand, prev_cloud_ points nowhere. When you have some spare time, try to add some more assertions around the line where this pointer is updated:

  prev_cloud_ = cloud->makeShared();

It would be interesting to know whether cloud and prev_cloud_ point anywhere right after the assignment.

Regards,
Sergey