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

Why define xml will cause multiple nodes named error?

asked 2012-12-09 21:41:49 -0500

sam gravatar image

updated 2012-12-09 21:43:07 -0500

I followed PR2PluggingIn doc.

For example, I have a runable launch file:

  <launch>
     <!-- Set params for sim -->
    <param name="detect_wall_norm/sim" value="True" type="bool"/>
    <param name="detect_outlet/sim" value="True" type="bool"/>

    <param name="r_gripper_controller/gripper_action_node/stall_velocity_threshold" value="0.01" type="double"/>

    <!-- Start PR and load the plug and outlet in the world -->
    <include file="$(find pr2_plugs_gazebo_demo)/launch/pr2_plug_outlet.launch"/>

    <!-- Start the plugs app -->
    <include file="$(find pr2_plugs_actions)/launch/plug_actions.launch"/>

    <!-- ik action -->
    <node pkg="pr2_arm_move_ik" type="arm_ik" name="r_arm_ik" output="screen">
      <param name="joint_trajectory_action" value="r_arm_controller/joint_trajectory_generator" />
      <param name="arm" value="r" />
      <param name="free_angle" value="2" />
      <param name="search_discretization" value="0.01" />
      <param name="ik_timeout" value="5.0" />
    </node>

    <!-- Trajectory generator -->
    <node pkg="joint_trajectory_generator" type="joint_trajectory_generator" output="screen" 
          name="joint_trajectory_generator" ns="r_arm_controller" >
      <param name="max_acc" value="2.0" />
      <param name="max_vel" value="2.5" />
    </node>
    <node pkg="joint_trajectory_generator" type="joint_trajectory_generator" output="screen" 
          name="joint_trajectory_generator" ns="l_arm_controller" >
      <param name="max_acc" value="2.0" />
      <param name="max_vel" value="2.5" />
    </node>

    <!-- tuckarm action -->
    <node pkg="pr2_tuck_arms_action" type="tuck_arms.py" name="tuck_arms_action" output="screen">
      <param name="r_joint_trajectory_action" value="r_arm_controller/joint_trajectory_generator" />
      <param name="l_joint_trajectory_action" value="l_arm_controller/joint_trajectory_generator" />
      <param name="move_duration" value="0.0" />
    </node>



  </launch>

But when I add the following lines:

    <!-- navstack -->
    <include file="$(find pr2_2dnav)/pr2_2dnav.launch" />

I will get error when I running:

  sam@sam:~/code/ros/temp$ optirun roslaunch ./t2.launch 
  ... logging to /home/sam/.ros/log/68f97e50-42ad-11e2-8d06-e0b9a5f829db/roslaunch-sam-26744.log
  Checking log directory for disk usage. This may take awhile.
  Press Ctrl-C to interrupt
  Done checking log file disk usage. Usage is <1GB.

  roslaunch file contains multiple nodes named [/r_arm_controller/joint_trajectory_generator].
  Please check all <node> 'name' attributes to make sure they are unique.
  Also check that $(anon id) use different ids.
  sam@sam:~/code/ros/temp$

How could that possible?

I try to trace pr2_2dnav.launch.

  <launch>
    <include file="$(find pr2_machine)/$(env ROBOT).machine" />
    <include file="$(find pr2_navigation_global)/amcl_node.xml" />
    <include file="$(find pr2_navigation_teleop)/teleop.xml" />
    <include file="$(find pr2_navigation_perception)/lasers_and_filters.xml" />
    <include file="$(find pr2_navigation_perception)/ground_plane.xml" />
    <include file="$(find pr2_navigation_global)/move_base.xml" />
  </launch>

It seems very normal.

I am confused what situation I met.

Is there anything I missing?

How to fix it?

Thank you~

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-12-09 22:57:10 -0500

dornhege gravatar image

The same node occurs twice in the overall launch. This can happen if you include something that defines the same node. You can use roslaunch --find-node to figure out where/if your launch file and the include define this node.

You should disabled/comment the node from one of the launches, so it is only started once.

edit flag offensive delete link more

Comments

1

I can't use --find-node or --nodes or --args to find the node name that happen twice. But I find the xml have the same structure with launch file... Why launch file structure not use the launch extension but use xml extension? Thank you~

sam gravatar image sam  ( 2012-12-11 14:23:18 -0500 )edit

Question Tools

Stats

Asked: 2012-12-09 21:41:49 -0500

Seen: 845 times

Last updated: Dec 09 '12