Closed samiamlabs closed 2 years ago
It seems a bit strange to me that LoopClosureAssistant is using raw pointers rather that smart pointers. I suspect there is a reason for this thought...
At the time of writing, I had just gotten out of several months working in the core of lib KartoSDK which has raw pointers galore for the graph-SLAM representations so it was just the headspace I was in. Plus,
Basic Info
I was getting a segfault in in
localization_slam_toolbox_node
after loading a posegraph from a file here in the code: https://github.com/SteveMacenski/slam_toolbox/blob/ae68b851094668738fd32e8dc6e72e18fd15a965/src/loop_closure_assistant.cpp#L189The problem is that the
LoopClosureAssistant
was created with a raw pointer to akarto::Mapper
instance from a unique pointer. The raw pointer is not replaced when a new serialized pose graph is loaded. Trying to call functions on themapper_
pointer in theLoopClosureAssistant
after that will cause a segfault.| Primary OS tested on | Ubuntu | | Robotic platform tested on | gazebo simulation of Husky |
Description of contribution in a few bullet points
mapper_
pointer toLoopClosureAssistant
LoopClosureAssistant
inloadSerializedPoseGraph
Future work that may be required
It seems a bit strange to me that
LoopClosureAssistant
is using raw pointers rather that smart pointers. I suspect there is a reason for this thought... If not, it not we should probably change it so it uses smart pointers and avoid segfaults like this.