Tried to advertise a service that is already advertised in this node [/leo/controller_manager/list_controllers]

asked 2021-01-19 21:28:50 -0500

I'm trying to do a multi agent simulation using leo_rover which is open source. I'm comfortable with single system, but when I add a second robot using namespaces i get the second robot spawned in the gazebo exactly where i want, but the controllers for the two agents try to get published at the same node location. In the end neither of the controller spawns and I'm left with rovers without controllers.

This is the rover.launch file.

<launch>
   <arg name="init_pose"/>
   <arg name="robot_name"/>
   <param name="robot_description" command="$(find xacro)/xacro $(find leo_description)/urdf/new.urdf.xacro" />

   <!-- push robot_description to factory and spawn robot in gazebo -->
   <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
    args="$(arg init_pose) -unpause -urdf -model $(arg robot_name) -param /robot_description" respawn="false" output="screen"/>

  <node pkg="robot_state_publisher" type="robot_state_publisher"  name="robot_state_publisher" ns="leo">
      <param name="publish_frequency" type="double" value="30.0" />
  </node>

  <include file="$(find leo_control)/launch/control.launch">
   <!-- TODO: add possible arguments for depth camera, etc.-->
  </include>

</launch>

This is the control.launch used in the rover.launch

<launch>


  <arg name="use_tf_static" default="false"/>
  <arg name="model" default="$(find leo_description)/urdf/new.urdf.xacro"/>

  <!-- Load controller configuration />-->
  <rosparam command="load" file="$(find leo_control)/config/control.yaml" />

  <node name="controller_spawner" pkg="controller_manager" type="spawner"
    respawn="false" args="leo_velocity_controller leo_joint_publisher" output="screen" ns="leo"/>

</launch>

Below launch file tries to add 2rovers into the simulation using namespaces.

<launch>
  <!-- No namespace here as we will share this description. 
      Access with slash at the beginning -->
  <param name="robot_description" command="$(find xacro)/xacro $(find leo_description)/urdf/new.urdf.xacro" />

  <!-- BEGIN ROBOT 1-->
  <group ns="rover1">
    <param name="tf_prefix" value="rover1_tf" />
    <include file="$(find btp)/launch/rover.launch" >
      <arg name="init_pose" value="-x 0 -y 0 -z 0" />
      <arg name="robot_name"  value="Robot1" />
    </include>
  </group>

  <!-- BEGIN ROBOT 2-->
  <group ns="rover2">
    <param name="tf_prefix" value="rover2_tf" />
    <include file="$(find btp)/launch/rover.launch" >
      <arg name="init_pose" value="-x -2 -y 0 -z 0" />
      <arg name="robot_name"  value="Robot2" />
    </include>
  </group>
</launch>

Below multisim.launch file combines all these launches.

<launch>
   <arg name="world_name" default="worlds/empty.world"/>

   <include file="$(find gazebo_ros)/launch/empty_world.launch">
     <arg name="world_name" value="$(arg world_name)"/> <!-- world_name is wrt GAZEBO_RESOURCE_PATH environment variable -->
     <arg name="paused" value="false"/>
     <arg name="use_sim_time" value="true"/>
     <arg name="gui" value="true"/>
     <arg name="headless" value="false"/>
     <arg name="debug" value="true"/>
     <arg name="verbose" value="true"/>
   </include>
   <!-- start gui -->
   <!-- <node name="gazebo_gui" pkg="gazebo" type="gui" respawn="false" output="screen"/> -->

   <!-- include our robots -->
   <include file="$(find btp)/launch/multi_rover.launch"/>
</launch>

Now the error why I launch this multisim.launch file.

[ERROR] [1611075925.200755903, 0.394000000]: Tried to advertise a service that is already advertised in this node [/leo/controller_manager/list_controllers]
[ERROR] [1611075925.200778314, 0.394000000]: Tried to advertise a service that is already advertised in this node [/leo/controller_manager/list_controller_types]
[ERROR] [1611075925.200811448, 0.394000000]: Tried to advertise a service that is already advertised in this node [/leo/controller_manager/load_controller]
[ERROR] [1611075925.200824730, 0.394000000]: Tried to ...
(more)
edit retag flag offensive close merge delete