├── CMakeLists.txt
├── Dependencies.md
├── Examples
├── Monocular-Inertial
│ ├── Config
│ │ └── EuRoC.yaml
│ ├── mono_inertial_euroc
│ └── mono_inertial_euroc.cc
├── Monocular
│ ├── Config
│ │ ├── EuRoC.yaml
│ │ ├── KITTI00-02.yaml
│ │ ├── KITTI03.yaml
│ │ ├── KITTI04-12.yaml
│ │ ├── TUM1.yaml
│ │ ├── TUM2.yaml
│ │ └── TUM3.yaml
│ ├── mono_euroc
│ ├── mono_euroc.cc
│ ├── mono_kitti
│ ├── mono_kitti.cc
│ ├── mono_tum
│ └── mono_tum.cc
├── RGB-D
│ ├── Config
│ │ ├── TUM1.yaml
│ │ ├── TUM2.yaml
│ │ └── TUM3.yaml
│ ├── associations
│ │ ├── fr1_desk.txt
│ │ ├── fr1_desk2.txt
│ │ ├── fr1_room.txt
│ │ ├── fr1_xyz.txt
│ │ ├── fr2_desk.txt
│ │ ├── fr2_xyz.txt
│ │ ├── fr3_nstr_tex_near.txt
│ │ ├── fr3_office.txt
│ │ ├── fr3_office_val.txt
│ │ ├── fr3_str_tex_far.txt
│ │ └── fr3_str_tex_near.txt
│ ├── rgbd_tum
│ └── rgbd_tum.cc
├── ROS
│ └── PLI_SLAM2
│ │ ├── Asus.yaml
│ │ ├── CMakeLists.txt
│ │ ├── manifest.xml
│ │ └── src
│ │ ├── AR
│ │ ├── ViewerAR.cc
│ │ ├── ViewerAR.h
│ │ └── ros_mono_ar.cc
│ │ ├── ros_mono.cc
│ │ ├── ros_mono_inertial.cc
│ │ ├── ros_rgbd.cc
│ │ ├── ros_stereo.cc
│ │ └── ros_stereo_inertial.cc
├── Stereo-Inertial
│ ├── Config
│ │ └── EuRoC.yaml
│ ├── stereo_inertial_euroc
│ └── stereo_inertial_euroc.cc
└── Stereo
│ ├── Config
│ ├── EuRoC.yaml
│ ├── KITTI00-02.yaml
│ ├── KITTI03.yaml
│ └── KITTI04-12.yaml
│ ├── stereo_euroc
│ ├── stereo_euroc.cc
│ ├── stereo_kitti
│ └── stereo_kitti.cc
├── FindEigen3.cmake
├── LICENSE
├── README.md
├── Thirdparty
├── DBoW2
│ ├── CMakeLists.txt
│ ├── DBoW2
│ │ ├── BowVector.cpp
│ │ ├── BowVector.h
│ │ ├── FClass.h
│ │ ├── FORB.cpp
│ │ ├── FORB.h
│ │ ├── FeatureVector.cpp
│ │ ├── FeatureVector.h
│ │ ├── ScoringObject.cpp
│ │ ├── ScoringObject.h
│ │ └── TemplatedVocabulary.h
│ ├── DUtils
│ │ ├── Random.cpp
│ │ ├── Random.h
│ │ ├── Timestamp.cpp
│ │ └── Timestamp.h
│ └── README.txt
├── g2o
│ ├── CMakeLists.txt
│ ├── README.txt
│ ├── cmake_modules
│ │ ├── FindBLAS.cmake
│ │ ├── FindEigen3.cmake
│ │ └── FindLAPACK.cmake
│ ├── config.h
│ ├── config.h.in
│ ├── g2o
│ │ ├── core
│ │ │ ├── base_binary_edge.h
│ │ │ ├── base_binary_edge.hpp
│ │ │ ├── base_edge.h
│ │ │ ├── base_multi_edge.h
│ │ │ ├── base_multi_edge.hpp
│ │ │ ├── base_unary_edge.h
│ │ │ ├── base_unary_edge.hpp
│ │ │ ├── base_vertex.h
│ │ │ ├── base_vertex.hpp
│ │ │ ├── batch_stats.cpp
│ │ │ ├── batch_stats.h
│ │ │ ├── block_solver.h
│ │ │ ├── block_solver.hpp
│ │ │ ├── cache.cpp
│ │ │ ├── cache.h
│ │ │ ├── creators.h
│ │ │ ├── eigen_types.h
│ │ │ ├── estimate_propagator.cpp
│ │ │ ├── estimate_propagator.h
│ │ │ ├── factory.cpp
│ │ │ ├── factory.h
│ │ │ ├── hyper_dijkstra.cpp
│ │ │ ├── hyper_dijkstra.h
│ │ │ ├── hyper_graph.cpp
│ │ │ ├── hyper_graph.h
│ │ │ ├── hyper_graph_action.cpp
│ │ │ ├── hyper_graph_action.h
│ │ │ ├── jacobian_workspace.cpp
│ │ │ ├── jacobian_workspace.h
│ │ │ ├── linear_solver.h
│ │ │ ├── marginal_covariance_cholesky.cpp
│ │ │ ├── marginal_covariance_cholesky.h
│ │ │ ├── matrix_operations.h
│ │ │ ├── matrix_structure.cpp
│ │ │ ├── matrix_structure.h
│ │ │ ├── openmp_mutex.h
│ │ │ ├── optimizable_graph.cpp
│ │ │ ├── optimizable_graph.h
│ │ │ ├── optimization_algorithm.cpp
│ │ │ ├── optimization_algorithm.h
│ │ │ ├── optimization_algorithm_dogleg.cpp
│ │ │ ├── optimization_algorithm_dogleg.h
│ │ │ ├── optimization_algorithm_factory.cpp
│ │ │ ├── optimization_algorithm_factory.h
│ │ │ ├── optimization_algorithm_gauss_newton.cpp
│ │ │ ├── optimization_algorithm_gauss_newton.h
│ │ │ ├── optimization_algorithm_levenberg.cpp
│ │ │ ├── optimization_algorithm_levenberg.h
│ │ │ ├── optimization_algorithm_property.h
│ │ │ ├── optimization_algorithm_with_hessian.cpp
│ │ │ ├── optimization_algorithm_with_hessian.h
│ │ │ ├── parameter.cpp
│ │ │ ├── parameter.h
│ │ │ ├── parameter_container.cpp
│ │ │ ├── parameter_container.h
│ │ │ ├── robust_kernel.cpp
│ │ │ ├── robust_kernel.h
│ │ │ ├── robust_kernel_factory.cpp
│ │ │ ├── robust_kernel_factory.h
│ │ │ ├── robust_kernel_impl.cpp
│ │ │ ├── robust_kernel_impl.h
│ │ │ ├── solver.cpp
│ │ │ ├── solver.h
│ │ │ ├── sparse_block_matrix.h
│ │ │ ├── sparse_block_matrix.hpp
│ │ │ ├── sparse_block_matrix_ccs.h
│ │ │ ├── sparse_block_matrix_diagonal.h
│ │ │ ├── sparse_block_matrix_test.cpp
│ │ │ ├── sparse_optimizer.cpp
│ │ │ └── sparse_optimizer.h
│ │ ├── solvers
│ │ │ ├── linear_solver_dense.h
│ │ │ └── linear_solver_eigen.h
│ │ ├── stuff
│ │ │ ├── color_macros.h
│ │ │ ├── macros.h
│ │ │ ├── misc.h
│ │ │ ├── os_specific.c
│ │ │ ├── os_specific.h
│ │ │ ├── property.cpp
│ │ │ ├── property.h
│ │ │ ├── string_tools.cpp
│ │ │ ├── string_tools.h
│ │ │ ├── timeutil.cpp
│ │ │ └── timeutil.h
│ │ └── types
│ │ │ ├── se3_ops.h
│ │ │ ├── se3_ops.hpp
│ │ │ ├── se3mat.cpp
│ │ │ ├── se3mat.h
│ │ │ ├── se3quat.h
│ │ │ ├── sim3.h
│ │ │ ├── types_sba.cpp
│ │ │ ├── types_sba.h
│ │ │ ├── types_seven_dof_expmap.cpp
│ │ │ ├── types_seven_dof_expmap.h
│ │ │ ├── types_six_dof_expmap.cpp
│ │ │ └── types_six_dof_expmap.h
│ └── license-bsd.txt
└── line_descriptor
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── include
│ ├── line_descriptor
│ │ └── descriptor_custom.hpp
│ └── line_descriptor_custom.hpp
│ └── src
│ ├── LSDDetector_custom.cpp
│ ├── binary_descriptor_custom.cpp
│ ├── binary_descriptor_matcher.cpp
│ ├── bitarray_custom.hpp
│ ├── bitops_custom.hpp
│ ├── draw_custom.cpp
│ ├── precomp_custom.hpp
│ └── types_custom.hpp
├── Vocabulary
└── README.md
├── build.sh
├── build_ros.sh
├── include
├── Atlas.h
├── Auxiliar.h
├── CameraModels
│ ├── GeometricCamera.h
│ ├── KannalaBrandt8.h
│ └── Pinhole.h
├── Config.h
├── Converter.h
├── Frame.h
├── FrameDrawer.h
├── G2oTypes.h
├── ImuTypes.h
├── InitKeyFrame.h
├── Initializer.h
├── KDTree.h
├── KeyFrame.h
├── KeyFrameDatabase.h
├── LineExtractor.h
├── LineIterator.h
├── LineMatcher.h
├── LocalMapping.h
├── LoopClosing.h
├── MLPnPsolver.h
├── Map.h
├── MapDrawer.h
├── MapLine.h
├── MapPoint.h
├── ORBVocabulary.h
├── ORBextractor.h
├── ORBmatcher.h
├── OptimizableTypes.h
├── Optimizer.h
├── PnPsolver.h
├── Sim3Solver.h
├── System.h
├── SystemSetting.h
├── Tracking.h
├── TwoViewReconstruction.h
├── Viewer.h
└── gridStructure.h
└── src
├── Atlas.cc
├── Auxiliar.cc
├── CameraModels
├── KannalaBrandt8.cpp
└── Pinhole.cpp
├── Config.cpp
├── Converter.cc
├── Frame.cc
├── FrameDrawer.cc
├── G2oTypes.cc
├── ImuTypes.cc
├── InitKeyFrame.cc
├── Initializer.cc
├── KeyFrame.cc
├── KeyFrameDatabase.cc
├── LineExtractor.cc
├── LineIterator.cpp
├── LineMatcher.cpp
├── LocalMapping.cc
├── LoopClosing.cc
├── MLPnPsolver.cpp
├── Map.cc
├── MapDrawer.cc
├── MapLine.cc
├── MapPoint.cc
├── ORBextractor.cc
├── ORBmatcher.cc
├── OptimizableTypes.cpp
├── Optimizer.cc
├── PnPsolver.cc
├── Sim3Solver.cc
├── System.cc
├── SystemSetting.cc
├── Tracking.cc
├── TwoViewReconstruction.cc
├── Viewer.cc
└── gridStructure.cpp
/Dependencies.md:
--------------------------------------------------------------------------------
1 | ##List of Known Dependencies
2 | ###ORB-SLAM3 version 0.3
3 |
4 | In this document we list all the pieces of code included by ORB-SLAM3 and linked libraries which are not property of the authors of ORB-SLAM3.
5 |
6 |
7 | #####Code in **src** and **include** folders
8 |
9 | * *ORBextractor.cc*.
10 | This is a modified version of orb.cpp of OpenCV library. The original code is BSD licensed.
11 |
12 | * *PnPsolver.h, PnPsolver.cc*.
13 | This is a modified version of the epnp.h and epnp.cc of Vincent Lepetit.
14 | This code can be found in popular BSD licensed computer vision libraries as [OpenCV](https://github.com/Itseez/opencv/blob/master/modules/calib3d/src/epnp.cpp) and [OpenGV](https://github.com/laurentkneip/opengv/blob/master/src/absolute_pose/modules/Epnp.cpp). The original code is FreeBSD.
15 |
16 | * *MLPnPsolver.h, MLPnPsolver.cc*.
17 | This is a modified version of the MLPnP of Steffen Urban from [here](https://github.com/urbste/opengv).
18 | The original code is BSD licensed.
19 |
20 | * Function *ORBmatcher::DescriptorDistance* in *ORBmatcher.cc*.
21 | The code is from: http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel.
22 | The code is in the public domain.
23 |
24 | #####Code in Thirdparty folder
25 |
26 | * All code in **DBoW2** folder.
27 | This is a modified version of [DBoW2](https://github.com/dorian3d/DBoW2) and [DLib](https://github.com/dorian3d/DLib) library. All files included are BSD licensed.
28 |
29 | * All code in **g2o** folder.
30 | This is a modified version of [g2o](https://github.com/RainerKuemmerle/g2o). All files included are BSD licensed.
31 |
32 | #####Library dependencies
33 |
34 | * **Pangolin (visualization and user interface)**.
35 | [MIT license](https://en.wikipedia.org/wiki/MIT_License).
36 |
37 | * **OpenCV**.
38 | BSD license.
39 |
40 | * **Eigen3**.
41 | For versions greater than 3.1.1 is MPL2, earlier versions are LGPLv3.
42 |
43 | * **ROS (Optional, only if you build Examples/ROS)**.
44 | BSD license. In the manifest.xml the only declared package dependencies are roscpp, tf, sensor_msgs, image_transport, cv_bridge, which are all BSD licensed.
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Examples/Monocular-Inertial/mono_inertial_euroc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/Monocular-Inertial/mono_inertial_euroc
--------------------------------------------------------------------------------
/Examples/Monocular/mono_euroc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/Monocular/mono_euroc
--------------------------------------------------------------------------------
/Examples/Monocular/mono_kitti:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/Monocular/mono_kitti
--------------------------------------------------------------------------------
/Examples/Monocular/mono_tum:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/Monocular/mono_tum
--------------------------------------------------------------------------------
/Examples/RGB-D/rgbd_tum:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/RGB-D/rgbd_tum
--------------------------------------------------------------------------------
/Examples/ROS/PLI_SLAM2/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.4.6)
2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
3 |
4 | rosbuild_init()
5 |
6 | IF(NOT ROS_BUILD_TYPE)
7 | SET(ROS_BUILD_TYPE Release)
8 | ENDIF()
9 |
10 | MESSAGE("Build type: " ${ROS_BUILD_TYPE})
11 |
12 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
14 |
15 | # Check C++11 or C++0x support
16 | include(CheckCXXCompilerFlag)
17 | CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
18 | CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
19 | if(COMPILER_SUPPORTS_CXX11)
20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
21 | add_definitions(-DCOMPILEDWITHC11)
22 | message(STATUS "Using flag -std=c++11.")
23 | elseif(COMPILER_SUPPORTS_CXX0X)
24 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
25 | add_definitions(-DCOMPILEDWITHC0X)
26 | message(STATUS "Using flag -std=c++0x.")
27 | else()
28 | message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
29 | endif()
30 |
31 | LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake_modules)
32 |
33 | find_package(OpenCV 3.0 QUIET)
34 | if(NOT OpenCV_FOUND)
35 | find_package(OpenCV 2.4.3 QUIET)
36 | if(NOT OpenCV_FOUND)
37 | message(FATAL_ERROR "OpenCV > 2.4.3 not found.")
38 | endif()
39 | endif()
40 |
41 | find_package(Eigen3 3.1.0 REQUIRED)
42 | find_package(Pangolin REQUIRED)
43 |
44 | include_directories(
45 | ${PROJECT_SOURCE_DIR}
46 | ${PROJECT_SOURCE_DIR}/../../../
47 | ${PROJECT_SOURCE_DIR}/../../../include
48 | ${PROJECT_SOURCE_DIR}/../../../include/CameraModels
49 | ${Pangolin_INCLUDE_DIRS}
50 | )
51 |
52 | set(LIBS
53 | ${OpenCV_LIBS}
54 | ${EIGEN3_LIBS}
55 | ${Pangolin_LIBRARIES}
56 | ${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
57 | ${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
58 | ${PROJECT_SOURCE_DIR}/../../../lib/libPLI_SLAM.so
59 | -lboost_system
60 | )
61 |
62 | # Node for monocular camera
63 | rosbuild_add_executable(Mono
64 | src/ros_mono.cc
65 | )
66 |
67 | target_link_libraries(Mono
68 | ${LIBS}
69 | )
70 |
71 | # Node for monocular camera (Augmented Reality Demo)
72 | rosbuild_add_executable(MonoAR
73 | src/AR/ros_mono_ar.cc
74 | src/AR/ViewerAR.h
75 | src/AR/ViewerAR.cc
76 | )
77 |
78 | target_link_libraries(MonoAR
79 | ${LIBS}
80 | )
81 |
82 | # Node for stereo camera
83 | rosbuild_add_executable(Stereo
84 | src/ros_stereo.cc
85 | )
86 |
87 | target_link_libraries(Stereo
88 | ${LIBS}
89 | )
90 |
91 | # Node for RGB-D camera
92 | rosbuild_add_executable(RGBD
93 | src/ros_rgbd.cc
94 | )
95 |
96 | target_link_libraries(RGBD
97 | ${LIBS}
98 | )
99 |
100 | # Node for monocular-inertial camera
101 | rosbuild_add_executable(Mono_Inertial
102 | src/ros_mono_inertial.cc
103 | )
104 |
105 | target_link_libraries(Mono_Inertial
106 | ${LIBS}
107 | )
108 |
109 | # Node for stereo-inertial camera
110 | rosbuild_add_executable(Stereo_Inertial
111 | src/ros_stereo_inertial.cc
112 | )
113 |
114 | target_link_libraries(Stereo_Inertial
115 | ${LIBS}
116 | )
117 |
--------------------------------------------------------------------------------
/Examples/ROS/PLI_SLAM2/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ORB_SLAM3
4 |
5 | Carlos Campos, Richard Elvira, Juan J. Gomez, Jose M.M. Montiel, Juan D. Tardos
6 | GPLv3
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Examples/ROS/PLI_SLAM2/src/AR/ViewerAR.h:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of ORB-SLAM3
3 | *
4 | * Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez Rodríguez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
5 | * Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
6 | *
7 | * ORB-SLAM3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
8 | * License as published by the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * ORB-SLAM3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
12 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along with ORB-SLAM3.
16 | * If not, see .
17 | */
18 |
19 |
20 | #ifndef VIEWERAR_H
21 | #define VIEWERAR_H
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include"../../../include/System.h"
28 |
29 | namespace ORB_SLAM3
30 | {
31 |
32 | class Plane
33 | {
34 | public:
35 | Plane(const std::vector &vMPs, const cv::Mat &Tcw);
36 | Plane(const float &nx, const float &ny, const float &nz, const float &ox, const float &oy, const float &oz);
37 |
38 | void Recompute();
39 |
40 | //normal
41 | cv::Mat n;
42 | //origin
43 | cv::Mat o;
44 | //arbitrary orientation along normal
45 | float rang;
46 | //transformation from world to the plane
47 | cv::Mat Tpw;
48 | pangolin::OpenGlMatrix glTpw;
49 | //MapPoints that define the plane
50 | std::vector mvMPs;
51 | //camera pose when the plane was first observed (to compute normal direction)
52 | cv::Mat mTcw, XC;
53 | };
54 |
55 | class ViewerAR
56 | {
57 | public:
58 | ViewerAR();
59 |
60 | void SetFPS(const float fps){
61 | mFPS = fps;
62 | mT=1e3/fps;
63 | }
64 |
65 | void SetSLAM(ORB_SLAM3::System* pSystem){
66 | mpSystem = pSystem;
67 | }
68 |
69 | // Main thread function.
70 | void Run();
71 |
72 | void SetCameraCalibration(const float &fx_, const float &fy_, const float &cx_, const float &cy_){
73 | fx = fx_; fy = fy_; cx = cx_; cy = cy_;
74 | }
75 |
76 | void SetImagePose(const cv::Mat &im, const cv::Mat &Tcw, const int &status,
77 | const std::vector &vKeys, const std::vector &vMPs);
78 |
79 | void GetImagePose(cv::Mat &im, cv::Mat &Tcw, int &status,
80 | std::vector &vKeys, std::vector &vMPs);
81 |
82 | private:
83 |
84 | //SLAM
85 | ORB_SLAM3::System* mpSystem;
86 |
87 | void PrintStatus(const int &status, const bool &bLocMode, cv::Mat &im);
88 | void AddTextToImage(const std::string &s, cv::Mat &im, const int r=0, const int g=0, const int b=0);
89 | void LoadCameraPose(const cv::Mat &Tcw);
90 | void DrawImageTexture(pangolin::GlTexture &imageTexture, cv::Mat &im);
91 | void DrawCube(const float &size, const float x=0, const float y=0, const float z=0);
92 | void DrawPlane(int ndivs, float ndivsize);
93 | void DrawPlane(Plane* pPlane, int ndivs, float ndivsize);
94 | void DrawTrackedPoints(const std::vector &vKeys, const std::vector &vMPs, cv::Mat &im);
95 |
96 | Plane* DetectPlane(const cv::Mat Tcw, const std::vector &vMPs, const int iterations=50);
97 |
98 | // frame rate
99 | float mFPS, mT;
100 | float fx,fy,cx,cy;
101 |
102 | // Last processed image and computed pose by the SLAM
103 | std::mutex mMutexPoseImage;
104 | cv::Mat mTcw;
105 | cv::Mat mImage;
106 | int mStatus;
107 | std::vector mvKeys;
108 | std::vector mvMPs;
109 |
110 | };
111 |
112 |
113 | }
114 |
115 |
116 | #endif // VIEWERAR_H
117 |
118 |
119 |
--------------------------------------------------------------------------------
/Examples/ROS/PLI_SLAM2/src/ros_mono.cc:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of ORB-SLAM3
3 | *
4 | * Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez Rodríguez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
5 | * Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
6 | *
7 | * ORB-SLAM3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
8 | * License as published by the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * ORB-SLAM3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
12 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along with ORB-SLAM3.
16 | * If not, see .
17 | */
18 |
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 | #include
27 |
28 | #include
29 |
30 | #include"../../../include/System.h"
31 |
32 | using namespace std;
33 |
34 | class ImageGrabber
35 | {
36 | public:
37 | ImageGrabber(ORB_SLAM3::System* pSLAM):mpSLAM(pSLAM){}
38 |
39 | void GrabImage(const sensor_msgs::ImageConstPtr& msg);
40 |
41 | ORB_SLAM3::System* mpSLAM;
42 | };
43 |
44 | int main(int argc, char **argv)
45 | {
46 | ros::init(argc, argv, "Mono");
47 | ros::start();
48 |
49 | if(argc != 3)
50 | {
51 | cerr << endl << "Usage: rosrun ORB_SLAM3 Mono path_to_vocabulary path_to_settings" << endl;
52 | ros::shutdown();
53 | return 1;
54 | }
55 |
56 | // Create SLAM system. It initializes all system threads and gets ready to process frames.
57 | ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR,true);
58 |
59 | ImageGrabber igb(&SLAM);
60 |
61 | ros::NodeHandle nodeHandler;
62 | ros::Subscriber sub = nodeHandler.subscribe("/camera/image_raw", 1, &ImageGrabber::GrabImage,&igb);
63 |
64 | ros::spin();
65 |
66 | // Stop all threads
67 | SLAM.Shutdown();
68 |
69 | // Save camera trajectory
70 | SLAM.SaveTrajectoryTUM("CamTraj_TUM.txt");
71 | SLAM.SaveKeyFrameTrajectoryTUM("KFTraj_TUM.txt");
72 |
73 | ros::shutdown();
74 |
75 | return 0;
76 | }
77 |
78 | void ImageGrabber::GrabImage(const sensor_msgs::ImageConstPtr& msg)
79 | {
80 | // Copy the ros image message to cv::Mat.
81 | cv_bridge::CvImageConstPtr cv_ptr;
82 | try
83 | {
84 | cv_ptr = cv_bridge::toCvShare(msg);
85 | }
86 | catch (cv_bridge::Exception& e)
87 | {
88 | ROS_ERROR("cv_bridge exception: %s", e.what());
89 | return;
90 | }
91 |
92 | mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
93 | }
94 |
95 |
96 |
--------------------------------------------------------------------------------
/Examples/ROS/PLI_SLAM2/src/ros_rgbd.cc:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is part of ORB-SLAM3
3 | *
4 | * Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez Rodríguez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
5 | * Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
6 | *
7 | * ORB-SLAM3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
8 | * License as published by the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * ORB-SLAM3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
12 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along with ORB-SLAM3.
16 | * If not, see .
17 | */
18 |
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | #include
32 |
33 | #include"../../../include/System.h"
34 |
35 | using namespace std;
36 |
37 | class ImageGrabber
38 | {
39 | public:
40 | ImageGrabber(ORB_SLAM3::System* pSLAM):mpSLAM(pSLAM){}
41 |
42 | void GrabRGBD(const sensor_msgs::ImageConstPtr& msgRGB,const sensor_msgs::ImageConstPtr& msgD);
43 |
44 | ORB_SLAM3::System* mpSLAM;
45 | };
46 |
47 | int main(int argc, char **argv)
48 | {
49 | ros::init(argc, argv, "RGBD");
50 | ros::start();
51 |
52 | if(argc != 3)
53 | {
54 | cerr << endl << "Usage: rosrun ORB_SLAM3 RGBD path_to_vocabulary path_to_settings" << endl;
55 | ros::shutdown();
56 | return 1;
57 | }
58 |
59 | // Create SLAM system. It initializes all system threads and gets ready to process frames.
60 | ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::RGBD,true);
61 |
62 | ImageGrabber igb(&SLAM);
63 |
64 | ros::NodeHandle nh;
65 |
66 | message_filters::Subscriber rgb_sub(nh, "/camera/rgb/image_raw", 100);
67 | message_filters::Subscriber depth_sub(nh, "camera/depth_registered/image_raw", 100);
68 | typedef message_filters::sync_policies::ApproximateTime sync_pol;
69 | message_filters::Synchronizer sync(sync_pol(10), rgb_sub,depth_sub);
70 | sync.registerCallback(boost::bind(&ImageGrabber::GrabRGBD,&igb,_1,_2));
71 |
72 | ros::spin();
73 |
74 | // Stop all threads
75 | SLAM.Shutdown();
76 |
77 | // Save camera trajectory
78 | SLAM.SaveKeyFrameTrajectoryTUM("KeyFrameTrajectory.txt");
79 |
80 | ros::shutdown();
81 |
82 | return 0;
83 | }
84 |
85 | void ImageGrabber::GrabRGBD(const sensor_msgs::ImageConstPtr& msgRGB,const sensor_msgs::ImageConstPtr& msgD)
86 | {
87 | // Copy the ros image message to cv::Mat.
88 | cv_bridge::CvImageConstPtr cv_ptrRGB;
89 | try
90 | {
91 | cv_ptrRGB = cv_bridge::toCvShare(msgRGB);
92 | }
93 | catch (cv_bridge::Exception& e)
94 | {
95 | ROS_ERROR("cv_bridge exception: %s", e.what());
96 | return;
97 | }
98 |
99 | cv_bridge::CvImageConstPtr cv_ptrD;
100 | try
101 | {
102 | cv_ptrD = cv_bridge::toCvShare(msgD);
103 | }
104 | catch (cv_bridge::Exception& e)
105 | {
106 | ROS_ERROR("cv_bridge exception: %s", e.what());
107 | return;
108 | }
109 | mpSLAM->TrackRGBD(cv_ptrRGB->image,cv_ptrD->image,cv_ptrRGB->header.stamp.toSec());
110 | }
111 |
112 |
113 |
--------------------------------------------------------------------------------
/Examples/Stereo-Inertial/stereo_inertial_euroc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/Stereo-Inertial/stereo_inertial_euroc
--------------------------------------------------------------------------------
/Examples/Stereo/stereo_euroc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/Stereo/stereo_euroc
--------------------------------------------------------------------------------
/Examples/Stereo/stereo_kitti:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VealFang/PLI-SLAM/28b84b9091183c277baf0f2f044617f41a572d09/Examples/Stereo/stereo_kitti
--------------------------------------------------------------------------------
/FindEigen3.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find Eigen3 lib
2 | #
3 | # This module supports requiring a minimum version, e.g. you can do
4 | # find_package(Eigen3 3.1.2)
5 | # to require version 3.1.2 or newer of Eigen3.
6 | #
7 | # Once done this will define
8 | #
9 | # EIGEN3_FOUND - system has eigen lib with correct version
10 | # EIGEN3_INCLUDE_DIR - the eigen include directory
11 | # EIGEN3_VERSION - eigen version
12 |
13 | # Copyright (c) 2006, 2007 Montel Laurent,
14 | # Copyright (c) 2008, 2009 Gael Guennebaud,
15 | # Copyright (c) 2009 Benoit Jacob
16 | # Redistribution and use is allowed according to the terms of the 2-clause BSD license.
17 |
18 | if(NOT Eigen3_FIND_VERSION)
19 | if(NOT Eigen3_FIND_VERSION_MAJOR)
20 | set(Eigen3_FIND_VERSION_MAJOR 2)
21 | endif(NOT Eigen3_FIND_VERSION_MAJOR)
22 | if(NOT Eigen3_FIND_VERSION_MINOR)
23 | set(Eigen3_FIND_VERSION_MINOR 91)
24 | endif(NOT Eigen3_FIND_VERSION_MINOR)
25 | if(NOT Eigen3_FIND_VERSION_PATCH)
26 | set(Eigen3_FIND_VERSION_PATCH 0)
27 | endif(NOT Eigen3_FIND_VERSION_PATCH)
28 |
29 | set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
30 | endif(NOT Eigen3_FIND_VERSION)
31 |
32 | macro(_eigen3_check_version)
33 | file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
34 |
35 | string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
36 | set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
37 | string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
38 | set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
39 | string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
40 | set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
41 |
42 | set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
43 | if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
44 | set(EIGEN3_VERSION_OK FALSE)
45 | else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
46 | set(EIGEN3_VERSION_OK TRUE)
47 | endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
48 |
49 | if(NOT EIGEN3_VERSION_OK)
50 |
51 | message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
52 | "but at least version ${Eigen3_FIND_VERSION} is required")
53 | endif(NOT EIGEN3_VERSION_OK)
54 | endmacro(_eigen3_check_version)
55 |
56 | if (EIGEN3_INCLUDE_DIR)
57 |
58 | # in cache already
59 | _eigen3_check_version()
60 | set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
61 |
62 | else (EIGEN3_INCLUDE_DIR)
63 |
64 | # specific additional paths for some OS
65 | if (WIN32)
66 | set(EIGEN_ADDITIONAL_SEARCH_PATHS ${EIGEN_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/Eigen/include" "C:/Program Files (x86)/Eigen/include")
67 | endif(WIN32)
68 |
69 | find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
70 | PATHS
71 | ${CMAKE_INSTALL_PREFIX}/include
72 | ${EIGEN_ADDITIONAL_SEARCH_PATHS}
73 | ${KDE4_INCLUDE_DIR}
74 | PATH_SUFFIXES eigen3 eigen
75 | )
76 |
77 | if(EIGEN3_INCLUDE_DIR)
78 | _eigen3_check_version()
79 | endif(EIGEN3_INCLUDE_DIR)
80 |
81 | include(FindPackageHandleStandardArgs)
82 | find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
83 |
84 | mark_as_advanced(EIGEN3_INCLUDE_DIR)
85 |
86 | endif(EIGEN3_INCLUDE_DIR)
87 |
88 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PLI-SLAM: A Stereo Visual-Inertial SLAM based on Point-Line Features
2 | PLI-SLAM is developed on the foundation of [PL-SLAM](http://github.com/rubengooj/pl-slam) and [ORB_SLAM3](http://github.com/UZ-SLAMLab/ORB_SLAM3), line features are fully engaged in the whole process of the system including tracking, map building and loop detection.
3 | Higher accuracy has been shown in PLI-SLAM on EuRoC Dataset compared to other VIO or point-line based SLAM systems. PLI-SLAM also performed stronger tracking robustness in various real scenario experiments conduted with a self-developed robot.
4 |
5 | **Video demo**: [youtube](https://youtu.be/UuJuEZoYsso)
6 |
7 | ## 1. License:
8 | The provided code is published under the General Public License Version 3 (GPL v3).
9 | ## 2. Prerequisites:
10 | ### Ubuntu
11 | Ubuntu 16.04 or higher version is required.
12 | ### ROS
13 | We use ROS Melodic for real scenario experiments.
14 | ### C++11 or C++0x Compiler
15 | We use the new thread and chrono functionalities of C++11.
16 | ### Pangolin
17 | We use Pangolin for visualization and user interface. It can be found at: https://github.com/stevenlovegrove/Pangolin.
18 | ### OpenCV
19 | We use OpenCV 3.3.1 to manipulate images and features.
20 | Noted that [line_descripter](https://github.com/opencv/opencv_contrib/tree/master/modules/line_descriptor) should be impoerted from the [OpenCV/contrib](https://github.com/opencv/opencv_contrib) library independently.
21 | ### Eigen3
22 | We use Eigen 3.3.4. It can be found at: http://eigen.tuxfamily.org.
23 | ### Ceres Solver
24 | We use ceres-solver-1.14.0 for nonlinear optimization. It can be found at: https://ceres-solver.googlesource.com/ceres-solver.
25 | ### DBoW2 and g2o
26 | We use modified versions of the [DBoW2](https://github.com/dorian3d/DBoW2) library to perform place recognition and [g2o](https://github.com/RainerKuemmerle/g2o) library to perform non-linear optimizations.
27 | ## 3. Building PLI-SLAM library and examples on ROS
28 | 1. Clone the repository and add the path to the ROS_PACKAGE_PATH environment variable:
29 | ```Bash
30 | git clone https://github.com/VealFang/PLI-SLAM.git
31 | gedit ~/.bashrc #Open .bashrc file
32 | export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM3/Examples/ROS #Add at the end of the file
33 | source ~/.bashrc
34 | ```
35 | 2. Execute ``build_ros.sh`` script:
36 | ```Bash
37 | cd PLI_SLAM
38 | chmod +x build_ros.sh
39 | ./build_ros.sh
40 | ```
41 | ## 4. Run on EuRoC dataset
42 | Download a [rosbag](http://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets) from the EuRoC dataset.
43 | Open 3 tabs on the terminal and run the following command at each tab:
44 | ```Bash
45 | roscore
46 | ```
47 | ```Bash
48 | roslaunch PLI_SLAM Stereo_Inertial Vocabulary Examples/Stereo-Inertial/EuRoC.yaml true
49 | ```
50 | ```Bash
51 | rosbag play ROSBAG_PATH
52 | ```
53 |
--------------------------------------------------------------------------------
/Thirdparty/DBoW2/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 | project(DBoW2)
3 |
4 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
6 |
7 | set(HDRS_DBOW2
8 | DBoW2/BowVector.h
9 | DBoW2/FORB.h
10 | DBoW2/FClass.h
11 | DBoW2/FeatureVector.h
12 | DBoW2/ScoringObject.h
13 | DBoW2/TemplatedVocabulary.h)
14 | set(SRCS_DBOW2
15 | DBoW2/BowVector.cpp
16 | DBoW2/FORB.cpp
17 | DBoW2/FeatureVector.cpp
18 | DBoW2/ScoringObject.cpp)
19 |
20 | set(HDRS_DUTILS
21 | DUtils/Random.h
22 | DUtils/Timestamp.h)
23 | set(SRCS_DUTILS
24 | DUtils/Random.cpp
25 | DUtils/Timestamp.cpp)
26 |
27 | find_package(OpenCV 3.0 QUIET)
28 | if(NOT OpenCV_FOUND)
29 | find_package(OpenCV 2.4.3 QUIET)
30 | if(NOT OpenCV_FOUND)
31 | message(FATAL_ERROR "OpenCV > 2.4.3 not found.")
32 | endif()
33 | endif()
34 |
35 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
36 |
37 | include_directories(${OpenCV_INCLUDE_DIRS})
38 | add_library(DBoW2 SHARED ${SRCS_DBOW2} ${SRCS_DUTILS})
39 | target_link_libraries(DBoW2 ${OpenCV_LIBS})
40 |
41 |
--------------------------------------------------------------------------------
/Thirdparty/DBoW2/DBoW2/BowVector.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * File: BowVector.cpp
3 | * Date: March 2011
4 | * Author: Dorian Galvez-Lopez
5 | * Description: bag of words vector
6 | * License: see the LICENSE.txt file
7 | *
8 | */
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | #include "BowVector.h"
17 |
18 | namespace DBoW2 {
19 |
20 | // --------------------------------------------------------------------------
21 |
22 | BowVector::BowVector(void)
23 | {
24 | }
25 |
26 | // --------------------------------------------------------------------------
27 |
28 | BowVector::~BowVector(void)
29 | {
30 | }
31 |
32 | // --------------------------------------------------------------------------
33 |
34 | void BowVector::addWeight(WordId id, WordValue v)
35 | {
36 | BowVector::iterator vit = this->lower_bound(id);
37 |
38 | if(vit != this->end() && !(this->key_comp()(id, vit->first)))
39 | {
40 | vit->second += v;
41 | }
42 | else
43 | {
44 | this->insert(vit, BowVector::value_type(id, v));
45 | }
46 | }
47 |
48 | // --------------------------------------------------------------------------
49 |
50 | void BowVector::addIfNotExist(WordId id, WordValue v)
51 | {
52 | BowVector::iterator vit = this->lower_bound(id);
53 |
54 | if(vit == this->end() || (this->key_comp()(id, vit->first)))
55 | {
56 | this->insert(vit, BowVector::value_type(id, v));
57 | }
58 | }
59 |
60 | // --------------------------------------------------------------------------
61 |
62 | void BowVector::normalize(LNorm norm_type)
63 | {
64 | double norm = 0.0;
65 | BowVector::iterator it;
66 |
67 | if(norm_type == DBoW2::L1)
68 | {
69 | for(it = begin(); it != end(); ++it)
70 | norm += fabs(it->second);
71 | }
72 | else
73 | {
74 | for(it = begin(); it != end(); ++it)
75 | norm += it->second * it->second;
76 | norm = sqrt(norm);
77 | }
78 |
79 | if(norm > 0.0)
80 | {
81 | for(it = begin(); it != end(); ++it)
82 | it->second /= norm;
83 | }
84 | }
85 |
86 | // --------------------------------------------------------------------------
87 |
88 | std::ostream& operator<< (std::ostream &out, const BowVector &v)
89 | {
90 | BowVector::const_iterator vit;
91 | std::vector::const_iterator iit;
92 | unsigned int i = 0;
93 | const unsigned int N = v.size();
94 | for(vit = v.begin(); vit != v.end(); ++vit, ++i)
95 | {
96 | out << "<" << vit->first << ", " << vit->second << ">";
97 |
98 | if(i < N-1) out << ", ";
99 | }
100 | return out;
101 | }
102 |
103 | // --------------------------------------------------------------------------
104 |
105 | void BowVector::saveM(const std::string &filename, size_t W) const
106 | {
107 | std::fstream f(filename.c_str(), std::ios::out);
108 |
109 | WordId last = 0;
110 | BowVector::const_iterator bit;
111 | for(bit = this->begin(); bit != this->end(); ++bit)
112 | {
113 | for(; last < bit->first; ++last)
114 | {
115 | f << "0 ";
116 | }
117 | f << bit->second << " ";
118 |
119 | last = bit->first + 1;
120 | }
121 | for(; last < (WordId)W; ++last)
122 | f << "0 ";
123 |
124 | f.close();
125 | }
126 |
127 | // --------------------------------------------------------------------------
128 |
129 | } // namespace DBoW2
130 |
131 |
--------------------------------------------------------------------------------
/Thirdparty/DBoW2/DBoW2/BowVector.h:
--------------------------------------------------------------------------------
1 | /**
2 | * File: BowVector.h
3 | * Date: March 2011
4 | * Author: Dorian Galvez-Lopez
5 | * Description: bag of words vector
6 | * License: see the LICENSE.txt file
7 | *
8 | */
9 |
10 | #ifndef __D_T_BOW_VECTOR__
11 | #define __D_T_BOW_VECTOR__
12 |
13 | #include
14 | #include