raulmur / ORB_SLAM2

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

ROS build error for ORB_SLAM2 #603

Closed ujur007 closed 6 years ago

ujur007 commented 6 years ago

I want to build ROS node. I have set the environment variable as follows and also added it to .bashrc. Still I get the errrors as shown bellow. Anyone has idea?

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:home/ujjval/ORB_SLAM2/Examples/ROS/ORB_SLAM2

`ujjval@ujjval-VPCEH18FG:~/ORB_SLAM2$ ./build_ros.sh Building ROS nodes mkdir: cannot create directory ‘build’: File exists [rosbuild] Building package ORB_SLAM2 [rosbuild] Error from directory check: /opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py /home/ujjval/ORB_SLAM2/Examples/ROS/ORB_SLAM2 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_SLAM2" at "", but the current directory is "/home/ujjval/ORB_SLAM2/Examples/ROS/ORB_SLAM2". 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/ujjval/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log". make: *** No targets specified and no makefile found. Stop. `

saikrn112 commented 6 years ago

Hey Rathod, As the line [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ujjval/ORB_SLAM2/Examples/ROS/ORB_SLAM2" indicates your ros environment variable is not setup correctly. After exporting the ROS_PACKAGE_PATH cross verify if it is setup correctly by echo $ROS_PACKAGE_PATH also make sure that you are exporting and running the build_ros.sh in the same terminal.

ujur007 commented 6 years ago

Hello, As far as I know ROS_PACKAGE_PATH should be where the packages are I have set them like follows, still the error persists. ujjval@ujjval-VPCEH18FG:~/ORB_SLAM2$ echo $ROS_PACKAGE_PATH /opt/ros/kinetic:/opt/ros/kinetic/share:home/ujjval/ORB_SLAM2/Examples/ROS/ORB_SLAM2

saikrn112 commented 6 years ago

Did you try rospack find ORB_SLAM2 after setting the ROS_PACKAGE_PATH variable?

ujur007 commented 6 years ago

I checked it but it could not find the ORB_SLAM2 package. So I cloned the SLAM2 library using git in my /opt/ros/kinetic/share folder. then it was able to find the package but the error was not resoved

I saw a similar issue inhttps://github.com/raulmur/ORB_SLAM/issues/39

ujur007 commented 6 years ago

Following the steps shown on the web-page worked for me. closing https://gitlab.tu-berlin.de/breakdowncookie/ORB_SLAM2/tree/a0493c223e41c37032e5c9103f8b4724f1217663

SuperBigBrother commented 6 years ago

Hi~ I'm facing the same error as same as yours~ But when I clicking the website, I see 404... Would you please give me some help~I will appreciate that!!

VitoLing commented 5 years ago

did you have source .bashrc

VitoLing commented 5 years ago

I found the way man ,maybe we are the same situation, don't let the "source /opt/ros/kinetic/setup.bash" as the last line in ~/.bashrc, it will change the $ROS_PACKAGE_PATH, make sure export ${ROS_PACKAGE_PATH}:home/ujjval/ORB_SLAM2/Examples/ROS/ORB_SLAM2 as the last line

pankhurivanjani commented 5 years ago

I am facing the same error but the link given is not opening. Can someone please help in this?

kevinstudyprogram commented 5 years ago

I also encountered this error, how can I do?

nhjydywd commented 3 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

tungtungyan commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

nhjydywd commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

tungtungyan commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method.

echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

However, It still have the problem.

CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

nhjydywd commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method.

echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

However, It still have the problem.

CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

Maybe you should try /ORB_SLAM2/Examples/ROS/ORB_SLAM2 instead of /ORB_SLAM2/Examples/ROS/

nhjydywd commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method.

echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

However, It still have the problem.

CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

tungtungyan commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS However, It still have the problem. CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

I try /ORB_SLAM2/Examples/ROS/ORB_SLAM2, but it is still an error. How can I access that directory through cd ${ORB_SLAM_PATH}?

nhjydywd commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS However, It still have the problem. CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

I try /ORB_SLAM2/Examples/ROS/ORB_SLAM2, but it is still an error. How can I access that directory through cd ${ORB_SLAM_PATH}?

It's a way to check the enviromental variable.Type this command in the terminal: cd ${ORB_SLAM_PATH}, then your terminal are supposed to enter that directory. if your terminal didn't, it means that there is something wrong with your ${ORB_SLAM_PATH}.

tungtungyan commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS However, It still have the problem. CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

I try /ORB_SLAM2/Examples/ROS/ORB_SLAM2, but it is still an error. How can I access that directory through cd ${ORB_SLAM_PATH}?

It's a way to check the enviromental variable.Type this command in the terminal: cd ${ORB_SLAM_PATH}, then your terminal are supposed to enter that directory. if your terminal didn't, it means that there is something wrong with your ${ORB_SLAM_PATH}.

I tried cd ${ORB_SLAM_PATH}, but it did not have any directory. How can I set ${ORB_SLAM_PATH}? Many thanks 🙏

nhjydywd commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS However, It still have the problem. CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

I try /ORB_SLAM2/Examples/ROS/ORB_SLAM2, but it is still an error. How can I access that directory through cd ${ORB_SLAM_PATH}?

It's a way to check the enviromental variable.Type this command in the terminal: cd ${ORB_SLAM_PATH}, then your terminal are supposed to enter that directory. if your terminal didn't, it means that there is something wrong with your ${ORB_SLAM_PATH}.

I tried cd ${ORB_SLAM_PATH}, but it did not have any directory. How can I set ${ORB_SLAM_PATH}? Many thanks 🙏

export ORB_SLAM_PATH={path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 , where {path} is the absolute path of source code folder of ORB_SLAM2

tungtungyan commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS However, It still have the problem. CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

I try /ORB_SLAM2/Examples/ROS/ORB_SLAM2, but it is still an error. How can I access that directory through cd ${ORB_SLAM_PATH}?

It's a way to check the enviromental variable.Type this command in the terminal: cd ${ORB_SLAM_PATH}, then your terminal are supposed to enter that directory. if your terminal didn't, it means that there is something wrong with your ${ORB_SLAM_PATH}.

I tried cd ${ORB_SLAM_PATH}, but it did not have any directory. How can I set ${ORB_SLAM_PATH}? Many thanks 🙏

export ORB_SLAM_PATH={path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 , where {path} is the absolute path of source code folder of ORB_SLAM2

I try it but still have the problem.

In ~/.bashrc, I add the two line. export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 export ORB_SLAM_PATH=/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2

echo $ORB_SLAM_PATH /home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2

However, I deleted all the export lines in ~/.bashrc. The result of echo $ROS_PACKAGE_PATH, show as below: /opt/ros/melodic/share:/media/ytl/2TB/catkin_orb/src/ORB_SLAM3/Examples/ROS

I don't know how to delete it.

nhjydywd commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS However, It still have the problem. CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

I try /ORB_SLAM2/Examples/ROS/ORB_SLAM2, but it is still an error. How can I access that directory through cd ${ORB_SLAM_PATH}?

It's a way to check the enviromental variable.Type this command in the terminal: cd ${ORB_SLAM_PATH}, then your terminal are supposed to enter that directory. if your terminal didn't, it means that there is something wrong with your ${ORB_SLAM_PATH}.

I tried cd ${ORB_SLAM_PATH}, but it did not have any directory. How can I set ${ORB_SLAM_PATH}? Many thanks 🙏

export ORB_SLAM_PATH={path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 , where {path} is the absolute path of source code folder of ORB_SLAM2

I try it but still have the problem.

In ~/.bashrc, I add the two line. export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 export ORB_SLAM_PATH=/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2

echo $ORB_SLAM_PATH /home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2

However, I deleted all the export lines in ~/.bashrc. The result of echo $ROS_PACKAGE_PATH, show as below: /opt/ros/melodic/share:/media/ytl/2TB/catkin_orb/src/ORB_SLAM3/Examples/ROS

I don't know how to delete it.

I remember that /opt/ros/melodic/setup.bash will also export some enviromental variables, maybe you can check that. I‘m not sure because I have uninstalled ROS for a long time😬

tungtungyan commented 2 years ago

I just solved the same problem as you encountered. The cause of the problem is that my ROS_PACKAGE_PATH is wrong. (Although I once thought it was correct) So I strongly reconmend you to check your ROS_PACKAGE_PATH. export ORB_SLAM_PATH={your orb_slam2 path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:${ORB_SLAM_PATH} run command cd ${ORB_SLAM_PATH} in terminal to insure the path is correct. and then you can run ./build_ros.sh

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)

You can redefine the variable: export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS

I try your method. echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS However, It still have the problem. CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:99 (message): [rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.

${ORB_SLAM_PATH} should be configured as the path of ROS directory in ORB_SLAM2 . Can you access that directory through cd ${ORB_SLAM_PATH}?

I try /ORB_SLAM2/Examples/ROS/ORB_SLAM2, but it is still an error. How can I access that directory through cd ${ORB_SLAM_PATH}?

It's a way to check the enviromental variable.Type this command in the terminal: cd ${ORB_SLAM_PATH}, then your terminal are supposed to enter that directory. if your terminal didn't, it means that there is something wrong with your ${ORB_SLAM_PATH}.

I tried cd ORBSLAMPATH,butitdidnothaveanydirectory.HowcanIset{ORB_SLAM_PATH}? Many thanks 🙏

export ORB_SLAM_PATH={path}/ORB_SLAM2/Examples/ROS/ORB_SLAM2 , where {path} is the absolute path of source code folder of ORB_SLAM2

I try it but still have the problem. In ~/.bashrc, I add the two line. export ROS_PACKAGE_PATH=/opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 export ORB_SLAM_PATH=/home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 echo $ORB_SLAM_PATH /home/ytl/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 echo $ROS_PACKAGE_PATH /opt/ros/melodic/share:PATH/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 However, I deleted all the export lines in ~/.bashrc. The result of echo $ROS_PACKAGE_PATH, show as below: /opt/ros/melodic/share:/media/ytl/2TB/catkin_orb/src/ORB_SLAM3/Examples/ROS I don't know how to delete it.

I remember that /opt/ros/melodic/setup.bash will also export some enviromental variables, maybe you can check that. I‘m not sure because I have uninstalled ROS for a long timegrimacing

I had solved by sudo ln -s ~/ORB_SLAM2_modified/Examples/ROS/ORB_SLAM2 /opt/ros/melodic/share/ORB_SLAM2

Mr-brillianter commented 2 years ago

Things get strange. i also encountered this problems but it turned out that roslaunch could auto-complete with TAB, but ROS also could not find it. I also echo the variable and find the right path exists . I am trying to use catkin_make.