I tried to create catkin workspace for my ROS project. First I went to the home directory of linux system (Ubuntu 20.04) and create a new folder name Workspaces. Then I opened the Workspaces folder and create a new folder named test_ws under the workspaces. Then I created a new folder named src under the test_ws. Then I went to terminal and typed the command cd Workspaces/test_ws/src/ to follow that path. Then I create a catkin package from the terminal following the command catkin_create_pkg test_pkg roscpp rospy std_msgs sensor_msgs. Then I came back to home directory and entered to the test_pkg to create a folder named scripts. The test_pkg contained include, scripts, src, cmakeList.txt, and package.xml. After that I tried to compile the project using the command catkin_make. I got an error "Command 'catkin_make' not found, but can be installed with: sudo apt install catkin". Then I tried this command on terminal "~/Workspaces/test_ws$ source /opt/ros/foxy/setup.bash". Then tried "~/Workspaces/test_ws$ catkin_make". I again got the previous error. Then I tried "~/Workspaces/test_ws$ sudo apt install catkin" and get the following messages
Reading package lists... Done Building
dependency tree Reading state
information... Done Some packages
could not be installed. This may mean
that you have requested an impossible
situation or if you are using the
unstable distribution that some
required packages have not yet been
created or been moved out of Incoming.
The following information may help to
resolve the situation:
The following packages have unmet dependencies:
catkin : Depends: python3-catkin-pkg (>= 0.4.14-2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
After that I tried "~/Workspaces/test_ws$ sudo apt install ros-foxy-catkin". I received the following messages
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ros-foxy-catkin
Then I tried "sudo apt install ros2-foxy-catkin" I got following messages
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ros2-foxy-catkin
Then I updated the all using sudo apt update and ran the same commands again. The errors remained same. I tried all the solution that I found on web for this error but nothing worked.
I also checked the gcc version which produced "gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 Copyright (C) 2019 Free Software Foundation, Inc."
Following is my ROS version "/Workspaces/test_ws$ echo $ROS_DISTRO foxy "
Based on your comment you're using the wrong build system. Catkin
is the meta build system created for ros1, but for ros2 a new tool has been created called colcon
. Colcon
supports both python and C++ packages and they should be made using the CLI tools. For example:
ros2 pkg create --build-type ament_cmake <package_name>
Will create a cmake
package. Instead of using catkin_make
for a package you would now use colcon build
in your workspace root directory.
For further information you should check out the official documentation.