ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How do I assign joint state publisher nodes to the correct namespaces?

asked 2022-03-04 09:01:08 -0500

JustinPMaio gravatar image

updated 2022-03-08 07:21:46 -0500

lucasw gravatar image

I am trying to have multiple turtlebots navigate on a shared map. I used template codes from The Construct live class #64 along with my own gazebo launch file that spawns the three turtlebots. When I launch my navigation file, I get the following error:

RLException: roslaunch file contains multiple nodes named [/robot_state_publisher].
Please check all <node> 'name' attributes to make sure they are unique.
Also check that $(anon id) use different ids.
The traceback for the exception was written to the log file

I thought I could avoid this error by specifying a "multi_robot_name" as an argument in the launch file, but I still got the error. Here is the navigation launch file I tried to run. I am using ROS Melodic. Many thanks if someone knows how to correct this!

<launch> 
  <!-- Arguments -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="open_rviz" default="true"/>
  <arg name="multi_robot_name" default=""/>
  <arg name="move_forward_only" default="false"/>

  <param name="/use_sim_time" value="true"/>

  <!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="/home/in/sandbox.yaml">
    <param name="frame_id" value="map" />
  </node>



 <!-- Properties of each robot      -->
<include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
    <arg name="multi_robot_name" value="robot1/" />
    <arg name="model" value="waffle_pi" />
  </include>
  <include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
    <arg name="multi_robot_name" value="robot2/" />
    <arg name="model" value="waffle_pi" />
  </include>
  <include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
    <arg name="multi_robot_name" value="robot3/" />
    <arg name="model" value="burger" />
  </include>

  <!-- AMCL      -->
    <include file="$(find MoveOneOfThree)/launch/amcl_robot1.launch"/>
    <include file="$(find MoveOneOfThree)/launch/amcl_robot2.launch"/>
    <include file="$(find MoveOneOfThree)/launch/amcl_robot3.launch"/>

<!-- MOVE_BASE-->
    <include file="$(find MoveOneOfThree)/launch/move_base_1.launch" />
    <include file="$(find MoveOneOfThree)/launch/move_base_2.launch" />
    <include file="$(find MoveOneOfThree)/launch/move_base_3.launch" />

Here is one of the three AMCL files:

<launch>

  <arg name="use_map_topic"   default="false"/>
  <arg name="scan_topic"      default="/robot1/scan"/>
  <arg name="initial_pose_x"  default="0.0"/>
  <arg name="initial_pose_y"  default="0.0"/>
  <arg name="initial_pose_a"  default="0.0"/>
  <arg name="odom_frame_id"   default="/robot1/odom"/>
  <arg name="base_frame_id"   default="/robot1/base_footprint"/>
  <arg name="global_frame_id" default="map"/>

  <node pkg="amcl" type="amcl" name="robot1_amcl">
    <param name="use_map_topic"             value="$(arg use_map_topic)"/>
    <!-- Publish scans from best pose at a max of 10 Hz -->
    <param name="odom_model_type"           value="diff"/>
    <param name="odom_alpha5"               value="0.1"/>
    <param name="gui_publish_rate"          value="10.0"/>
    <param name="laser_max_beams"             value="60"/>
    <param name="laser_max_range"           value="12.0"/>
    <param name="min_particles"             value="500"/>
    <param name="max_particles"             value="2000"/>
    <param name="kld_err"                   value="0.05"/>
    <param name="kld_z"                     value="0.99"/>
    <param name="odom_alpha1"               value="0.2"/>
    <param name="odom_alpha2"               value="0.2"/>
    <!-- translation std dev, m -->
    <param name="odom_alpha3"               value="0.2 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-03-08 07:21:32 -0500

lucasw gravatar image

updated 2022-03-11 17:27:11 -0500

To get past that first error you have to change node names to make them unique, given they are all in the same namespace:

<node pkg="robot_state_publisher" type="robot_state_publisher" name="$(arg model)_robot_state_publisher">

Depending on what is in the description.launch there could be any number of additional node name collisions, unless that launch file already uses model as to alter every node name.

Or you could launch each turtlebot3_remote.launch in a separate namespace

...
<include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch" ns="model3">

But then necessary topics connections could get broken- or topics that are commingled between robots will get separated, so the distinct namespace is the better option.

edit flag offensive delete link more

Comments

Lucas, your answer helped me take a few steps forward but now I've also taken a few steps back. I cannot get the map to transform data over TF. Will publish new question momentarily. Thank you!

JustinPMaio gravatar image JustinPMaio  ( 2022-03-11 17:21:03 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-03-04 09:00:02 -0500

Seen: 552 times

Last updated: Mar 11 '22