multiple robots spawn issue

asked 2020-06-18 03:36:30 -0600

Dale gravatar image

updated 2020-06-18 03:53:38 -0600

gvdhoorn gravatar image

Hi, I am studying ROS with Kuka Kr6r900sixx through this (https://github.com/SebNag/kuka_kr6r90...) and I also saw this Youtube Video : https://www.youtube.com/watch?v=IC33S...

when I started to spawn two kuka robot , there is two issues broke out.

first, I can't find my (namespace)/link 1,2,3,4 ...

I think this issue came from "robot_state_publisher" can not read tf

Second, 'Tried to advertise a service that is already advertised in this node [/controller_manager/reload_controller_libraries]' error occur when I start my start.launch

here is my source code, no audit just refer and use upload git link kuka sources

start.launch

<?xml version="1.0" encoding="UTF-8"?>

<launch>
  <arg name="paused" default="false"/>
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
  <arg name="world_name" value="worlds/empty.world"/>
  <arg name="gui" value="true" />
  <arg name="paused" value="$(arg paused)"/>
</include>

  <group ns="robot1">
    <param name="tf_prefix" value="robot1_tf" />
    <include file="$(find kr6r900sixx_dual)/launch/kr6r900sixx_robot.launch">
      <arg name="robot_name" value="robot1" />
      <arg name="x" value="0" /> <!-- -0.388079 -->
      <arg name="y" value="0" /> <!-- -2.716179 -->
      <arg name="z" value="0" /> <!-- 1.002342 -->
      <arg name="yaw" value="0" />  <!-- 2.581257 -->
    </include>
  </group>

  <group ns="robot2">
    <param name="tf_prefix" value="robot2_tf" />
    <include file="$(find kr6r900sixx_dual)/launch/kr6r900sixx_robot.launch">
      <arg name="robot_name" value="robot2" />
      <arg name="x" value="0" /> <!-- -0.388079 -->
      <arg name="y" value="3" /> <!-- -2.716179 -->
      <arg name="z" value="0" /> <!-- 1.002342 -->
      <arg name="yaw" value="0" />  <!-- 2.581257 -->
    </include>
  </group>
</launch>

kr6r900sixx_robot.launch

<?xml version="1.0" encoding="UTF-8"?>

<launch>

    <arg name="limited" default="false"  doc="If true, limits joint range [-PI, PI] on all joints." />
    <arg name = "robot_name" />
    <arg name = "x" default ="0.0" />
    <arg name = "y" default ="0.0" />
    <arg name = "z" default ="0.0" />
    <arg name = "roll" default ="0.0" />
    <arg name = "pitch" default ="0.0" />
    <arg name = "yaw" default ="0.0" />

    <!-- remap topics to conform to ROS-I specifications -->
    <remap from="$(arg robot_name)/arm_controller/follow_joint_trajectory" to="$(arg robot_name)/joint_trajectory_action" />
    <remap from="$(arg robot_name)/arm_controller/state" to="$(arg robot_name)/feedback_states" />
    <remap from="$(arg robot_name)/arm_controller/command" to="$(arg robot_name)/joint_path_command"/>
    <!-- urdf xml robot description loaded on the Parameter Server, converting the xacro into a proper urdf file-->
    <!-- include file="$(find kuka_kr6_gazebo)/launch/load_kr6r900sixx.launch" /-->
    <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find kuka_kr6_gazebo)/urdf/kuka_kr6r900sixx.xacro'" />

    <node name="spawn_gazebo_model" 
            pkg="gazebo_ros" 
            type="spawn_model" 
            respawn="false" 
            output="screen"
            args="
            -urdf 
            -param robot_description
            -model $(arg robot_name) 
            -x $(arg x) 
            -y $(arg y) 
            -z $(arg z) 
            -R $(arg roll) 
            -P $(arg pitch)
            -Y $(arg yaw) 
            " />

      <!-- convert joint states to TF transforms for rviz, etc -->
      <node name="robot_state_publisher" pkg ...
(more)
edit retag flag offensive close merge delete

Comments

First thing I've noticed is that you launch the node robot_state_publisher within kr6r900sixx_robot.launch which is called twice. You can only have one node robot_state_publisher so launching it in start.launch should be better.

Delb gravatar image Delb  ( 2020-06-18 04:24:03 -0600 )edit

so, you means that I should have to put "robot_state_publisher" node into the 'start.launch' ?

<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen"> </node>

Dale gravatar image Dale  ( 2020-06-18 04:28:29 -0600 )edit

Yes. You can't launch this node twice, even if it's another group and with a different name.

Delb gravatar image Delb  ( 2020-06-18 04:41:30 -0600 )edit

ohm, well I thought group tag and tf_prefix can make launch node individual, and another Question is why my xacro robot model cannot launch tf link 1,2,3,4 ... ?

Dale gravatar image Dale  ( 2020-06-18 06:17:12 -0600 )edit

@Delb wrote:

Yes. You can't launch this node twice, even if it's another group and with a different name.

I don't want to detract from the main topic here, but you can certainly start robot_state_publisher twice -- or more times. There's nothing special about the RSP, it just transforms JointStates into TFMessages via FK + the URDF. And multiple publishers to /tf is perfectly fine, as long as you take care of clashes (ie: don't publish conflicting information about frames from two different RSPs).

@Dale:

well I thought group tag and tf_prefix can make launch node individual,

it's not about the group tag, but the namespace and/or name of the node. And tf_prefix can indeed be used to avoid clashes (although it's deprecated).

gvdhoorn gravatar image gvdhoorn  ( 2020-06-18 06:25:56 -0600 )edit

then , gvdhoorn, I have a question about the my link model. my link model doesn't browse the all state of model. why does it happen?

Dale gravatar image Dale  ( 2020-06-18 17:54:33 -0600 )edit
1

I don't understand what you are saying.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-19 15:33:42 -0600 )edit