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

How to view multiple cameras using cv_camera?

asked 2018-04-10 15:54:09 -0500

Coppermind gravatar image

updated 2018-04-11 12:04:54 -0500

Hello, I am a ros newbie that is trying to work with cameras. My question is how can I scale up the use of cv_camera so that I can use multiple cameras at the same time? My understanding is that since cv_camera will try to open the device specified by the device_id parameter, I cannot try to run multiple instances of the node since it will just refer to the same parameter.

Just to test this theory, I tried to run 'rosrun cv_camera cv_camera_node 0' and 'rosrun cv_camera cv_camera_node 1' with two cameras connected, but they just showed the same device. Any insight or advice would be greatly appreciated.

UPDATE: The solution was to use rosrun and specify the device name and a new node name using parameters: e.g. 'rosrun cv_camera cv_camera_node __name:=test _device_id:=1'

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-04-10 20:19:59 -0500

lucasw gravatar image

updated 2018-04-11 18:58:17 -0500

Try this instead:

rosrun cv_camera cv_camera_node _device_id:=0 __name:=cam1
rosrun cv_camera cv_camera_node _device_id:=1 __name:=cam2

You were passing a regular un-named command line argument in and it was getting ignored, and the default camera 0 was getting used.

http://wiki.ros.org/cv_camera#Parameters

edit flag offensive delete link more

Comments

Thank you for the response, When I tried to run both commands in separate terminals, the first node stopped working and posted this error. '[ WARN] [1523458344.803396303]: Reason given for shutdown: [new node registered with same name]'

Coppermind gravatar image Coppermind  ( 2018-04-11 09:51:16 -0500 )edit
1

@Coppermind you have to give the nodes different names otherwise one node gets shut down. See section 3 of http://wiki.ros.org/Remapping%20Argum...

jayess gravatar image jayess  ( 2018-04-11 14:50:29 -0500 )edit
1

I updated the rosruns to provide a __name for each node.

lucasw gravatar image lucasw  ( 2018-04-11 19:48:45 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-10 15:54:09 -0500

Seen: 1,368 times

Last updated: Apr 11 '18