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

Launching a node two times with same namespace

asked 2017-09-15 06:20:37 -0600

BotLover gravatar image

updated 2017-09-15 15:10:53 -0600

jayess gravatar image

Hi, I am trying to generate left and right images from 2 webcameras. The two images generated topics are then passed to stereo image proc package for disparity and point cloud generation. However for this the namespace of left and right images should be same. The launch file is https://drive.google.com/open?id=0B5T... . I want the images on topics like /camera/left/image_raw and /camera/right/image_raw however the topics now are /camera1/left/image_raw and /camera2/right/image_raw Thanks in advance!


Edit

@huanxiner, I got an error

roslaunch file contains multiple nodes named [/camera/image_view]. 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
edit retag flag offensive close merge delete

Comments

Why don't you just put the two nodes in the same group?

 <group ns="camera">
     ...
 </group>
huanxiner gravatar image huanxiner  ( 2017-09-15 09:39:21 -0600 )edit

@BotLover: could you please post your launch file here so if it gets removed from your Drive we still have it? Thanks.

jayess gravatar image jayess  ( 2017-09-15 10:33:17 -0600 )edit

@huanxiner, I got an error roslaunch file contains multiple nodes named [/camera/image_view]. 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

BotLover gravatar image BotLover  ( 2017-09-15 15:00:18 -0600 )edit

@BotLover: I updated your question with error from your comment.

jayess gravatar image jayess  ( 2017-09-15 15:11:18 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-09-15 09:53:18 -0600

There is some redundancy in your launch file. How about that?

<launch>
 <group ns="camera">
  <node name="left" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video1" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="yuyv" />
    <param name="camera_frame_id" value="yuyv" />
    <param name="io_method" value="mmap"/>
  </node>
  <node name="image_view_left" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/camera/left/image_raw"/>
    <param name="autosize" value="true" />
  </node>
  <node name="right" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video2" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="yuyv" />
    <param name="camera_frame_id" value="yuyv" />
    <param name="io_method" value="mmap"/>
  </node>
  <node name="image_view_right" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/camera/right/image_raw"/>
    <param name="autosize" value="true" />
  </node>  
 </group>
</launch>
edit flag offensive delete link more

Comments

Yes, I tried with this but I got an error stating roslaunch file contains multiple nodes named [/camera/image_view]. 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

BotLover gravatar image BotLover  ( 2017-09-15 14:59:18 -0600 )edit

@BotLover: make sure every node has a unique name. I.e., change the name attribute to be different for every <node> tag.

jayess gravatar image jayess  ( 2017-09-15 15:13:31 -0600 )edit
1

Have you replaced your launch file with my complete code example? Have you noticed, that I changed the names of the "image_view" nodes to "image_view_left" and "image_view_right"?

Andre Volk gravatar image Andre Volk  ( 2017-09-15 15:15:42 -0600 )edit

Wow!!!!! @Andre it works. Can you please explain me the reason for future references?

BotLover gravatar image BotLover  ( 2017-09-15 15:27:39 -0600 )edit

You are welcome. Every node you are running in your ROS environment has to have a unique name. You will have to take care of this, especially if you want to run multiple nodes of the same type. Please see #q61983 for an explanation on the difference between node types and node names.

Andre Volk gravatar image Andre Volk  ( 2017-09-15 15:44:01 -0600 )edit

Thank you so much!

BotLover gravatar image BotLover  ( 2017-09-15 15:48:01 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-09-15 06:20:37 -0600

Seen: 1,102 times

Last updated: Sep 15 '17