How to launch 2 different camera at the same time using uvc_camera_node
I am currently using 2 logicool BRIO web camera. The program launched perfectly when it was just 1 camera using below code
<?xml version="1.0"?>
<!-- camera param -->
<!-- type 0:file 1:topic (CameraInfo) -->
<param name="campara_type" value="0"/>
<!-- camera param file -->
<param name="cam_param_file" value="$(find lenti_mark)/Data/CameraParams/20.txt"/>
<!-- debug (RViz) -->
<!--TF frame_id world -->
<param name="world_flg" value="true" />
<!-- camera position -->_AL
<param name="cam_pos_x" value="0.0" />
<param name="cam_pos_y" value="0.0" />
<param name="cam_pos_z" value="0.3" />
<node name="uvc_camera" pkg="uvc_camera" type="uvc_camera_node" output="screen">
<param name="device" type="string" value="/dev/video6"/>
<param name="width" value="1920"/>
<param name="height" value="1080"/>
<param name="pixel_format" value="MJPG"/>
<param name="fps" value="30"/>
<param name="focus_auto" value="0" />
<param name="frame_id" value="camera_right"/>
But when I modified those code with below code to launched 2 camera at the same time, the code went error.
<group ns="camera_right">
<node name="uvc_camera" pkg="uvc_camera" type="uvc_camera_node" output="screen">
<param name="device" type="string" value="/dev/video6"/>
<param name="width" value="1920"/>
<param name="height" value="1080"/>
<param name="pixel_format" value="MJPG"/>
<param name="fps" value="30"/>
<param name="focus_auto" value="0" />
<param name="frame_id" value="camera_right"/>
<remap from="image_raw" to="image_rawR">
</remap>
</node>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find lenti_mark)/launch/leag.rviz"/>
</group>
<group ns="camera_left">
<node name="uvc_camera" pkg="uvc_camera" type="uvc_camera_node" output="screen">
<param name="device" type="string" value="/dev/video2"/>
<param name="width" value="1920"/>
<param name="height" value="1080"/>
<param name="pixel_format" value="MJPG"/>
<param name="fps" value="30"/>
<param name="focus_auto" value="0" />
<param name="frame_id" value="camera_left"/>
<remap from="image_raw" to="image_rawL">
</remap>
</node>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find lenti_mark)/launch/leag.rviz"/>
</group>
This is the error messages
terminate called after throwing an instance of 'std::runtimeerror' what(): couldn't dequeue buffer select timeout in grab [cameraleft/uvccamera-5] process has died [pid 5795, exit code -6, cmd /opt/ros/melodic/lib/uvccamera/uvccameranode imageraw:=imagerawL _name:=uvccamera _log:=/home/member/.ros/log/6372719c-069e-11ee-8ece-e4a7a0e56889/cameraleft-uvccamera-5.log]. log file: /home/member/.ros/log/6372719c-069e-11ee-8ece-e4a7a0e56889/cameraleft-uvc_camera-5*.log
I already make sure the dev/video number, so I think the problem is not there. I really appreciate if anyone has a clue regarding to this problem.
Asked by nemunatu on 2023-06-09 03:28:43 UTC
Comments
That error looks to me like something else already had the camera /dev device open (e.g. /dev/video2). Use linux
/bin/ps
to make sure there are no old uvc_camera linux processes hanging around; doing arosnode list
is not good enough.Asked by Mike Scheutzow on 2023-06-10 08:43:29 UTC
A small optimization: I don't think you need to remap the "image_raw" topic, because the parent namespace should make the full topic name unique.
Asked by Mike Scheutzow on 2023-06-10 08:47:34 UTC
Why are you starting rviz twice? And why is it inside a namespace?
Asked by Mike Scheutzow on 2023-06-10 08:48:44 UTC