Ask Your Question
0

Gazebo packages conflict with 2 simulators [closed]

asked 2014-12-01 05:20:47 -0500

courrier gravatar image

updated 2014-12-06 12:30:44 -0500

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 controller_manager_msgs 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}
)
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by 130s
close date 2016-03-24 13:50:54.762762

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-12-02 02:05:32 -0500

gvdhoorn gravatar image

updated 2014-12-03 01:41:36 -0500

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.
edit flag offensive delete link more

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.

courrier gravatar imagecourrier ( 2014-12-02 12:36:47 -0500 )edit

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 [...]"/>
courrier gravatar imagecourrier ( 2014-12-02 12:37:58 -0500 )edit

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.

carlosjoserg gravatar imagecarlosjoserg ( 2015-01-19 06:32:36 -0500 )edit

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?

carlosjoserg gravatar imagecarlosjoserg ( 2015-01-19 06:35:05 -0500 )edit

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.

gvdhoorn gravatar imagegvdhoorn ( 2015-01-19 07:07:49 -0500 )edit
0

answered 2015-01-19 11:10:53 -0500

carlosjoserg gravatar image

updated 2015-01-19 11:11:40 -0500

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>
edit flag offensive delete link more

Comments

You should use catkin_create_pkg macro to create your packages.

DevonW gravatar imageDevonW ( 2015-01-19 15:38:18 -0500 )edit

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

carlosjoserg gravatar imagecarlosjoserg ( 2015-01-19 20:14:17 -0500 )edit
1

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?

gvdhoorn gravatar imagegvdhoorn ( 2015-01-20 01:41:29 -0500 )edit

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

carlosjoserg gravatar imagecarlosjoserg ( 2015-01-20 11:20:45 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-12-01 05:20:47 -0500

Seen: 311 times

Last updated: Jan 19 '15