ORB_SLAM2
ORB_SLAM2 copied to clipboard
Saving map and loading the data
Dear @Jiankai-Sun,
Hello, I have used your code for ORB_SLAM2. Jiankai-Sun, thanks for your code. When I have compiled your code, I have faced error:
sami@sami:~/orbslam2_catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build$ make -j
-- Found PythonInterp: /usr/bin/python (found version "2.7.6")
[rosbuild] Building package ORB_SLAM2
[rosbuild] Cached build flags older than manifests; calling rospack to get flags
-- Using CATKIN_DEVEL_PREFIX: /home/sami/orbslam2_catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/devel
-- Using CMAKE_PREFIX_PATH: /home/sami/orbslam2_catkin_ws/devel;/opt/ros/indigo
-- This workspace overlays: /home/sami/orbslam2_catkin_ws/devel;/opt/ros/indigo
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Skip enable_testing() for dry packages
-- Using CATKIN_TEST_RESULTS_DIR: /home/sami/orbslam2_catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/test_results
-- Looking for include file pthread.h
-- Looking for include file 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
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.19
[rosbuild] using multiarch 'x86_64-linux-gnu' for finding Boost
-- Using these message generators: gencpp;genlisp;genpy
[rosbuild] Including /opt/ros/indigo/share/roslisp/rosbuild/roslisp.cmake
[rosbuild] Including /opt/ros/indigo/share/roscpp/rosbuild/roscpp.cmake
[rosbuild] Including /opt/ros/indigo/share/rospy/rosbuild/rospy.cmake
Build type: RelWithDebInfo
-- 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.
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "3.1.0")
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sami/orbslam2_catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build
Scanning dependencies of target rospack_genmsg_libexe
[ 0%] Built target rospack_genmsg_libexe
Scanning dependencies of target rosbuild_precompile
[ 0%] Built target rosbuild_precompile
Scanning dependencies of target Mono
Scanning dependencies of target MonoAR
Scanning dependencies of target RGBD
Scanning dependencies of target Stereo
[ 20%] [ 40%] [ 60%] Building CXX object CMakeFiles/Mono.dir/src/ros_mono.cc.o
Building CXX object CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o
Building CXX object CMakeFiles/Stereo.dir/src/ros_stereo.cc.o
[ 80%] [100%] Building CXX object CMakeFiles/MonoAR.dir/src/AR/ros_mono_ar.cc.o
Building CXX object CMakeFiles/MonoAR.dir/src/AR/ViewerAR.cc.o
Linking CXX executable ../Mono
Linking CXX executable ../RGBD
Linking CXX executable ../Stereo
CMakeFiles/Mono.dir/src/ros_mono.cc.o: In function main': /home/sami/orbslam2_catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_mono.cc:59: undefined reference to
ORB_SLAM2::System::System(std::string const&, std::string const&, ORB_SLAM2::System::eSensor, bool)'
collect2: error: ld returned 1 exit status
CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: In function main': /home/sami/orbslam2_catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc:64: undefined reference to
ORB_SLAM2::System::System(std::string const&, std::string const&, ORB_SLAM2::System::eSensor, bool)'
CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o: In function main': /home/sami/orbslam2_catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_rgbd.cc:62: undefined reference to
ORB_SLAM2::System::System(std::string const&, std::string const&, ORB_SLAM2::System::eSensor, bool)'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make[2]: *** [../Mono] Error 1
make[2]: *** [../RGBD] Error 1
make[2]: *** [../Stereo] Error 1
make[1]: *** [CMakeFiles/Mono.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/RGBD.dir/all] Error 2
make[1]: *** [CMakeFiles/Stereo.dir/all] Error 2
make[1]: *** [CMakeFiles/MonoAR.dir/all] Error 2
make: *** [all] Error 2
I have used Ubuntu 14.04, ROS indigo and OpenCV 2.4.13. I also have tested your code with Ubuntu 16.04, ROS Kinetic and OpenCV 2.4.13.
I think that there is a problem in ros_mono.cc or system.cc file. Is it correct? I do not know where is the problem, exactly. I have tried a lot. your answer is very important to me. I need to save map and the load data.
Please guide me. Thanks.
Hi, same problem happens on me. (Ubuntu 16.04 + ROS Kinect) Has anybody solved this issue ?
xxx@xxx-PC:~/ORB_SLAM2$./build_ros.sh
...
[ 44%] Linking CXX executable ../MonoAR
CMakeFiles/Mono.dir/src/ros_mono.cc.o: In function main': ros_mono.cc:(.text.startup+0x104): undefined reference to
ORB_SLAM2::System::System(std::__cxx11::basic_string<char, std::char_traitsmain': ros_rgbd.cc:(.text.startup+0x111): undefined reference to
ORB_SLAM2::System::System(std::__cxx11::basic_string<char, std::char_traitsmain': ros_stereo.cc:(.text.startup+0xaa8): undefined reference to
ORB_SLAM2::System::System(std::__cxx11::basic_string<char, std::char_traitsmain': ros_mono_ar.cc:(.text.startup+0xbfc): undefined reference to
ORB_SLAM2::System::System(std::__cxx11::basic_string<char, std::char_traits
Hi, I found an error and solved like this. I hope it would help for anybody who has the same problem.
-
~/ORB_SLAM2/build_ros.h - line 6 --cmake .. -DROS_BUILD_TYPE=Release ++cmake .. -DROS_BUILD_TYPE=Release -DUSE_MAP_SAVE_LOAD=1
-
~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/CMakeLists.txt - line 60 ++if(USE_MAP_SAVE_LOAD) ++ ADD_DEFINITIONS(-DFUNC_MAP_SAVE_LOAD) ++endif()
-
~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_mono.cc - line 59 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true,true); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true); ++#endif
-
~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc - line 64 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::STEREO,true); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::STEREO,true,true); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::STEREO,true); ++#endif
-
~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_rgbd.cc - line 62 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::RGBD,true); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::RGBD,true,true); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::RGBD,true); ++#endif
-
~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/AR/ros_mono_ar.cc - line 70 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,false); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,false,false); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,false); ++#endif
Hi, I found an error and solved like this. I hope it would help for anybody who has the same problem.
- ~/ORB_SLAM2/build_ros.h - line 6 --cmake .. -DROS_BUILD_TYPE=Release ++cmake .. -DROS_BUILD_TYPE=Release -DUSE_MAP_SAVE_LOAD=1
- ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/CMakeLists.txt - line 60 ++if(USE_MAP_SAVE_LOAD) ++ ADD_DEFINITIONS(-DFUNC_MAP_SAVE_LOAD) ++endif()
- ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_mono.cc - line 59 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true,true); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true); ++#endif
- ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc - line 64 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::STEREO,true); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::STEREO,true,true); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::STEREO,true); ++#endif
- ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_rgbd.cc - line 62 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::RGBD,true); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::RGBD,true,true); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::RGBD,true); ++#endif
- ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/AR/ros_mono_ar.cc - line 70 -- ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,false); ++#ifdef FUNC_MAP_SAVE_LOAD ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,false,false); ++#else ++ ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,false); ++#endif
@jasonoh231
Thank you
This solution worked for me!