Files
ORB_SLAM3_Win/README.md
Иван Подмогильный ae2b9bb47d Update 'README.md'
2022-01-20 14:37:15 +03:00

5.8 KiB
Raw Blame History

Changed version of ORB_SLAM3 for Windows 10.

Project is provided with already built ORB_SLAM3.lib library. You might want to skip the build part and put the library from lib/ORB_SLAM3.lib to build/Release/ORB_SLAM3.lib

If you downloaded ORB_SLAM3 from the official repository, all you need to do is:

  1. Add unistd.h and getopt.c and getopt.h to include/ folder.
  2. Add void usleep(__int64 usec); to Sytem.h before namespace ORB_SLAM3, and add:
    void usleep(__int64 usec){
    std::this_thread::sleep_for(std::chrono::microseconds(usec));
    }
    to the System.ccfile before namespace ORB_SLAM3.

Prerequisites

Note on Preferences of projects in Visual Studio 2019

  1. You may need to change the Runtime Library of the project frequently. In order to do that, you need to open Preferences -> C/C++ -> Code Generation -> Runtime Library -> MT.
    Further the procedure above will be mentioned just as "Change the Runtime Library to MT"

  2. You may also need to change a lot of the libraries to Static. In order to do that, you need to: General -> Configuration Type -> Static lib (.lib). And in Advanced -> Target File Extension -> .lib Further this procedure will be mentioned as "Change the project to Static"

  3. All of the commands must be executed in the Windows cmd.

Build Boost

  1. bootstrap.bat
  2. .\b2 runtime-link=static

Build DBoW2

  1. mkdir build && cd build
  2. cmake ..
  3. Open Visual Studio 16 2019 with Administrative privilege and open the project
  4. Change the Runtiime Library to MT
  5. Change the project to Static
  6. Build ALL_BUILD

Build g2o

  1. Install Eigen3: vcpkg install eigen3:x64-windows
  2. mkdir build && cd build
  3. cmake -DCMAKE_TOOLCHAIN_FILE=C:/Users/ivan/Source/Repos/ORB_SLAM3/Thirdparty/Pangolin/vcpkg/scripts/buildsystems/vcpkg.cmake .. Instead of my path, you have to paste your path to vcpkg.cmake. Or you may download and configure Eigen3 with CMake. No need to to build. You will just need to include the path to Eigen3.
  4. Open Visual Studio 16 2019 with Administrative privilege and open the project
  5. Change the Runtiime Library to MT
  6. Change the project to Static
  7. Build ALL_BUILD

Build Pangolin

  1. mkdir build && cd build
  2. cmake ..
  3. Open Visual Studio 16 2019 with Administrative (IMPORTANT!) privilege and open the project
  4. Change the Runtiime Library to MT
  5. Change the project to Static
  6. Build project pangolin

Build ORB_SLAM3

  1. mkdir build && cd build
  2. cmake ..
  3. Open Visual Studio 16 2019 with Administrative (IMPORTANT!) privilege and open the project
  4. Change the Runtiime Library to MT
  5. Change the project to Static
  6. Add the path to vcpkg include: C/C++ -> Additional Include Libraries -> C:\Users\ivan\Source\Repos\ORB_SLAM3\Thirdparty\Pangolin\vcpkg\installed\x64-windows\include If vcpkg is installed, the path to Eigen3 will be automatically added to MSVC.
  7. You might need to add path to Boost libs manually to Libraian → General → Additional Library Dependencies: C:\Users\ivan\Source\Repos\ORB-SLAM3forWindows\Thirdparty\boost_1_77_0\stage\lib Automatic boost finding included into the version 1.0
  8. Build ORB_SLAM3 project.

----- Log. -----

Попытка забилдить Pangolin and g2o:

  1. Включены права андминистратора
  2. Ошибка undefined reference to `vasprintf' · Issue #1954 · esp8266/Arduino (github.com) . Фикс и билд библиотеки .dll сработал.

После успешного билда Pangolin, g2o and DBoW2 пробуем билд ORB_SLAM3:

  1. Ошибка undefined usleep: определите функцию c++, usleep() is obsolete, workarounds for Windows/MingW? - Stack Overflow
  2. Установите vcpkg и включите его vcpkg integrate install
  3. Ошибка с OpenCV из Anaconda: попытка переключить на OpenCV3 (c VC15)
  4. Ошибка cannot open include file openssl/md5.h нужно отдельно прописывать в инклуде CMake? Попытка: ручная прописка в Additional Include Directories
  5. Добавлены изменения в ORB_SLAM3 в код MapPoint.cc, пожалуйста, используйте мой исправленный код для билда
  6. Namespace changed from std::tr1 to std.
  7. Test: Linker → Additional Include Directories C:\Users\ivan\Source\Repos\ORB_SLAM3\build; C:\Users\ivan\Source\Repos\ORB_SLAM3\build\Release
  8. Автоматическое появление Release\ORB_SLAM3.lib ???????
  9. Определение usleep в System.cc и System.hpp
  10. Также, обратите внимание на эту ссылку, также по этой ссылке вы найдёте репозиторий, который во многом похож на мои изменения к ORB_SLAM3 для Windows. https://github.com/UZ-SLAMLab/ORB_SLAM3/pull/53

Чек-лист по изменениям в проект в Visual Studio 2019 для билда:

  1. Runtime Library: MT
  2. Static Library
  3. Add (path to vcpkg) manually to Additional Include Directories C:\Users\ivan\Source\Repos\ORB_SLAM3\Thirdparty\Pangolin\vcpkg\installed\x64-windows\include
  4. Add path to Boost libs manually to Linker → General → Additional Library Dependencies: C:\Users\ivan\Source\Repos\ORB-SLAM3forWindows\Thirdparty\boost_1_77_0\stage\lib
  5. From Linker → Input → Additional Dependencies delete Release\oscpack.lib