Closed hycwuy closed 5 years ago
Do you have some details about the crash?
After resetting there should still be an empty map sent out to clear (through publishAll)
With this patch in place, is the MarkerArray visualization of occupied / free nodes properly cleared when calling the reset service?
About the crash (Edit: this crash has been fixed in octomap devel branch, see this) **1. feed data to octomap, make sure the map is NOT empty, otherwise the crash will not be triggered
0 0x00007ffff65ca0cd in octomap::OccupancyOcTreeBaseoctomap::OcTreeNode::writeBinaryNode(std::ostream&, octomap::OcTreeNode const*) const ()
from /opt/ros/kinetic/lib/liboctomap.so.1.8
1 0x00007ffff65ca352 in octomap::OccupancyOcTreeBaseoctomap::OcTreeNode::writeBinaryData(std::ostream&) const ()
from /opt/ros/kinetic/lib/liboctomap.so.1.8
2 0x00007ffff7aaef4f in octomap_msgs::binaryMapToMsgoctomap::OcTree (
octomap=..., msg=...) at /opt/ros/kinetic/include/octomap_msgs/conversions.h:172
3 0x00007ffff7aaa889 in octomap_server::OctomapServer::publishBinaryOctoMap (
this=0x7fffffffcb80, rostime=...) at /home/someone/catkin_ws/src/octomap_mapping/octomap_server/src/OctomapServer.cpp:801
4 0x00007ffff7aaa436 in octomap_server::OctomapServer::resetSrv (
this=0x7fffffffcb80, req=..., resp=...) at /home/someone/catkin_ws/src/octomap_mapping/octomap_server/src/OctomapServer.cpp:765
Another crash (Edit: this crash has been fixed in octomap devel branch, see this) **1. remove publishBinaryOctoMap() in resetSrv(), which will crash the program when map is empty
Thread 1 "octomapserver" received signal SIGSEGV, Segmentation fault. 0x00007ffff7adbea1 in octomap::OcTreeBaseImpl<octomap::OcTreeNode, octomap::AbstractOccupancyOcTree>::nodeChildExists (this=0x64df00, node=0x6c8e20, childIdx=5) at /opt/ros/kinetic/include/octomap/OcTreeBaseImpl.hxx:237 237 if ((node->children != NULL) && (node->children[childIdx] != NULL)) (gdb) bt
0 0x00007ffff7adbea1 in octomap::OcTreeBaseImpl<octomap::OcTreeNode, octomap::AbstractOccupancyOcTree>::nodeChildExists (this=0x64df00, node=0x6c8e20,
childIdx=5) at /opt/ros/kinetic/include/octomap/OcTreeBaseImpl.hxx:237
1 0x00007ffff7ace6c6 in octomap::OcTreeBaseImpl<octomap::OcTreeNode, octomap::AbstractOccupancyOcTree>::search (this=0x64df00, key=..., depth=16)
at /opt/ros/kinetic/include/octomap/OcTreeBaseImpl.hxx:456
2 0x00007ffff65cdebf in octomap::OccupancyOcTreeBaseoctomap::OcTreeNode::updateNode(octomap::OcTreeKey const&, float, bool) ()
from /opt/ros/kinetic/lib/liboctomap.so.1.8
3 0x00007ffff7aa781a in octomap_server::OctomapServer::insertScan (
this=0x7fffffffcb80, sensorOriginTf=..., ground=..., nonground=...) at /home/someone/catkin_ws/src/octomap_mapping/octomap_server/src/OctomapServer.cpp:441
4 0x00007ffff7aa6044 in octomap_server::OctomapServer::insertCloudCallback (
this=0x7fffffffcb80, cloud=...) at /home/someone/catkin_ws/src/octomap_mapping/octomap_server/src/OctomapServer.cpp:348
After fixing the crash above, I tested again. Because publishAll() skipped empty map, the map was not published until I fed new data to octomap. So with this patch, MarkerArray will not be cleared, but MarkerArray updates properly after feeding new data to octomap. I don't know why publishAll() should skip empty map. In my opinion, empty map should also be published.
The crash is likely related to https://github.com/OctoMap/octomap/issues/123
It's fixed in the OctoMap devel branch, could you test with that as an overlay? The fix is not released yet.
I have tested the latest version in devel branch, it works fine. Thank you!
@hycwuy can this pull request be closed givne that it's working fine?
because already publish all and publish empty binary octomap will crash program