Robotics StackExchange | Archived questions

Gazebo packages conflict with 2 simulators

Hi all,

I'm installing and compiling Baxter's simulator while I already have other simulators in my workspace, especially a custom robot called rfe. The problem is that both simulations redefine controllermanagermsgs and it creates a conflict (see catkin_make output below).

I created a simulation of this custom robot myself so I may have done something wrong with this (it works well however).

As a temporary workaround I add a CATKIN_IGNORE file into the simulator I want to mute, but I'm wondering what is the clean solution in this case?

Thanks

$ catkin_make
[...]
-- ==> add_subdirectory(baxter_common/baxter_maintenance_msgs)
-- Using these message generators: gencpp;genlisp;genpy
-- baxter_maintenance_msgs: 7 messages, 0 services
-- +++ processing catkin package: 'controller_manager_msgs'
-- ==> add_subdirectory(ros_control/controller_manager_msgs)
-- Using these message generators: gencpp;genlisp;genpy
-- controller_manager_msgs: 3 messages, 6 services
CMake Error at /home/courrier/ros_ws/build/ros_control/controller_manager_msgs/cmake/controller_manager_msgs-genmsg.cmake:83 (add_custom_target):
  add_custom_target cannot create target
  "controller_manager_msgs_generate_messages_cpp" because another target with
  the same name already exists.  The existing target is a custom target
  created in source directory "/home/courrier/ros_ws/src/ros_rfe/rfe_gazebo".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  /opt/ros/hydro/share/genmsg/cmake/genmsg-extras.cmake:299 (include)
  ros_control/controller_manager_msgs/CMakeLists.txt:35 (generate_messages)


CMake Error at /home/courrier/ros_ws/build/ros_control/controller_manager_msgs/cmake/controller_manager_msgs-genmsg.cmake:160 (add_custom_target):
  add_custom_target cannot create target
  "controller_manager_msgs_generate_messages_lisp" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory "/home/courrier/ros_ws/src/ros_rfe/rfe_gazebo".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  /opt/ros/hydro/share/genmsg/cmake/genmsg-extras.cmake:299 (include)
  ros_control/controller_manager_msgs/CMakeLists.txt:35 (generate_messages)


CMake Error at /home/courrier/ros_ws/build/ros_control/controller_manager_msgs/cmake/controller_manager_msgs-genmsg.cmake:237 (add_custom_target):
  add_custom_target cannot create target
  "controller_manager_msgs_generate_messages_py" because another target with
  the same name already exists.  The existing target is a custom target
  created in source directory "/home/courrier/ros_ws/src/ros_rfe/rfe_gazebo".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  /opt/ros/hydro/share/genmsg/cmake/genmsg-extras.cmake:299 (include)
  ros_control/controller_manager_msgs/CMakeLists.txt:35 (generate_messages)


-- +++ processing catkin package: 'baxter_core_msgs'
-- ==> add_subdirectory(baxter_common/baxter_core_msgs)
[...]

EDIT : Deleting build and devel does not change anything, here is my CMakeList for rfe_gazebo:

cmake_minimum_required(VERSION 2.8.3)
project(rfe_gazebo)

find_package(catkin REQUIRED COMPONENTS
  imu_sensor_controller
  force_torque_sensor_controller
  position_controllers
  velocity_controllers
  effort_controllers
  forward_command_controller
  joint_state_controller
  joint_trajectory_controller
  )

catkin_package(
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

Asked by courrier on 2014-12-01 06:20:47 UTC

Comments

Answers

Provided the two controller_manager_msgs packages you have are actually different (and so you need them both in your workspace), your approach with CATKIN_IGNORE is acceptable, albeit a bit error prone / clumsy.

Another option would be to create two separate workspaces: one for your "custom simulator" (?) and one for working with Baxter. By building and sourcing the correct one, you would not get any conflicts anymore. It would however incur some more workspace management overhead (you don't want to be sourcing either one workspace in your .bashrc fi).

A third alternative would ofcourse be to just install controller_manager_msgs from the ROS package repositories (sudo apt-get install ros-DISTRO-controller-manager-msgs) and remove (or permanently CATKIN_IGNORE) the ones in your "custom simulator" and the Baxter directories.


Edit: according to these lines:

add_subdirectory(ros_control/controller_manager_msgs)

and:

The existing target is a custom target created in source directory "/home/courrier/ros_ws/src/ros_rfe/rfe_gazebo".

You have something in the CMakeLists.txt in the rfe_gazebo package that is trying to create a target called controller_manager_msgs_generate_messages_cpp. This suggests you don't have two checkouts of controller_manager_msgs, but the targets are created twice.

Two things:

  1. Delete your build and devel folders, then rebuild everything without any CATKIN_IGNORE anywhere. See if this was a cached build-info issue.
  2. Update your original question with the contents of the CMakeLists.txt of the rfe_gazebo pkg. Please remove any comments in it, just the CMake statements are enough.

Asked by gvdhoorn on 2014-12-02 03:05:32 UTC

Comments

When I say "custom simulator" I mean "gazebo for a custom robot".

The thing is, for robot RFE I don't provide any controller_manager packet, the guilty package rfe_gazebo only contains launchfiles to configure gazebo and some config/yaml files.

Asked by courrier on 2014-12-02 13:36:47 UTC

The only reference I can find is the controller spawner:

rfe_gazebo/launch/rfe_controller.launch:  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" ns="/rfe" args="joint_state_controller ra_x_controller ra_y_controller [...]"/>

Asked by courrier on 2014-12-02 13:37:58 UTC

I'm having the same problem. I'm using Indigo on 14.04 and ros control cloned.

Then, I have a HW interface, and in the CMakeLists.txt I need to add the controller_manager package. When I comment the inclusion of the package it compiles and gives a linking error, naturaly.

Asked by carlosjoserg on 2015-01-19 07:32:36 UTC

The thing is a bit more strange since I have another HW interface from which I copied the CMakeLists.txt and that does not give that error. Any ideas?

Asked by carlosjoserg on 2015-01-19 07:35:05 UTC

Without more information and / or access to that 'coped CMakeLists.txt' we cannot help you. If the issue is sufficiently different, you might want to open a new question and add all the relevant information to it.

Asked by gvdhoorn on 2015-01-19 08:07:49 UTC

Problem solved.

In general, I have the bad habit of forgetting about the package.xml when starting developing a package. In fact, I copied the CMakeLists.txt, and not the package.xml (don't try that at home)

I added the code below and the problem was gone.

<build_depend>controller_interface</build_depend>
<build_depend>hardware_interface</build_depend>
<build_depend>control_toolbox</build_depend>
<build_depend>realtime_tools</build_depend>
<run_depend>controller_interface</run_depend>
<run_depend>hardware_interface</run_depend>
<run_depend>control_toolbox</run_depend>
<run_depend>realtime_tools</run_depend>

Asked by carlosjoserg on 2015-01-19 12:10:53 UTC

Comments

You should use catkin_create_pkg macro to create your packages.

Asked by DevonW on 2015-01-19 16:38:18 UTC

Yes, I know and I usually use it, but still keep forgetting to update the package.xml if add a new dependency. Thanks.

Asked by carlosjoserg on 2015-01-19 21:14:17 UTC

You might be interested in catkin_lint to catch these kind of problems. Also, I'm wondering whether this is actually an answer to the OP?

Asked by gvdhoorn on 2015-01-20 02:41:29 UTC

suppose we will only know if the person that posted the OP says something. however, I was having exactly the same error, but it is also true that it might be caused by another cause. thanks for the catkin_lint link

Asked by carlosjoserg on 2015-01-20 12:20:45 UTC