EVO Evaluation of SLAM 4 --- ORB-SLAM3 编译和利用数据集运行

一、前言

上一篇已经用EVO来估计了VINS-Mono:
EVO Evaluation of SLAM 2 — VINS-Mono 编译和利用数据集运行
EVO Evaluation of SLAM 3 — VINS-Mono 精度和性能效果评估

二、说明

现在开始用EVO估计ORB-SLAM3。
之前编译ORB-SLAM3的时候是用现在电脑上的环境,用源码编译遇到的坑已经在之前的文章中列出来,有问题的童鞋可以看看:
ORB-SLAM3 Ubuntu ros melodic 编译的坑

自己修改的源码在github上,欢迎大家指正:
https://github.com/shanpenghui/ORB_SLAM3_Fixed.git

如果用新安装Ubuntu系统的电脑进行编译的话,需要进行Pangolin的安装,
地址是:
https://github.com/stevenlovegrove/Pangolin.git

具体操作步骤是:

sudo apt install libglew-dev
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake ..
make -j 4
sudo make install

然后进行ORB-SLAM3的编译,其中有分ros版本和非ros版本,因为涉及到EuRoc和TUM数据集的评估,有些地方不一样,所以在此特别指出。否则会出现下面错误:

--------------------------------------------------------------------------------
Loaded 2151 stamps and poses from: f_dataset-room4_512_monoi.txt
Loaded 13075 stamps and poses from: data_tum.csv
Synchronizing trajectories...
[ERROR] found no matching timestamps between f_dataset-room4_512_monoi.txt and data_tum.csv with max. time diff 0.01 (s) and time offset 0.0 (s)

EuRoc

把system.cc里面的Line677和Line685的源码中的1e9*(*lT)变成(*lT)

f << setprecision(6) << (*lT) << " " <<  setprecision(9) << twb.at<float>(0) << " " << twb.at<float>(1) << " " << twb.at<float>(2) << " " << q[0] << " " << q[1] << " " << q[2] << " " << q[3] << endl;

TUM

把system.cc里面的Line677和Line685的源码中的1e9*(*lT)不变

f << setprecision(6) << 1e9*(*lT) << " " <<  setprecision(9) << twb.at<float>(0) << " " << twb.at<float>(1) << " " << twb.at<float>(2) << " " << q[0] << " " << q[1] << " " << q[2] << " " << q[3] << endl;

三、下载数据集

A.EuRoc

本文利用的是EuRoc数据集的MH_01_easy
http://robotics.ethz.ch/~asl-datasets/ijrr_euroc_mav_dataset/machine_hall/MH_01_easy/MH_01_easy.zip
官网地址是:
http://robotics.ethz.ch/~asl-datasets

B.TUM

TUM的Visual-Inertial Dataset数据集的地址在下面,注意选择room4的Euroc / DSO 512x512 dataset
http://vision.in.tum.de/tumvi/exported/euroc/512_16/dataset-room4_512_16.tar
官网地址是:
https://vision.in.tum.de/data/datasets/visual-inertial-dataset

四、非ros版本编译和运行(Monocular)

1.编译

git clone https://github.com/shanpenghui/ORB_SLAM3_Fixed.git
cd ORB_SLAM3_Fixed/shells
./build.sh

2.运行

这里要分清楚,两个数据集运行脚本分别是euroc.sh和tum_vi.sh

A.EuRoc

运行之前,需要修改ORB_SLAM3_Fixed/shells/euroc.sh文件里面的数据集存放的路径:

Line 5:
pathDatasetEuroc='/home/sph/Downloads' #Example, it is necesary to change it by the dataset path

然后运行:

cd ORB_SLAM3_Fixed/shells
./euroc.sh

结果:

B.TUM

运行之前,需要修改ORB_SLAM3_Fixed/shells/tum_vi.sh文件里面的数据集存放的路径:

Line 5:
pathDatasetTUM_VI='/home/sph/Downloads' #Example, it is necesary to change it by the dataset path

然后运行:

cd ORB_SLAM3_Fixed/shells
./tum_vi.sh

结果:

五、ros版本的编译和运行

1.编译

git clone https://github.com/shanpenghui/ORB_SLAM3_Fixed.git
cd ORB_SLAM3_Fixed/shells
./build_ros.sh

2.运行

Stereo和Mono订阅的话题名称不一样,所以在运行rosbag和rosrun的时候,两个指令是有区别的!!!比如:

rosbag in terminal 2 的
(1)EuRoc - Stereo
(2)EuRoc - Mono

rosrun in terminal 3 的
(1)EuRoc - Stereo
(2)EuRoc - Mono

A.roscore in terminal 1

source /opt/ros/melodic/setup.bash
roscore

B.rosbag in terminal 2

(1)EuRoc - Stereo

以暂停的方式运行,等orb-slam3运行起来之后记得按空格键play,不然不正常都不知道什么原因,切记!切记!

source /opt/ros/melodic/setup.bash
cd /home/sph/Downloads/dataset/EuRoc
rosbag play --pause MH_01_easy.bag /cam0/image_raw:=/camera/left/image_raw /cam1/image_raw:=/camera/right/image_raw

(2)EuRoc - Mono

source /opt/ros/melodic/setup.bash
cd /home/sph/Downloads/dataset/EuRoc
rosbag play --pause MH_01_easy.bag /cam0/image_raw:=/camera/image_raw

(3)TUM - Stereo

source /opt/ros/melodic/setup.bash
cd /home/sph/Downloads/dataset/TUM
rosbag play --pause dataset-room4_512_16.bag /cam0/image_raw:=/camera/left/image_raw /cam1/image_raw:=/camera/right/image_raw

(4)TUM - Mono ros版本暂时不支持该功能!!!

C.rosrun in terminal 3

编译完之后运行ros版本的时候,需要先export一下package的路径.
运行的路径是在ORB_SLAM3_Fixed下,不要在shells里面运行!!

(1)EuRoc - Stereo

source /opt/ros/melodic/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/sph/Documents/slam/ORB_SLAM3_Fixed/Examples/ROS
cd /home/sph/Documents/slam/ORB_SLAM3_Fixed
rosrun ORB_SLAM3 Stereo Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml true

Result files:

Saving keyframe trajectory to KeyFrameTrajectory_TUM_Format.txt ...
Saving camera trajectory to FrameTrajectory_TUM_Format.txt ...
Saving camera trajectory to FrameTrajectory_KITTI_Format.txt ...

结果:

(2)EuRoc - Mono

source /opt/ros/melodic/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/sph/Documents/slam/ORB_SLAM3_Fixed/Examples/ROS
cd /home/sph/Documents/slam/ORB_SLAM3_Fixed
rosrun ORB_SLAM3 Mono Vocabulary/ORBvoc.txt Examples/Monocular/EuRoC.yaml

Result files:

Saving keyframe trajectory to KeyFrameTrajectory.txt ...

结果:

(3)TUM - Stereo

因为没有打开IMU,所以rosrun指令结尾要以false结束

source /opt/ros/melodic/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/sph/Documents/slam/ORB_SLAM3_Fixed/Examples/ROS
cd /home/sph/Documents/slam/ORB_SLAM3_Fixed
rosrun ORB_SLAM3 Stereo Vocabulary/ORBvoc.txt Examples/Stereo/TUM_512.yaml false

Result files:

Saving keyframe trajectory to KeyFrameTrajectory_TUM_Format.txt ...
Saving camera trajectory to FrameTrajectory_TUM_Format.txt ...
Saving camera trajectory to FrameTrajectory_KITTI_Format.txt ...

结果:

(4)TUM - Monocular

source /opt/ros/melodic/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/sph/Documents/slam/ORB_SLAM3_Fixed/Examples/ROS
cd /home/sph/Documents/slam/ORB_SLAM3_Fixed
rosrun ORB_SLAM3 Mono Vocabulary/ORBvoc.txt Examples/Monocular/TUM_512.yaml

-------------------------------- 华丽的分割线 --------------------------------
2021年01月21日新增

六、非ros版本编译和运行(RGB-D)

1. 下载数据集

本例子用的是TUM的RGBD数据集,https://vision.in.tum.de/data/datasets/rgbd-dataset/download#freiburg1_desk
本次用的yaml配置文件是TUM4.yaml,在tum_rgbd.sh文件中可以修改。作者原版本是没有TUM4.yaml文件的,只有TUM1-3.yaml,我这里是根据官网给的参数自己添加的配置文件,具体相机参数的参考在这里:File Formats

2. 配置启动文件

启动文件是tum_rgbd.sh,在shells文件夹下面,内容我贴一下吧:

#!/bin/bash

cd ..
currentDir=$(pwd)
# 配置运行类型
runType=RGB-D
# 配置文件夹
datasetType=rgbd_dataset_freiburg1_desk

pathDatasetTUM_VI='/home/sph/Downloads/dataset/TUM' #Example, it is necesary to change it by the dataset path
if  [ -d "$pathDatasetTUM_VI" ];then
  echo  ""
else
  echo  "该文件夹不存在 ${pathDatasetTUM_VI} "
  exit 1
fi

if  [ -f "$currentDir/Vocabulary/ORBvoc.txt" ];then
  echo  ""
else
  echo  "该文件不存在 $currentDir/Vocabulary/ORBvoc.txt "
  exit 1
fi
if  [ -f "$currentDir/Examples/$runType/TUM4.yaml" ];then
  echo  ""
else
  echo  "该文件不存在 $currentDir/Examples/$runType/TUM4.yaml "
  exit 1
fi

if  [ -d ""$pathDatasetTUM_VI"/"$datasetType"" ];then
  echo  ""
else
  echo  "该文件夹不存在 "$pathDatasetTUM_VI"/"$datasetType" "
  exit 1
fi
if  [ -f "$currentDir/Examples/$runType/associations/fr1_desk.txt" ];then
  echo  ""
else
  echo  "该文件不存在 $currentDir/Examples/$runType/associations/fr1_desk.txt "
  exit 1
fi
if  [ -d "logs" ];then
  echo  ""
else
  echo  "logs 该文件夹不存在 创建"
  mkdir logs
fi

#------------------------------------
# Monocular Examples
echo "Launching $datasetType with $runType SLAM"
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/"$runType"/TUM4.yaml "$pathDatasetTUM_VI"/"$datasetType" "$currentDir"/Examples/"$runType"/associations/fr1_desk.txt

3. 运行

按照上面的配置,运行之后如果有问题的话会显示提示的,所以不用担心出问题怎么办,直接运行脚本就好,注意运行的时候保证终端的文件夹路径是在shells下面。提醒一下,有时候会发现相机位姿跳变这是正常现象。在IDE里面运行该程序,比如我在CLion里面运行的时候,就出现Segment的问题,建议大家还是在系统terminal下面运行,否则会出现一些莫名其妙的问题

./tum_rgbd.sh

结果:

  • 9
    点赞
  • 94
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 14
    评论
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晚餐男孩

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值