文章目录
1、问题描述
在运行ORB-SLAM3时出现以下报错
./Examples/Stereo-Inertial/stereo_inertial_euroc Vocabulary/ORBvoc.txt Examples/Stereo-Inertial/EuRoC.yaml /mnt/hgfs/Shared/datasets/EuRoC/V2_03_difficult Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt
num_seq = 1
Loading images for sequence 0...LOADED!
Loading IMU 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.
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-Inertial
Loading settings from Examples/Stereo-Inertial/EuRoC.yaml
Camera1.k3 optional parameter does not exist...
-Loaded camera 1
Camera2.k3 optional parameter does not exist...
-Loaded camera 2
Camera.newHeight optional parameter does not exist...
Camera.newWidth optional parameter does not exist...
-Loaded image info
IMU.InsertKFsWhenLost optional parameter does not exist...
-Loaded IMU calibration
-Loaded ORB settings
-Loaded viewer settings
System.LoadAtlasFromFile optional parameter does not exist...
System.SaveAtlasToFile optional parameter does not exist...
-Loaded Atlas settings
System.thFarPoints optional parameter does not exist...
-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.11007784307003021
-Stereo depth threshold : 60
-Gyro noise: 0.00016999999934341758
-Accelerometer noise: 0.0020000000949949026
-Gyro walk: 1.9392999092815444e-05
-Accelerometer walk: 0.0030000000260770321
-IMU frequency: 200
-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...
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
.pnged to load image at: /mnt/hgfs/Shared/datasets/EuRoC/V2_03_difficult/mav0/cam0/data/1413394881605760512
这是因为文件:Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt 出现了“\r”(回车符)导致的。把MH01.txt中的所有内容复制到一个新的MH01.txt文件中,替换掉原来的MH01.txtx即可。
若无法解决,可使用下面的方法。
如果出现 .pnged to load at 的错误,且怀疑是因为 V203.txt 文件中的回车符**(\r)**导致的问题,处理步骤如下:
2、回车符问题
可以通过以下步骤检查并修复 V203.txt 中的回车符问题:
2.1.查看文件中的回车符:
使用 cat -v 命令查看 V203.txt 文件是否有回车符:
cat -v Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt
如果文件中有 ^M 字符,表示确实存在 \r 回车符。
cat -v Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt
1413394881605760512^M
1413394881655760384^M
1413394881705760512^M
1413394881755760384^M
1413394881805760512^M
1413394881855760384^M
1413394881905760512^M
1413394881955760384^M
1413394882005760512^M
1413394882055760384^M
1413394882105760512^M
2.2.移除回车符:
如果发现有回车符,可以使用以下方法来移除回车符:
使用 sed:
sed -i 's/\r//' Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt
使用 dos2unix: 如果你已经安装了 dos2unix 工具,可以直接使用它来转换文件格式:
dos2unix Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt
2.3.确认修改
你可以再次使用 cat -v 命令检查文件是否已被正确修改,没有 ^M 回车符:
cat -v Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt
如果 ^M 已消失,说明回车符已成功移除,文件格式已修复。
2.3.重新运行命令,运行ORB-SLAM3即可。
3.参考
4.方法2:使用 dos2unix 工具来转换文件中的换行符格式
在build.sh 文件包含了不正确的换行符。 Windows 系统中编辑或下载的这个脚本文件,导致使用了 Windows 的换行符 \r\n,而 Linux 系统期望使用 \n 换行符。因此,Linux 识别不了这些 Windows 的换行符,导致出现错误
步骤 1:安装 dos2unix 工具
如果你的系统上没有安装 dos2unix,可以使用以下命令来安装它:
sudo apt install dos2unix
步骤 2:转换 build.sh 文件的换行符
运行以下命令将 build.sh 文件转换为 Linux 格式:
dos2unix build.sh
该命令会将文件中的 Windows 换行符替换为 Unix/Linux 格式的换行符。
步骤 3:重新运行脚本
转换完成后,再次运行你的 build.sh 脚本:
./build.sh