gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.17k stars 477 forks source link

Heightmap visual without collision causes gzclient black screen #2046

Open osrf-migration opened 8 years ago

osrf-migration commented 8 years ago

Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


If you open a world file that has a <visual> heightmap element without a <collision>, it will cause gzclient to hang with a black screen without loading (similar to #681). The following patch can be used to replicate the problem:

diff -r 5e1b4aafa300d6d92a2b1bd2a71bf2b6273c566c worlds/heightmap.world
--- a/worlds/heightmap.world    Thu Aug 25 15:55:30 2016 -0700
+++ b/worlds/heightmap.world    Fri Sep 09 17:02:46 2016 -0700
@@ -96,15 +96,6 @@
     <model name="heightmap">
       <static>true</static>
       <link name="link">
-        <collision name="collision">
-          <geometry>
-            <heightmap>
-              <uri>file://media/materials/textures/heightmap_bowl.png</uri>
-              <size>129 129 10</size>
-              <pos>0 0 0</pos>
-            </heightmap>
-          </geometry>
-        </collision>
         <visual name="visual_abcedf">
           <geometry>
             <heightmap>

I halted gzclient in gdb and found the following backtrace:

^C
Program received signal SIGINT, Interrupt.
pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185 in ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
(gdb) bt
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007ffff5e4f2f3 in wait (m=..., this=0x7ffff6071be0 <g_responseCondition>) at /usr/include/boost/thread/pthread/condition_variable.hpp:73
#2  gazebo::transport::request (_worldName="default", _request="heightmap_data", _data="") at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/transport/TransportIface.cc:220
#3  0x00007ffff5aba428 in gazebo::rendering::Heightmap::Load (this=this@entry=0x181bbb0) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/rendering/Heightmap.cc:371
#4  0x00007ffff5abbb7e in gazebo::rendering::Heightmap::LoadFromMsg (this=0x181bbb0, _msg=...) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/rendering/Heightmap.cc:147
#5  0x00007ffff5afa699 in gazebo::rendering::Scene::ProcessVisualMsg (this=this@entry=0x1861310, _msg=..., _type=<optimized out>) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/rendering/Scene.cc:2758
#6  0x00007ffff5b05f25 in gazebo::rendering::Scene::PreRender (this=0x1861310) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/rendering/Scene.cc:2040
#7  0x00007ffff7648c95 in operator() (this=<optimized out>) at /usr/include/boost/function/function_template.hpp:767
#8  gazebo::event::EventT<void ()>::Signal() (this=<optimized out>) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/common/Event.hh:370
#9  0x00007ffff7641344 in operator() (this=<optimized out>) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/common/Event.hh:214
#10 gazebo::gui::GLWidget::paintEvent (this=0x1846740, _e=0x7fffffffd520) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/gui/GLWidget.cc:277
#11 0x00007ffff27b9300 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#12 0x00007ffff2769e2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#13 0x00007ffff27704a0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007ffff71b64dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#15 0x00007ffff27b3a21 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007ffff2974b9b in QWidgetPrivate::repaint_sys(QRegion const&) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007ffff27a8e47 in QWidgetPrivate::syncBackingStore() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007ffff27b8e7a in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#19 0x00007ffff2769e2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007ffff27704a0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#21 0x00007ffff71b64dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#22 0x00007ffff71b9b3d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#23 0x00007ffff71e3f83 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#24 0x00007fffefdd7e04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007fffefdd8048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007fffefdd80ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007ffff71e37a1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#28 0x00007ffff280bbe6 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#29 0x00007ffff71b50af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x00007ffff71b53a5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#31 0x00007ffff71bab79 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#32 0x00007ffff76508bb in gazebo::gui::run (_argc=_argc@entry=2, _argv=_argv@entry=0x7fffffffddd8) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/gui/GuiIface.cc:360
#33 0x000000000040152a in main (_argc=2, _argv=0x7fffffffddd8) at /var/lib/jenkins/workspace/gazebo7-debbuilder/build/gazebo-7.3.1/gazebo/gui/main.cc:25
(gdb)

It is ultimately blocking on a gazebo::transport::request call (type heightmap_data) in rendering::Heightmap::Load, which was generated by Scene::PreRender. Apparently, physics::HeightmapShape is the only class that responds to heightmap_data requests. Since there is no heightmap <collision>, there is no HeightmapShape to respond to the request. Also, I believe this design prevents multiple heightmaps from being used, since they would all try to respond to the same heightmap_data requests.

osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).