Discussion - Adding a Camera to our Robot (Making a Mobile Robot Pt 9)

Blog Post

This is the discussion topic for the video and blog post linked above. Please keep all replies relevant to the content, otherwise create a new topic.

Hi, thanks for the great tutorials. They have really made a difference. However, I have hit a problem I cant seem to resolve. Despite trying all over the holiday.
If I start a node publishing to an image topic at 10hz. I can see the publisher running well. But when I start the subscriber node. The publisher hangs. I have tried switching to cyclonedds, running the nodes with best_effort reliability to no avail.
Using image_tools cam2image to publish on my Pi and image_tools showimage to subscribe on my PC, it runs perfectly. Similarly with rviz2 on the PC. But as soon as I interrogate the topic with ros2 topic hz, it hangs.
I am running Humble on Ubuntu 22.04 on the Pi and PC. Everything I can see on the blogsphere says it goes away with cyclonedds, but not for me.
Any ideas?
Jimmy

Hmm very odd… and switching RMW and QoS were going to be my first suggestions!

What resolution/size is the image? It’s possible that you’re running up against some buffer size issues somewhere internally? Can you try forcing a lower size and/or framerate to see if it works and then slowly step up?

Can you guide me how can i add raspberry Pi camera v3 to my robot in ros2 in ubuntu mate 20.04

Sorry for the late reply. I would be happy to help you with picamera 3. What variant pi do you have, are you planning to run ros2

I have both ros 2 humble and foxy on two different sd card but still i am not able to use new raspberry Pi camera v3 with IMX708 camera sensor. I think the camera is not supported in ubuntu please help me is there any way to run the v3 camera on ubuntu.

Hi, unfortunately I haven’t got the Pi camera 3 yet so am unable to help - I would have assumed the old driver would still work and that they would speak the same protocol but perhaps not?

Sorry I can’t be of more help but hopefully @jimmymcinerney has some suggestions?

I am feeling foolish, I recently bought a new pi camera, as I was ordering it I thought I clicked on the module3. But a v2 turned up, I didnt check it, simply popped it into the camera holder (I broke the previous one by dropping a screwdriver onto it). Away it went :slight_smile:
The point of thiis long story is that I don’t have a picamera v3, so I cant really be of any help, sorry.
Perhaps you might consider amending your config.txt file and “replace start_x=1 with dtoverlay=imx708” https://community.octoprint.org/t/pi-camera-v3-imx-chipset-based-cameras-not-working/49022/7

Hi Josh,

I receive image on rqt but by starting I recive following message

[INFO] [1679843507.375241045] [v4l2_camera]: Scene Mode (3) = 0
[ERROR] [1679843507.375331600] [v4l2_camera]: Failed getting value for control 10289153: Permission denied (13); returning 0!
[INFO] [1679843507.375390989] [v4l2_camera]: JPEG Compression Controls (6) = 0
[INFO] [1679843507.375457489] [v4l2_camera]: Compression Quality (1) = 30
[INFO] [1679843507.375517823] [v4l2_camera]: Time-per-frame support: YES
[INFO] [1679843507.375575397] [v4l2_camera]: Current time per frame: 1000/30000 s
[INFO] [1679843507.375635082] [v4l2_camera]: Available intervals:
[INFO] [1679843507.377566639] [v4l2_camera]: Requesting format: 1024x768
[INFO] [1679843507.383716995] [v4l2_camera]: Success
[INFO] [1679843507.383963828] [v4l2_camera]: Requesting format: 640x480
[INFO] [1679843507.384433440] [v4l2_camera]: Success
[WARN] [1679843507.385575385] [v4l2_camera]: Control type not currently supported: 6, for control: Codec Controls
[WARN] [1679843507.386117682] [v4l2_camera]: Control type not currently supported: 6, for control: Camera Controls
[WARN] [1679843507.386400719] [v4l2_camera]: Control type not currently supported: 9, for control: Auto Exposure, Bias
[WARN] [1679843507.386604108] [v4l2_camera]: Control type not currently supported: 9, for control: ISO Sensitivity
[WARN] [1679843507.386868052] [v4l2_camera]: Control type not currently supported: 6, for control: JPEG Compression Controls
[INFO] [1679843507.387004793] [v4l2_camera]: Starting camera
[INFO] [1679843507.925867239] [v4l2_camera]: using default calibration URL
[INFO] [1679843507.926314776] [v4l2_camera]: camera calibration URL: file:///home/ubuntu/.ros/camera_info/mmal_service_16.1.yaml
[ERROR] [1679843507.926712628] [camera_calibration_parsers]: Unable to open camera calibration file [/home/ubuntu/.ros/camera_info/mmal_service_16.1.yaml]

I made several times adding the $USER to video group but unfortunatellly after restart commes the same message again.

Thank you very much in advance!

Cheers,
Ivo

Very odd, are you using the Raspberry Pi Camera? What other Hardware/OS?

The only actual error there is on line 2, failing to get the control value. Apparently this is something to do with JPEG compression (which is probably why the next line is 0) but I reckon that’s not actually an limiting error. Everything else is pretty normal.

Does the camera come up properly with vcgencmd get_camera and v4l2-ctl --get-devices? (Apologies if those commands are wrong I’m not in a position to test them right now.

Hi Josh,

Sorry for my late answer.
ubuntu@ubuntu:~$ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
/dev/video10
/dev/video11
/dev/video12
/dev/media1

bcm2835-isp (platform:bcm2835-isp):
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/media0

mmal service 16.1 (platform:bcm2835-v4l2):
/dev/video0

ubuntu@ubuntu:~$ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
/dev/video10
/dev/video11
/dev/video12
/dev/media1

bcm2835-isp (platform:bcm2835-isp):
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/media0

mmal service 16.1 (platform:bcm2835-v4l2):
/dev/video0

My Platform is : Raspberry Pi 4b 8Gb RAM Ubuntu 20.04 ROS2- Foxy
Thank you very much in advance!

Cheers,
Ivo

Good day @JoshNewans ,

I am unsure whether you follow these anymore, but I wish to begin with thanking you for your tutorials. They have been the absolutely best I’ve found relating to ROS and worth diamonds.

You wrote that it can be tricky to get Camera working in Rviz, and this is my current problem. Image works fine, but I’d need the Camera object for a hand-eye-calibration test I’m running (someone else’s code). Whenever I select the topic for the Camera object, my terminal starts banging

[INFO] [1727237898.475203440] [rviz]: Message Filter dropping message: frame ‘camera_optical_link’ at time 1727237897.969 for reason ‘discarding message because the queue is full’

and I get no feed. This is regardless of webcam (have tried two) and happens both with v4l2_camera and usb_cam.

Selecting “Best effort” made no difference. Any ideas?