【视觉SLAM十四讲源码解读】Ubuntu 20.04 slambook 代码运行环境搭建

【视觉SLAM十四讲源码解读】Ubuntu 20.04 slambook 代码运行环境搭建,第1张

文章目录
    • slambook ch2
    • slambook2 ch2
    • slambook ch3 useEigen
    • slambook2 ch3 useEigen
    • slambook ch3 useGeometry
    • slambook2 ch3 useGeometry
    • slambook ch3 visualizeGeometry
    • slambook2 ch3 visualizeGeometry
    • slambook2 ch3 coordinateTransform
    • slambook2 ch3 plotTrajectory
    • slambook ch4 useSophus
    • slambook2 ch4 useSophus
    • slambook2 submodule
    • slambook2 ch4 trajectoryError
    • slambook ch5 imageBasics
    • slambook ch5 joinMap
    • slambook2 ch5 imageBasics
    • slambook2 ch5 undistortImage
    • slambook2 ch5 joinMap
    • slambook2 ch5 stereoVision
    • 通用 CMakeLists.txt
    • 安装 opencv
    • Ubuntu16.04系统下搭建开发环境和源码的编译调试
    • 位置姿态的表示显示与优化
    • 视觉SLAM十四讲源码解读
    • ORB_SLAM2

slambook ch2
git clone https://github.com/gaoxiang12/slambook.git
cd slambook/ch2$
CMakeLists.txt  helloSLAM  helloSLAM.cpp  libHelloSLAM.cpp  libHelloSLAM.h  useHello.cpp
~/slambook/ch2$ mkdir build
~/slambook/ch2$ cd build/
~/slambook/ch2/build$ cmake ..
~/slambook$ cd ch2
~/slambook/ch2$ ls
libHelloSLAM.cpp  useHello.cpp CMakeLists.txt  helloSLAM.cpp  libHelloSLAM.h
~/slambook/ch2$ cd build/
~/slambook/ch2/build$ cmake ..
~/slambook/ch2/build$ make -j

slambook2 ch2

slambook ch3 useEigen
xq@xq:~/slambook$ cd ch3
xq@xq:~/slambook/ch3$ ls
useEigen  useGeometry  visualizeGeometry
xq@xq:~/slambook/ch3$ cd useEigen/
xq@xq:~/slambook/ch3/useEigen$ ls
CMakeLists.txt  eigenMatrix.cpp
xq@xq:~/slambook/ch3/useEigen$ mkdir build
xq@xq:~/slambook/ch3/useEigen$ cd build/
xq@xq:~/slambook/ch3/useEigen/build$ cmake ..
xq@xq:~/slambook/ch3/useEigen/build$ make -j
xq@xq:~/slambook/ch3/useEigen/build$ ls
CMakeCache.txt  CMakeFiles  cmake_install.cmake  eigenMatrix  Makefile
xq@xq:~/slambook/ch3/useEigen/build$ ./eigenMatrix 

slambook2 ch3 useEigen
xq@xq:~/slambook2$ cd ch3
xq@xq:~/slambook2/ch3$ 
xq@xq:~/slambook2/ch3$ ls
CMakeLists.txt  examples  useEigen  useGeometry  visualizeGeometry
xq@xq:~/slambook2/ch3$ mkdir build
xq@xq:~/slambook2/ch3$ cd build/
xq@xq:~/slambook2/ch3/build$ cmake ..
xq@xq:~/slambook2/ch3/build$ make -j4

slambook ch3 useGeometry
/home/xq/slambook/ch3
xq@xq:~/slambook/ch3$ ls
useEigen  useGeometry  visualizeGeometry
xq@xq:~/slambook/ch3$ cd useGeometry/
xq@xq:~/slambook/ch3/useGeometry$ ls
CMakeLists.txt  eigenGeometry.cpp
xq@xq:~/slambook/ch3/useGeometry$ mkdir build
xq@xq:~/slambook/ch3/useGeometryuseGeometryuseGeometry$ cd build/
xq@xq:~/slambook/ch3/useGeometry/build$ cmake ..
xq@xq:~/slambook/ch3/useGeometry/build$ make -j
xq@xq:~/slambook/ch3/useGeometry/build$ ls
CMakeCache.txt  CMakeFiles  cmake_install.cmake  eigenGeometry  Makefile

slambook2 ch3 useGeometry

slambook ch3 visualizeGeometry
xq@xq:~/slambook/ch3$ cd visualizeGeometry/
xq@xq:~/slambook/ch3/visualizeGeometry$ ls
CMakeLists.txt  Readme.txt  visualizeGeometry.cpp
xq@xq:~/slambook/ch3/visualizeGeometry$ mkdir build
xq@xq:~/slambook/ch3/visualizeGeometry$ cd build/
xq@xq:~/slambook/ch3/visualizeGeometry/build$ cmake ..
xq@xq:~/slambook/ch3/visualizeGeometry/build$ make -j

slambook2 ch3 visualizeGeometry

slambook2 ch3 coordinateTransform

slambook2 ch3 plotTrajectory

cannot find trajectory file at ./examples/trajectory.txt
gedit /home/xq/slambook2/ch3/examples/plotTrajectory.cpp

slambook ch4 useSophus
xq@xq:~/slambook$ cd ch4/
xq@xq:~/slambook/ch4$ ls
useSophus
xq@xq:~/slambook/ch4$ cd useSophus/
xq@xq:~/slambook/ch4/useSophus$ ls
CMakeLists.txt  useSophus.cpp
xq@xq:~/slambook/ch4/useSophus$ mkdir build
xq@xq:~/slambook/ch4/useSophus$ cd build/
xq@xq:~/slambook/ch4/useSophus/build$ cmake ..
xq@xq:~/slambook/ch4/useSophus/build$ make -j
/home/xq/slambook/ch4/useSophus/useSophus.cpp:8:10: fatal error: sophus/so3.h: No such file or directory
    8 | #include "sophus/so3.h"

xq@xq:~/slambook$ cd 3rdparty/
xq@xq:~/slambook/3rdparty$ ls
ceres-solver.tar.gz  DBow3.tar.gz  g2o.tar.gz  g2o_viewer.patch  Pangolin.tar.gz  Sophus.tar.gz
xq@xq:~/slambook/3rdparty$ tar -xzf Sophus.tar.gz 
xq@xq:~/slambook/3rdparty$ ls
ceres-solver.tar.gz  DBow3.tar.gz  g2o.tar.gz  g2o_viewer.patch  Pangolin.tar.gz  Sophus  Sophus.tar.gz
xq@xq:~/slambook/3rdparty$ cd Sophus/
xq@xq:~/slambook/3rdparty/Sophus$ ls
CMakeLists.txt  cmake_modules  README  sophus  SophusConfig.cmake.in
xq@xq:~/slambook/3rdparty/Sophus$ mkdir build
xq@xq:~/slambook/3rdparty/Sophus$ cd build/
xq@xq:~/slambook/3rdparty/Sophus/build$ cmake -D CMAKE_INSTALL_PREFIX=/home/xq/slambook/3rdparty/Sophus/lib ..
xq@xq:~/slambook/3rdparty/Sophus/build$ make -j
/home/xq/slambook/3rdparty/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment
   32 |   unit_complex_.real() = 1.;
      |                          ^~
/home/xq/slambook/3rdparty/Sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment
   33 |   unit_complex_.imag() = 0.;

gedit /home/xq/slambook/3rdparty/Sophus/sophus/so2.cpp

xq@xq:~/slambook/3rdparty/Sophus/build$ sudo make install

gedit /home/xq/slambook/ch4/useSophus/CMakeLists.txt

xq@xq:~/slambook/ch4/useSophus/build$ make -j
xq@xq:~/slambook/ch4/useSophus/build$ ./useSophus 

slambook2 ch4 useSophus
xq@xq:~/slambook2$ cd ch4
xq@xq:~/slambook2/ch4$ ls
CMakeLists.txt  example  useSophus.cpp
xq@xq:~/slambook2/ch4$ mkdir build
xq@xq:~/slambook2/ch4$ cd build/
xq@xq:~/slambook2/ch4/build$ cmake ..
xq@xq:~/slambook2/ch4/build$ make -j

/home/xq/slambook2/ch4/example/trajectoryError.cpp:5:10: fatal error: sophus/se3.hpp: No such file or directory
    5 | #include <sophus/se3.hpp>
slambook2 submodule
git clone 的仓库才可以在目录下输入下面命令下载第三方库
git submodule init 
git submodule update
xq@xq:~/slambook2$ cd 3rdparty/
xq@xq:~/slambook2/3rdparty$ ls
ceres-solver  DBoW3  g2o  googletest  Pangolin  Sophus
xq@xq:~/slambook2/3rdparty$ cd Sophus/
xq@xq:~/slambook2/3rdparty/Sophus$ mkdir build
xq@xq:~/slambook2/3rdparty/Sophus$ cd build/
xq@xq:~/slambook2/3rdparty/Sophus/build$ 
xq@xq:~/slambook2/3rdparty/Sophus/build$ cmake -D CMAKE_INSTALL_PREFIX=/home/xq/slambook2/3rdparty/Sophus/lib ..
xq@xq:~/slambook2/3rdparty/Sophus/build$ make -j

/home/xq/slambook2/3rdparty/Sophus/test/core/test_rxso2.cpp:134:27: error: implicitly-declared ‘Eigen::Map<Sophus::RxSO2<double> >::Map(const Eigen::Map<Sophus::RxSO2<double> >&)’ is deprecated [-Werror=deprecated-copy]
  134 |     Eigen::Map<RxSO2Type> shallow_copy = map_of_rxso2;
gedit /home/xq/slambook2/3rdparty/Sophus/CMakeLists.txt

xq@xq:~/slambook2/3rdparty/Sophus/build$ make -j
xq@xq:~/slambook2/3rdparty/Sophus/build$ sudo make install

gedit /home/xq/slambook2/ch4/CMakeLists.txt


slambook2 ch4 trajectoryError

trajectory ./example/groundtruth.txt not found.
trajectory ./example/estimated.txt not found.
trajectoryError: /home/xq/slambook2/ch4/example/trajectoryError.cpp:22: int main(int, char**): Assertion `!groundtruth.empty() && !estimated.empty()' failed.
Aborted (core dumped)
gedit /home/xq/slambook2/ch4/example/trajectoryError.cpp

slambook ch5 imageBasics
xq@xq:~/slambook$ cd ch5/
xq@xq:~/slambook/ch5$ ls
imageBasics  joinMap
xq@xq:~/slambook/ch5$ cd imageBasics/
xq@xq:~/slambook/ch5/imageBasics$ ls
CMakeLists.txt  imageBasics.cpp  ubuntu.png
xq@xq:~/slambook/ch5/imageBasics$ mkdir build
xq@xq:~/slambook/ch5/imageBasics$ cd build/
xq@xq:~/slambook/ch5/imageBasics/build$ cmake ..
Could not find a configuration file for package "OpenCV" that is compatible
  with requested version "3".

gedit /home/xq/slambook/ch5/imageBasics/CMakeLists.txt

xq@xq:~/slambook/ch5/imageBasics/build$ make -j
xq@xq:~/slambook/ch5/imageBasics/build$ ./imageBasics ../ubuntu.png


按空格键

slambook ch5 joinMap
xq@xq:~/slambook/ch5$ cd joinMap/
xq@xq:~/slambook/ch5/joinMap$ ls
CMakeLists.txt  color  depth  joinMap.cpp  pose.txt
xq@xq:~/slambook/ch5/joinMap$ mkdir build
xq@xq:~/slambook/ch5/joinMap$ cd build/
xq@xq:~/slambook/ch5/joinMap/build$ cmake ..
/usr/include/pcl-1.10/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above
    7 |   #error PCL requires C++14 or above

gedit /home/xq/slambook/ch5/joinMap/CMakeLists.txt

xq@xq:~/slambook/ch5/joinMap/build$ ./joinMap 
请在有pose.txt的目录下运行此程序

xq@xq:~/slambook/ch5/joinMap/build$./joinMap 
正在将图像转换为点云...
转换图像中: 1
转换图像中: 2
转换图像中: 3
转换图像中: 4
转换图像中: 5
点云共有0个点.
terminate called after throwing an instance of 'pcl::IOException'
  what():  : [pcl::PCDWriter::writeBinary] Input point cloud has no data!
Aborted (core dumped)
gedit /home/xq/slambook/ch5/joinMap/joinMap.cpp

slambook2 ch5 imageBasics
xq@xq:~/slambook2$ cd ch5/
xq@xq:~/slambook2/ch5$ ls
CMakeLists.txt  imageBasics  rgbd  stereo
xq@xq:~/slambook2/ch5$ mkdir build
xq@xq:~/slambook2/ch5$ cd build/
xq@xq:~/slambook2/ch5/build$ cmake ..
xq@xq:~/slambook2/ch5/build$ make -j
/home/xq/slambook2/ch5/rgbd/CMakeLists.txt

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)

slambook2 ch5 undistortImage
./imageBasics/undistortImage 
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.2.0) ../modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'

Aborted (core dumped)

gedit /home/xq/slambook2/ch5/imageBasics/undistortImage.cpp

slambook2 ch5 joinMap
./rgbd/joinMap 
请在有pose.txt的目录下运行此程序

gedit /home/xq/slambook2/ch5/rgbd/joinMap.cpp

slambook2 ch5 stereoVision
./stereo/stereoVision 
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.2.0) ../modules/core/src/matrix_expressions.cpp:23: error: (-5:Bad argument) Matrix operand is an empty matrix. in function 'checkOperandsExist'

Aborted (core dumped)

gedit /home/xq/slambook2/ch5/stereo/stereoVision.cpp

通用 CMakeLists.txt
# OpenCV
find_package( OpenCV REQUIRED )
include_directories(${OpenCV_DIRS} )
include_directories(${OpenCV_INCLUDE_DIRS})

# find_package(G2O REQUIRED)
set(G2O_INCLUDE_DIRS /home/q/CLionProjects/slambook2/3rdparty/g2o/)
set(CERES_LIBRARIES /home/q/CLionProjects/slambook2/3rdparty/g2o/lib/)
include_directories(${G2O_INCLUDE_DIRS})

# find_package(Ceres REQUIRED)
set(CERES_INCLUDE_DIRS /usr/local/include/ceres)
set(CERES_LIBRARIES /usr/local/lib/libceres.a)
include_directories(${CERES_INCLUDE_DIRS})

# find_package(Eigen3 REQUIRED)
include_directories("/usr/local/include/eigen3")

# find_package(Sophus REQUIRED)
include_directories(${Sophus_INCLUDE_DIRS})

# find_package(Pangolin REQUIRED)
set(Pangolin_INCLUDE_DIRS /usr/local/include/pangolin)
set(Pangolin_LIBRARIES /usr/local/lib/libpangolin.so)

# pcl
find_package( PCL REQUIRED COMPONENT common io )
include_directories( ${PCL_INCLUDE_DIRS} )
add_definitions( ${PCL_DEFINITIONS} )

安装 opencv
官方安装教程:https://docs.opencv.org/3.4.0/d7/d9f/tutorial_linux_install.html
cd /opencv3.4.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -DWITH_GTK_2_X=ON -DWITH_VTK=ON ..
make -j4
sudo make install
Ubuntu16.04系统下搭建开发环境和源码的编译调试

视觉SLAM十四讲实践系列笔记之ubuntu16.04系统下高频使用命令

视觉SLAM十四讲实践系列笔记之安装和如何使用C++集成开环境Clion调试C++和ROS项目

视觉SLAM十四讲实践系列笔记之安装和如何使用Visual Studio Code调试C++和ROS项目

视觉SLAM十四讲实践系列笔记之ubuntu16.04下如何搭建开发环境安装OpenCV等开源算法库

视觉SLAM十四讲实践系列笔记之如何使用cmake组织编译大型C++源码项目

视觉SLAM十四讲实践系列笔记之gdb如何调试C++源码项目

ubuntu16.04下如何使用git创建代码仓库对本地代码进行版本控制

位置姿态的表示显示与优化

eigen下的位姿表示显示变换
视觉SLAM十四讲实践系列笔记之eigen表示四种位姿以及相互转换

视觉SLAM十四讲实践系列之坐标系之间的欧式变换

李群李代数sophus下位姿的优化
视觉SLAM十四讲实践系列之Sophus下的位姿表示和更新优化和修正

轨迹可视化与评估
视觉SLAM十四讲实践系列笔记之轨迹可视化

视觉SLAM十四讲实践笔记系列之真实轨迹和估计轨迹均方根误差

TUM数据集RGBD-Benchmark工具之associate.py
TUM数据集RGBD-Benchmark工具之evaluate_ate.py
TUM数据集RGBD-Benchmark工具之evaluate_rpe.py
「原理+实践」从文件或终端读写yaml和txt文件
视觉SLAM十四讲实践系列笔记之SLAM轨迹可视化
ORB_SLAM2的可视化是怎么实现的?
https://zhuanlan.zhihu.com/p/61738607

如何使用evo工具评估位姿轨迹精度?

传感器
TOF的工作原理是什么
RealSense D435i RGBD英特尔® 实感™ D435i 深度摄像头 硬件结构及各个组件原理详解 SDK ROS
SLAM领域传感器工作原理与使用场景汇总
扫地机器人工作原理、传感器原理、结构、工作流程、路径规划技术
小觅双目摄像头MYNTEYE-S1030-IR和自制双目摄像头测试ORB-SLAM2和RTAB-Map的运行效果对比

文件 yaml
「原理+实践」从文件或终端读写yaml和txt文件

图像 opencv
模拟图像、数字图像、OpenCV表示图像
视觉SLAM十四讲系列之图像的基本 *** 作
视觉SLAM十四讲实践笔记系列之图像去畸变

用直方图统计图像的像素和计算图像的矩
高斯平滑和高斯模糊的算法
离散傅里叶变换和仿射变换Affine Transformation在图像处理中的应用及原理
循环读取rgbd_dataset_freiburg1_desk数据集每一张图片并且重命名的两种方法
视觉SLAM十四讲实践系列之OpenCV实现特征点检测和匹配

G2O优化问题 视觉SLAM十四讲系列之第七讲pose_estimation_2d2d.cpp
视觉SLAM十四讲实践系列之三角化方法求深度
视觉SLAM十四讲实践笔记系列之双目图像如何生成视差图和点云图
[视觉SLAM十四讲实践系列之两张图像拼接成点云]

视觉SLAM十四讲源码解读

视觉SLAM十四讲实践系列之三角化方法求深度
视觉SLAM十四讲从理论到实践|第六讲|gaussNewton.cpp
视觉SLAM十四讲|0.4两帧之间的视觉里程计
【视觉SLAM十四讲源码解读】VIZ Pangolin 实现SLAM的可视化
视觉SLAM十四讲|第九讲代码实践|0.2两帧之间的视觉里程计
视觉SLAM十四讲实践系列之g2o优化两帧之间的视觉里程计
视觉SLAM十四讲系列之非线性最小二乘开源库之G2O图优化
视觉SLAM十四讲实践系列之两帧之间的视觉里程计
视觉SLAM十四讲实践笔记系列之视觉里程计前端基本数据结构
视觉SLAM十四讲实践系列之3D-2D求位姿用高斯牛顿和最小二乘法优化
视觉SLAM十四讲实践笔记系列之3D-3D求解位姿并用g2o优化
视觉SLAM十四讲系列之第七讲pose_estimation_2d2d.cpp
【ORB_SLAM2源码解读】坐标变换 坐标系之间坐标点的变换
【ORB_SLAM2源码解读】坐标变换 像素坐标系、图像坐标系、相机坐标系、相机归一化坐标系、世界坐标系
BA问题用g2o求解重新投影误差优化相机位姿和路标点的源码注释版本来了

如何理解概率密度函数以及概率论的一些总结
视觉SLAM十四讲实践系列之曲线拟合高斯牛顿优化
G2O优化问题 视觉SLAM十四讲系列之第七讲pose_estimation_2d2d.cpp
视觉SLAM十四讲实践系列之三角化方法求深度
视觉SLAM十四讲实践笔记系列之双目图像如何生成视差图和点云图
视觉SLAM十四讲实践系列之两张图像拼接成点云
一文帮你理解SLAM的投影模型、像素坐标系、图像坐标系、相机坐标系、世界坐标系
视觉SLAM十四讲实践系列之3D-2D求位姿用高斯牛顿和最小二乘法优化
视觉SLAM里的最小二乘Bundle Adjustment问题
Bundle adjustment 总结
视觉SLAM十四讲实践笔记系列之3D-3D求解位姿并用g2o优化
g2o之非线性优化(一)
视觉SLAM十四讲实践笔记系列之g2o_viewer
视觉SLAM十四讲实践系列之VIZ可视化
OpenCV Viz 代码实战详解

视觉SLAM十四讲实践笔记系列之视觉里程计前端基本数据结构
视觉SLAM十四讲实践系列之两帧之间的视觉里程计
视觉SLAM十四讲实践系列之g2o优化两帧之间的视觉里程计
BA问题用g2o求解重新投影误差优化相机位姿和路标点的源码注释版本来了
什么是路标点?
视觉SLAM十四讲实践系列之两帧之间的视觉里程计g2o优化并保存mappiont路标点
精确率、精度(Precision) 召回率(recall)你真的理解吗?
SLAM 后端优化 算法 简单描述
欧氏距离、汉明距离、余弦相似度
一起做RGB-D SLAM (1)-(7) 代码实践
我的 一起做RGB-D SLAM (1)-(7) 代码实践
高博博客
高博代码

ORB_SLAM2
  1. ros_rgbd.cc的头文件讲解
  2. ros_rgbd.cc文件的ros::init、start、shutdown、NodeHandle、message_filters、spin、shutdown讲解
  3. 「ORB_SLAM2|3实践笔记」详细解读ros_rgbd.cc文件ORB_SLAM2::System、System::TrackRGBD运行流程
  4. ORB_SLAM2::System、System::TrackRGBD运行流程
  5. cv::Mat Tracking::GrabImageRGBD()
  6. 构造函数Frame::Frame() 、去畸变UndistortKeyPoints()、计算虚拟右目横坐标ComputeStereoFromRGBD
  7. void Tracking::StereoInitialization()、UnprojectStereo、ComputeDistinctiveDescriptors
  8. mpFrameDrawer->Update(this)
  9. void Tracking::Track()
  10. LocalMapping线程执行流程
  11. void MapPoint::UpdateNormalAndDepth()









欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/717982.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-25
下一篇 2022-04-25

发表评论

登录后才能评论

评论列表(0条)

保存