Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usb_cam works on galactic but does not work on humble #299

Closed
lmendyk opened this issue Nov 16, 2023 · 5 comments
Closed

usb_cam works on galactic but does not work on humble #299

lmendyk opened this issue Nov 16, 2023 · 5 comments

Comments

@lmendyk
Copy link

lmendyk commented Nov 16, 2023

I’m in a process of migration with my turtlebot3 from galactic to humble ros2 with usb_cam used for raspberry pi 4 camera. The same code (in respect to usb_cam and image transport) works on galactic. But when I try to use it inside docker container (started with –prevailed option so I don't think it is a docker issue but rather galactic vs humble), the usb_camere does not work.
This means that in the logs I get:

[usb_cam_node_exe-4] [INFO] [1700139031.778458873] [camera.usb_cam]: camera_name value: camera
[usb_cam_node_exe-4] [WARN] [1700139031.778748632] [camera.usb_cam]: framerate: 10.000000
[usb_cam_node_exe-4] [INFO] [1700139031.801688143] [camera.usb_cam]: camera calibration URL: package://turtlebot3_manipulation_bringup/camera_info/turtlebot3_rpicamera.yaml
[usb_cam_node_exe-4] [INFO] [1700139031.803539599] [camera.usb_cam]: Starting 'camera' (/dev/video0) at 1920x1080 via mmap (yuyv) at 10 FPS
[usb_cam_node_exe-4] [INFO] [1700139031.820321373] [camera.usb_cam]: This devices supproted formats:

And no formats are printed while when running on galactic ROS2 – I get long list of formats

Then I get following logs:

[usb_cam_node_exe-4] [INFO] [1700139031.820714983] [camera.usb_cam]: Setting 'brightness' to 50
[usb_cam_node_exe-4] unknown control 'white_balance_temperature_auto'
[usb_cam_node_exe-4] 
[usb_cam_node_exe-4] [INFO] [1700139031.845867690] [camera.usb_cam]: Setting 'white_balance_temperature_auto' to 1
[usb_cam_node_exe-4] [INFO] [1700139031.846006245] [camera.usb_cam]: Setting 'exposure_auto' to 3
[usb_cam_node_exe-4] unknown control 'exposure_auto'
[usb_cam_node_exe-4] 
[usb_cam_node_exe-4] [INFO] [1700139031.859236161] [camera.usb_cam]: Setting 'focus_auto' to 0
[usb_cam_node_exe-4] unknown control 'focus_auto'
[usb_cam_node_exe-4] 
[usb_cam_node_exe-4] [INFO] [1700139032.271723424] [camera.usb_cam]: Timer triggering every 100 ms

when trying to display the images in rqt I get

ImageView.callback_image() while trying to convert image from 'yuv422_yuy2' to 'rgb8' an exception was thrown (Image is wrongly formated ...)

Errata:
There is difference in encoding

  • galactic:
    ubuntu@turtlebot3:~$ ros2 topic echo /camera/image_raw/compressed
    header:
    stamp:
    sec: 1700144015
    nanosec: 556514791
    frame_id: camera_rgb_optical_frame
    format: rgb8; jpeg compressed bgr8

  • humble (in docker container)
    ubuntu@turtlebot3:~$ ros2 topic echo /camera/image_raw/compressed
    header:
    stamp:
    sec: 1700144265
    nanosec: 195542000
    frame_id: camera_rgb_optical_frame
    format: yuv422_yuy2; jpeg compressed mono8

@flynneva
Copy link
Collaborator

@lmendyk galactic has been deprecated for awhile now and so it hasn't been getting the recent updates.

Check the read me about selecting the right formats, that's changed recently and could explain your issue here.

@lmendyk
Copy link
Author

lmendyk commented Nov 17, 2023

@flynneva - the problem is on humble (on galactic it works!). I have read the readme and don't know what is the issue :(

I think the main problem is that no formats reported:
[usb_cam_node_exe-4] [INFO] [1700139031.820321373] [camera.usb_cam]: This devices supported formats:

So if no formats are reported I don't think I can set a right format in a config but still I have experimented with "pixel_format" for example with "rgb24" but the result was even worse as nothing was published on the topics (not additional errors in log)

@lmendyk
Copy link
Author

lmendyk commented Nov 22, 2023

Ok, I have found it (not in the documentation) that I need to add
pixel_format: "yuyv2rgb"

Still no formats are printed, but at least the camera works so I can see it in rviz and rqt

@lmendyk lmendyk closed this as completed Nov 22, 2023
@flynneva
Copy link
Collaborator

@lmendyk this is documented in the README in this section. Glad you got it working!

@lmendyk
Copy link
Author

lmendyk commented Nov 27, 2023

Sorry - I must have been tricked by the "default" branch of README which directed me by

"For full documentation, see the ROS wiki."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants