Running two nodes for two webcams with usb_cam
I'm trying to run two different webcams. What I understood was I need to create two different nodes and set the parameters differently to run them. Both are Logitech C270 cameras.
What I did was copy the usb_cam_node.cpp file to usb_cam_node1.cpp and usb_cam_node2.cpp. 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
I added executables to the CMakeList.txt as follows:
add_executable(${PROJECT_NAME}_node1 nodes/usb_cam_node1.cpp)
add_executable(${PROJECT_NAME}_node2 nodes/usb_cam_node2.cpp)
target_link_libraries(${PROJECT_NAME}_node1
${PROJECT_NAME}
${avcodec_LIBRARIES}
${swscale_LIBRARIES}
${catkin_LIBRARIES}
)
target_link_libraries(${PROJECT_NAME}_node2
${PROJECT_NAME}
${avcodec_LIBRARIES}
${swscale_LIBRARIES}
${catkin_LIBRARIES}
)
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.