6

I have been following the book "Programming Robots with ROS: A Practical Introduction to the Robot Operating System"

In the "Defining a New Message" part of the book we create a new message definition

Example 3-3. Complex.msg
float32 real
float32 imaginary

so we require to modify the package.xml and add the following lines:

<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend> 

but when I run the catkin_make in the catkin_ws directory I get the following error

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

My version:

ii  python-rospkg                                         1.1.4-100                                           all          ROS package library
ii  python-rospkg-modules                                 1.1.4-1                                             all          ROS package library

Here is the full package.xml file

<?xml version="1.0"?>
<package format="2">
  <name>basic</name>
  <version>0.0.0</version>
  <description>The basic package</description>

  <maintainer email="gtkratosman-lap@todo.todo">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>
サルバドル
  • 379
  • 1
  • 6
  • 12
  • I also had to make modifications to the CMakeLists.txt but I think those modifications are not relevant here – サルバドル Nov 15 '17 at 14:26
  • As a side note: There is usually no need to put `rospy` as a *build_depend*, as Python code is not build anyway. Further `message_generation` should be a *build_depend*. – luator Nov 28 '17 at 09:17

2 Answers2

14

You are mixing formats 1 and 2 in your package.xml: <run_depend> is only available in format 1 while in format 2 it should be <exec_depend> (which is not available in format 1).

So in your case simply replace run_depend with exec_depend and it should be good.

For more information about the difference between the formats see the official documentation.

luator
  • 4,769
  • 3
  • 30
  • 51
2

Just omit the format. It is not necessary and breaks your code. Use this template for your package.xml.

<?xml version="1.0"?>
<package>

    <name>basic</name>
    <version>0.0.0</version>
    <description>The basic package</description>

    <maintainer email="gtkratosman-lap@todo.todo">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>

サルバドル
  • 379
  • 1
  • 6
  • 12
maetulj
  • 1,032
  • 1
  • 9
  • 15
  • 2
    When I omit the format, `catkin_make` defaults to version 1, which is even worse. `- The manifest (with format version 1) must not contain the following tags: build_export_depend, exec_depend` – Edward Ned Harvey May 31 '18 at 22:03
  • exec_depend is defined in manifest format version 2. If you want to use it, then use manifest format version 2. – maetulj Jun 01 '18 at 09:48