Multiple cameras issue
HuanyuL opened this issue · 3 comments
Hello, I am running usb_cam node on ROS-Noetic Ubuntu20.04, I recieved this error when I have two node running at the same time.
[ERROR] [1686147531.307026703]: Video4linux: frame grabber failed
I don't have problem when I launch the usb_cam.launch
, but I seems the second node kills the first one video4linux stream. Here's my launch file.
<group ns="camera1">
<node name="usb_cam1" pkg="usb_cam" type="usb_cam_node" output="screen">
<rosparam command="load" file="$(find usb_cam)/config/usb_cam.yml" />
<remap from="image" to="/camera/usb_cam1/image_raw"/>
</node>
</group>
<group ns="camera2">
<node name="usb_cam2" pkg="usb_cam" type="usb_cam_node" output="screen">
<rosparam command="load" file="$(find usb_cam)/config/usb_cam_2.yml" />
<remap from="image" to="/camera2/usb_cam2/image_raw"/>
</node>
</group>
</launch>
Then my first node frame mapping timeout, the error is showing as below
huanyu@laptop:~/webcam_ws$ roslaunch usb_cam usb_cam_copy.launch
... logging to /home/huanyu/.ros/log/368d6d0a-053e-11ee-8f7c-cb4ac6d7dbd1/roslaunch-laptop-16306.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://laptop:33847/
SUMMARY
========
PARAMETERS
* /camera1/usb_cam1/camera_frame_id: head_camera
* /camera1/usb_cam1/camera_info_url:
* /camera1/usb_cam1/camera_name: head_camera
* /camera1/usb_cam1/camera_transport_suffix: image_raw
* /camera1/usb_cam1/color_format: yuv422p
* /camera1/usb_cam1/create_suspended: False
* /camera1/usb_cam1/framerate: 60
* /camera1/usb_cam1/full_ffmpeg_log: False
* /camera1/usb_cam1/image_height: 480
* /camera1/usb_cam1/image_width: 640
* /camera1/usb_cam1/intrinsic_controls/exposure_absolute: 500
* /camera1/usb_cam1/intrinsic_controls/exposure_auto: 1
* /camera1/usb_cam1/intrinsic_controls/exposure_auto_priority: False
* /camera1/usb_cam1/intrinsic_controls/focus_auto: False
* /camera1/usb_cam1/intrinsic_controls/ignore: ['brightness', 'c...
* /camera1/usb_cam1/intrinsic_controls/power_line_frequency: 1
* /camera1/usb_cam1/intrinsic_controls/white_balance_temperature_auto: False
* /camera1/usb_cam1/io_method: mmap
* /camera1/usb_cam1/pixel_format: yuyv
* /camera1/usb_cam1/start_service_name: start_capture
* /camera1/usb_cam1/stop_service_name: stop_capture
* /camera1/usb_cam1/video_device: /dev/video2
* /camera2/usb_cam2/camera_frame_id: head_camera
* /camera2/usb_cam2/camera_info_url:
* /camera2/usb_cam2/camera_name: head_camera
* /camera2/usb_cam2/camera_transport_suffix: image_raw
* /camera2/usb_cam2/color_format: yuv422p
* /camera2/usb_cam2/create_suspended: False
* /camera2/usb_cam2/framerate: 60
* /camera2/usb_cam2/full_ffmpeg_log: False
* /camera2/usb_cam2/image_height: 480
* /camera2/usb_cam2/image_width: 640
* /camera2/usb_cam2/intrinsic_controls/exposure_absolute: 100
* /camera2/usb_cam2/intrinsic_controls/exposure_auto: 1
* /camera2/usb_cam2/intrinsic_controls/exposure_auto_priority: False
* /camera2/usb_cam2/intrinsic_controls/focus_auto: False
* /camera2/usb_cam2/intrinsic_controls/ignore: ['brightness', 'c...
* /camera2/usb_cam2/intrinsic_controls/power_line_frequency: 1
* /camera2/usb_cam2/intrinsic_controls/white_balance_temperature_auto: True
* /camera2/usb_cam2/io_method: mmap
* /camera2/usb_cam2/pixel_format: yuyv
* /camera2/usb_cam2/start_service_name: start_capture
* /camera2/usb_cam2/stop_service_name: stop_capture
* /camera2/usb_cam2/video_device: /dev/video4
* /rosdistro: noetic
* /rosversion: 1.16.0
NODES
/camera1/
usb_cam1 (usb_cam/usb_cam_node)
/camera2/
usb_cam2 (usb_cam/usb_cam_node)
auto-starting new master
process[master]: started with pid [16314]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to 368d6d0a-053e-11ee-8f7c-cb4ac6d7dbd1
process[rosout-1]: started with pid [16324]
started core service [/rosout]
process[camera1/usb_cam1-2]: started with pid [16331]
process[camera2/usb_cam2-3]: started with pid [16332]
[ INFO] [1686147526.095739582]: Initializing ROS V4L USB camera 'head_camera' (/dev/video2) at 640x480 via mmap (yuyv) at 60 FPS
[ INFO] [1686147526.095915443]: Initializing ROS V4L USB camera 'head_camera' (/dev/video4) at 640x480 via mmap (yuyv) at 60 FPS
[ INFO] [1686147526.162768589]: using default calibration URL
[ INFO] [1686147526.162804139]: camera calibration URL: file:///home/huanyu/.ros/camera_info/head_camera.yaml
[ INFO] [1686147526.162861339]: Unable to open camera calibration file [/home/huanyu/.ros/camera_info/head_camera.yaml]
[ WARN] [1686147526.162876634]: Camera calibration file /home/huanyu/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1686147526.162922380]: Advertising std_srvs::Empty start service under name 'start_capture'
[ INFO] [1686147526.163237714]: Advertising std_srvs::Empty suspension service under name 'stop_capture'
[ INFO] [1686147526.163788554]: Advertising std_srvs::Trigger supported formats information service under name 'supported_formats'
[ INFO] [1686147526.163913989]: using default calibration URL
[ INFO] [1686147526.163943532]: camera calibration URL: file:///home/huanyu/.ros/camera_info/head_camera.yaml
[ INFO] [1686147526.163981246]: Unable to open camera calibration file [/home/huanyu/.ros/camera_info/head_camera.yaml]
[ WARN] [1686147526.163996472]: Camera calibration file /home/huanyu/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1686147526.164031742]: Advertising std_srvs::Empty start service under name 'start_capture'
[ INFO] [1686147526.164086079]: Advertising std_srvs::Trigger supported V4L controls information service under name 'supported_controls'
[ INFO] [1686147526.164363908]: Advertising std_srvs::Empty suspension service under name 'stop_capture'
Opening streaming device /dev/video2
[ INFO] [1686147526.164774366]: Advertising std_srvs::Trigger supported formats information service under name 'supported_formats'
[ INFO] [1686147526.165087745]: Advertising std_srvs::Trigger supported V4L controls information service under name 'supported_controls'
Opening streaming device /dev/video4
Video4Linux: IOCTL is not supported
Video4Linux: IOCTL is not supported
Video4linux: Querying V4L2 driver for available controls (register base 0x980900, 0..99)
Sorting control names:
focus_auto
exposure_auto_priority
exposure_auto
white_balance_temperature_auto
brightness
contrast
saturation
hue
gamma
power_line_frequency
white_balance_temperature
sharpness
backlight_compensation
exposure_absolute
pan_absolute
tilt_absolute
focus_absolute
zoom_absolute
[ WARN] [1686147526.250271060]: NOTE: the parameters generated for V4L intrinsic camera controls will be placed under namespace 'intrinsic_controls'
[ INFO] [1686147526.250294038]: Use 'intrinsic_controls/ignore' list to enumerate the controls provoking errors or the ones you just want to keep untouched
[ INFO] [1686147526.250310101]: Attempting to generate ROS parameter for V4L2 control 'focus_auto':
Focus, Auto, min = 0, max = 1, step = 1, flags = 0x0 [1] (bool 1/0)
Video4linux: Querying V4L2 driver for available controls (register base 0x980900, 0..99)
Sorting control names:
[ INFO] [1686147526.251289907]: Parameter intrinsic_controls/focus_auto exposed with value 0
[ INFO] [1686147526.251312326]: Attempting to generate ROS parameter for V4L2 control 'exposure_auto_priority':
Exposure, Auto Priority, min = 0, max = 1, step = 1, flags = 0x0 [0] (bool 1/0)
focus_auto
exposure_auto_priority
exposure_auto
white_balance_temperature_auto
brightness
contrast
saturation
hue
gamma
power_line_frequency
white_balance_temperature
sharpness
backlight_compensation
exposure_absolute
pan_absolute
tilt_absolute
focus_absolute
zoom_absolute
[ WARN] [1686147526.251376231]: NOTE: the parameters generated for V4L intrinsic camera controls will be placed under namespace 'intrinsic_controls'
[ INFO] [1686147526.251411082]: Use 'intrinsic_controls/ignore' list to enumerate the controls provoking errors or the ones you just want to keep untouched
[ INFO] [1686147526.251426167]: Attempting to generate ROS parameter for V4L2 control 'focus_auto':
Focus, Auto, min = 0, max = 1, step = 1, flags = 0x0 [1] (bool 1/0)
[ INFO] [1686147526.252048944]: Parameter intrinsic_controls/exposure_auto_priority exposed with value 0
[ INFO] [1686147526.252070804]: Attempting to generate ROS parameter for V4L2 control 'exposure_auto':
Exposure, Auto, min = 0, max = 3, step = 1, flags = 0x0 [ 1: Manual Mode 3: Aperture Priority Mode ] [3]
[ INFO] [1686147526.252293389]: Parameter intrinsic_controls/focus_auto exposed with value 0
[ INFO] [1686147526.252314900]: Attempting to generate ROS parameter for V4L2 control 'exposure_auto_priority':
Exposure, Auto Priority, min = 0, max = 1, step = 1, flags = 0x0 [0] (bool 1/0)
[ INFO] [1686147526.252999835]: Parameter intrinsic_controls/exposure_auto exposed with value 1
[ INFO] [1686147526.253021765]: Attempting to generate ROS parameter for V4L2 control 'white_balance_temperature_auto':
White Balance Temperature, Auto, min = 0, max = 1, step = 1, flags = 0x0 [1] (bool 1/0)
[ INFO] [1686147526.253228426]: Parameter intrinsic_controls/exposure_auto_priority exposed with value 0
[ INFO] [1686147526.253249798]: Attempting to generate ROS parameter for V4L2 control 'exposure_auto':
Exposure, Auto, min = 0, max = 3, step = 1, flags = 0x0 [ 1: Manual Mode 3: Aperture Priority Mode ] [3]
[ INFO] [1686147526.253816491]: Parameter intrinsic_controls/white_balance_temperature_auto exposed with value 0
[ INFO] [1686147526.253838142]: Attempting to generate ROS parameter for V4L2 control 'brightness':
Brightness, min = -64, max = 64, step = 1, flags = 0x0 [0]
[ INFO] [1686147526.254043476]: Parameter intrinsic_controls/exposure_auto exposed with value 1
[ INFO] [1686147526.254065057]: Attempting to generate ROS parameter for V4L2 control 'white_balance_temperature_auto':
White Balance Temperature, Auto, min = 0, max = 1, step = 1, flags = 0x0 [1] (bool 1/0)
[ INFO] [1686147526.254205229]: Parameter intrinsic_controls/brightness exposed with value 0
[ INFO] [1686147526.254227229]: Attempting to generate ROS parameter for V4L2 control 'contrast':
Contrast, min = 0, max = 100, step = 1, flags = 0x0 [50]
[ INFO] [1686147526.254572804]: Parameter intrinsic_controls/contrast exposed with value 50
[ INFO] [1686147526.254593198]: Attempting to generate ROS parameter for V4L2 control 'saturation':
Saturation, min = 0, max = 100, step = 1, flags = 0x0 [64]
[ INFO] [1686147526.254766056]: Parameter intrinsic_controls/white_balance_temperature_auto exposed with value 1
[ INFO] [1686147526.254785122]: Attempting to generate ROS parameter for V4L2 control 'brightness':
Brightness, min = -64, max = 64, step = 1, flags = 0x0 [0]
[ INFO] [1686147526.254930183]: Parameter intrinsic_controls/saturation exposed with value 64
[ INFO] [1686147526.254950647]: Attempting to generate ROS parameter for V4L2 control 'hue':
Hue, min = -180, max = 180, step = 1, flags = 0x0 [0]
[ INFO] [1686147526.255075593]: Parameter intrinsic_controls/brightness exposed with value 0
[ INFO] [1686147526.255091028]: Attempting to generate ROS parameter for V4L2 control 'contrast':
Contrast, min = 0, max = 100, step = 1, flags = 0x0 [50]
[ INFO] [1686147526.255232666]: Parameter intrinsic_controls/hue exposed with value 0
[ INFO] [1686147526.255247473]: Attempting to generate ROS parameter for V4L2 control 'gamma':
Gamma, min = 100, max = 500, step = 1, flags = 0x0 [200]
[ INFO] [1686147526.255373327]: Parameter intrinsic_controls/contrast exposed with value 50
[ INFO] [1686147526.255387156]: Attempting to generate ROS parameter for V4L2 control 'saturation':
Saturation, min = 0, max = 100, step = 1, flags = 0x0 [64]
[ INFO] [1686147526.255521950]: Parameter intrinsic_controls/gamma exposed with value 200
[ INFO] [1686147526.255535848]: Attempting to generate ROS parameter for V4L2 control 'power_line_frequency':
Power Line Frequency, min = 0, max = 2, step = 1, flags = 0x0 [ 0: Disabled 1: 50 Hz 2: 60 Hz ] [1]
[ INFO] [1686147526.255669874]: Parameter intrinsic_controls/saturation exposed with value 64
[ INFO] [1686147526.255683493]: Attempting to generate ROS parameter for V4L2 control 'hue':
Hue, min = -180, max = 180, step = 1, flags = 0x0 [0]
[ INFO] [1686147526.255956433]: Parameter intrinsic_controls/hue exposed with value 0
[ INFO] [1686147526.255969983]: Attempting to generate ROS parameter for V4L2 control 'gamma':
Gamma, min = 100, max = 500, step = 1, flags = 0x0 [200]
[ INFO] [1686147526.256123564]: Parameter intrinsic_controls/power_line_frequency exposed with value 1
[ INFO] [1686147526.256143608]: Attempting to generate ROS parameter for V4L2 control 'white_balance_temperature':
White Balance Temperature, min = 2800, max = 6500, step = 10, flags = 0x0 [4600]
[ INFO] [1686147526.256282942]: Parameter intrinsic_controls/gamma exposed with value 200
[ INFO] [1686147526.256297190]: Attempting to generate ROS parameter for V4L2 control 'power_line_frequency':
Power Line Frequency, min = 0, max = 2, step = 1, flags = 0x0 [ 0: Disabled 1: 50 Hz 2: 60 Hz ] [1]
[ INFO] [1686147526.256433241]: Parameter intrinsic_controls/white_balance_temperature exposed with value 4600
[ INFO] [1686147526.256446860]: Attempting to generate ROS parameter for V4L2 control 'sharpness':
Sharpness, min = 0, max = 100, step = 1, flags = 0x0 [80]
[ INFO] [1686147526.256727832]: Parameter intrinsic_controls/sharpness exposed with value 80
[ INFO] [1686147526.256740962]: Attempting to generate ROS parameter for V4L2 control 'backlight_compensation':
Backlight Compensation, min = 0, max = 1, step = 1, flags = 0x0 [0]
[ INFO] [1686147526.256868982]: Parameter intrinsic_controls/power_line_frequency exposed with value 1
[ INFO] [1686147526.256884347]: Attempting to generate ROS parameter for V4L2 control 'white_balance_temperature':
White Balance Temperature, min = 2800, max = 6500, step = 10, flags = 0x10 [4600]
[ INFO] [1686147526.257005173]: Parameter intrinsic_controls/backlight_compensation exposed with value 0
[ INFO] [1686147526.257018023]: Attempting to generate ROS parameter for V4L2 control 'exposure_absolute':
Exposure (Absolute), min = 50, max = 10000, step = 1, flags = 0x0 [166]
[ INFO] [1686147526.257145275]: Parameter intrinsic_controls/white_balance_temperature exposed with value 4600
[ INFO] [1686147526.257158963]: Attempting to generate ROS parameter for V4L2 control 'sharpness':
Sharpness, min = 0, max = 100, step = 1, flags = 0x0 [80]
[ INFO] [1686147526.257410463]: Parameter intrinsic_controls/sharpness exposed with value 80
[ INFO] [1686147526.257423872]: Attempting to generate ROS parameter for V4L2 control 'backlight_compensation':
Backlight Compensation, min = 0, max = 1, step = 1, flags = 0x0 [0]
[ INFO] [1686147526.257545257]: Parameter intrinsic_controls/exposure_absolute exposed with value 500
[ INFO] [1686147526.257558666]: Attempting to generate ROS parameter for V4L2 control 'pan_absolute':
Pan (Absolute), min = -57600, max = 57600, step = 3600, flags = 0x0 [0]
[ INFO] [1686147526.257698349]: Parameter intrinsic_controls/backlight_compensation exposed with value 0
[ INFO] [1686147526.257711759]: Attempting to generate ROS parameter for V4L2 control 'exposure_absolute':
Exposure (Absolute), min = 50, max = 10000, step = 1, flags = 0x0 [166]
[ INFO] [1686147526.257822038]: Parameter intrinsic_controls/pan_absolute exposed with value 0
[ INFO] [1686147526.257835238]: Attempting to generate ROS parameter for V4L2 control 'tilt_absolute':
Tilt (Absolute), min = -43200, max = 43200, step = 3600, flags = 0x0 [0]
[ INFO] [1686147526.258098191]: Parameter intrinsic_controls/tilt_absolute exposed with value 0
[ INFO] [1686147526.258111112]: Attempting to generate ROS parameter for V4L2 control 'focus_absolute':
Focus (absolute), min = 120, max = 960, step = 4, flags = 0x0 [220]
[ INFO] [1686147526.258244579]: Parameter intrinsic_controls/exposure_absolute exposed with value 100
[ INFO] [1686147526.258258547]: Attempting to generate ROS parameter for V4L2 control 'pan_absolute':
Pan (Absolute), min = -57600, max = 57600, step = 3600, flags = 0x0 [0]
[ INFO] [1686147526.258369665]: Parameter intrinsic_controls/focus_absolute exposed with value 220
[ INFO] [1686147526.258382027]: Attempting to generate ROS parameter for V4L2 control 'zoom_absolute':
Zoom, Absolute, min = 0, max = 3, step = 1, flags = 0x0 [0]
[ INFO] [1686147526.258513748]: Parameter intrinsic_controls/pan_absolute exposed with value 0
[ INFO] [1686147526.258528345]: Attempting to generate ROS parameter for V4L2 control 'tilt_absolute':
Tilt (Absolute), min = -43200, max = 43200, step = 3600, flags = 0x0 [0]
[ INFO] [1686147526.258655177]: Parameter intrinsic_controls/zoom_absolute exposed with value 0
[ INFO] [1686147526.258800726]: Parameter intrinsic_controls/tilt_absolute exposed with value 0
[ INFO] [1686147526.258814834]: Attempting to generate ROS parameter for V4L2 control 'focus_absolute':
Focus (absolute), min = 120, max = 960, step = 4, flags = 0x0 [220]
[ INFO] [1686147526.259069197]: Parameter intrinsic_controls/focus_absolute exposed with value 220
[ INFO] [1686147526.259082537]: Attempting to generate ROS parameter for V4L2 control 'zoom_absolute':
Zoom, Absolute, min = 0, max = 3, step = 1, flags = 0x0 [0]
Video4linux: Setting up auxiliary camera parameters
[ INFO] [1686147526.259345071]: Parameter intrinsic_controls/zoom_absolute exposed with value 0
Video4linux: Setting up auxiliary camera parameters
Video4linux: frame mapping timeout (11)
[ERROR] [1686147531.307026703]: Video4linux: frame grabber failed
Video4linux: frame mapping timeout (11)
[ERROR] [1686147536.312275487]: Video4linux: frame grabber failed
I tried to rosnode kill the /camera2/usb_cam2
node then the first node coming back immediately. I am using two trust 23637 camera, all the configs in yaml file are supported my this camera. The strange thing is that this issue can be solved by replace one camera by a different model, here I replaced it by logitech c920.
Could you please have a look?
Many thanks!
@HuanyuL did you try to run the nodes accessing the cameras by ID but not via the /dev/video
? Could you please test this access mode to ensure it is not a kernel driver problem?
hello, It's not a kernel driver issue, I sovled by reduce the fps to 10, my usb bandwidth dosen't support two camera streaming at the same time. Thank you for suggestion!
Closing as resolved