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

Revision history [back]

click to hide/show revision 1
initial version

What I understood was I need to create two different nodes and set the parameters differently to run them.

yes, but not by copying the source ..

I then run them as follows:

rosrun usb_cam usb_cam_node1 _video_device:=/dev/video1 _camera_name:=cam1
rosrun usb_cam usb_cam_node2 _video_device:=/dev/video2 _camera_name:=cam2

[..]

However every time I execute one after the other, I get the following error.

[ WARN] [1458914475.903122037]: Shutdown request received.
[ WARN] [1458914475.903222764]: Reason given for shutdown: [new node registered with same name]

Quite obviously the nodes are different. Not sure what's going wrong.

No. They're actually not different. It's not the name of the .cpp file that needs to be different, it's the node name. And that is set in usb_cam.node.cpp here:

Since you didn't change that, ROS detects that you have two nodes with the same name running, and shuts one of them down.


But changing the sources to run two instances of the same node is not actually required. You just need to configure them properly. See Running 2 different cameras using usb_cam for an example of a launch file that shows how to do that.

What I understood was I need to create two different nodes and set the parameters differently to run them.

yes, but not by copying the source ..

I then run them as follows:

rosrun usb_cam usb_cam_node1 _video_device:=/dev/video1 _camera_name:=cam1
rosrun usb_cam usb_cam_node2 _video_device:=/dev/video2 _camera_name:=cam2

[..]

However every time I execute one after the other, I get the following error.

[ WARN] [1458914475.903122037]: Shutdown request received.
[ WARN] [1458914475.903222764]: Reason given for shutdown: [new node registered with same name]

Quite obviously the nodes are different. Not sure what's going wrong.

No. They're actually not different. It's not the name of the .cpp file that needs to be different, it's the node name. And that is set in usb_cam.node.cpp here:.

Since you didn't change that, ROS detects that you have two nodes with the same name running, and shuts one of them down.


But changing the sources to run two instances of the same node is not actually required. You just need to configure them properly. See Running 2 different cameras using usb_cam for an example of a launch file that shows how to do that.