-
Notifications
You must be signed in to change notification settings - Fork 95
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
double free or corruption (out) [ros2run]: Aborted #26
Comments
I faced the same problem. I solved it with correcting node class. I created node outside the class in the main (stereo.cpp), then put the created node variable into the node class (StereoSlamNode). It looks like StereoSlamNode class cannot access the shared_ptrrclcpp::Node(this) inside the StereoSlamNode constructor, thus instead of shared_ptrrclcpp::Node(this) an external node should be used. stereo.cpp rclcpp::init(argc, argv);
if(argc < 4)
{
std::cerr << "\nUsage: ros2 run orbslam stereo path_to_vocabulary path_to_settings do_rectify" << std::endl;
return 1;
}
auto node = std::make_shared<rclcpp::Node>("run_slam");
// malloc error using new.. try shared ptr
// Create SLAM system. It initializes all system threads and gets ready to process frames.
bool visualization = true;
ORB_SLAM3::System pSLAM(argv[1], argv[2], ORB_SLAM3::System::STEREO, visualization);
std::shared_ptr<StereoSlamNode> slam_ros;
slam_ros = std::make_shared<StereoSlamNode>(&pSLAM, node.get(), argv[2], argv[3]);
std::cout << "============================ " << std::endl;
rclcpp::spin(slam_ros->node_->get_node_base_interface());
rclcpp::shutdown();
return EXIT_SUCCESS; stereo-slam-node.hpp class StereoSlamNode : public rclcpp::Node
{
public:
StereoSlamNode(ORB_SLAM3::System* pSLAM, rclcpp::Node* node, const string &strSettingsFile, const string &strDoRectify);
~StereoSlamNode();
rclcpp::Node* node_; stereo-slam-node.cpp StereoSlamNode::StereoSlamNode(ORB_SLAM3::System* pSLAM, rclcpp::Node* node, const string &strSettingsFile, const string &strDoRectify)
: Node("ORB_SLAM3_ROS2"),
m_SLAM(pSLAM),
node_(node)
{
left_sub = std::make_shared<message_filters::Subscriber<ImageMsg> >(node_, "camera/left");
right_sub = std::make_shared<message_filters::Subscriber<ImageMsg> >(node_, "camera/right");
syncApproximate = std::make_shared<message_filters::Synchronizer<approximate_sync_policy> >(approximate_sync_policy(10), *left_sub, *right_sub);
syncApproximate->registerCallback(&StereoSlamNode::GrabStereo, this);
} |
Simplier way to solve the bug - #24 |
ROS2 Humble
Ubuntu 22.04
I tried this already. Not working.
The program crashes without showing output.
ros2 run orbslam3 stereo vocabulary/ORBvoc.txt BFS.yaml False
ORB-SLAM3 Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
ORB-SLAM2 Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions. See LICENSE.txt.
Input sensor was set to: Stereo
Loading ORB Vocabulary. This could take a while...
Vocabulary loaded!
Initialization of Atlas from scratch
Creation of new map with id: 0
Creation of new map with last KF id: 0
Seq. Name:
Camera Parameters:
Camera: Pinhole
Image scale: 0.25
fx: 1749.73
fy: 1764.11
cx: 255.644
cy: 114.834
k1: -0.00412
k2: 0.723251
p1: -0.007554
p2: 0.001609
k3: 0
fps: 30
color order: BGR (ignored if grayscale)
Depth Threshold (Close/Far Points): 50.0339
ORB Extractor Parameters:
Number of Features: 1250
Scale Levels: 8
Scale Factor: 1.2
Initial Fast Threshold: 20
Minimum Fast Threshold: 7
There are 1 cameras in the atlas
Camera 0 is pinhole
Starting the Viewer
Shutdown
Saving keyframe trajectory to KeyFrameTrajectory.txt ...
double free or corruption (out)
[ros2run]: Aborted
The text was updated successfully, but these errors were encountered: