raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.2k stars 4.69k forks source link

Fail in building with ROS #250

Open Kanelankai opened 7 years ago

Kanelankai commented 7 years ago

Hello, everyone! I have succeeded in building and testing it with monocular examples. Now I want to run it with ROS examples. However, when I built the nodes for mono, errors occurred after executing build_ros.sh. The error information is as follows: ///////////////////////////////////////////////////////////////////////////////////////////// Scanning dependencies of target Mono [ 20%] Building CXX object CMakeFiles/Mono.dir/src/ros_mono.cc.o In file included from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../Thirdparty/g2o/g2o/types/../core/optimizable_graph.h:41:0, from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../Thirdparty/g2o/g2o/types/../core/base_vertex.h:30, from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h:34, from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../include/LoopClosing.h:34, from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../include/LocalMapping.h:26, from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../include/Tracking.h:31, from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../include/System.h:29, from /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_mono.cc:32: /home/dars/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/../../../Thirdparty/g2o/g2o/types/../core/jacobian_workspace.h:30:22: fatal error: Eigen/Core: No such file or directory

include <Eigen/Core>

                  ^

compilation terminated. make[2]: [CMakeFiles/Mono.dir/src/ros_mono.cc.o] Error 1 make[1]: [CMakeFiles/Mono.dir/all] Error 2 make: *** [all] Error 2 ////////////////////////////////////////////////////////////////////////////////////// Does anyone know where the problem is? Thank you very much!

pisuto commented 7 years ago

why i can't find build_ros.sh? Did I lose something?

Kanelankai commented 7 years ago

The build_ros.sh is in the ORB_SLAM2 file. It has the same path with build.sh.

在 2017年2月12日,23:29,pisuto notifications@github.com<mailto:notifications@github.com> 写道:

why i can't find build_ros.sh? Did I lose something?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279222176, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYIMX5S2hlq_zTUq-I2ZZ3Cpz_NM3WsZks5rbxdHgaJpZM4L15iA.

pisuto commented 7 years ago

I find it. But I met the same problem when executing it. compilation terminated. make[2]: [CMakeFiles/Mono.dir/src/ros_mono.cc.o] 错误 1 make[1]: [CMakeFiles/Mono.dir/all] 错误 2 make[1]: 正在等待未完成的任务.... make[2]: [CMakeFiles/MonoAR.dir/src/AR/ros_mono_ar.cc.o] 错误 1 make[1]: [CMakeFiles/MonoAR.dir/all] 错误 2 make[2]: [CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o] 错误 1 make[1]: [CMakeFiles/RGBD.dir/all] 错误 2 make[2]: [CMakeFiles/Stereo.dir/src/ros_stereo.cc.o] 错误 1 make[1]: [CMakeFiles/Stereo.dir/all] 错误 2 make: [all] 错误 2

Kanelankai commented 7 years ago

I can't confirm if your problem is the same with me. In my case, "fatal error: Eigen/core :no such file or directory" is why this problem happens. Some blogs say that since orbslam2 uses Eigen 3, you can add a link to the path of Eigen 3/Eigen/core to solve this problem. I can't remember the command of adding the link. If you google "fatal error: Eigen/core :no such file or directory", I think you can find the same blog. Good luck!

发自我的 iPhone

在 2017年2月12日,23:54,pisuto notifications@github.com<mailto:notifications@github.com> 写道:

I find it. But I met the same problem when executing it. compilation terminated. make[2]: [CMakeFiles/Mono.dir/src/ros_mono.cc.o] 错误 1 make[1]: [CMakeFiles/Mono.dir/all] 错误 2 make[1]: 正在等待未完成的任务.... make[2]: [CMakeFiles/MonoAR.dir/src/AR/ros_mono_ar.cc.o] 错误 1 make[1]: [CMakeFiles/MonoAR.dir/all] 错误 2 make[2]: [CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o] 错误 1 make[1]: [CMakeFiles/RGBD.dir/all] 错误 2 make[2]: [CMakeFiles/Stereo.dir/src/ros_stereo.cc.o] 错误 1 make[1]: [CMakeFiles/Stereo.dir/all] 错误 2 make: [all] 错误 2

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279223627, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYIMX7eDJJ3Fooi1OpwkqytU4ZgqhScoks5rbx0TgaJpZM4L15iA.

pisuto commented 7 years ago

thx.I will try.来自我的华为手机-------- 原始邮件 --------主题:Re: [raulmur/ORB_SLAM2] Fail in building with ROS (#250)发件人:Kanelankai 收件人:raulmur/ORB_SLAM2 抄送:pisuto ,Comment I can't confirm if your problem is the same with me. In my case, "fatal error: Eigen/core :no such file or directory" is why this problem happens. Some blogs say that since orbslam2 uses Eigen 3, you can add a link to the path of Eigen 3/Eigen/core to solve this problem. I can't remember the command of adding the link. If you google "fatal error: Eigen/core :no such file or directory", I think you can find the same blog. Good luck!

发自我的 iPhone

在 2017年2月12日,23:54,pisuto notifications@github.com<mailto:notifications@github.com> 写道:

I find it.

But I met the same problem when executing it.

compilation terminated.

make[2]: *** [CMakeFiles/Mono.dir/src/ros_mono.cc.o] 错误 1

make[1]: *** [CMakeFiles/Mono.dir/all] 错误 2

make[1]: *** 正在等待未完成的任务....

make[2]: *** [CMakeFiles/MonoAR.dir/src/AR/ros_mono_ar.cc.o] 错误 1

make[1]: *** [CMakeFiles/MonoAR.dir/all] 错误 2

make[2]: *** [CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o] 错误 1

make[1]: *** [CMakeFiles/RGBD.dir/all] 错误 2

make[2]: *** [CMakeFiles/Stereo.dir/src/ros_stereo.cc.o] 错误 1

make[1]: *** [CMakeFiles/Stereo.dir/all] 错误 2

make: *** [all] 错误 2

You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHubhttps://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279223627, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYIMX7eDJJ3Fooi1OpwkqytU4ZgqhScoks5rbx0TgaJpZM4L15iA.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/raulmur/ORB_SLAM2","title":"raulmur/ORB_SLAM2","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/raulmur/ORB_SLAM2"}},"updates":{"snippets":[{"icon":"PERSON","message":"@Kanelankai in #250: I can't confirm if your problem is the same with me. In my case, \"fatal error: Eigen/core :no such file or directory\" is why this problem happens. Some blogs say that since orbslam2 uses Eigen 3, you can add a link to the path of Eigen 3/Eigen/core to solve this problem. I can't remember the command of adding the link. If you google \"fatal error: Eigen/core :no such file or directory\", I think you can find the same blog. Good luck!\r\n\r\n发自我的 iPhone\r\n\r\n在 2017年2月12日,23:54,pisuto \u003cnotifications@github.com\u003cmailto:notifications@github.com\u003e\u003e 写道:\r\n\r\n\r\nI find it.\r\nBut I met the same problem when executing it.\r\ncompilation terminated.\r\nmake[2]: [CMakeFiles/Mono.dir/src/ros_mono.cc.o] 错误 1\r\nmake[1]: [CMakeFiles/Mono.dir/all] 错误 2\r\nmake[1]: 正在等待未完成的任务....\r\nmake[2]: [CMakeFiles/MonoAR.dir/src/AR/ros_mono_ar.cc.o] 错误 1\r\nmake[1]: [CMakeFiles/MonoAR.dir/all] 错误 2\r\nmake[2]: [CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o] 错误 1\r\nmake[1]: [CMakeFiles/RGBD.dir/all] 错误 2\r\nmake[2]: [CMakeFiles/Stereo.dir/src/ros_stereo.cc.o] 错误 1\r\nmake[1]: [CMakeFiles/Stereo.dir/all] 错误 2\r\nmake: [all] 错误 2\r\n\r\n—\r\nYou are receiving this because you authored the thread.\r\nReply to this email directly, view it on GitHub\u003chttps://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279223627\u003e, or mute the thread\u003chttps://github.com/notifications/unsubscribe-auth/AYIMX7eDJJ3Fooi1OpwkqytU4ZgqhScoks5rbx0TgaJpZM4L15iA\u003e.\r\n"}],"action":{"name":"View Issue","url":"https://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279224600"}}}

pisuto commented 7 years ago

I find one.But I dont't know where I should change the code. fatal error: Eigen/Core: No such file or directory - ROS Answers: Open Source Q&A Forum http://answers.ros.org/question/44140/fatal-error-eigencore-no-such-file-or-directory/ Do you understand the method of the first answer?

Kanelankai commented 7 years ago

I solved it by executing the following: sudo ln -s /usr/include/eigen3/Eigen /usr/local/include/Eigen You can see the details from the following URL: http://askubuntu.com/questions/491067/eigen-installation-seemed-to-work-but-i-still-cant-make-eigen-work @pisuto

pisuto commented 7 years ago

Thank you! I solved my problem by executing the code you provide!

pisuto commented 7 years ago

Sorry,I met another problem.Can you help me? When I executed the code:rosrun ORB_SLAM2 MonoAR PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE I met: [ERROR] [1486956228.917143261]: [registerPublisher] Failed to contact master at [localhost:11311]. Retrying...

Kanelankai commented 7 years ago

Maybe you didn't launch your monocular camera or didn't run a roscore. I'm sorry but I'm not very familiar with this kind of problems.....

On 2017/02/13 12:26, pisuto wrote:

Sorry,I met another problem.Can you help me? When I executed the code:rosrun ORB_SLAM2 MonoAR PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE I met: [ERROR] [1486956228.917143261]: [registerPublisher] Failed to contact master at [localhost:11311]. Retrying...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279286342, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYIMX6bdL7Y-cnbthmAu4C5S3EQNANlJks5rb81jgaJpZM4L15iA.

pisuto commented 7 years ago

Sorry,I think I may bother you. Now I can execute the example,but when executing Mono,I see a black window lining WAITING FOR IMAGES. I want to know how to see the images.I try to use usb_cam,but I can't find a correct method. Can you give me some suggestions or tutorials?

Kanelankai commented 7 years ago

That's OK. Please don't mind.

Can you acquire the rgb image through your usb camera without using ORB-SLAM2?

If you cannot, I think you'd better check whether the driver of your camera has been installed or not.

Otherwise, I found that you can only use a Kinect or Xtion in RGBD mode, or an ordinary usb camera in mono mode due to the default settings. Since I haven't seen the contents of the code I have no idea about the details of these settings.

I succeeded in SLAM with ROS in RGBD mode with Xtion camera, When I executed it in Mono mode with an ordinary usb camera, I could only obtain images from the camera but failed to initialize. I haven't fixed this problem.

On 2017/02/14 11:36, pisuto wrote:

Sorry,I think I may bother you. Now I can execute the example,but when executing Mono,I see a black window lining WAITING FOR IMAGES. I want to know how to see the images.I try to use usb_cam,but I can't find a correct method. Can you give me some suggestions or tutorials?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279590533, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYIMX8sbwYnaL5uMgUAr_0At-Y8DYK4Gks5rcRNAgaJpZM4L15iA.

pisuto commented 7 years ago

I execute:rosrun usb_cam usb_cam_node I can success the camera without ORB_SLAM2. But when using ORB_SLAM2,it shows WAITING FOR IMAGES. I don't know "a monocular input from topic /camera/image_raw run node ORB_SLAM2/Mono"means. I think my problem occur because of this. Can you help me?

Kanelankai commented 7 years ago

When you run the monocular examples, did you replace "PATH_TO_VOCABULARY" and "PATH_TO SETTINGS_FILE" with your own information? If you had already done it when running the codes, I'm sorry but I have no idea as well.

On 2017/02/14 12:29, pisuto wrote:

I execute:rosrun usb_cam usb_cam_node I can success the camera without ORB_SLAM2. But when using ORB_SLAM2,it shows WAITING FOR IMAGES. I don't know "a monocular input from topic /camera/image_raw run node ORB_SLAM2/Mono"means. I think my problem occur because of this. Can you help me?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/raulmur/ORB_SLAM2/issues/250#issuecomment-279597845, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AYIMX7hX04d5s8hLOdAtWOiHnCFDJqOgks5rcR-bgaJpZM4L15iA.

pisuto commented 7 years ago

Yes,I have already replaced these.I may try other method. I am not familiar with ROS. So I think I should learn its tutorials first. Thank you again.

pisuto commented 7 years ago

I solved my problem.The original location which images are got from:/camera/image_raw doesn't match with the location where images are saved by usb camera. I made them same.Then done.

wertig0n commented 7 years ago

Hi!

Sorry for hijacking but I have a similar problem. First it would not find the eigen sources, but doing the symlink trick mentioned earlier in the thread worked for that.

Now I have problem number 2, which is that the linker will not find the opencv libraries for some unknown reason. I'm running Ubuntu 16.10 with ROS kinetic. I could compile everything fine before I installed ROS, but after I installed ROS I get this (only showing first error message, if you want full log I can pastebin it):

[ 81%] Linking CXX executable ../Examples/Stereo/stereo_kitti CMakeFiles/mono_tum.dir/Examples/Monocular/mono_tum.cc.o: In function main': mono_tum.cc:(.text.startup+0x504): undefined reference tocv::imread(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, int)'

Probably a very simple fix as well, but I do not know which line to alter.

Edit:

Further research shows that it has include dirs mixed up, so symlinking and installing the proper package fixed it. That is, to solve two problems, I did:

sudo apt-get install ros-kinetic-opencv3 sudo ln -s /usr/include/eigen3/Eigen /usr/local/include/Eigen sudo ln -s /opt/ros/kinetic/include/opencv-3.1.0-dev /usr/include/opencv-3.1.0-dev

I still have the above problem though. :(