Visual SLAM14 lectures on the second version of ch2 and ch3 code demonstration

Environment: ubuntu20.04 dual system
Background: I have debugged in VScode, but encountered many problems. After solving the path problem, header file and other problems, there are still problems that I cannot solve. On this problem, I decided to write a book Use KDevelop to run the code as above. (The advantage is that you can run existing programs directly)

Step 1: Download KDevelop

It is not recommended to download it in the store. I can't open it after downloading. I don't know why.
It is recommended to use apt-get to download: sudo apt-get install kdevelop
After the download is completed, perform Chinese processing: aptitude search kdevelop
if kdevelop-l10n appears, sudo apt-get install kdevelop-l10n
the installation is complete.

Step 2: Import the code into KDevelop

First of all, you need to download the code: git clone https://github.com/gaoxiang12/slambook2
after completion, as shown
insert image description here
in the figure, you will find a blank file in 3rdparty, here you need to download it separately, we enter the above github location, and then enter 3rdparty: https://github.com/gaoxiang12/slambook2/tree/master/3rdpartyinsert image description herehere we need to download separately (I use DBoW3 as an example) Click to enter, then click the upper right code to select the address to
insert image description hereopen the terminal in 3rdparty, copy the selected address and add it in front of it git clone
insert image description here
. After the end, we can import the code into KDevelop.
Click on the project, click to open the import project, and then select the project you want to import.
insert image description here

The third step is to download the Eigen library and the pangolin library

Note: If you download the pangolin library first, an error may be reported in the program compilation, which will not match the version of the eigen library.
eigen library installation:sudo apt-get install libeigen3-dev check the installation path: locate eigen3
it will show that the path is /usr/include/eigen3 and the path required in the book is so /usr/include/eigen3/Eigen
the solution is (1) sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigencopy the past (2) add eigen3/ pangolin library installation
in the code #include <Eigen/Dense>and before it : in 3rdparty we have already done it separately Downloaded the pangolin file, so we just need to compile it and switch to the slambook2/3rdparty folder#include <Eigen/Core>
insert image description here

cd Pangolin
mkdir build && cd build
cmake -DCPP11_NO_BOOST=1 ..
make -j4
sudo make install

After the installation is complete, let's check: enter the bulid

 cd examples/HelloPangolin
 ./HelloPangolin

insert image description here

The fourth step is to start the code demonstration

In the project->open/import project, import ch2, then click build, wait for the build to complete (generally there will be no problems, if there is a problem, it will be a problem in the program, at this time Baidu) and then click the configuration in the upper left corner to
run Launch Select Add, then add the resulting executable.
insert image description hereIn the same way, import ch3, the same steps, but it may report an error during construction, it may be a path problem, or it may be a code problem. If it is a path problem of the eigen library, there is a solution in the third step. If it is prompted in the pangolin library that the trajectory.txt file cannot be found under the path, just replace the path with an absolute path. If there are /home/自己的home名/slambook2/ch3/examples/trajectory.txt
other errors, because the problems encountered are different, Baidu is recommended.
Demo:
insert image description hereinsert image description hereinsert image description here

Guess you like

Origin blog.csdn.net/m0_56895840/article/details/130957991
Recommended