ubuntu 无法在ROS foxy上创建工作区

fdx2calv  于 2023-05-22  发布在  其他
关注(0)|答案(1)|浏览(234)

我尝试为我的ROS项目创建柔荑花序工作区。首先,我进入linux系统(Ubuntu 20.04)的主目录,并创建一个新的文件夹名称Workspaces。然后我打开Workspaces文件夹,并在工作区下创建一个名为test_ws的新文件夹。然后我在test_ws下创建了一个名为src的新文件夹。然后我进入终端并输入命令cd Workspaces/test_ws/src/以遵循该路径。然后我从终端按照命令catkin_create_pkg test_pkg roscpp rospy std_msgs sensor_msgs创建一个catkin包。然后我回到主目录,进入test_pkg,创建一个名为scripts的文件夹。test_pkg包含include、scripts、src、cmakeList.txt和package.xml。之后,我尝试使用命令catkin_make编译项目。我得到一个错误“Command 'catkin_make' not found,but can be installed with:sudo apt install catkin".然后我在终端“~/Workspaces/test_ws$ source /opt/ros/foxy/setup.bash"上尝试了这个命令。然后尝试“~/Workspaces/test_ws$ catkin_make"。我又犯了以前的错误。然后我尝试“~/Workspaces/test_ws$ sudo apt install catkin”并得到以下消息

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.

之后我尝试了“~/Workspaces/test_ws$ sudo apt install ros-foxy-catkin"。我收到了以下信息

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ros-foxy-catkin

然后我尝试“sudo apt install ros 2-foxy-catkin”我得到以下消息

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ros2-foxy-catkin

然后我使用sudo apt update更新了all,并再次运行相同的命令。错误仍然相同。我尝试了所有的解决方案,我在网上找到这个错误,但没有工作。
我还检查了生成“gcc(Ubuntu 9.4.0- 1ubuntu 1 ~20.04.1)9.4.0 Copyright(C)2019 Free Software Foundation,Inc”的gcc版本。
下面是我的ROS版本“/Workspaces/test_ws$ echo $ROS_DISTROfoxy

bvk5enib

bvk5enib1#

根据您的评论,您使用了错误的构建系统。Catkin是为 ros1 创建的 meta构建系统,但为ros2创建了一个名为colcon的新工具。Colcon支持python和C++包,它们应该使用CLI工具创建。例如:

ros2 pkg create --build-type ament_cmake <package_name>

将创建一个cmake包。您现在可以在工作区根目录中使用colcon build,而不是将catkin_make用于包。
有关详细信息,请查看the official documentation.

相关问题