Advertisement

ORB-SLAM的USB双目摄像头测试

阅读量:

这些内容基于ORB-SLAM2编写而成;如果需要使用ORB-SLAM3,则只需将ORB-SLAM2 替换为ORB-SLAM3 即可。

在了解如何调用USB双目摄像头之前,请访问以下链接:链接

复制代码
    rostopic list

你应当能够识别出两个重要的摄像头节点:/left\_cam\text{/}image\_raw/right\_cam\text{/}image\_raw

在这里插入图片描述

然后是ORB-SLAM2的安装与配置
如果基于上述链接中的ORB-slam2已实现了相应的功能,则下一步我们需定位到orb_slam_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc这一具体的代码路径进行修改。

复制代码
    message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, "/camera/left/image_raw", 1);
    message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, "/camera/right/image_raw", 1);

修改为

复制代码
    message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, "/left_cam/image_raw", 1);
    message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, "/right_cam/image_raw", 1);

然后

复制代码
    cd /orb_slam_ws/src/ORB_SLAM2
    ./build_ros.sh

接下来

复制代码
     rosrun ORB_SLAM2 Stereo /home/daybeha/Documents/github/orb_slam_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/daybeha/Documents/github/orb_slam_ws/src/ORB_SLAM2/Examples/Stereo/mystereo.yaml false

其中mystereo.yaml 需要应包含你的相机标定参数(特别提示:需特别注意的是,在ORB-SLAM2与ORB-SLAM3v1.0及以上版本中文件格式存在差异)

该方法对于ORB-SLAM3v1.0而言,在do_rectify选项设为false的情况下(即使设置为false),只要有配置文件存在即可实现校正效果。

复制代码
    /home/daybeha/Documents/github/ORB_SLAM3/Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml /home/daybeha/Documents/Dataset/EuRoc/V1_01_easy ./Examples/Stereo/EuRoC_TimeStamps/V101.txt dataset-V101_stereo
    num_seq = 1
    file name: dataset-V101_stereo
    Loading images for sequence 0...LOADED!
    
    -------
    
    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.
    under certain conditions. See LICENSE.txt.
    
    Input sensor was set to: Stereo
    Loading settings from ./Examples/Stereo/EuRoC.yaml
    	-Loaded camera 1
    	-Loaded camera 2
    	-Loaded image info
    	-Loaded ORB settings
    	-Loaded viewer settings
    	-Loaded Atlas settings
    	-Loaded misc parameters
    	-Computed rectification maps
    ----------------------------------
    SLAM settings: 
    	-Camera 1 parameters (Pinhole): [ 458.65399169921875 457.29598999023438 367.21499633789062 248.375 ]
    	-Camera 1 distortion parameters: [  -0.28340810537338257 0.073959067463874817 0.00019359000725671649 1.7618711353861727e-05 ]
    	-Camera 2 parameters (Pinhole: [ 457.58700561523438 456.13400268554688 379.99899291992188 255.23800659179688 ]
    	-Camera 1 distortion parameters: [  -0.2836836576461792 0.074512839317321777 -0.00010473000293131918 -3.555907096597366e-05 ]
    	-Original image size: [ 752 , 480 ]
    	-Current image size: [ 752 , 480 ]
    	-Camera 1 parameters after rectification: [  456.71499633789062 456.71499633789062 364.52615356445312 257.268798828125 ]
    	-Sequence FPS: 20
    	-Stereo baseline: 0.11007785052061081
    	-Stereo depth threshold : 60
    	-Features per image: 1200
    	-ORB scale factor: 1.2000000476837158
    	-ORB number of scales: 8
    	-Initial FAST threshold: 20
    	-Min FAST threshold: 7
    
    
    Loading ORB Vocabulary. This could take a while...
    Camera1.k3 optional parameter does not exist...
    Camera2.k3 optional parameter does not exist...
    Camera.newHeight optional parameter does not exist...
    Camera.newWidth optional parameter does not exist...
    System.LoadAtlasFromFile optional parameter does not exist...
    System.SaveAtlasToFile optional parameter does not exist...
    System.thFarPoints optional parameter does not exist...
    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: 
    There are 1 cameras in the atlas
    Camera 0 is pinhole
    First KF:0; Map init KF:0
    New Map created with 545 points
    Starting the Viewer

全部评论 (0)

还没有任何评论哟~