ros-visualization / rviz

ROS 3D Robot Visualizer
BSD 3-Clause "New" or "Revised" License
824 stars 463 forks source link

crash on adding obstacles from local_costmap and LaserScan #713

Closed WildBaker closed 10 years ago

WildBaker commented 10 years ago

not only i am getting this errors: http://answers.ros.org/question/124896/rviz-crash-on-adding-obstacles-from-local_costmap/?comment=125576#comment-125576

dgossow commented 10 years ago

Uh oh, looks like maybe a bug in the point cloud base classes..

wjwwood commented 10 years ago

It would be helpful if you could run rviz with gdb and get a traceback on the segfault. You can run it in gdb like this:

$ gdb /opt/ros/hydro/lib/rviz/rviz

And when it crashes type bt and put the output from that in this issue.

WildBaker commented 10 years ago

when i try to run rviz in gdb, it says "Reading symbols from /opt/ros/groovy/lib/rviz/rviz...(no debugging symbols found)...done."

wjwwood commented 10 years ago

After that you have to type r and press enter to run the program.

WildBaker commented 10 years ago

gdb returns: http://pastebin.com/1QF8mWmk

wjwwood commented 10 years ago

Thanks @WildBaker, that confirms @dgossow's assessment. If you have time and know how it would be useful to get the gdb output from rviz compiled for debug.

Something else that would be helpful for the record would be more information about your system (even if it is listed on the answers.ros.org question) and the exact steps you went through to cause the problem.

WildBaker commented 10 years ago

I do not know how to do it, but if you tell me where can I find sth, what will show me how- I can try to do it.

Ubuntu 12.04.4 LTS OGRE 1.7.4 OpenGl version: 3 (GLSL 1.3). rviz version 1.9.34

I run stage symulation with LaserScan and than rviz. I've checked how it works on my friend's computer- rviz has been working just fine with gazeebo, but also crashes while taking LaserScan from stage.

wjwwood commented 10 years ago

I run stage symulation with LaserScan and than rviz. I've checked how it works on my friend's computer- rviz has been working just fine with gazeebo, but also crashes while taking LaserScan from stage.

So you say it works with the laser scan from Gazebo but not Stage?

To compile rviz with debug on, do this:

$ source /opt/ros/hydro/setup.bash
$ mkdir /tmp/rviz_ws
$ cd /tmp/rviz_ws
$ rosinstall_generator rviz --deps --exclude RPP --tar > rviz.rosinstall
$ wstool init src rviz.rosinstall
$ catkin_make -DCMAKE_BUILD_TYPE=Debug
$ source ./devel/setup.bash
$ gdb ./devel/lib/rviz/rviz
WildBaker commented 10 years ago

i forgot to tell i have groovy

i installed rosinstall, but when i try to

$ rosinstall_generator rviz --deps --exclude RPP --tar > rviz.rosinstall

i get error:

/tmp/rviz_ws$ rosinstall_generator rviz --deps --exclude RPP --tar > rviz.rosinstall
Using ROS_DISTRO: groovy
Traceback (most recent call last):
  File "/usr/bin/rosinstall_generator", line 98, in <module>
    rc = main()
  File "/usr/bin/rosinstall_generator", line 86, in main
    tar=args.tar)
  File "/usr/lib/pymodules/python2.7/rosinstall_generator/generator.py", line 187, in generate_rosinstall
    names, unknown_names = _classify_names(distro_name, names)
  File "/usr/lib/pymodules/python2.7/rosinstall_generator/generator.py", line 85, in _classify_names
    wet_distro = get_wet_distro(distro_name)
  File "/usr/lib/pymodules/python2.7/rosinstall_generator/generator.py", line 169, in get_wet_distro
    _wet_distro = _get_wet_distro(distro_name)
  File "/usr/lib/pymodules/python2.7/rosinstall_generator/distro.py", line 45, in get_distro
    return get_cached_distribution(index, distro_name)
  File "/usr/lib/pymodules/python2.7/rosdistro/__init__.py", line 134, in get_cached_distribution
    cache = get_distribution_cache(index, dist_name)
  File "/usr/lib/pymodules/python2.7/rosdistro/__init__.py", line 160, in get_distribution_cache
    yaml_gz_str = load_url(url, skip_decode=True)
  File "/usr/lib/pymodules/python2.7/rosdistro/loader.py", line 59, in load_url
    raise URLError(str(e) + ' (%s)' % url)
urllib2.URLError: <urlopen error <urlopen error [Errno -2] Name or service not known> (http://ros.org/rosdistro/groovy-cache.yaml.gz)>
wjwwood commented 10 years ago

I can download that file here, it looks like an intermittent internet error, can you try again?

wjwwood commented 10 years ago

Groovy works just as well.

WildBaker commented 10 years ago

after few errors i get this:

 No packages/stacks left after applying the exclusions
WildBaker commented 10 years ago

I do not know gazeebo, but i tried on already running one and stage running on the same time. When i switched topic of LaserScan from Gazeebo to stage- rviz crashed.

wjwwood commented 10 years ago

Ok, run this command instead:

$ rosinstall_generator rviz --tar > rviz.rosinstall
WildBaker commented 10 years ago

it works and gdb returns: /base_scan as LaserScan error: http://pastebin.com/xNJLD5wv

and move_base_node/local_costmap/obstacles as GridCell error: http://pastebin.com/s8rSDNP0

wjwwood commented 10 years ago

@dgossow do you have any insight as to why this segfault would occur?

My first guess would be that we are iterating through pointers assuming that the overall structure is larger than it actually is because the structure type is somehow wrong. If I understand @WildBaker correctly this hypothesis is support by it occurring only with certain sources of LaserScans messages. He mentioned Stage which could easily be sending something bogus, tripping an error in the conversion to a pointcloud for visualization.

wjwwood commented 10 years ago

Also, if I understand correctly this has started happening recently and worked correctly in the past. So here are some candid commits for regression:

dgossow commented 10 years ago

Very well possible that this is what broke it. That code wasn't very well tested.

One thing I see is that depending on the value of current_mode_supports_geometryshader, the code will iterate twice as fast over the vertex array, but the array size will still be the same. Looks like a bug. I think that variable is usually set to true if your hardware supports geometry shaders and the loaded material has the special "gp" technique, and false otherwise. So, this might only crash on machines without geometry shader support.

wjwwood commented 10 years ago

@dgossow do you know of a way for them to easily check if their hardware has support for geometry shaders? Is it possible that our detection method is broken?

dgossow commented 10 years ago

No, the detection method works fine. What I meant was that because in https://github.com/ros-visualization/rviz/blob/groovy-devel/src/rviz/ogre_helpers/point_cloud.cpp#L583 we put an extra vertex in for each point, in https://github.com/ros-visualization/rviz/blob/groovy-devel/src/rviz/ogre_helpers/point_cloud.cpp#L534 it should maybe say

if (current_mode_supports_geometry_shader_) {
  num_verts *= 2;
}

or something along these lines. Looking at that code, it looks very very fishy to me anyway. This should probably be rewritten. The only difference between geometry shader support and not should be that we put in one 4x4 Byte vertex per point cloud point (x,y,z,RGBA), and a bunch of vertices without geometry shader support (all the corners of the quad or box or whatever). The code there is doing a lot of pointer magic and is probably not very fast because it has a lot of ifs and function calls in its inner loop.

dgossow commented 10 years ago

Looking at the code again, I don't really understand what's happening there.

dgossow commented 10 years ago

Okay, so the magic happens in https://github.com/ros-visualization/rviz/blob/groovy-devel/src/rviz/ogre_helpers/point_cloud.cpp#L803, so forget what I said before. I don't know what's causing this bug.

WildBaker commented 10 years ago

i've just run rviz via optirun and there is no more error from LaserScan, but there is still an error with GridCells

wjwwood commented 10 years ago

Having that work when run with optirun supports the idea that some code path that normally is not executed might be the issue. optirun will have switched rviz to your more powerful video card correct?

WildBaker commented 10 years ago

i think so

Dtad commented 10 years ago

I tried. it is not working. Optirun Bumblebee only works with Nvidia Card. I have ATI RADEON HD 46000

tfoote commented 10 years ago

@WildBaker what is your hardware?

WildBaker commented 10 years ago

Intel Corporation 3rd Gen Core processor Graphics Controller(intel core i5) and NVIDIA Corporation GF108M [NVS 5400M] -those are hybrid, I do not know how they exactly work, but I think it is not a "pure" 2nd Graphic Card.

WildBaker commented 10 years ago

Ander says, that version 1.9.32 is w/o those bugs. Btw, can u tell me how to replace current rviz with the old one (i'm dont know this becouse I've only apt-get everything or put intoo my catkin ws). Thanks in advance.

wjwwood commented 10 years ago

@WildBaker I described how to build it from source here: https://github.com/ros-visualization/rviz/issues/715#issuecomment-34255312

Dtad commented 10 years ago

I tried 1.9.32 installation works. But still need to test it on Turtlebot 1 on monday. Thanks.

tfoote commented 10 years ago

I've tested the hydro version of rviz 1.10.11 with both optimus and non-optimus and everything seemed to run.

rviz_both_optirun_and_regular

I have 01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1100M](rev a1)

I'll try to reproduce in the 1.9.x revisions next.

veger commented 10 years ago

I was following the rviz Markers: Points and Lines tutorial using groovy, and seemed to suffer from the same problem. After adding the Marker display, rviz crashed/hung and showed a 'memory corruption' in the terminal (and I had to forcefully stop it). The previous rviz tutorial (Markers: Sending Basic Shapes) did not suffer from these crashes.

I manually installed and build ros groovy from sources (and 'got' rviz version 1.9.34 from it) After downgrading rviz to 1.9.32 the crashes I suffered from, disappeared and I got the result as showed in the tutorial.

Edit: I forgot to add that version 1.9.33 also crashed. So change(s) between version 1.9.32 and 1.9.33 seems to be the culprit..?

wjwwood commented 10 years ago

@veger There is a proposed fix for this: https://github.com/ros-visualization/rviz/pull/721

I am waiting on people to test that fix before merging and releasing it. If you could test that fix I would probably merge it as it seems to address the issue's originally described here.

wjwwood commented 10 years ago

Fixed by #721