Closed Jai-GAY closed 3 months ago
I don't fully follow what commands work and which do not. If the "rpicam-apps" do not work, you should open an issue at https://github.com/raspberrypi/rpicam-apps. If libcamera does not detect any cameras, then there is nothing the node can do. Maybe this is just a configuration issue?
I am also testing on an ov5647 on a Raspberry Pi Zero 2 W, previously with Ubuntu 22.04 and libcamera 0.1, now with Ubuntu 24.04 with libcamera 0.3, without issues. You could try to compile a newer libcamera version from source or simply switch to Ubuntu 24.04.
I don't fully follow what commands work and which do not. If the "rpicam-apps" do not work, you should open an issue at https://github.com/raspberrypi/rpicam-apps. If libcamera does not detect any cameras, then there is nothing the node can do. Maybe this is just a configuration issue?
I am also testing on an ov5647 on a Raspberry Pi Zero 2 W, previously with Ubuntu 22.04 and libcamera 0.1, now with Ubuntu 24.04 with libcamera 0.3, without issues. You could try to compile a newer libcamera version from source or simply switch to Ubuntu 24.04.
So the prerequisites if rpicam-apps (without sudo) work and libcamera detected OV5647, camera_ros should work?
So the prerequisites if rpicam-apps (without sudo) work and libcamera detected OV5647, camera_ros should work?
Of course, libcamera has to recognise the camera. The ROS node is just using the library to access cameras, read image data, etc. This all should work as normal user without sudo. If you can use libcamera only with sudo, then your user is probably missing the access rights or other settings are missing or wrong.
Can you please confirm if you can or cannot use the libcamera example applications (a.k.a. rpicam-apps
) as a regular user without sudo?
You can list the video devices with v4l2-ctl --list-devices
as you have shown, and then check the required permissions with ls
. E.g.:
$ ls -alh /dev/video0
crw-rw----+ 1 root video 81, 0 Jun 22 19:32 /dev/video0
shows me that the root
user and users of the video
group have access to that device.
I am not in the video
group but I can still access the cameras. But maybe you need to be in the video
group?
Can you please confirm if you can or cannot use the libcamera example applications (a.k.a.
rpicam-apps
) as a regular user without sudo?
I cannot use it without sudo. it could be due to raspberrypi step recommend sudo ninja -C build install while GitHub site recommends without sudo.
check the required permissions with
ls
. E.g.:$ll /dev/video0 crw-rw-rw-+ 1 root video 81, 0 Jun 25 10:42 /dev/video0 $ll /dev/media0 crw-rw-rw-+ 1 root video 505, 0 Jun 25 10:42 /dev/media0
$ ls -alh /dev/video0 crw-rw-rw-+ 1 root video 81, 13 Jun 26 15:59 /dev/video0
$ groups pi pi : pi adm cdrom sudo dip video plugdev lpadmin lxd sambashare
I cannot use it without sudo. it could be due to raspberrypi step recommend sudo ninja -C build install while GitHub site recommends without sudo.
And this is the same for the ROS node, i.e. you can use it with sudo but not without sudo? If this is the case, then I guess you have to take the issue with libcamera or the rpicam-apps projects since there is nothing the node can do about this.
And this is the same for the ROS node, i.e. you can use it with sudo but not without sudo?
if I use sudo ros2 run,
[ros2run]: Aborted
sudo: ros2: command not found
separately, what is your opinion on the humble-libcamera?
after the following change. still on libcamera v0.1.0 Edit /boot/config.txt, remove the line "camera_auto_detect=1" and dtoverlay=ov5647, and add "start_x=1" and "gpu_mem=128". Rebooting at this stage will reload the old V4L2 driver.
$cheese works
$ ros2 run camera_ros camera_node
[0:34:34.080810852] [3100] INFO Camera camera_manager.cpp:284 libcamera v0.1.0
terminate called after throwing an instance of 'std::runtime_error'
what(): no cameras available
[ros2run]: Aborted
$ sudo rpicam-hello
[sudo] password for pi:
ERROR: rpicam-apps currently only supports the Raspberry Pi platforms.
Contributions for other platforms are welcome at https://github.com/raspberrypi/rpicam-apps.
$cat /boot/firmware/config.txt
#camera_auto_detect=0
start_x=1
dtoverlay=ov5647
$ sudo rpicam-hello
okay, works.
$ sudo cheese
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.154: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.154: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.155: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.155: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.155: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.390: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.400: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.408: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.472: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): GLib-GObject-CRITICAL **: 09:17:45.491: g_value_dup_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(cheese:3509): cheese-WARNING **: 09:17:45.524: Failed to allocate required memory.: ../sys/v4l2/gstv4l2src.c(759): gst_v4l2src_decide_allocation (): /GstCameraBin:camerabin/GstWrapperCameraBinSrc:camera_source/GstBin:bin18/GstV4l2Src:v4l2src1:
Buffer pool activation failed
A new finding, after disabling start_x=1 now, stop at [ERROR] [1719563746.700658255] [camera_calibration_parsers]: Unable to open camera calibration file [/home/pi/.ros/camera_info/ov5647__base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml]
$ ros2 run camera_ros camera_node
[0:08:37.057173377] [2578] [1;32m INFO [1;37mCamera [1;34mcamera_manager.cpp:284 [0mlibcamera v0.1.0
[0:08:37.127649848] [2591] [1;32m INFO [1;37mRPI [1;34mvc4.cpp:390 [0mRegistered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media0 and ISP device /dev/media1
[INFO] [1719563745.786570339] [camera]:
>> cameras:
0: ov5647 (/base/soc/i2c0mux/i2c@1/ov5647@36)
[WARN] [1719563745.786935432] [camera]: no camera selected, using default: "/base/soc/i2c0mux/i2c@1/ov5647@36"
[INFO] [1719563745.787877017] [camera]:
>> stream formats:
- Pixelformat: NV21 (64x64 - 2592x1944)
- Pixelformat: YUV420 (64x64 - 2592x1944)
- Pixelformat: NV12 (64x64 - 2592x1944)
- Pixelformat: YVU420 (64x64 - 2592x1944)
- Pixelformat: XBGR8888 (64x64 - 2592x1944)
- Pixelformat: BGR888 (64x64 - 2592x1944)
- Pixelformat: RGB888 (64x64 - 2592x1944)
- Pixelformat: XRGB8888 (64x64 - 2592x1944)
- Pixelformat: RGB565 (64x64 - 2592x1944)
- Pixelformat: YVYU (64x64 - 2592x1944)
- Pixelformat: YUYV (64x64 - 2592x1944)
- Pixelformat: VYUY (64x64 - 2592x1944)
- Pixelformat: UYVY (64x64 - 2592x1944)
[WARN] [1719563745.788069761] [camera]: no pixel format selected, using default: "XBGR8888"
[INFO] [1719563745.788195337] [camera]:
>> XBGR8888 format sizes:
- 160x120
- 240x160
- 320x240
- 400x240
- 480x320
- 640x360
- 640x480
- 720x480
- 768x480
- 854x480
- 720x576
- 800x600
- 960x540
- 1024x576
- 960x640
- 1024x600
- 1024x768
- 1280x720
- 1152x864
- 1280x800
- 1360x768
- 1366x768
- 1440x900
- 1280x1024
- 1536x864
- 1280x1080
- 1600x900
- 1400x1050
- 1680x1050
- 1600x1200
- 1920x1080
- 2048x1080
- 1920x1200
- 2160x1080
- 2048x1152
- 2560x1080
- 2048x1536
- 2560x1440
- 2560x1600
[WARN] [1719563745.788252947] [camera]: no dimensions selected, auto-selecting: "2560x1600"
[WARN] [1719563745.788642233] [camera]: stream configuration adjusted from "2560x1600-XBGR8888" to "2560x1600-XBGR8888"
[0:08:37.130476584] [2578] [1;32m INFO [1;37mCamera [1;34mcamera.cpp:1033 [0mconfiguring streams: (0) 2560x1600-XBGR8888
[0:08:37.133130507] [2591] [1;32m INFO [1;37mRPI [1;34mvc4.cpp:512 [0mSensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 2592x1944-SGBRG10_1X10 - Selected unicam format: 2592x1944-pGAA
[INFO] [1719563745.797166584] [camera]: camera "/base/soc/i2c0mux/i2c@1/ov5647@36" configured with 2560x1600-XBGR8888 stream
[WARN] [1719563745.798542579] [camera]: control NoiseReductionMode (39) not handled
[INFO] [1719563746.700198244] [camera]: using default calibration URL
[INFO] [1719563746.700371074] [camera]: camera calibration URL: file:///home/pi/.ros/camera_info/ov5647__base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml
[ERROR] [1719563746.700658255] [camera_calibration_parsers]: Unable to open camera calibration file [/home/pi/.ros/camera_info/ov5647__base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml]
[WARN] [1719563746.700725738] [camera]: Camera calibration file /home/pi/.ros/camera_info/ov5647__base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml not found
$ cat /boot/firmware/config.txt
camera_auto_detect=0
#start_x=1
dtoverlay=ov5647
$ sudo rpicam-hello --version
rpicam-apps build: 122b835fb927-intree 09-01-2024 (17:13:42)
libcamera build: v0.1.0+118-563cd78e
$ sudo rpicam-hello --list-camera
Available cameras
-----------------
0 : ov5647 [2592x1944 10-bit GBRG] (/base/soc/i2c0mux/i2c@1/ov5647@36)
Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]
if I use sudo ros2 run,
[ros2run]: Aborted sudo: ros2: command not found
You can also start the node directly via its camera_node
executable in the install
folder.
You can also start the node directly via its
camera_node
executable in theinstall
folder.
Concretely, I mean that instead of sudo ros2 run camera_ros camera_node
you can also run the camera_node
executable directly via sudo ./install/camera_ros/lib/camera_ros/camera_node
.
@Jai-GAY Can you check if running the node with sudo this way allows you to access the camera? Also, can you be specific about what you expect to work and what concretely does not work? You are mixing a couple of things here and I am still not sure what issues are caused by the node and what is irrelevant to this repo.
sudo ./install/camera_ros/lib/camera_ros/camera_node
camera_ros was installed via
source /opt/ros/humble/setup.bash
sudo apt install ros-$ROS_DISTRO-camera-ros
$ ll ./install
ls: cannot access './install': No such file or directory
Also, can you be specific about what you expect to work and what concretely does not work?
hoping this works. ros2 run camera_ros camera_node. by the way, if it works what will user see?
I think camera_ros depends on libcamera, so I understand what you mean. I may have overwhelmed the issue without knowing how camera_ros and libcamera working relationship.
current error. [ERROR] [1719809358.804975838] [camera_calibration_parsers]: Unable to open camera calibration file [/home/pi/.ros/camera_info/ov5647base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml] [WARN] [1719809358.805043906] [camera]: Camera calibration file /home/pi/.ros/camera_info/ov5647base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml not found
$ ros2 run camera_ros camera_node
[0:03:43.447698915] [2374] INFO Camera camera_manager.cpp:284 libcamera v0.1.0
[0:03:43.523380998] [2387] INFO RPI vc4.cpp:390 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media0 and ISP device /dev/media2
[INFO] [1719809357.905187514] [camera]:
>> cameras:
0: ov5647 (/base/soc/i2c0mux/i2c@1/ov5647@36)
[WARN] [1719809357.905536335] [camera]: no camera selected, using default: "/base/soc/i2c0mux/i2c@1/ov5647@36"
[INFO] [1719809357.906442977] [camera]:
>> stream formats:
- Pixelformat: NV21 (64x64 - 2592x1944)
- Pixelformat: YUV420 (64x64 - 2592x1944)
- Pixelformat: NV12 (64x64 - 2592x1944)
- Pixelformat: YVU420 (64x64 - 2592x1944)
- Pixelformat: XBGR8888 (64x64 - 2592x1944)
- Pixelformat: BGR888 (64x64 - 2592x1944)
- Pixelformat: RGB888 (64x64 - 2592x1944)
- Pixelformat: XRGB8888 (64x64 - 2592x1944)
- Pixelformat: RGB565 (64x64 - 2592x1944)
- Pixelformat: YVYU (64x64 - 2592x1944)
- Pixelformat: YUYV (64x64 - 2592x1944)
- Pixelformat: VYUY (64x64 - 2592x1944)
- Pixelformat: UYVY (64x64 - 2592x1944)
[WARN] [1719809357.906535561] [camera]: no pixel format selected, using default: "XBGR8888"
[INFO] [1719809357.906639182] [camera]:
>> XBGR8888 format sizes:
- 160x120
- 240x160
- 320x240
- 400x240
- 480x320
- 640x360
- 640x480
- 720x480
- 768x480
- 854x480
- 720x576
- 800x600
- 960x540
- 1024x576
- 960x640
- 1024x600
- 1024x768
- 1280x720
- 1152x864
- 1280x800
- 1360x768
- 1366x768
- 1440x900
- 1280x1024
- 1536x864
- 1280x1080
- 1600x900
- 1400x1050
- 1680x1050
- 1600x1200
- 1920x1080
- 2048x1080
- 1920x1200
- 2160x1080
- 2048x1152
- 2560x1080
- 2048x1536
- 2560x1440
- 2560x1600
[WARN] [1719809357.906695306] [camera]: no dimensions selected, auto-selecting: "2560x1600"
[WARN] [1719809357.907038202] [camera]: stream configuration adjusted from "2560x1600-XBGR8888" to "2560x1600-XBGR8888"
[0:03:43.525823651] [2374] INFO Camera camera.cpp:1033 configuring streams: (0) 2560x1600-XBGR8888
[0:03:43.526560123] [2387] INFO RPI vc4.cpp:512 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 2592x1944-SGBRG10_1X10 - Selected unicam format: 2592x1944-pGAA
[INFO] [1719809357.909785402] [camera]: camera "/base/soc/i2c0mux/i2c@1/ov5647@36" configured with 2560x1600-XBGR8888 stream
[WARN] [1719809357.910690432] [camera]: control NoiseReductionMode (39) not handled
[INFO] [1719809358.804530191] [camera]: using default calibration URL
[INFO] [1719809358.804711713] [camera]: camera calibration URL: file:///home/pi/.ros/camera_info/ov5647__base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml
[ERROR] [1719809358.804975838] [camera_calibration_parsers]: Unable to open camera calibration file [/home/pi/.ros/camera_info/ov5647__base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml]
[WARN] [1719809358.805043906] [camera]: Camera calibration file /home/pi/.ros/camera_info/ov5647__base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml not found
camera_ros was installed via
source /opt/ros/humble/setup.bash sudo apt install ros-$ROS_DISTRO-camera-ros
$ ll ./install ls: cannot access './install': No such file or directory
Of course, you have to pick the correct path. If you install the node via the Debian package, the executable will be somewhere under /opt/ros/
.
current error. [ERROR] [1719809358.804975838] [camera_calibration_parsers]: Unable to open camera calibration file [/home/pi/.ros/camera_info/ov5647base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml] [WARN] [1719809358.805043906] [camera]: Camera calibration file /home/pi/.ros/camera_info/ov5647base_soc_i2c0mux_i2c_1_ov5647_36_2560x1600.yaml not found
What issues do you have with this? You should still get images from the camera.
You should still get images from the camera.
No, that is the thing.
You should still get images from the camera.
No, that is the thing.
Can you please be more specific about what the observed and expected behaviour is? What did you try, what did you expect and what was the actual observed behaviour? Is this still related to your initial problem? It is not possible to help you with this sparse information. The missing calibration file does not affect the published images.
can you provide a screen capture of when the user runs this command and what success output is expected?
ros2 run camera_ros camera_node
can you provide a screen capture of when the user runs this command and what success output is expected?
If you are trying to use the node, there must be something that you expect it to do for you :-) Typically, you want to subscribe to an image topic to get the images from the camera.
If you say you are not receiving images, what did you try?
how does the user verify setup and that everything is working when executing the following command, ros2 run camera_ros camera_node? Do you have a screenshot example?
I won't be able to help you unless you tell me explicitly and in detail 1)what you have tried, 2) what you expect to happen and 3) what actually happened.
Your questions are generically about how to run a ROS node and use topics etc. For this, please consult the ROS tutorials and documentation at https://docs.ros.org/en/jazzy/Tutorials.html.
I have only tried installing and launching the node.
But what did you try with the node in order to access the images? Did you subscribe to the image topics?
You said that you are not getting images from the camera. What makes you say that?
You said that you are not getting images from the camera. What makes you say that?
First, I needed to verify that my hardware and settings were okay, so I used 3rd party software module or application to verify.
So, I like to know how users verify that their subscription for images is not working or Camera_ros is not working. Is there any printout statement users can observe to know that Camera_ros is working well in the backend?
I created PR https://github.com/christianrauch/camera_ros/pull/52 to add more information about ROS topics, calibration and debugging to the documentation. Please have a look if this helps you to better understand what the node is supposed to do and let me know if anything is missing from your side there.
So, I like to know how users verify that their subscription for images is not working or Camera_ros is not working. Is there any printout statement users can observe to know that Camera_ros is working well in the backend?
Not in the default info log level. You can enable the libcamera and ROS debug levels. With the libcamera debug information, you should see something like DEBUG Request request.cpp:122 Request(1:C:0/1:0)
printed periodically on screen. To introspect the ROS topics, you can use the usual ros2 topic list
and ros2 topic echo
commands.
finally, I got the legacy camera working with Ubuntu 22.04 over OpenCV 4.x.
The "legacy" mode will be removed at some point since libcamera is now the official way to access the cameras: https://www.raspberrypi.com/documentation/computers/camera_software.html. If you need something future-proof, I would not invest in the legacy mode.
since libcamera is now the official way to access the cameras: https://www.raspberrypi.com/documentation/computers/camera_software.html.
I am unsure if anything has to do with the libcamera I recompiled and reinstalled last month.
Raspberry Pi’s implementation of libcamera supports the following cameras: Official cameras: OV5647 (V1)
I don't get what you want to say. libcamera supports all Raspberry Pi cameras. It's the officially supported camera software stack on the Raspberry Pi and the one this ROS node is made for.
If you still want to use the legacy stack for a while, then you cannot use this node.
I can run sudo rpicam-hello but not rpicam-hello, and also I get a Could not open any dmaHeap device error with the camera_ros. What am I missing? ros-humble-camera-ros (0.1.0-2jammy.20240524.040616)
$sudo libcamera-hello --list-cameras
$ sudo v4l2-ctl --list-devices