Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RViz crash with high-resolution map #424

Closed
rotu opened this issue Jul 5, 2019 · 5 comments · Fixed by #425
Closed

RViz crash with high-resolution map #424

rotu opened this issue Jul 5, 2019 · 5 comments · Fixed by #425

Comments

@rotu
Copy link
Contributor

rotu commented Jul 5, 2019

RViz seems to have trouble rendering high-pixel count maps, causing a very reproducible crash.
Publishing the map in map_lores.zip (533x423 px, 230.3 kB) and viewing it in rviz2 works fine.
Publishing the map in map_hires.zip (861x661 px, 569.2 kB) and trying to view it in rviz2 causes a hard crash with the following error info:

ros2 launch openrover_demo rviz.launch.py 
[INFO] [launch]: All log files can be found below /home/snuc/.ros/log/2019-07-05-16-22-21-496956-rhea-15882
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rviz2-1]: process started with pid [15913]
[rviz2-1] [INFO] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-1] [INFO] [rviz2]: OpenGl version: 3 (GLSL 1.3)
[rviz2-1] [INFO] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-1] [INFO] [rviz2]: Creating 1 swatches_
[rviz2-1] [ERROR] [rviz2]: InvalidParametersException: Stream size does not match calculated image size in Image::loadRawData at /opt/ros/master/build/rviz_ogre_vendor/ogre-master-ca665a6-prefix/src/ogre-master-ca665a6/OgreMain/src/OgreImage.cpp (line 283)
[rviz2-1] [ERROR] [rviz2]: Failed to create 1 swatches_
[rviz2-1] [INFO] [rviz2]: Creating 2 swatches_
[rviz2-1] [ERROR] [rviz2]: InvalidParametersException: Stream size does not match calculated image size in Image::loadRawData at /opt/ros/master/build/rviz_ogre_vendor/ogre-master-ca665a6-prefix/src/ogre-master-ca665a6/OgreMain/src/OgreImage.cpp (line 283)
[rviz2-1] [ERROR] [rviz2]: Failed to create 2 swatches_
[rviz2-1] [INFO] [rviz2]: Creating 4 swatches_
[rviz2-1] [ERROR] [rviz2]: InvalidParametersException: Stream size does not match calculated image size in Image::loadRawData at /opt/ros/master/build/rviz_ogre_vendor/ogre-master-ca665a6-prefix/src/ogre-master-ca665a6/OgreMain/src/OgreImage.cpp (line 283)
[rviz2-1] [ERROR] [rviz2]: Failed to create 4 swatches_
[rviz2-1] [INFO] [rviz2]: Creating 8 swatches_
[rviz2-1] [ERROR] [rviz2]: InvalidParametersException: Stream size does not match calculated image size in Image::loadRawData at /opt/ros/master/build/rviz_ogre_vendor/ogre-master-ca665a6-prefix/src/ogre-master-ca665a6/OgreMain/src/OgreImage.cpp (line 283)
[rviz2-1] [ERROR] [rviz2]: Failed to create 8 swatches_
[rviz2-1] [ERROR] [rviz2]: InvalidParametersException: Stream size does not match calculated image size in Image::loadRawData at /opt/ros/master/build/rviz_ogre_vendor/ogre-master-ca665a6-prefix/src/ogre-master-ca665a6/OgreMain/src/OgreImage.cpp (line 283)
[rviz2-1] terminate called after throwing an instance of 'Ogre::InvalidParametersException'
[rviz2-1]   what():  InvalidParametersException: Stream size does not match calculated image size in Image::loadRawData at /opt/ros/master/build/rviz_ogre_vendor/ogre-master-ca665a6-prefix/src/ogre-master-ca665a6/OgreMain/src/OgreImage.cpp (line 283)
[ERROR] [rviz2-1]: process has died [pid 15913, exit code -6, cmd '/opt/ros/master/install/lib/rviz2/rviz2 --display-config /home/snuc/ros2_ws/src/openrover/openrover_demo/config/default.rviz --fixed-frame map'].

This is on Ubuntu 18 with ROS2 built from master branch.

map_hires.zip
map_lores.zip

@rotu
Copy link
Contributor Author

rotu commented Jul 5, 2019

It seems to be related to the total image size, not the maximum dimension, as cropping either the width or height to 400px prevents the crash.

@Martin-Idel
Copy link
Contributor

Martin-Idel commented Jul 6, 2019

This is a non-obvious duplicate of #401. (previously linked to #394)

The root cause is a bug such that any swatch can only have at most 255*255 pixels and there can only be eight swatches in total.

If you have a source build available, you can try my fix below to check whether that solves everything for you!

@rotu
Copy link
Contributor Author

rotu commented Jul 6, 2019

@Martin-Idel awesome. I’m glad you understand this issue! Will try the PR.

@rotu
Copy link
Contributor Author

rotu commented Jul 7, 2019

Upon further reflection and research, I think (1) this has nothing to do with #394. (2) this is due to an errant static_cast<uint8_t> in Swatch::resetTexture accidentally introduced in #267.

ROS2:
https://github.com/ros2/rviz/blob/ros2/rviz_default_plugins/src/rviz_default_plugins/displays/map/swatch.cpp#L212
ROS1:
https://github.com/ros-visualization/rviz/blob/4b6c0f447159044bfaa633e140e6094b19516b02/src/rviz/default_plugin/map_display.cpp#L204

A swatch should be able to be more than 255 bits wide and high, but these dimensions are incorrectly truncated to a uint8_t instead of a uint16_t (aka ushort, for those of you following along in the code). This effectively limits each swatch to 255 bits in each dimension - it should be able to be bigger.

Edit: d'oh. It seems you're one step ahead of me. I only read PR #394, not PR #425.

@Martin-Idel
Copy link
Contributor

Martin-Idel commented Jul 7, 2019

That's also partly my fault - I first thought it'd be exactly the same issue and more swatches will indeed solve the problem. But as you say I then thought that a swatch should be able to hold more data and found the root cause.

EDIT: Argh, now I see, my original comment contained a link to #394 while it SHOULD have contained a link to #401 - I have no idea how that happened. Sorry for that confusion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants