UZ-SLAMLab / ORB_SLAM3

ORB-SLAM3: An Accurate Open-Source Library for Visual, Visual-Inertial and Multi-Map SLAM
GNU General Public License v3.0
6.69k stars 2.57k forks source link

Running ORB-SLAM3 with ROS - Problems! #89

Closed ihamieh closed 4 years ago

ihamieh commented 4 years ago

When I try to execute build_ros.sh script, the get the following error message:

Ish@US:~/ORB_SLAM3$ chmod +x build_ros.sh Ish@US:~/ORB_SLAM3$ ./build_ros.sh Building ROS nodes mkdir: cannot create directory ‘build’: File exists [rosbuild] Building package ORB_SLAM3 [rosbuild] Error from directory check: /opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py /home/Ish/ORB_SLAM3/Examples/ROS/ORB_SLAM3 1 Traceback (most recent call last): File "/opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py", line 46, in raise Exception Exception CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/private.cmake:102 (message): [rosbuild] rospack found package "ORB_SLAM3" at "", but the current directory is "/home/Ish/ORB_SLAM3/Examples/ROS/ORB_SLAM3". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order. Call Stack (most recent call first): /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location) CMakeLists.txt:4 (rosbuild_init)

-- Configuring incomplete, errors occurred! See also "/home/Ish/ORB_SLAM3/Examples/ROS/ORB_SLAM3/build/CMakeFiles/CMakeOutput.log". make: *** No targets specified and no makefile found. Stop.

jj-gomez commented 4 years ago

This error comes because you forgot some steps mentioned in the ReadMe related with rose. More specifically:

  1. Add the path including Examples/ROS/ORB_SLAM3 to the ROS_PACKAGE_PATH environment variable. Open .bashrc file:

    gedit ~/.bashrc

    and add at the end the following line. Replace PATH by the folder where you cloned ORB_SLAM3:

    export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM3/Examples/ROS

After doing this, you should be able to compile the ROS examples.

weblucas commented 4 years ago

Easier, if you just want to use it.

https://github.com/VIS4ROB-lab/orb_slam_3_catkin

ihamieh commented 4 years ago

@weblucas @jjgr3496 I was able to run this successfully! Thank you guys ...

owenwijaya177 commented 3 years ago

I did what you told @jjgr3496 but still gives the same error. Any suggestions?

kanishkanarch commented 3 years ago

I did what you told @jjgr3496 but still gives the same error. Any suggestions?

Before executing the script ./build_ros.sh, you should first source your ~/.bashrc file using the command source ~/.bashrc. Now your script will not give the error.

MarcusDudeBro commented 3 years ago

using source ~/.bashrc also doesn't fix the issue for me

Maithilishetty commented 2 years ago

@MarcusDudeBro were you able to fix this issue?

kanishkanarch commented 2 years ago

@MarcusDudeBro were you able to fix this issue?

This issue can be solved by the following method: export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${PWD}/Examples/ROS Run the above command while being present in the ORB_SLAM3 repo. Now running the ./build_ros.sh script won't give any errors.

tungtungyan commented 2 years ago

@MarcusDudeBro were you able to fix this issue?

This issue can be solved by the following method: export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${PWD}/Examples/ROS Run the above command while being present in the ORB_SLAM3 repo. Now running the ./build_ros.sh script won't give any errors.

My result is this. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:/media/ytl/2TB/catkin_orb/src/ORB_SLAM3/Examples/ROS:PATH/ORB_SLAM2_modified/Examples/ROS How can I remove the medium part ? (/media/ytl/2TB/catkin_orb/src/ORB_SLAM3/Examples/ROS)

kanishkanarch commented 2 years ago

You can manually set the path by typing, whatever you want your ROS_PACKAGE_PATH to be. To do this, run the command export ROS_PACKAGE_PATH=/your/desired/paths:/another/path/you/want/to/put:/yet/another/path. Don't source your .bashrc file after doing this or else your path with reset with what is present in the file.

AndrewBloom commented 1 year ago

I can see on ./build_ros.sh cd Examples/ROS/ORB_SLAM3

but this folder is not present on the repo, and seems it is in Examples_old instead

kanishkanarch commented 1 year ago

Please try with Examples_old and see if it works. Make sure you're using the correct branch of the repository.