一直在关注《Programming Robots with ROS: A Practical Introduction to the Robot Operating System》这本书
在本书的“Defining a New Message”部分我们创建了一个新的消息定义
Example 3-3. Complex.msg
float32 real
float32 imaginary
所以我们需要修改package.xml,添加如下几行:
<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend>
但是当我在 catkin_ws 目录中运行 catkin_make 时,出现以下错误
Error(s) in /home/gtkratosman-lap/catkin_ws/src/basic/package.xml:
- The manifest (with format version 2) must not contain the following tags: run_depend
我的版本:
ii python-rospkg 1.1.4-100 all ROS package library
ii python-rospkg-modules 1.1.4-1 all ROS package library
这里是完整的 package.xml 文件
<?xml version="1.0"?>
<package format="2">
<name>basic</name>
<version>0.0.0</version>
<description>The basic package</description>
<maintainer email="[email protected]">gtkratosman-
lap</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>rospy</build_depend>
<run_depend>message_generation</run_depend>
<run_depend>message_runtime</run_depend>
<build_export_depend>rospy</build_export_depend>
<exec_depend>rospy</exec_depend>
<export>
</export>
</package>
您在 package.xml 中混合了格式 1 和格式 2:
<run_depend>
仅在格式 1 中可用,而在格式 2 中应为 <exec_depend>
(在格式 1 中不可用)。
因此,在您的情况下,只需将
run_depend
替换为 exec_depend
就可以了。
有关格式之间差异的更多信息,请参阅官方文档。
只是省略格式。这是没有必要的,并且会破坏您的代码。 将此模板用于您的 package.xml。
<?xml version="1.0"?>
<package>
<name>basic</name>
<version>0.0.0</version>
<description>The basic package</description>
<maintainer email="[email protected]">gtkratosman-lap</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>rospy</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend>
<export>
<!-- Other tools can request additional information be placed here -->
</export>