Skip to content

BWSI-UAV-2025/Week2_Vision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Configuring Pi 5 camera with ROS2

WARNING: Do not install or remove cameras when Pi is powered on, always shutdown and power off the Pi when moving the camera cables.

Remove any previously installed versions of libcamera:

sudo apt purge libcamera*
sudo apt purge ros-jazzy-libcamera*
rm -rf ~/camera_ws/build ~/camera_ws/install ~/camera_ws/log 

Install Dependencies:

sudo apt install -y libavdevice-dev libepoxy-dev
sudo apt install -y ros-jazzy-camera-info-manager
sudo apt install -y ros-jazzy-image-transport-plugins
sudo apt install -y python3-colcon-meson
sudo apt install -y python3-rosdep
sudo apt install -y python3-colcon-common-extensions
sudo apt install -y libboost-dev
sudo apt install -y libgnutls28-dev openssl libtiff5-dev pybind11-dev
sudo apt install -y qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5
sudo apt install -y meson cmake
sudo apt install -y python3-yaml python3-ply
sudo apt install -y libglib2.0-dev libgstreamer-plugins-base1.0-dev

Build ROS package and libcamera:

# create workspace
mkdir -p ~/camera_ws/src
cd ~/camera_ws/src

# raspberrypi fork with support for newer camera modules
git clone https://github.com/raspberrypi/libcamera.git
# camera_ros repository
git clone https://github.com/christianrauch/camera_ros.git

# resolve binary dependencies and build workspace
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/camera_ws/
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO --skip-keys=libcamera
colcon build

Run node:

ros2 run camera_ros camera_node

Visualize images using rqt, type "rqt" in a terminal, then go to "Plugins->Visualization->Image View", and then select the appropriate topic in the dropdown menu

Setup multiple cameras:

Modify /boot/firmware/config.txt by commenting out the line that says camera_auto_detect=1 and then adding the following lines below:

dtoverlay=imx708,cam0
dtoverlay=imx708,cam1
#camera_auto_detect=1

Then when running the ros node specify the camera index:

ros2 run camera_ros camera_node __name:=camera_0 --ros-args -p camera:=0
ros2 run camera_ros camera_node __name:=camera_1 --ros-args -p camera:=1

The above instructions were derived from: https://github.com/TanmayChhatbar/ros2_car/blob/feature/camera_setup/README_ELI5.md

ROSBag Tutorial

Pi 5 40-pin header pinout

Additional resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors