clydemcqueen/h264_image_transport

Failed to detect content in .ini file

justin-kel opened this issue · 2 comments

Hi

I am running ROS2 Humble on Ubuntu 22.04.

I am trying to run the example_launch.py file and receive the following output

[h264_cam_node-1] [INFO] [1689043986.530547557] [h264_cam_node]: Parameter input_fn: /dev/video0
[h264_cam_node-1] [INFO] [1689043986.530613627] [h264_cam_node]: Parameter fps: 30
[h264_cam_node-1] [INFO] [1689043986.530626967] [h264_cam_node]: Parameter size: 800x600
[h264_cam_node-1] [INFO] [1689043986.530637862] [h264_cam_node]: Parameter frame_id: camera_frame
[h264_cam_node-1] [INFO] [1689043986.530648478] [h264_cam_node]: Parameter camera_info_path: info.ini
[h264_cam_node-1] [ERROR] [1689043986.794651497] [camera_calibration_parsers]: Failed to detect content in .ini file
[h264_cam_node-1] [ERROR] [1689043986.794677269] [h264_cam_node]: Could not get camera info, will not publish
[h264_cam_node-1] [INFO] [1689043986.794921435] [h264_cam_node]: Camera thread started
[republish-2] [INFO] [1689043986.880832502] [republish_node]: First message: 0

I have checked that my camera can encode H.264 using v4l2-ctl --list-formats

ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

[0]: 'MJPG' (Motion-JPEG, compressed)
[1]: 'YUYV' (YUYV 4:2:2)
[2]: 'NV12' (Y/CbCr 4:2:0)
[3]: 'H264' (H.264, compressed)
[4]: 'HEVC' (HEVC, compressed)

Do I need to write/generate an info.ini file? If so, could you advise on how to go about doing this?

Thank you!

Update:

I am not sure if generating a calibration file is what i am required to do, but I did so in an attempt to troubleshoot the issue.

I generated a configuration file using the instructions found here: https://navigation.ros.org/tutorials/docs/camera_calibration.html

This resulted in a yaml file with the following parameters:

image_width: 1280
image_height: 720
camera_name: brandless_webcam
camera_matrix:
  rows: 3
  cols: 3
  data: [959.74707,   0.     , 649.90426,
           0.     , 958.91379, 313.78371,
           0.     ,   0.     ,   1.     ]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.414667, 0.166386, -0.001646, 0.002119, 0.000000]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1., 0., 0.,
         0., 1., 0.,
         0., 0., 1.]
projection_matrix:
  rows: 3
  cols: 4
  data: [755.73706,   0.     , 660.31249,   0.     ,
           0.     , 893.4975 , 306.081  ,   0.     ,
           0.     ,   0.     ,   1.     ,   0.     ]

I used the yaml generated above as the 'camera_info_path', thus my launch command was the following:

ros2 run h264_image_transport h264_cam_node --ros-args -p input_fn:=/dev/video0 -p camera_info_path:='<path_to_calibration_file>'

Now when I run:

ros2 run image_transport republish h264 raw --ros-args -r in/h264:=/image_raw/h264 -r out:=/repub_raw

I receive the following error:

[INFO] [1689065745.296607917] [image_republisher]: First message: 191
[h264 @ 0x55ecf659e0c0] non-existing PPS 0 referenced
[h264 @ 0x55ecf659e0c0] decode_slice_header error
[h264 @ 0x55ecf659e0c0] non-existing PPS 0 referenced
[h264 @ 0x55ecf659e0c0] decode_slice_header error
[h264 @ 0x55ecf659e0c0] no frame!

I receive this message several times, and then it gets stuck.

Ok never mind. The messages can be safely ignored, the images are still published, and everything works as expected.