0
$\begingroup$

Running ROS2 Iron with the usb_cam driver.

I ran the calibration script as suggested by the wiki and saved the yaml file to
/opt/ros/iron/share/usb_cam/config/camera_info.yaml

Now when I go to run the driver to get the corrected images to a topic (with the command

ros2 run usb_cam usb_cam_node_exe --ros-args --params-file /opt/ros/iron/share/usb_cam/config/params.yaml --remap image_raw:=image

), the calibration is not applied. Params.yaml content down here:

/**:
    ros__parameters:
      video_device: "/dev/video0"
      framerate: 15.0
      io_method: "mmap"
      frame_id: "camera"
      pixel_format: "mjpeg2rgb"  # see usb_cam/supported_formats for list of supported formats
      av_device_format: "YUV422P"
      image_width: 1600
      image_height: 1200
      camera_name: "default_cam"
      camera_info_url: "file:///opt/ros/iron/share/usb_cam/config/camera_info.yaml"
     # camera_info_url: "package://usb_cam/config/camera_info.yaml"
      brightness: -1
      contrast: -1
      saturation: -1
      sharpness: -1
      gain: -1
      auto_white_balance: false
      autoexposure: false
      autofocus: false
      focus: -1

All the other parameters are applied, as you can see down here

[INFO] [1709827622.870491090] [usb_cam]: camera_name value: default_cam
[WARN] [1709827622.870600440] [usb_cam]: framerate: 15.000000
[INFO] [1709827622.872847952] [usb_cam]: camera calibration URL: file:///opt/ros/iron/share/usb_cam/config/camera_info.yaml
[INFO] [1709827622.986680707] [usb_cam]: Starting 'default_cam' (/dev/video0) at 1600x1200 via mmap (mjpeg2rgb) at 15 FPS
This device supports the following formats:
    Motion-JPEG 1600 x 1200 (15 Hz)
    Motion-JPEG 1600 x 1200 (15 Hz)
    Motion-JPEG 2592 x 1944 (15 Hz)
    Motion-JPEG 2048 x 1536 (15 Hz)
    Motion-JPEG 1920 x 1080 (30 Hz)
    Motion-JPEG 1280 x 1024 (15 Hz)
    Motion-JPEG 1280 x 720 (30 Hz)
    Motion-JPEG 1024 x 768 (30 Hz)
    Motion-JPEG 800 x 600 (30 Hz)
    Motion-JPEG 640 x 480 (30 Hz)
    Motion-JPEG 1600 x 1200 (15 Hz)
    Motion-JPEG 1600 x 1200 (15 Hz)
    YUYV 4:2:2 1600 x 1200 (5 Hz)
    YUYV 4:2:2 1600 x 1200 (5 Hz)
    YUYV 4:2:2 2592 x 1944 (3 Hz)
    YUYV 4:2:2 2048 x 1536 (4 Hz)
    YUYV 4:2:2 1920 x 1080 (5 Hz)
    YUYV 4:2:2 1280 x 1024 (9 Hz)
    YUYV 4:2:2 1280 x 720 (5 Hz)
    YUYV 4:2:2 1024 x 768 (10 Hz)
    YUYV 4:2:2 800 x 600 (20 Hz)
    YUYV 4:2:2 640 x 480 (30 Hz)
    YUYV 4:2:2 1600 x 1200 (5 Hz)
    YUYV 4:2:2 1600 x 1200 (5 Hz)
[INFO] [1709827623.026446424] [usb_cam]: Setting 'white_balance' to 4000
unknown control 'white_balance_temperature_auto'

white_balance_temperature: Permission denied
VIDIOC_S_CTRL: failed: Permission denied

[INFO] [1709827623.042949174] [usb_cam]: Setting 'exposure_auto' to 1
[INFO] [1709827623.043033954] [usb_cam]: Setting 'exposure' to 100
unknown control 'exposure_auto'

unknown control 'exposure_absolute'

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

[INFO] [1709827623.372774575] [usb_cam]: Timer triggering every 66 ms

but the image is not corrected. I tested this with foxglove and got this result enter image description here

which means that the calibration is correct, just isn’t being applied. What am I doing wrong in the usb_cam launch command?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.