picamera_ros2
PiCamera wrapper using libcamera (RasPi-CSI2)
Docker
build and run the read to use docker container:
docker build -t ros2-libcamera-apps .
sudo docker run -it --rm --name devfull --hostname devfull --network=host --privileged -v /dev/:/dev/ -v /run/udev:/run/udev -v /run/dbus/:/run/dbus ros2-libcamera-apps
Depends (Development environment)
- Raspberry Pi Bullseye (64bit)
- libcamera-dev
sudo apt install libcamera-dev
- ROS2-Humble
- OpenCV4
- libboost
sudo apt install build-essential cmake git libcamera-dev libopencv-dev libdrm-dev libboost-dev libboost-program-options-dev
building libcamera
Usage
source /opt/ros/galactic/setup.bash
git clone https://github.com/Ar-Ray-code/picamera_ros2.git ~/ros2_ws/src
cd ~/ros2_ws
colcon build --symlink-install
Topic
Publish
- image_raw (sensor_msgs/msg/Image)
Parameter
- video_width: width of publishing image (Default: 1280)
- video_height height of publishing image (Default: 720)
- framerate: publishing rate (Default: 30)
Note: The actual frame rate may be lower than the set frame rate.
Context (by kbarni)
In Raspbian Bullseye, the Raspberry Pi camera framework was completely rebased from MMAL to the libcamera library - thus breaking most of the previous camera dependencies.
Raspbian comes with the handy libcamera-apps package that duplicates the old raspistill and raspivid applications, with some added functionnality, like the possibility of adding postprocessing routines to the capturing process.
However this is still limited, as it doesn't allow full integration of the camera in your software.
LCCV aims to provide a simple to use wrapper library that allows you to access the camera from a C++ program and capture images in cv::Mat format.
License
BSD 2-Clause License (Raspberry Pi)
Reference
- LCCV by kbarni
- libcamera-apps by raspberrypi