ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You are on the right track and only need minor assistance. Please read below:
source
command. First of all, because you are in Ubuntu 20.04, you should use ROS Noetic. Therefore, please replace the text kinetic
with noetic
in every command.Next, after installing ROS Noetic, you should be able to source it. For example, you can see ROS-related environment variables after sourcing it, as shown below:
ravi@dell:~$ printenv | grep ROS
ravi@dell:~$ source /opt/ros/noetic/setup.bash
ravi@dell:~$ printenv | grep ROS
ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic
Most importantly, you can notice that ROS_DISTRO
is set to noetic
and ROS_PACKAGE_PATH
is set to the installation directory.
You are good to go if you see a similar output on your side. Now, you can create a workspace as you were doing before. Please see the below commands:
ravi@dell:~$ mkdir -p ~/catkin_ws/src
ravi@dell:~$ cd catkin_ws/
We have created an empty workspace. Now, we should compile it. Before executing catkin_make
, do not forget to source
your ROS installation as shown below:
ravi@dell:~/catkin_ws$ catkin_make
Base path: /home/ravi/catkin_ws
Source space: /home/ravi/catkin_ws/src
Build space: /home/ravi/catkin_ws/build
Devel space: /home/ravi/catkin_ws/devel
Install space: /home/ravi/catkin_ws/install
Creating symlink "/home/ravi/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/noetic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /home/ravi/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/ravi/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/ravi/catkin_ws/install -G Unix Makefiles" in "/home/ravi/catkin_ws/build"
####
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/ravi/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Found PY_em: /usr/lib/python3/dist-packages/em.py
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ravi/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10")
-- Found Threads: TRUE
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ravi/catkin_ws/build
####
#### Running command: "make -j16 -l16" in "/home/ravi/catkin_ws/build"
####
The compilation is done successfully. Now, in order to run any package (right now, we don't have any, nevertheless), first, we need to source
the ROS installation file and then source
the workspace file as shown below:
ravi@dell:~/catkin_ws$ source /opt/ros/noetic/setup.bash
ravi@dell:~/catkin_ws$ source devel/setup.bash
Finally, you can confirm that both of the above source
commands worked well by looking into the ROS_PACKAGE_PATH
environment variable as shown below:
ravi@dell:~/catkin_ws$ printenv | grep ROS
ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/home/ravi/catkin_ws/src:/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=/home/ravi/catkin_ws/devel/share/common-lisp
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic
Notice that ROS_PACKAGE_PATH
points to your workspace and the ROS Noetic installation directories.
2 | No.2 Revision |
You are on the right track and only need minor assistance. Please read below:
source
command. First of all, because you are in Ubuntu 20.04, you should use ROS Noetic. Therefore, please replace the text kinetic
with noetic
in every command.Next, after installing ROS Noetic, you should be able to source it. For example, you can see ROS-related environment variables after sourcing it, as shown below:
ravi@dell:~$ printenv | grep ROS
ravi@dell:~$ source /opt/ros/noetic/setup.bash
ravi@dell:~$ printenv | grep ROS
ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic
Most importantly, you can notice that ROS_DISTRO
is set to noetic
and ROS_PACKAGE_PATH
is set to the installation directory.
You are good to go if you see a similar output on your side. Now, you can create a workspace as you were doing before. Please see the below commands:
ravi@dell:~$ mkdir -p ~/catkin_ws/src
ravi@dell:~$ cd catkin_ws/
We have created an empty workspace. Now, we should compile it. Before executing catkin_make
, do not forget to source
your ROS installation as shown below:
ravi@dell:~/catkin_ws$ source /opt/ros/noetic/setup.bash
ravi@dell:~/catkin_ws$ catkin_make
Base path: /home/ravi/catkin_ws
Source space: /home/ravi/catkin_ws/src
Build space: /home/ravi/catkin_ws/build
Devel space: /home/ravi/catkin_ws/devel
Install space: /home/ravi/catkin_ws/install
Creating symlink "/home/ravi/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/noetic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /home/ravi/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/ravi/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/ravi/catkin_ws/install -G Unix Makefiles" in "/home/ravi/catkin_ws/build"
####
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/ravi/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Found PY_em: /usr/lib/python3/dist-packages/em.py
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ravi/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10")
-- Found Threads: TRUE
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ravi/catkin_ws/build
####
#### Running command: "make -j16 -l16" in "/home/ravi/catkin_ws/build"
####
The compilation is done successfully. Now, in order to run any package (right now, we don't have any, nevertheless), first, we need to source
the ROS installation file and then source
the workspace file as shown below:
ravi@dell:~/catkin_ws$ source /opt/ros/noetic/setup.bash
ravi@dell:~/catkin_ws$ source devel/setup.bash
Finally, you can confirm that both of the above source
commands worked well by looking into the ROS_PACKAGE_PATH
environment variable as shown below:
ravi@dell:~/catkin_ws$ printenv | grep ROS
ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/home/ravi/catkin_ws/src:/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=/home/ravi/catkin_ws/devel/share/common-lisp
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic
Notice that ROS_PACKAGE_PATH
points to your workspace and the ROS Noetic installation directories. directories.