前言
系统环境:ubantu18.04 虚拟机
提前安装:
wget http://fishros.com/install -O fishros && . fishros
sudo apt update
sudo apt install git cmake gcc g++
断网解决办法:
nmcli networking on
参考:
https://blog.csdn.net/weixin_48924581/article/details/126534339
https://blog.csdn.net/shadowmimii/article/details/129472719
https://blog.csdn.net/Zoey_chn/article/details/135139494
ORB-SLAM3与ROS集成
ORB-SLAM3可以与ROS(Robot Operating System)集成,以支持更多的机器人应用。以下是一些相关的ROS包:
- orb_slam3_ros:一个将ORB-SLAM3集成到ROS中的包,支持单目、双目和RGB-D SLAM。
- orb_slam3_ros_wrapper:一个更高级的ROS包装器,提供了更多的功能和配置选项。
相关工具和库
- DBoW2:用于图像序列中的快速地点识别。
- g2o:一个通用的图优化库,用于SLAM中的地图优化。
- Eigen:一个C++模板库,用于线性代数运算。
详解:ORB-SLAM3代码详解----基本框架解析及ORB特征提取_orbslam3代码详解-CSDN博客
1、安装EIGEN3.3.4
直接apt安装
sudo apt-get install libeigen3-dev
2、安装pangolin0.6
sudo apt install libglew-dev libpython2.7-dev
https://github.com/stevenlovegrove/Pangolin/releases/tag/v0.6
获得pangolin的稳定版本安装包后进行编译,
mkdir build
cd build
cmake ..
make
sudo make install
//安装后pangolin将在 /usr/local/include/中找到
详细编译记录:
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6$ mkdir build
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6$ cd build
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Build type not set (defaults to release)
-DCMAKE_BUILD_TYPE=Debug for debug
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found GLEW: /usr/lib/x86_64-linux-gnu/libGLEW.so
-- Eigen Found and Enabled
-- libdc1394 Found and Enabled
-- V4L Found and Enabled
-- Performing Test HAVE_FFMPEG_MAX_ANALYZE_DURATION
-- Performing Test HAVE_FFMPEG_MAX_ANALYZE_DURATION - Success
-- Performing Test HAVE_FFMPEG_AVFORMAT_ALLOC_OUTPUT_CONTEXT2
-- Performing Test HAVE_FFMPEG_AVFORMAT_ALLOC_OUTPUT_CONTEXT2 - Success
-- Performing Test HAVE_FFMPEG_AVPIXELFORMAT
-- Performing Test HAVE_FFMPEG_AVPIXELFORMAT - Success
-- ffmpeg Found and Enabled
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- OpenNI Found and Enabled
-- OpenNI2 Found and Enabled
-- libpng Found and Enabled
-- libjpeg Found and Enabled
-- libtiff Found and Enabled
-- libopenexr Found and Enabled
-- liblz4 Found and Enabled
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ht_llibra/VSlam/Pangolin-v0.6/build
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6/build$
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6/build$ make
Scanning dependencies of target pangolin
[ 1%] Building CXX object src/CMakeFiles/pangolin.dir/utils/file_extension.cpp.o
[ 2%] Building CXX object src/CMakeFiles/pangolin.dir/utils/file_utils.cpp.o
[ 2%] Building CXX object src/CMakeFiles/pangolin.dir/utils/sigstate.cpp.o
[ 3%] Building CXX object src/CMakeFiles/pangolin.dir/utils/threadedfilebuf.cpp.o
[ 4%] Building CXX object src/CMakeFiles/pangolin.dir/utils/timer.cpp.o
[ 5%] Building CXX object src/CMakeFiles/pangolin.dir/utils/uri.cpp.o
[ 6%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io.cpp.o
[ 7%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_exr.cpp.o
[ 7%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_jpg.cpp.o
[ 8%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_lz4.cpp.o
[ 9%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_packed12bit.cpp.o
[ 10%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_pango.cpp.o
[ 11%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_png.cpp.o
[ 12%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_ppm.cpp.o
[ 12%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_raw.cpp.o
[ 13%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_tga.cpp.o
[ 14%] Building CXX object src/CMakeFiles/pangolin.dir/image/image_io_zstd.cpp.o
[ 15%] Building CXX object src/CMakeFiles/pangolin.dir/image/pixel_format.cpp.o
[ 16%] Building CXX object src/CMakeFiles/pangolin.dir/log/packet.cpp.o
[ 17%] Building CXX object src/CMakeFiles/pangolin.dir/log/packetstream.cpp.o
[ 17%] Building CXX object src/CMakeFiles/pangolin.dir/log/packetstream_reader.cpp.o
[ 18%] Building CXX object src/CMakeFiles/pangolin.dir/log/packetstream_writer.cpp.o
[ 19%] Building CXX object src/CMakeFiles/pangolin.dir/log/playback_session.cpp.o
[ 20%] Building CXX object src/CMakeFiles/pangolin.dir/geometry/geometry.cpp.o
[ 21%] Building CXX object src/CMakeFiles/pangolin.dir/geometry/geometry_obj.cpp.o
[ 22%] Building CXX object src/CMakeFiles/pangolin.dir/geometry/geometry_ply.cpp.o
[ 22%] Building CXX object src/CMakeFiles/pangolin.dir/geometry/glgeometry.cpp.o
[ 23%] Building CXX object src/CMakeFiles/pangolin.dir/geometry/tinyobj.cpp.o
[ 24%] Building CXX object src/CMakeFiles/pangolin.dir/gl/glchar.cpp.o
[ 25%] Building CXX object src/CMakeFiles/pangolin.dir/gl/gldraw.cpp.o
[ 26%] Building CXX object src/CMakeFiles/pangolin.dir/gl/glfont.cpp.o
[ 27%] Building CXX object src/CMakeFiles/pangolin.dir/gl/glpangoglu.cpp.o
[ 27%] Building CXX object src/CMakeFiles/pangolin.dir/gl/gltext.cpp.o
[ 28%] Building CXX object src/CMakeFiles/pangolin.dir/gl/gltexturecache.cpp.o
[ 29%] Building CXX object src/CMakeFiles/pangolin.dir/display/display.cpp.o
[ 30%] Building CXX object src/CMakeFiles/pangolin.dir/display/image_view.cpp.o
[ 31%] Building CXX object src/CMakeFiles/pangolin.dir/display/opengl_render_state.cpp.o
[ 32%] Building CXX object src/CMakeFiles/pangolin.dir/display/view.cpp.o
[ 32%] Building CXX object src/CMakeFiles/pangolin.dir/display/viewport.cpp.o
[ 33%] Building CXX object src/CMakeFiles/pangolin.dir/display/window_factory.cpp.o
[ 34%] Building CXX object src/CMakeFiles/pangolin.dir/handler/handler.cpp.o
[ 35%] Building CXX object src/CMakeFiles/pangolin.dir/handler/handler_glbuffer.cpp.o
[ 36%] Building CXX object src/CMakeFiles/pangolin.dir/handler/handler_image.cpp.o
[ 37%] Building CXX object src/CMakeFiles/pangolin.dir/plot/datalog.cpp.o
[ 37%] Building CXX object src/CMakeFiles/pangolin.dir/plot/plotter.cpp.o
[ 38%] Building CXX object src/CMakeFiles/pangolin.dir/var/input_record_repeat.cpp.o
[ 39%] Building CXX object src/CMakeFiles/pangolin.dir/var/vars.cpp.o
[ 40%] Building CXX object src/CMakeFiles/pangolin.dir/display/widgets/widgets.cpp.o
[ 41%] Building CXX object src/CMakeFiles/pangolin.dir/video/stream_encoder_factory.cpp.o
[ 42%] Building CXX object src/CMakeFiles/pangolin.dir/video/video.cpp.o
[ 42%] Building CXX object src/CMakeFiles/pangolin.dir/video/video_input.cpp.o
[ 43%] Building CXX object src/CMakeFiles/pangolin.dir/video/video_interface_factory.cpp.o
[ 44%] Building CXX object src/CMakeFiles/pangolin.dir/video/video_output.cpp.o
[ 45%] Building CXX object src/CMakeFiles/pangolin.dir/video/video_output_interface_factory.cpp.o
[ 46%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/test.cpp.o
[ 47%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/images.cpp.o
[ 47%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/images_out.cpp.o
[ 48%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/split.cpp.o
[ 49%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/truncate.cpp.o
[ 50%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/pvn.cpp.o
[ 51%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/pango.cpp.o
[ 52%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/pango_video_output.cpp.o
[ 52%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/debayer.cpp.o
[ 53%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/shift.cpp.o
[ 54%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/mirror.cpp.o
[ 55%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/unpack.cpp.o
[ 56%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/pack.cpp.o
[ 57%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/join.cpp.o
[ 57%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/merge.cpp.o
[ 58%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/json.cpp.o
[ 59%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/thread.cpp.o
[ 60%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/shared_memory.cpp.o
[ 61%] Building CXX object src/CMakeFiles/pangolin.dir/tools/video_viewer.cpp.o
[ 62%] Building CXX object src/CMakeFiles/pangolin.dir/display/device/display_headless.cpp.o
[ 62%] Building CXX object src/CMakeFiles/pangolin.dir/display/device/display_x11.cpp.o
[ 63%] Building CXX object src/CMakeFiles/pangolin.dir/utils/posix/condition_variable.cpp.o
[ 64%] Building CXX object src/CMakeFiles/pangolin.dir/utils/posix/semaphore.cpp.o
[ 65%] Building CXX object src/CMakeFiles/pangolin.dir/utils/posix/shared_memory_buffer.cpp.o
[ 66%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/firewire.cpp.o
[ 67%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/deinterlace.cpp.o
[ 67%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/v4l.cpp.o
[ 68%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/ffmpeg.cpp.o
[ 69%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/openni.cpp.o
/home/ht_llibra/VSlam/Pangolin-v0.6/src/video/drivers/openni.cpp: In constructor ‘pangolin::OpenNiVideo::OpenNiVideo(pangolin::OpenNiSensorType, pangolin::OpenNiSensorType, pangolin::ImageDim, int)’:
/home/ht_llibra/VSlam/Pangolin-v0.6/src/video/drivers/openni.cpp:82:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
depth_to_color = true;
~~~~~~~~~~~~~~~^~~~~~
/home/ht_llibra/VSlam/Pangolin-v0.6/src/video/drivers/openni.cpp:83:9: note: here
case OpenNiDepth_1mm:
^~~~
[ 70%] Building CXX object src/CMakeFiles/pangolin.dir/video/drivers/openni2.cpp.o
[ 71%] Building CXX object src/CMakeFiles/pangolin.dir/fonts.cpp.o
[ 72%] Linking CXX shared library libpangolin.so
[ 72%] Built target pangolin
Scanning dependencies of target VideoViewer
[ 73%] Building CXX object tools/VideoViewer/CMakeFiles/VideoViewer.dir/main.cpp.o
[ 74%] Linking CXX executable VideoViewer
[ 74%] Built target VideoViewer
Scanning dependencies of target VideoConvert
[ 75%] Building CXX object tools/VideoConvert/CMakeFiles/VideoConvert.dir/main.cpp.o
[ 76%] Linking CXX executable VideoConvert
[ 76%] Built target VideoConvert
Scanning dependencies of target VideoJsonPrint
[ 77%] Building CXX object tools/VideoJson/CMakeFiles/VideoJsonPrint.dir/main-print.cpp.o
[ 78%] Linking CXX executable VideoJsonPrint
[ 78%] Built target VideoJsonPrint
Scanning dependencies of target VideoJsonTransform
[ 78%] Building CXX object tools/VideoJson/CMakeFiles/VideoJsonTransform.dir/main-transform.cpp.o
[ 79%] Linking CXX executable VideoJsonTransform
[ 79%] Built target VideoJsonTransform
Scanning dependencies of target Plotter
[ 80%] Building CXX object tools/Plotter/CMakeFiles/Plotter.dir/main.cpp.o
[ 81%] Linking CXX executable Plotter
[ 81%] Built target Plotter
Scanning dependencies of target ModelViewer
[ 81%] Building CXX object tools/ModelViewer/CMakeFiles/ModelViewer.dir/main.cpp.o
[ 82%] Linking CXX executable ModelViewer
[ 82%] Built target ModelViewer
Scanning dependencies of target HelloPangolin
[ 82%] Building CXX object examples/HelloPangolin/CMakeFiles/HelloPangolin.dir/main.cpp.o
[ 83%] Linking CXX executable HelloPangolin
[ 83%] Built target HelloPangolin
Scanning dependencies of target HelloPangolinOffscreen
[ 84%] Building CXX object examples/HelloPangolinOffscreen/CMakeFiles/HelloPangolinOffscreen.dir/main.cpp.o
[ 85%] Linking CXX executable HelloPangolinOffscreen
[ 85%] Built target HelloPangolinOffscreen
Scanning dependencies of target HelloPangolinThreads
[ 86%] Building CXX object examples/HelloPangolinThreads/CMakeFiles/HelloPangolinThreads.dir/main.cpp.o
[ 87%] Linking CXX executable HelloPangolinThreads
[ 87%] Built target HelloPangolinThreads
Scanning dependencies of target SimpleMultiDisplay
[ 88%] Building CXX object examples/SimpleMultiDisplay/CMakeFiles/SimpleMultiDisplay.dir/main.cpp.o
[ 89%] Linking CXX executable SimpleMultiDisplay
[ 89%] Built target SimpleMultiDisplay
Scanning dependencies of target SimpleDisplayImage
[ 90%] Building CXX object examples/SimpleDisplayImage/CMakeFiles/SimpleDisplayImage.dir/main.cpp.o
[ 91%] Linking CXX executable SimpleDisplayImage
[ 91%] Built target SimpleDisplayImage
Scanning dependencies of target SimpleScene
[ 92%] Building CXX object examples/SimpleScene/CMakeFiles/SimpleScene.dir/main.cpp.o
[ 93%] Linking CXX executable SimpleScene
[ 93%] Built target SimpleScene
Scanning dependencies of target SimplePlot
[ 93%] Building CXX object examples/SimplePlot/CMakeFiles/SimplePlot.dir/main.cpp.o
[ 94%] Linking CXX executable SimplePlot
[ 94%] Built target SimplePlot
Scanning dependencies of target SimpleDisplay
[ 94%] Building CXX object examples/SimpleDisplay/CMakeFiles/SimpleDisplay.dir/main.cpp.o
[ 95%] Linking CXX executable SimpleDisplay
[ 95%] Built target SimpleDisplay
Scanning dependencies of target SimpleVideo
[ 95%] Building CXX object examples/SimpleVideo/CMakeFiles/SimpleVideo.dir/main.cpp.o
[ 96%] Linking CXX executable SimpleVideo
[ 96%] Built target SimpleVideo
Scanning dependencies of target SimpleRecord
[ 97%] Building CXX object examples/SimpleRecord/CMakeFiles/SimpleRecord.dir/main.cpp.o
[ 98%] Linking CXX executable SimpleRecord
[ 98%] Built target SimpleRecord
Scanning dependencies of target SharedMemoryCamera
[ 99%] Building CXX object examples/SharedMemoryCamera/CMakeFiles/SharedMemoryCamera.dir/main.cpp.o
[100%] Linking CXX executable SharedMemoryCamera
[100%] Built target SharedMemoryCamera
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6/build$
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6/build$ sudo make install
[sudo] ht_llibra 的密码:
[ 72%] Built target pangolin
[ 74%] Built target VideoViewer
[ 76%] Built target VideoConvert
[ 78%] Built target VideoJsonPrint
[ 79%] Built target VideoJsonTransform
[ 81%] Built target Plotter
[ 82%] Built target ModelViewer
[ 83%] Built target HelloPangolin
[ 85%] Built target HelloPangolinOffscreen
[ 87%] Built target HelloPangolinThreads
[ 89%] Built target SimpleMultiDisplay
[ 91%] Built target SimpleDisplayImage
[ 93%] Built target SimpleScene
[ 94%] Built target SimplePlot
[ 95%] Built target SimpleDisplay
[ 96%] Built target SimpleVideo
[ 98%] Built target SimpleRecord
[100%] Built target SharedMemoryCamera
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/include/pangolin/config.h
-- Up-to-date: /usr/local/include/pangolin
-- Installing: /usr/local/include/pangolin/compat
-- Installing: /usr/local/include/pangolin/compat/glutbitmap.h
-- Installing: /usr/local/include/pangolin/compat/variant.h
-- Installing: /usr/local/include/pangolin/compat/optional.h
-- Installing: /usr/local/include/pangolin/compat/type_traits.h
-- Installing: /usr/local/include/pangolin/console
-- Installing: /usr/local/include/pangolin/console/ConsoleView.h
-- Installing: /usr/local/include/pangolin/console/ConsoleInterpreter.h
-- Installing: /usr/local/include/pangolin/var
-- Installing: /usr/local/include/pangolin/var/varvaluet.h
-- Installing: /usr/local/include/pangolin/var/varstate.h
-- Installing: /usr/local/include/pangolin/var/varwrapper.h
-- Installing: /usr/local/include/pangolin/var/var.h
-- Installing: /usr/local/include/pangolin/var/input_record_repeat.h
-- Installing: /usr/local/include/pangolin/var/varvalue.h
-- Installing: /usr/local/include/pangolin/var/varextra.h
-- Installing: /usr/local/include/pangolin/var/varvaluegeneric.h
-- Installing: /usr/local/include/pangolin/log
-- Installing: /usr/local/include/pangolin/log/sync_time.h
-- Installing: /usr/local/include/pangolin/log/packetstream.h
-- Installing: /usr/local/include/pangolin/log/playback_session.h
-- Installing: /usr/local/include/pangolin/log/packet.h
-- Installing: /usr/local/include/pangolin/log/packetstream_tags.h
-- Installing: /usr/local/include/pangolin/log/packetstream_source.h
-- Installing: /usr/local/include/pangolin/log/packetstream_reader.h
-- Installing: /usr/local/include/pangolin/log/packetstream_writer.h
-- Installing: /usr/local/include/pangolin/gl
-- Installing: /usr/local/include/pangolin/gl/gltext.h
-- Installing: /usr/local/include/pangolin/gl/compat
-- Installing: /usr/local/include/pangolin/gl/compat/gl_es_compat.h
-- Installing: /usr/local/include/pangolin/gl/compat/gl2engine.h
-- Installing: /usr/local/include/pangolin/gl/glsl.h
-- Installing: /usr/local/include/pangolin/gl/glchar.h
-- Installing: /usr/local/include/pangolin/gl/gldraw.h
-- Installing: /usr/local/include/pangolin/gl/glinclude.h
-- Installing: /usr/local/include/pangolin/gl/glplatform.h
-- Installing: /usr/local/include/pangolin/gl/glstate.h
-- Installing: /usr/local/include/pangolin/gl/cg.h
-- Installing: /usr/local/include/pangolin/gl/glvbo.h
-- Installing: /usr/local/include/pangolin/gl/glfont.h
-- Installing: /usr/local/include/pangolin/gl/gltexturecache.h
-- Installing: /usr/local/include/pangolin/gl/glcuda.h
-- Installing: /usr/local/include/pangolin/gl/glpixformat.h
-- Installing: /usr/local/include/pangolin/gl/gl.h
-- Installing: /usr/local/include/pangolin/gl/glformattraits.h
-- Installing: /usr/local/include/pangolin/gl/gl.hpp
-- Installing: /usr/local/include/pangolin/gl/colour.h
-- Installing: /usr/local/include/pangolin/gl/glpangoglu.h
-- Installing: /usr/local/include/pangolin/scene
-- Installing: /usr/local/include/pangolin/scene/renderable.h
-- Installing: /usr/local/include/pangolin/scene/scenehandler.h
-- Installing: /usr/local/include/pangolin/scene/axis.h
-- Installing: /usr/local/include/pangolin/scene/interactive_index.h
-- Installing: /usr/local/include/pangolin/scene/tree.h
-- Installing: /usr/local/include/pangolin/scene/interactive.h
-- Installing: /usr/local/include/pangolin/tools
-- Installing: /usr/local/include/pangolin/tools/video_viewer.h
-- Installing: /usr/local/include/pangolin/image
-- Installing: /usr/local/include/pangolin/image/image_io.h
-- Installing: /usr/local/include/pangolin/image/image_convert.h
-- Installing: /usr/local/include/pangolin/image/image.h
-- Installing: /usr/local/include/pangolin/image/image_utils.h
-- Installing: /usr/local/include/pangolin/image/memcpy.h
-- Installing: /usr/local/include/pangolin/image/typed_image.h
-- Installing: /usr/local/include/pangolin/image/managed_image.h
-- Installing: /usr/local/include/pangolin/image/copy.h
-- Installing: /usr/local/include/pangolin/image/pixel_format.h
-- Installing: /usr/local/include/pangolin/video
-- Installing: /usr/local/include/pangolin/video/drivers
-- Installing: /usr/local/include/pangolin/video/drivers/merge.h
-- Installing: /usr/local/include/pangolin/video/drivers/thread.h
-- Installing: /usr/local/include/pangolin/video/drivers/unpack.h
-- Installing: /usr/local/include/pangolin/video/drivers/pvn.h
-- Installing: /usr/local/include/pangolin/video/drivers/shared_memory.h
-- Installing: /usr/local/include/pangolin/video/drivers/realsense.h
-- Installing: /usr/local/include/pangolin/video/drivers/shift.h
-- Installing: /usr/local/include/pangolin/video/drivers/openni.h
-- Installing: /usr/local/include/pangolin/video/drivers/split.h
-- Installing: /usr/local/include/pangolin/video/drivers/openni2.h
-- Installing: /usr/local/include/pangolin/video/drivers/images.h
-- Installing: /usr/local/include/pangolin/video/drivers/join.h
-- Installing: /usr/local/include/pangolin/video/drivers/v4l.h
-- Installing: /usr/local/include/pangolin/video/drivers/uvc_mediafoundation.h
-- Installing: /usr/local/include/pangolin/video/drivers/pango.h
-- Installing: /usr/local/include/pangolin/video/drivers/truncate.h
-- Installing: /usr/local/include/pangolin/video/drivers/realsense2.h
-- Installing: /usr/local/include/pangolin/video/drivers/uvc.h
-- Installing: /usr/local/include/pangolin/video/drivers/pack.h
-- Installing: /usr/local/include/pangolin/video/drivers/firewire.h
-- Installing: /usr/local/include/pangolin/video/drivers/test.h
-- Installing: /usr/local/include/pangolin/video/drivers/deinterlace.h
-- Installing: /usr/local/include/pangolin/video/drivers/debayer.h
-- Installing: /usr/local/include/pangolin/video/drivers/teli.h
-- Installing: /usr/local/include/pangolin/video/drivers/depthsense.h
-- Installing: /usr/local/include/pangolin/video/drivers/openni_common.h
-- Installing: /usr/local/include/pangolin/video/drivers/ffmpeg.h
-- Installing: /usr/local/include/pangolin/video/drivers/mirror.h
-- Installing: /usr/local/include/pangolin/video/drivers/images_out.h
-- Installing: /usr/local/include/pangolin/video/drivers/pango_video_output.h
-- Installing: /usr/local/include/pangolin/video/drivers/pleora.h
-- Installing: /usr/local/include/pangolin/video/stream_info.h
-- Installing: /usr/local/include/pangolin/video/video_input.h
-- Installing: /usr/local/include/pangolin/video/video_output_interface.h
-- Installing: /usr/local/include/pangolin/video/video_exception.h
-- Installing: /usr/local/include/pangolin/video/video.h
-- Installing: /usr/local/include/pangolin/video/stream_encoder_factory.h
-- Installing: /usr/local/include/pangolin/video/iostream_operators.h
-- Installing: /usr/local/include/pangolin/video/video_output.h
-- Installing: /usr/local/include/pangolin/video/video_record_repeat.h
-- Installing: /usr/local/include/pangolin/video/video_interface.h
-- Installing: /usr/local/include/pangolin/platform.h
-- Installing: /usr/local/include/pangolin/handler
-- Installing: /usr/local/include/pangolin/handler/handler_image.h
-- Installing: /usr/local/include/pangolin/handler/handler.h
-- Installing: /usr/local/include/pangolin/handler/handler_glbuffer.h
-- Installing: /usr/local/include/pangolin/handler/handler_enums.h
-- Installing: /usr/local/include/pangolin/utils
-- Installing: /usr/local/include/pangolin/utils/log.h
-- Installing: /usr/local/include/pangolin/utils/format_string.h
-- Installing: /usr/local/include/pangolin/utils/signal_slot.h
-- Installing: /usr/local/include/pangolin/utils/params.h
-- Installing: /usr/local/include/pangolin/utils/file_utils.h
-- Installing: /usr/local/include/pangolin/utils/argagg.hpp
-- Installing: /usr/local/include/pangolin/utils/parse.h
-- Installing: /usr/local/include/pangolin/utils/threadedfilebuf.h
-- Installing: /usr/local/include/pangolin/utils/variadic_all.h
-- Installing: /usr/local/include/pangolin/utils/file_extension.h
-- Installing: /usr/local/include/pangolin/utils/type_convert.h
-- Installing: /usr/local/include/pangolin/utils/sigstate.h
-- Installing: /usr/local/include/pangolin/utils/simple_math.h
-- Installing: /usr/local/include/pangolin/utils/timer.h
-- Installing: /usr/local/include/pangolin/utils/fix_size_buffer_queue.h
-- Installing: /usr/local/include/pangolin/utils/transform.h
-- Installing: /usr/local/include/pangolin/utils/picojson.h
-- Installing: /usr/local/include/pangolin/utils/assert.h
-- Installing: /usr/local/include/pangolin/utils/memstreambuf.h
-- Installing: /usr/local/include/pangolin/utils/posix
-- Installing: /usr/local/include/pangolin/utils/posix/condition_variable.h
-- Installing: /usr/local/include/pangolin/utils/posix/shared_memory_buffer.h
-- Installing: /usr/local/include/pangolin/utils/posix/semaphore.h
-- Installing: /usr/local/include/pangolin/utils/registration.h
-- Installing: /usr/local/include/pangolin/utils/xml
-- Installing: /usr/local/include/pangolin/utils/xml/rapidxml_utils.hpp
-- Installing: /usr/local/include/pangolin/utils/xml/license.txt
-- Installing: /usr/local/include/pangolin/utils/xml/rapidxml_iterators.hpp
-- Installing: /usr/local/include/pangolin/utils/xml/rapidxml.hpp
-- Installing: /usr/local/include/pangolin/utils/xml/rapidxml_print.hpp
-- Installing: /usr/local/include/pangolin/utils/uri.h
-- Installing: /usr/local/include/pangolin/utils/compontent_cast.h
-- Installing: /usr/local/include/pangolin/plot
-- Installing: /usr/local/include/pangolin/plot/plotter.h
-- Installing: /usr/local/include/pangolin/plot/range.h
-- Installing: /usr/local/include/pangolin/plot/datalog.h
-- Installing: /usr/local/include/pangolin/display
-- Installing: /usr/local/include/pangolin/display/display.h
-- Installing: /usr/local/include/pangolin/display/device
-- Installing: /usr/local/include/pangolin/display/device/display_android.h
-- Installing: /usr/local/include/pangolin/display/device/X11Window.h
-- Installing: /usr/local/include/pangolin/display/device/PangolinNSApplication.h
-- Installing: /usr/local/include/pangolin/display/device/X11GlContext.h
-- Installing: /usr/local/include/pangolin/display/device/PangolinNSGLView.h
-- Installing: /usr/local/include/pangolin/display/device/OsxWindow.h
-- Installing: /usr/local/include/pangolin/display/device/WinWindow.h
-- Installing: /usr/local/include/pangolin/display/attach.h
-- Installing: /usr/local/include/pangolin/display/widgets
-- Installing: /usr/local/include/pangolin/display/widgets/widgets.h
-- Installing: /usr/local/include/pangolin/display/viewport.h
-- Installing: /usr/local/include/pangolin/display/user_app.h
-- Installing: /usr/local/include/pangolin/display/window.h
-- Installing: /usr/local/include/pangolin/display/opengl_render_state.h
-- Installing: /usr/local/include/pangolin/display/image_view.h
-- Installing: /usr/local/include/pangolin/display/display_internal.h
-- Installing: /usr/local/include/pangolin/display/view.h
-- Installing: /usr/local/include/pangolin/ios
-- Installing: /usr/local/include/pangolin/ios/PangolinUIView.h
-- Installing: /usr/local/include/pangolin/ios/PangolinAppDelegate.h
-- Installing: /usr/local/include/pangolin/factory
-- Installing: /usr/local/include/pangolin/factory/factory_registry.h
-- Installing: /usr/local/include/pangolin/python
-- Installing: /usr/local/include/pangolin/python/pyinterpreter.h
-- Installing: /usr/local/include/pangolin/python/pypangolin_init.h
-- Installing: /usr/local/include/pangolin/python/pyuniqueobj.h
-- Installing: /usr/local/include/pangolin/python/pyvar.h
-- Installing: /usr/local/include/pangolin/python/pypangoio.h
-- Installing: /usr/local/include/pangolin/geometry
-- Installing: /usr/local/include/pangolin/geometry/glgeometry.h
-- Installing: /usr/local/include/pangolin/geometry/geometry_obj.h
-- Installing: /usr/local/include/pangolin/geometry/geometry_ply.h
-- Installing: /usr/local/include/pangolin/geometry/geometry.h
-- Installing: /usr/local/include/pangolin/pangolin.h
-- Installing: /usr/local/lib/libpangolin.so
-- Installing: /usr/local/lib/cmake/Pangolin/PangolinConfig.cmake
-- Installing: /usr/local/lib/cmake/Pangolin/PangolinConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/Pangolin/PangolinTargets.cmake
-- Installing: /usr/local/lib/cmake/Pangolin/PangolinTargets-release.cmake
-- Installing: /usr/local/bin/VideoViewer
-- Set runtime path of "/usr/local/bin/VideoViewer" to ""
-- Installing: /usr/local/bin/VideoConvert
-- Set runtime path of "/usr/local/bin/VideoConvert" to ""
-- Installing: /usr/local/bin/VideoJsonPrint
-- Set runtime path of "/usr/local/bin/VideoJsonPrint" to ""
-- Installing: /usr/local/bin/VideoJsonTransform
-- Set runtime path of "/usr/local/bin/VideoJsonTransform" to ""
-- Installing: /usr/local/bin/Plotter
-- Set runtime path of "/usr/local/bin/Plotter" to ""
ht_llibra@ht-llibra:~/VSlam/Pangolin-v0.6/build$
在你所放置的Pangolin文件下
cd build/examples/HelloPangolin
./HelloPangolin
运行此示例,效果显示是一个红绿蓝立方体,表示即为安装成功。
(这次在ubantu18.04安装出奇的顺利)
3、Opencv安装
最新的ORB-SLAM3要求OpenCV 4.4及以上,但是最好不要安装OpenCV4以上,具体原因不太理解,最后选择安装3.4.3版本。首先,到官网下载源码:https://opencv.org/releases/page/5/,实验可行。
参考:https://blog.csdn.net/shadowmimii/article/details/129472719
unzip opencv-3.4.3.zip
更新一下索引 sudo apt-get update,
使用一条指令安装所有依赖,
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libtiff5-dev libswscale-dev libjasper-dev
可能会出现以下报错信息,
ht_llibra@ht-llibra:~$ sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libtiff5-dev libswscale-dev libjasper-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 无法定位软件包 libjasper-dev
ht_llibra@ht-llibra:~$
解决方法:执行以下命令之后再次安装
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
不出意外,安装好依赖,开始编译OpenCV,
在opencv-3.4.3目录下,
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Matlab: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ht_llibra/VSlam/opencv-3.4.3/build
ht_llibra@ht-llibra:~/VSlam/opencv-3.4.3/build$
不得不感叹一句,好顺利啊!还得是ubantu18.04。 记:需要科学上网,否则可能中间下载失败。
make -j4
j4表示4核,可以根据虚拟机分配的核数进行调整,也可以不用,直接make,速度稍微慢点。
时间肯有点长,编译完成之后需要再安装一下,
sudo make install
– Installing: /usr/local/bin/opencv_version
– Set runtime path of “/usr/local/bin/opencv_version” to “/usr/local/lib”
4、DBoW2 and g2o
DBoW2主要用于回环检测,g2o(General Graph Optimization)主要用于图优化。
ORB-SLAM3的源码包自带DBoW2 and g2o,编译时会自动安装,不用管。
5、编译ORB_slam3
参考:https://github.com/UZ-SLAMLab/ORB_SLAM3
源码下载:https://github.com/UZ-SLAMLab/ORB_SLAM3
git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git
打开ORB_SLAM3中build.sh可以看到5个需要编译的第三方库,
直接执行以下命令,可一次性编译这5个文档,但如果报错不易查找问题,
chmod +x build.sh
./build.sh
因此,建议单独进行编译。
(1)编译Thirdparty/DBoW2
在ORB_SLAM3文件夹下打开终端
cd Thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
(2)编译Thirdparty/g2o
在/ORB_SLAM3下开终端
cd Thirdparty/g2o
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
(3)编译Thirdparty/Sophus
在/ORB_SLAM3下开终端
cd Thirdparty/ Sophus
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
(4)解压/ORB_SLAM3/Vocabulary/ORBvoc.txt.tar.gz
在/ORB_SLAM3下开终端
cd Vocabulary
tar -xf ORBvoc.txt.tar.gz
cd ..
(5)编译ORB_SLAM3
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
ht_llibra@ht-llibra:~/VSlam/ORB_SLAM3/build$ cmake .. -DCMAKE_BUILD_TYPE=Release-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Build type: Release
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Using flag -std=c++11.
CMake Warning at CMakeLists.txt:33 (find_package):
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "4.4".
The following configuration files were considered but not accepted:
/usr/local/share/OpenCV/OpenCVConfig.cmake, version: 3.4.3
/usr/share/OpenCV/OpenCVConfig.cmake, version: 3.2.0
CMake Error at CMakeLists.txt:35 (message):
OpenCV > 4.4 not found.
-- Configuring incomplete, errors occurred!
See also "/home/ht_llibra/VSlam/ORB_SLAM3/build/CMakeFiles/CMakeOutput.log".
ht_llibra@ht-llibra:~/VSlam/ORB_SLAM3/build$ make -j4
make: *** 没有指明目标并且找不到 makefile。 停止。
ht_llibra@ht-llibra:~/VSlam/ORB_SLAM3/build$
报错原因:此处我安装的是opencv3.4.2
解决办法:将/ORB_SLAM3/CMakeLists.txt中第33行find_package(OpenCV 4.4)此处的4.4改为3.4.2即可,
即 find_package(OpenCV 3.4.2),然后再次编译。
又编译报错c++: internal compiler error:可能是内存不足或 CPU 资源过度使用
扩了容没有挂载成功,容量没变化
VMWare扩容
显示应用程序 --> 磁盘 --> 设置 调整大小
还是make -j4报错
试试减少并行编译任务数,降低 -j 参数的值,
make -j2
还是报错。。。
检测系统资源:
内存使用情况 free -h
CPU 使用情况 top
系统资源也没问题。
make
[ 71%] Linking CXX executable …/Examples/Stereo-Inertial/stereo_inertial_tum_vi
[ 71%] Built target stereo_inertial_tum_vi
[100%] Built target g2o
ht_llibra@ht-llibra:~/VSlam/ORB_SLAM3/build$
速度很慢,好在编译成功。
6、数据集下载及运行,评估
下载
https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets#downloads
/ORB_SLAM3下新建Datasets,
将下载好的文件MH_01_easy放入Datasets,并改名为MH01,ROS bag也下载一个。
运行
参考另一个ORB_SLAM项目:https://github.com/j4mf/ORB_SLAM3 中的ORB_SLAM3/euroc_examples.sh ,
或者 https://github.com/electech6/ORB_SLAM3_detailed_comments 这个,一样的 ,下载后放入目录,
#!/bin/bash
pathDatasetEuroc='/Datasets/EuRoC' #Example, it is necesary to change it by the dataset path
#------------------------------------
# Monocular Examples
echo "Launching MH01 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono
echo "Launching MH02 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/MH02 ./Examples/Monocular/EuRoC_TimeStamps/MH02.txt dataset-MH02_mono
echo "Launching MH03 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/MH03 ./Examples/Monocular/EuRoC_TimeStamps/MH03.txt dataset-MH03_mono
echo "Launching MH04 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/MH04 ./Examples/Monocular/EuRoC_TimeStamps/MH04.txt dataset-MH04_mono
echo "Launching MH05 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/MH05 ./Examples/Monocular/EuRoC_TimeStamps/MH05.txt dataset-MH05_mono
echo "Launching V101 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Monocular/EuRoC_TimeStamps/V101.txt dataset-V101_mono
echo "Launching V102 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V102 ./Examples/Monocular/EuRoC_TimeStamps/V102.txt dataset-V102_mono
echo "Launching V103 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V103 ./Examples/Monocular/EuRoC_TimeStamps/V103.txt dataset-V103_mono
echo "Launching V201 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Monocular/EuRoC_TimeStamps/V201.txt dataset-V201_mono
echo "Launching V202 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V202 ./Examples/Monocular/EuRoC_TimeStamps/V202.txt dataset-V202_mono
echo "Launching V203 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V203 ./Examples/Monocular/EuRoC_TimeStamps/V203.txt dataset-V203_mono
# MultiSession Monocular Examples
echo "Launching Machine Hall with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt "$pathDatasetEuroc"/MH02 ./Examples/Monocular/EuRoC_TimeStamps/MH02.txt "$pathDatasetEuroc"/MH03 ./Examples/Monocular/EuRoC_TimeStamps/MH03.txt "$pathDatasetEuroc"/MH04 ./Examples/Monocular/EuRoC_TimeStamps/MH04.txt "$pathDatasetEuroc"/MH05 ./Examples/Monocular/EuRoC_TimeStamps/MH05.txt dataset-MH01_to_MH05_mono
echo "Launching Vicon Room 1 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Monocular/EuRoC_TimeStamps/V101.txt "$pathDatasetEuroc"/V102 ./Examples/Monocular/EuRoC_TimeStamps/V102.txt "$pathDatasetEuroc"/V103 ./Examples/Monocular/EuRoC_TimeStamps/V103.txt dataset-V101_to_V103_mono
echo "Launching Vicon Room 2 with Monocular sensor"
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Monocular/EuRoC_TimeStamps/V201.txt "$pathDatasetEuroc"/V202 ./Examples/Monocular/EuRoC_TimeStamps/V202.txt "$pathDatasetEuroc"/V203 ./Examples/Monocular/EuRoC_TimeStamps/V203.txt dataset-V201_to_V203_mono
#------------------------------------
# Stereo Examples
echo "Launching MH01 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereo
echo "Launching MH02 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH02 ./Examples/Stereo/EuRoC_TimeStamps/MH02.txt dataset-MH02_stereo
echo "Launching MH03 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH03 ./Examples/Stereo/EuRoC_TimeStamps/MH03.txt dataset-MH03_stereo
echo "Launching MH04 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH04 ./Examples/Stereo/EuRoC_TimeStamps/MH04.txt dataset-MH04_stereo
echo "Launching MH05 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH05 ./Examples/Stereo/EuRoC_TimeStamps/MH05.txt dataset-MH05_stereo
echo "Launching V101 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Stereo/EuRoC_TimeStamps/V101.txt dataset-V101_stereo
echo "Launching V102 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V102 ./Examples/Stereo/EuRoC_TimeStamps/V102.txt dataset-V102_stereo
echo "Launching V103 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V103 ./Examples/Stereo/EuRoC_TimeStamps/V103.txt dataset-V103_stereo
echo "Launching V201 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Stereo/EuRoC_TimeStamps/V201.txt dataset-V201_stereo
echo "Launching V202 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V202 ./Examples/Stereo/EuRoC_TimeStamps/V202.txt dataset-V202_stereo
echo "Launching V203 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V203 ./Examples/Stereo/EuRoC_TimeStamps/V203.txt dataset-V203_stereo
# MultiSession Stereo Examples
echo "Launching Machine Hall with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt "$pathDatasetEuroc"/MH02 ./Examples/Stereo/EuRoC_TimeStamps/MH02.txt "$pathDatasetEuroc"/MH03 ./Examples/Stereo/EuRoC_TimeStamps/MH03.txt "$pathDatasetEuroc"/MH04 ./Examples/Stereo/EuRoC_TimeStamps/MH04.txt "$pathDatasetEuroc"/MH05 ./Examples/Stereo/EuRoC_TimeStamps/MH05.txt dataset-MH01_to_MH05_stereo
echo "Launching Vicon Room 1 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Stereo/EuRoC_TimeStamps/V101.txt "$pathDatasetEuroc"/V102 ./Examples/Stereo/EuRoC_TimeStamps/V102.txt "$pathDatasetEuroc"/V103 ./Examples/Stereo/EuRoC_TimeStamps/V103.txt dataset-V101_to_V103_stereo
echo "Launching Vicon Room 2 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Stereo/EuRoC_TimeStamps/V201.txt "$pathDatasetEuroc"/V202 ./Examples/Stereo/EuRoC_TimeStamps/V202.txt "$pathDatasetEuroc"/V203 ./Examples/Stereo/EuRoC_TimeStamps/V203.txt dataset-V201_to_V203_stereo
#------------------------------------
# Monocular-Inertial Examples
echo "Launching MH01 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH01.txt dataset-MH01_monoi
echo "Launching MH02 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH02 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH02.txt dataset-MH02_monoi
echo "Launching MH03 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH03 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH03.txt dataset-MH03_monoi
echo "Launching MH04 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH04 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH04.txt dataset-MH04_monoi
echo "Launching MH05 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH05 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH05.txt dataset-MH05_monoi
echo "Launching V101 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V101.txt dataset-V101_monoi
echo "Launching V102 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V102 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V102.txt dataset-V102_monoi
echo "Launching V103 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V103 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V103.txt dataset-V103_monoi
echo "Launching V201 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V201.txt dataset-V201_monoi
echo "Launching V202 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V202 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V202.txt dataset-V202_monoi
echo "Launching V203 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V203 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V203.txt dataset-V203_monoi
# MultiSession Monocular Examples
echo "Launching Machine Hall with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH01.txt "$pathDatasetEuroc"/MH02 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH02.txt "$pathDatasetEuroc"/MH03 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH03.txt "$pathDatasetEuroc"/MH04 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH04.txt "$pathDatasetEuroc"/MH05 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH05.txt dataset-MH01_to_MH05_monoi
echo "Launching Vicon Room 1 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V101.txt "$pathDatasetEuroc"/V102 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V102.txt "$pathDatasetEuroc"/V103 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V103.txt dataset-V101_to_V103_monoi
echo "Launching Vicon Room 2 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V201.txt "$pathDatasetEuroc"/V202 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V202.txt "$pathDatasetEuroc"/V203 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V203.txt dataset-V201_to_V203_monoi
#------------------------------------
# Stereo-Inertial Examples
echo "Launching MH01 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereoi
echo "Launching MH02 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH02 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH02.txt dataset-MH02_stereoi
echo "Launching MH03 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH03 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH03.txt dataset-MH03_stereoi
echo "Launching MH04 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH04 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH04.txt dataset-MH04_stereoi
echo "Launching MH05 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH05 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH05.txt dataset-MH05_stereoi
echo "Launching V101 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V101.txt dataset-V101_stereoi
echo "Launching V102 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V102 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V102.txt dataset-V102_stereoi
echo "Launching V103 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V103 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V103.txt dataset-V103_stereoi
echo "Launching V201 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V201.txt dataset-V201_stereoi
echo "Launching V202 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V202 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V202.txt dataset-V202_stereoi
echo "Launching V203 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V203 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt dataset-V203_stereoi
# MultiSession Stereo-Inertial Examples
echo "Launching Machine Hall with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH01.txt "$pathDatasetEuroc"/MH02 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH02.txt "$pathDatasetEuroc"/MH03 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH03.txt "$pathDatasetEuroc"/MH04 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH04.txt "$pathDatasetEuroc"/MH05 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH05.txt dataset-MH01_to_MH05_stereoi
echo "Launching Vicon Room 1 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V101 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V101.txt "$pathDatasetEuroc"/V102 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V102.txt "$pathDatasetEuroc"/V103 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V103.txt dataset-V101_to_V103_stereoi
echo "Launching Vicon Room 2 with Stereo-Inertial sensor"
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V201.txt "$pathDatasetEuroc"/V202 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V202.txt "$pathDatasetEuroc"/V203 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/V203.txt dataset-V201_to_V203_stereoi
找到MH01对应sensor的命令运行即可,如:
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml /home/ht_llibra/VSlam/ORB_SLAM3/Datasets/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereo
注意路径更改。
评估
评估脚本euroc_eval_examples.sh,
#!/bin/bash
pathDatasetEuroc='/Datasets/EuRoC' #Example, it is necesary to change it by the dataset path
# Single Session Example (Pure visual)
echo "Launching MH01 with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereo
echo "------------------------------------"
echo "Evaluation of MH01 trajectory with Stereo sensor"
python evaluation/evaluate_ate_scale.py evaluation/Ground_truth/EuRoC_left_cam/MH01_GT.txt f_dataset-MH01_stereo.txt --plot MH01_stereo.pdf
# MultiSession Example (Pure visual)
echo "Launching Machine Hall with Stereo sensor"
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml "$pathDatasetEuroc"/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt "$pathDatasetEuroc"/MH02 ./Examples/Stereo/EuRoC_TimeStamps/MH02.txt "$pathDatasetEuroc"/MH03 ./Examples/Stereo/EuRoC_TimeStamps/MH03.txt "$pathDatasetEuroc"/MH04 ./Examples/Stereo/EuRoC_TimeStamps/MH04.txt "$pathDatasetEuroc"/MH05 ./Examples/Stereo/EuRoC_TimeStamps/MH05.txt dataset-MH01_to_MH05_stereo
echo "------------------------------------"
echo "Evaluation of MAchine Hall trajectory with Stereo sensor"
python evaluation/evaluate_ate_scale.py evaluation/Ground_truth/EuRoC_left_cam/MH_GT.txt f_dataset-MH01_to_MH05_stereo.txt --plot MH01_to_MH05_stereo.pdf
# Single Session Example (Visual-Inertial)
echo "Launching V102 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V102 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V102.txt dataset-V102_monoi
echo "------------------------------------"
echo "Evaluation of V102 trajectory with Monocular-Inertial sensor"
python evaluation/evaluate_ate_scale.py "$pathDatasetEuroc"/V102/mav0/state_groundtruth_estimate0/data.csv f_dataset-V102_monoi.txt --plot V102_monoi.pdf
# MultiSession Monocular Examples
echo "Launching Vicon Room 2 with Monocular-Inertial sensor"
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml "$pathDatasetEuroc"/V201 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V201.txt "$pathDatasetEuroc"/V202 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V202.txt "$pathDatasetEuroc"/V203 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/V203.txt dataset-V201_to_V203_monoi
echo "------------------------------------"
echo "Evaluation of Vicon Room 2 trajectory with Stereo sensor"
python evaluation/evaluate_ate_scale.py evaluation/Ground_truth/EuRoC_imu/V2_GT.txt f_dataset-V201_to_V203_monoi.txt --plot V201_to_V203_monoi.pdf
执行脚本,
./euroc_examples.sh
部分终端记录:
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
Failed to load image at: /Datasets/EuRoC/V101/mav0/cam0/data/1403715273262142976.png
Launching Vicon Room 2 with Stereo sensor
num_seq = 3
file name: dataset-V201_to_V203_stereo
Loading images for sequence 0...LOADED!
Loading images for sequence 1...LOADED!
Loading images for sequence 2...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
Loading settings from ./Examples/Stereo/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
-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.28717041015625 257.04702758789062 ]
-Sequence FPS: 20
-Stereo baseline: 0.11007784307003021
-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
7、运行相机(用的是 Intel D455)
sudo apt-get install ros-melodic-realsense2-camera
ht_llibra@ht-llibra:~$ rospack find realsense2_camera
/opt/ros/melodic/share/realsense2_camera
这里咱们直接用apt安装,之前在ubantu20.04和ubantu22.04用过源码编译安装。
https://github.com/IntelRealSense/realsense-ros/tree/ros1-legacy
https://github.com/IntelRealSense/realsense-ros/tree/ros2-master
安装好后,连接相机,测试摄像头能否正确打开,
roslaunch realsense2_camera rs_rgbd.launch
roslaunch realsense2_camera rs_camera.launch
roslaunch realsense2_camera rs_camera.launch align_depth:=true
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
报错!解决:相机需要使用USB3,虚拟机默认配置的USB2
不知道为啥就是用不了,咱还是用源码编译吧!
参考:https://blog.csdn.net/u014374826/article/details/132000684
(1)安装librealsense SDK2.0
首先·注册秘钥:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
添加服务器地址:
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
安装必要库:
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
打开显示界面验证:
realsense-viewer
这里没连接相机,连接后会有画面,注意这里虚拟机需要改USB3.0以上才能连接成功,测试可用。
再次验证:
ht_llibra@ht-llibra:~$ modinfo uvcvideo | grep "version:"
version: 1.1.2.realsense-1.3.18
srcversion: 51A4A0210E91BE50A7BA2BB
ht_llibra@ht-llibra:~$
检测摄像头是否被正确识别:
rs-enumerate-devices
(2)安装realsense-ros
先将前面apt安装的卸载,避免后续冲突,
sudo apt-get remove ros-melodic-realsense2-camera
如需彻底移除配置文件和其他相关数据,可以使用 purge 命令,
sudo apt-get purge ros-melodic-realsense2-camera
这里先使用
ht_llibra@ht-llibra:~$ sudo apt-get remove ros-melodic-realsense2-camera
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
ros-melodic-ddynamic-reconfigure ros-melodic-librealsense2
使用'sudo apt autoremove'来卸载它(它们)。
下列软件包将被【卸载】:
ros-melodic-realsense2-camera
升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 56 个软件包未被升级。
解压缩后将会空出 1,412 kB 的空间。
您希望继续执行吗? [Y/n] Y
(正在读取数据库 ... 系统当前共安装有 264442 个文件和目录。)
正在卸载 ros-melodic-realsense2-camera (2.3.2-1bionic.20221025.193216) ...
ht_llibra@ht-llibra:~$
ht_llibra@ht-llibra:~$ rospack find realsense2-camera
[rospack] Error: package 'realsense2-camera' not found
ht_llibra@ht-llibra:~$
git clone https://github.com/IntelRealSense/realsense-ros.git 现在默认ros2分支,建议手动下载
初始化工作空间:
cd realsense_ws/src
catkin_init_workspace
cd ..
catkin_make clean
记录:
ht_llibra@ht-llibra:~/VSlam$ cd realsense_ws/src
ht_llibra@ht-llibra:~/VSlam/realsense_ws/src$ catkin_init_workspace
Creating symlink "/home/ht_llibra/VSlam/realsense_ws/src/CMakeLists.txt" pointing to "/opt/ros/melodic/share/catkin/cmake/toplevel.cmake"
ht_llibra@ht-llibra:~/VSlam/realsense_ws/src$ cd ..
ht_llibra@ht-llibra:~/VSlam/realsense_ws$ catkin_make clean
ht_llibra@ht-llibra:~/VSlam/realsense_ws$ catkin_make clean
Base path: /home/ht_llibra/VSlam/realsense_ws
Source space: /home/ht_llibra/VSlam/realsense_ws/src
Build space: /home/ht_llibra/VSlam/realsense_ws/build
Devel space: /home/ht_llibra/VSlam/realsense_ws/devel
Install space: /home/ht_llibra/VSlam/realsense_ws/install
####
#### Running command: "cmake /home/ht_llibra/VSlam/realsense_ws/src -DCATKIN_DEVEL_PREFIX=/home/ht_llibra/VSlam/realsense_ws/devel -DCMAKE_INSTALL_PREFIX=/home/ht_llibra/VSlam/realsense_ws/install -G Unix Makefiles" in "/home/ht_llibra/VSlam/realsense_ws/build"
####
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/ht_llibra/VSlam/realsense_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/ht_llibra/carto_ws/cartographer_detailed_comments_ws/install_isolated;/opt/ros/melodic
-- This workspace overlays: /home/ht_llibra/carto_ws/cartographer_detailed_comments_ws/install_isolated;/opt/ros/melodic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ht_llibra/VSlam/realsense_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.17")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.29
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 2 packages in topological order:
-- ~~ - realsense2_description
-- ~~ - realsense2_camera
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'realsense2_description'
-- ==> add_subdirectory(realsense-ros/realsense2_description)
-- +++ processing catkin package: 'realsense2_camera'
-- ==> add_subdirectory(realsense-ros/realsense2_camera)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Create Release Build.
-- realsense2_camera: 3 messages, 1 services
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ht_llibra/VSlam/realsense_ws/build
####
#### Running command: "make clean -j4 -l4" in "/home/ht_llibra/VSlam/realsense_ws/build"
####
ht_llibra@ht-llibra:~/VSlam/realsense_ws$
没有报错,之前在ubantu20.04和22.04都出现过报错,肯是前面apt安装的一些依赖没卸载,此处用到了,反正很顺利。
开始安装源码: 回到工作空间
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
添加到系统环境变量:
echo "source /home/ht_llibra/VSlam/realsense_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
验证是否安装成功:
roslaunch realsense2_camera rs_camera.launch
报错没显示画面,
08/01 20:24:50,782 WARNING [139676547536640] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
08/01 20:24:51,348 WARNING [139676547536640] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
08/01 20:25:02,952 WARNING [139676547536640] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
这个问题可能是librealsense版本和realsense-ros版本所需版本不一致!
参考:在配置Intel realsense (D435i)时遇到的问题(转载)_ubuntu20.04 d435i没有imu话题-CSDN博客
查看README.md文件,LibRealSense2 supported version: v2.50.0 ,
然而apt默认安装的librealsense版本为2.55.1(realsense-viewer打开可见),这里可能需要卸载重装,
https://github.com/IntelRealSense/librealsense/releases/tag/v2.50.0
Release Intel® RealSense™ SDK 2.0 (v2.48.0) · IntelRealSense/librealsense · GitHub
Ubuntu18.04安装librealsense(D455相机)_虚拟机ubuntu下载librealsense-CSDN博客
然后我又发现可能是我想错了,打不开是因为环境变量没刷新(但是我明明加入了系统环境变量),修改为相对路径,(后续又发现是apt安装的realsense-ros没删干净,用命令安装realsense-ros也会同时安装librealsense2.50.0,所以可以用,删了之后出现版本不一致问题,详情见手持建图笔记)
source ~/VSlam/realsense_ws/devel/setup.bash
前面加的这个source /home/ht_llibra/VSlam/realsense_ws/devel/setup.bash不知道为啥刷新不了,明明是pwd打印的绝对路径。
回顾以前安装的:
(1)Ubantu22.04虚拟机,ros2版本的,支持最新版librealsense,发现也是2.55.1 (具体安装过程之前没有记录下来),
ros2 launch realsense2_camera rs_launch.py camera_namespace:=robot1 camera_name:=D455_1
rviz2 注意:sudo apt install ros-humble-rviz2
使用正常。
(2)Ubantu20.04双系统,ros1版本的,
和上述ubantu18.04虚拟机安装的一样,librealsense版本也为2.55.1,但是功能正常。
roslaunch realsense2_camera rs_rgbd.launch
解决方法:在终端中输入以下指令,安装rgbd_launch的功能包依赖
sudo apt-get install ros-melodic-rgbd-launch
启动相机节点并使用 pointcloud 选项发布点云:
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
启动相机节点并发布对齐的深度流:
roslaunch realsense2_camera rs_camera.launch align_depth:=true
使用 rqt_reconfigure 调整相机参数:
rosrun rqt_reconfigure rqt_reconfigure
7、ROS部分编译
原作者将ROS部分放到了/ORB_SLAM3/Examples_old位置,后续编译是进入old中。
在~/.bashrc中添加环境变量,将以下复制粘贴到最后一行:
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/ht_llibra/VSlam/ORB_SLAM3/Examples_old/ROS
开始编译:
cd Examples_old/ROS/ORB_SLAM3
mkdir build
cd build
cmake .. -DROS_BUILD_TYPE=Release
make -j4
或者直接运行脚本,但是这个路径不对,
chmod +x build_ros.sh
./build_ros.sh
记:不小心使用错命令./build.sh又编译了一遍orbslam3,编译报错,但是还能用,所以应该没有覆盖,不知道有没有影响,后续有待观测。
因此还是单独编译,最后一步make -j4报错:
fatal error: sophus/se3.hpp: 没有那个文件或目录
#include <sophus/se3.hpp>,
开始解决:
找到ORB_SLAM3/Examples_old/ROS/ORB_SLAM3下的CMakeLists.txt 修改它,include_directories中添加
${PROJECT_SOURCE_DIR}/../../../Thirdparty/Sophus
再次make -j4编译, 又有新的报错,
(1)找到ORB_SLAM3/Examples_old/ROS/ORB_SLAM3/src/AR下的ros_mono_ar.cc文件:
将第151行的
cv::Mat Tcw = mpSLAM→TrackMonocular(cv_ptr→image,cv_ptr→header.stamp.toSec());
替换为
cv::Mat Tcw;
Sophus::SE3f Tcw_SE3f = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
Eigen::Matrix4f Tcw_Matrix = Tcw_SE3f.matrix();
cv::eigen2cv(Tcw_Matrix, Tcw);
(2)找到ORB_SLAM3/Examples_old/ROS/ORB_SLAM3/src/AR下的ViewerAR.cc文件:
将第405行的
vPoints.push_back(pMP→GetWorldPos());
替换为
cv::Mat WorldPos;
cv::eigen2cv(pMP->GetWorldPos(), WorldPos);
vPoints.push_back(WorldPos);
将532行的
cv::Mat Xw = pMP→GetWorldPos();
替换为
cv::Mat Xw;
cv::eigen2cv(pMP->GetWorldPos(), Xw);
再次编译,还是报错
加头文件:在/ORB_SLAM3/Examples_old/ROS/ORB_SLAM3/src/AR/ViewerAR.h中加入如下
#include <Eigen/Dense>
#include <opencv2/core/eigen.hpp>
#include <opencv2/opencv.hpp>
编译成功!!!
运行
roscore
在ORB_SLAM3下打开终端(每开一次都要source)
source /home/ht_llibra/VSlam/ORB_SLAM3/Examples_old/ROS/ORB_SLAM3/build/devel/setup.bash
rosrun ORB_SLAM3 Stereo Vocabulary/ORBvoc.txt Examples_old/Stereo/EuRoC.yaml /home/ht_llibra/VSlam/ORB_SLAM3/Datasets/MH_01_easy.bag
· 第一个参数为系统的主程序执行文件 Stereo
· 第二个参数为特征词典 Vocabulary/ORBvoc.txt
· 第三个参数为相机参数 Examples_old/Stereo/EuRoC.yaml
注意:后续如果要使用自己的数据集,是需要修改这个文件的。
· 第四个参数为数据集路径 /home/nj/下载/MH_01_easy.bag)
数据包回放: 启动双目 --pause默认暂停播放,按下空格键开始播放
rosbag play --pause --clock MH_01_easy.bag \
/cam0/image_raw:=/camera/left/image_raw \
/cam1/image_raw:=/camera/right/image_raw \
/imu0:=/imu
发现显示画面不同步,上面的命令是启动双目的配置,但文件中缺少左右摄像头标定的内参,所以无法跟踪,需要的话就标了放进去编译启动。
roscore
source /home/ht_llibra/VSlam/ORB_SLAM3/Examples_old/ROS/ORB_SLAM3/build/devel/setup.bash
rosrun ORB_SLAM3 Mono Vocabulary/ORBvoc.txt Examples_old/Monocular-Inertial/EuRoC.yaml
数据包回放:启动双目 --pause默认暂停播放,按下空格键开始播放
rosbag play --pause MH_01_easy.bag /cam0/image_raw:=/camera/image_raw /imu0:=/imu
注:后面对应自己的话题,一定要和节点要求的对应。
查看话题:
rosnode info / Mono_Inertial
rospack list | grep image_transport
ht_llibra@ht-llibra:~$ rospack list | grep image_transport
compressed_depth_image_transport /opt/ros/melodic/share/compressed_depth_image_transport
compressed_image_transport /opt/ros/melodic/share/compressed_image_transport
image_transport /opt/ros/melodic/share/image_transport
theora_image_transport /opt/ros/melodic/share/theora_image_transport
ht_llibra@ht-llibra:~$
PS: 踩坑小记
使用ROS编译ORB-SLAM2时遇到的问题(已解决)-CSDN博客
由于ORBSLAM中设置了rosbuild_init(),而我们编译文档之前需要先关联工作区间。ORBSLAM这里提供的这个文档中,并没有我们熟悉的ROS里的package.xml和devel这些文件,直接编译会显示ORBSLAM路径冲突之类的问题
但是我这里加了环境变量路径还是不行,最后发现必须加在最后一排才生效
# export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/ht_llibra/VSlam/ORB_SLAM3/Examples_old/ROS
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/VSlam/ORB_SLAM3/Examples_old/ROS
再次编译,编译成功!
安装大佬注释修正版
https://github.com/electech6/ORB_SLAM3_detailed_comments
https://blog.csdn.net/Zoey_chn/article/details/135139494
git clone https://github.com/electech6/ORB_SLAM3_detailed_comments.git
我用的opencv3.4.3,需要对应修改一下,
编译:
chmod +x build.sh
./build.sh
安装前面那个后电脑内存不够了,还没试验。
ubantu20.04版本
案例1:
https://github.com/lturing/ORB_SLAM3_ROS
# 安装ros
# http://wiki.ros.org/noetic/Installation/Ubuntu
sudo apt install ros-noetic-desktop-full
git clone https://github.com/lturing/ORB_SLAM3_ROS.git
cd ORB_SLAM3_ROS
chmod +x ./build.sh
./build.sh
# 数据集下载
# https://www.cvlibs.net/datasets/kitti/eval_odometry.php
# https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download
# 生成associate.txt(示例)
python evaluation/associate.py /home/spurs/dataset/rgbd_dataset_freiburg2_large_with_loop/rgb.txt /home/spurs/dataset/rgbd_dataset_freiburg2_large_with_loop/depth.txt >> associate.txt
# 运行单目
# 适当修改 launch/orb_slam_mono.launch
chmod +x ./run_mono.sh
./run_mono.sh
# 运行双目
# 适当修改 launch/orb_slam_stereo.launch
chmod +x ./run_stereo.sh
./run_stereo.sh
# 运行rgbd稠密建图
# 适当修改 launch/orb_slam_rgbd_mapping.launch
chmod +x ./run_rgbd_mapping.sh
./run_rgbd_mapping.sh
案例2:可视化工具
https://github.com/sunshanlu/SLAM_VIEWER
案例3:Yolov5_ORB_SLAM3
https://github.com/YWL0720/YOLO_ORB_SLAM3
https://github.com/triple-Mu/YOLOv8-TensorRT
案例4:vins-mono
https://blog.csdn.net/zardforever123/article/details/129042974
VINS-Mono 论文地址: https://ieeexplore.ieee.org/abstract/document/8593603
https://ieeexplore.ieee.org/document/8421746?arnumber=8421746&source=authoralert
icle/details/135139494
git clone https://github.com/electech6/ORB_SLAM3_detailed_comments.git
[外链图片转存中…(img-3DvWGQ2T-1746537461615)]
我用的opencv3.4.3,需要对应修改一下,
编译:
chmod +x build.sh
./build.sh
安装前面那个后电脑内存不够了,还没试验。
ubantu20.04版本
案例1:
https://github.com/lturing/ORB_SLAM3_ROS
# 安装ros
# http://wiki.ros.org/noetic/Installation/Ubuntu
sudo apt install ros-noetic-desktop-full
git clone https://github.com/lturing/ORB_SLAM3_ROS.git
cd ORB_SLAM3_ROS
chmod +x ./build.sh
./build.sh
# 数据集下载
# https://www.cvlibs.net/datasets/kitti/eval_odometry.php
# https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download
# 生成associate.txt(示例)
python evaluation/associate.py /home/spurs/dataset/rgbd_dataset_freiburg2_large_with_loop/rgb.txt /home/spurs/dataset/rgbd_dataset_freiburg2_large_with_loop/depth.txt >> associate.txt
# 运行单目
# 适当修改 launch/orb_slam_mono.launch
chmod +x ./run_mono.sh
./run_mono.sh
# 运行双目
# 适当修改 launch/orb_slam_stereo.launch
chmod +x ./run_stereo.sh
./run_stereo.sh
# 运行rgbd稠密建图
# 适当修改 launch/orb_slam_rgbd_mapping.launch
chmod +x ./run_rgbd_mapping.sh
./run_rgbd_mapping.sh
案例2:可视化工具
https://github.com/sunshanlu/SLAM_VIEWER
案例3:Yolov5_ORB_SLAM3
https://github.com/YWL0720/YOLO_ORB_SLAM3
https://github.com/triple-Mu/YOLOv8-TensorRT
案例4:vins-mono
https://blog.csdn.net/zardforever123/article/details/129042974
VINS-Mono 论文地址: https://ieeexplore.ieee.org/abstract/document/8593603
https://ieeexplore.ieee.org/document/8421746?arnumber=8421746&source=authoralert