Running 2 different cameras using usb_cam ROS Noetic

asked 2023-04-19 22:03:00 -0500

stevensu1838 gravatar image

updated 2023-04-20 02:13:15 -0500

gvdhoorn gravatar image

Hi,

I installed usb_cam on ROS noetic Ubuntu 20.04 by sudo apt-get install ros-noetic-usb-cam. I've got two usb_cam connected to the PC/

$ ls /dev/video /dev/video0 /dev/video1 /dev/video2 /dev/video3

I can successfully run roslaunch usb_cam usb_cam-test.launch and get the images with no problem.

The I created my own launch file for two webcams: image description

However, when I roslauch it, I got the error below and only one image view shows up. Could you please help?

$ roslaunch usb_cam usb_cam_dual.launch
... logging to /home/ysu66/.ros/log/68b9bfa0-df27-11ed-99b1-59764064f0a4/roslaunch-mech1936-31085.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/ysu66/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.

started roslaunch server http://mech1936:45683/

SUMMARY
========

PARAMETERS
 * /camera1/image_view/autosize: True
 * /camera1/usb_cam1/camera_frame_id: usb_cam
 * /camera1/usb_cam1/image_height: 480
 * /camera1/usb_cam1/image_width: 640
 * /camera1/usb_cam1/io_method: mmap
 * /camera1/usb_cam1/pixel_format: yuyv
 * /camera1/usb_cam1/video_device: /dev/video0
 * /camera2/image_view/autosize: True
 * /camera2/usb_cam2/camera_frame_id: usb_cam
 * /camera2/usb_cam2/image_height: 480
 * /camera2/usb_cam2/image_width: 640
 * /camera2/usb_cam2/io_method: mmap
 * /camera2/usb_cam2/pixel_format: yuyv
 * /camera2/usb_cam2/video_device: /dev/video1
 * /rosdistro: noetic
 * /rosversion: 1.16.0

NODES
  /camera1/
    image_view (image_view/image_view)
    usb_cam1 (usb_cam/usb_cam_node)
  /camera2/
    image_view (image_view/image_view)
    usb_cam2 (usb_cam/usb_cam_node)

auto-starting new master
process[master]: started with pid [31093]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 68b9bfa0-df27-11ed-99b1-59764064f0a4
process[rosout-1]: started with pid [31104]
started core service [/rosout]
process[camera1/usb_cam1-2]: started with pid [31111]
process[camera1/image_view-3]: started with pid [31112]
process[camera2/usb_cam2-4]: started with pid [31113]
process[camera2/image_view-5]: started with pid [31114]
[ INFO] [1681959587.789564847]: Initializing nodelet with 12 worker threads.
[ INFO] [1681959587.792808728]: Initializing nodelet with 12 worker threads.
[ INFO] [1681959587.860654948]: Using transport "raw"
[ INFO] [1681959587.882754798]: using default calibration URL
[ INFO] [1681959587.883277339]: camera calibration URL: file:///home/ysu66/.ros/camera_info/head_camera.yaml
[ INFO] [1681959587.883323430]: Unable to open camera calibration file [/home/ysu66/.ros/camera_info/head_camera.yaml]
[ WARN] [1681959587.883343939]: Camera calibration file /home/ysu66/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1681959587.883358782]: Starting 'head_camera' (/dev/video1) at 640x480 via mmap (yuyv) at 30 FPS
[ERROR] [1681959587.883417138]: VIDIOC_G_FMT error 22, Invalid argument
[ INFO] [1681959587.890189807]: Using transport "raw"
[ INFO] [1681959587.911759589]: using default calibration URL
[ INFO] [1681959587.912205553]: camera calibration URL: file:///home/ysu66/.ros/camera_info/head_camera.yaml
[ INFO] [1681959587.912244784]: Unable to open camera calibration file [/home/ysu66/.ros/camera_info/head_camera.yaml]
[ WARN] [1681959587.912258919]: Camera calibration file /home/ysu66/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1681959587.912273002]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 30 FPS
[camera2/usb_cam2-4] process has died [pid 31113, exit code 1, cmd /opt/ros/noetic/lib/usb_cam/usb_cam_node __name:=usb_cam2 __log:=/home/ysu66/.ros/log/68b9bfa0-df27-11ed-99b1-59764064f0a4/camera2-usb_cam2-4.log].
log file: /home/ysu66/.ros/log/68b9bfa0-df27-11ed-99b1-59764064f0a4/camera2-usb_cam2-4*.log

image description

edit retag flag offensive close merge delete