ros-drivers/usb_cam

invalid pointer (camera can be started with VLC)

TZECHIN6 opened this issue · 1 comments

Description

Basically just clone it, and tried the simplest setup to try to view the image. Unfortunately, error being thrown out...

$ ros2 run usb_cam usb_cam_node_exe --ros-args --params-file /home/thomas/Development/usb_cam/config/params_2.yaml 
[INFO] [1692153315.491018936] [usb_cam]: camera_name value: usb_cam
[WARN] [1692153315.491127087] [usb_cam]: framerate: 30.000000
[INFO] [1692153315.498681813] [usb_cam]: camera calibration URL: package://usb_cam/config/camera_info.yaml
[WARN] [1692153315.500304206] [usb_cam]: [usb_cam] does not match test_camera in file /home/thomas/Development/usb_cam/install/usb_cam/share/usb_cam/config/camera_info.yaml
[INFO] [1692153315.500354095] [usb_cam]: Starting 'usb_cam' (/dev/video2) at 640x480 via mmap (mjpeg2rgb) at 30 FPS
[INFO] [1692153315.771306881] [usb_cam]: This devices supproted formats:
[INFO] [1692153315.771485598] [usb_cam]: 	Motion-JPEG: 1920 x 1080 (30 Hz)
[INFO] [1692153315.771499280] [usb_cam]: 	Motion-JPEG: 1280 x 720 (30 Hz)
[INFO] [1692153315.771507354] [usb_cam]: 	Motion-JPEG: 640 x 480 (30 Hz)
[INFO] [1692153315.771514989] [usb_cam]: 	Motion-JPEG: 320 x 240 (30 Hz)
[INFO] [1692153315.771523124] [usb_cam]: Setting 'white_balance' to 4000
unknown control 'white_balance_temperature_auto'

unknown control 'white_balance_temperature'

[INFO] [1692153315.802487255] [usb_cam]: Setting 'exposure_auto' to 1
[INFO] [1692153315.802531818] [usb_cam]: Setting 'exposure' to 100
unknown control 'exposure_auto'

unknown control 'exposure_absolute'

[INFO] [1692153315.831822932] [usb_cam]: Setting 'focus_auto' to 0
unknown control 'focus_auto'

[INFO] [1692153315.853677597] [usb_cam]: Timer triggering every 33 ms
free(): invalid pointer
[ros2run]: Aborted

params_2.yaml

/**:
    ros__parameters:
      video_device: "/dev/video2"
      framerate: 30.0
      io_method: "mmap"
      frame_id: "camera2"
      pixel_format: "mjpeg2rgb"  # see usb_cam/supported_formats for list of supported formats
      image_width: 640
      image_height: 480
      camera_name: "usb_cam"
      # reusing same camera intrinsics only for demo, should really be unique for camera2"
      camera_info_url: "package://usb_cam/config/camera_info.yaml"
      brightness: -1
      contrast: -1
      saturation: -1
      sharpness: -1
      gain: -1
      auto_white_balance: false
      white_balance: 4000
      autoexposure: false
      exposure: 100
      autofocus: false
      focus: -1

Tested options

  1. switching different io_method, no difference
  2. switching different pixel_format (although it only states MJPEG), switch to yuyv could start the camera, but the image is half black and half white noise.

v4l2-compliance test

$ v4l2-compliance -d /dev/video2
v4l2-compliance 1.22.1, 64 bits, 64-bit time_t

Compliance test for uvcvideo device /dev/video2:

Driver Info:
	Driver name      : uvcvideo
	Card type        : USB CAMERA 
	Bus info         : usb-0000:00:14.0-1
	Driver version   : 6.2.13
	Capabilities     : 0x84a00001
		Video Capture
		Metadata Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : uvcvideo
	Model            : USB CAMERA 
	Serial           : 
	Bus info         : usb-0000:00:14.0-1
	Media version    : 6.2.13
	Hardware revision: 0x00000010 (16)
	Driver version   : 6.2.13
Interface Info:
	ID               : 0x03000002
	Type             : V4L Video
Entity Info:
	ID               : 0x00000001 (1)
	Name             : USB CAMERA 
	Function         : V4L2 I/O
	Flags            : default
	Pad 0x01000007   : 0: Sink
	  Link 0x02000013: from remote pad 0x100000a of entity 'Processing 4' (Video Pixel Formatter): Data, Enabled, Immutable

Required ioctls:
	test MC information (see 'Media Driver Info' above): OK
	test VIDIOC_QUERYCAP: OK
	test invalid ioctls: OK

Allow for multiple opens:
	test second /dev/video2 open: OK
	test VIDIOC_QUERYCAP: OK
	test VIDIOC_G/S_PRIORITY: OK
	test for unlimited opens: OK

Debug ioctls:
	test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
	test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
	test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
	test VIDIOC_ENUMAUDIO: OK (Not Supported)
	test VIDIOC_G/S/ENUMINPUT: OK
	test VIDIOC_G/S_AUDIO: OK (Not Supported)
	Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
	test VIDIOC_G/S_MODULATOR: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_ENUMAUDOUT: OK (Not Supported)
	test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
	test VIDIOC_G/S_AUDOUT: OK (Not Supported)
	Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
	test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
	test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
	test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
	test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls (Input 0):
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
	test VIDIOC_QUERYCTRL: OK
	test VIDIOC_G/S_CTRL: OK
	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
	Standard Controls: 0 Private Controls: 0

Format ioctls (Input 0):
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
	test VIDIOC_G/S_PARM: OK
	test VIDIOC_G_FBUF: OK (Not Supported)
	test VIDIOC_G_FMT: OK
	test VIDIOC_TRY_FMT: OK
		warn: v4l2-test-formats.cpp(1036): Could not set fmt2
	test VIDIOC_S_FMT: OK
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
	test Cropping: OK (Not Supported)
	test Composing: OK (Not Supported)
	test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
	test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
	test VIDIOC_EXPBUF: OK
	test Requests: OK (Not Supported)

Total for uvcvideo device /dev/video2: 46, Succeeded: 46, Failed: 0, Warnings: 1

Should be fixed now on the ros2 branch, closing this issue. Feel free to open more if you run into anything else!