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

Octomap_RVIZ_Plugin crashes when octomap data is empty #10

Closed
lsouchet opened this issue Nov 7, 2014 · 2 comments
Closed

Octomap_RVIZ_Plugin crashes when octomap data is empty #10

lsouchet opened this issue Nov 7, 2014 · 2 comments

Comments

@lsouchet
Copy link

lsouchet commented Nov 7, 2014

On the latest indigo, using the package ros-indigo-octomap-rviz-plugins.

When I publish a message with an empty data array, it makes rviz segfault, with the following error:

z$ rosrun rviz rviz                                                                                [14-11-06 17:03]
[ INFO] [1415289850.007577884]: rviz version 1.11.3
[ INFO] [1415289850.007641335]: compiled against OGRE version 1.8.1 (Byatis)
[ INFO] [1415289850.245712863]: Stereo is NOT SUPPORTED
[ INFO] [1415289850.245825528]: OpenGl version: 3 (GLSL 1.3).
rviz: /opt/ros/indigo/include/octomap_msgs/conversions.h:58: octomap::AbstractOcTree* octomap_msgs::fullMsgToMap(const Octomap&): Assertion `msg.data.size() > 0' failed.

Here is the publisher sample example:

octomap.binary, octomap.id, octomap.resolution, octomap.data = octomap_str_to_tuple(octomap_bin)
if (len(octomap.data) == 0):
  octomap.data = []
self.pub.publish(octomap)

It works when my resulting octomap is not empty.
A workaround consist in NOT publishing when the array is empty but that's kind of bothering.
Here is the code of the octomap_str_to_tuple() that takes an octree passed as a string with write():

boost::python::tuple octomap_str_to_tuple(const std::string &str_msg)
{
  std::stringstream ss;
  ss << str_msg;
  ss.seekg(0);
  octomap::OcTree* octree = dynamic_cast<octomap::OcTree*>(octomap::OcTree::read(ss));

  octomap_msgs::Octomap msg;
  bool res = octomap_msgs::fullMapToMsg(*octree, msg);

  return boost::python::make_tuple(msg.binary, msg.id, msg.resolution, std_vector_to_py_list(msg.data));
}
@lsouchet
Copy link
Author

lsouchet commented Nov 7, 2014

Here is the output of the rostopic echo /octomap:

z$ rostopic echo /octomap                                                                         [14-11-07 15:48]
header: 
  seq: 62
  stamp: 
    secs: 1415371717
    nsecs: 223220109
  frame_id: /odom
binary: False
id: OcTree
resolution: 0.1
data: []
---

In a loop. When opening rviz and displaying this topic, it crashes as explained.

@ahornung
Copy link
Member

ahornung commented Nov 7, 2014

Thanks for the report! I just fixed this in the indigo-devel branch at octomap_msgs (OctoMap/octomap_msgs@ba05c79). Once this gets released and octomap_rviz_plugins are rebuilt it should be all fine.

@ahornung ahornung closed this as completed Nov 7, 2014
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

No branches or pull requests

2 participants