Skip to content

Latest commit

 

History

History
73 lines (47 loc) · 1.87 KB

File metadata and controls

73 lines (47 loc) · 1.87 KB

Cam Sensor Kit

ROS 2 launch package for the Raspberry Pi HQ Camera (IMX477) on a Raspberry Pi 4.

Streams /sensing/cam/image_raw via v4l2_camera and exposes it remotely via foxglove_bridge.

Hardware

  • Raspberry Pi 4 (4 GB)
  • Raspberry Pi HQ Camera Module (IMX477, CSI)

Host OS Setup

Raspberry Pi OS 64-bit is required for driver compatibility.

Switch to the legacy camera driver

By default, newer Raspberry Pi OS releases use the unicam CSI driver, which only provides raw Bayer images and is not compatible with v4l2_camera. The legacy bcm2835 mmal driver must be enabled instead.

Edit /boot/config.txt on the host:

camera_autodetect=0
start_x=1
gpu_mem=128

Then reboot. Verify the correct driver is loaded:

v4l2-ctl -D
# Should report: Driver: bcm2835 mmal

For background, see the ros2_v4l2_camera Raspberry Pi support notes.

Docker device access

The following compose settings are required for the container to access the camera:

devices:
  - /dev/video0:/dev/video0
  - /dev/vchiq:/dev/vchiq
volumes:
  - /opt/vc:/opt/vc
environment:
  - LD_LIBRARY_PATH=/opt/vc/lib

These are configured in ade/compose.cam.yaml.

Usage

Inside the container:

ros2 launch cam_sensor_kit_launch cam.launch.py

Disable Foxglove bridge:

ros2 launch cam_sensor_kit_launch cam.launch.py enable_foxglove:=false

View the stream in Lichtblick by connecting to ws://<pi-ip>:8765 and subscribing to /sensing/cam/image_raw.

Configuration

Camera parameters are in cam_sensor_kit_launch/config/sensors/cam/v4l2_camera.param.yaml.

The bcm2835 mmal driver supports up to 1920×1080 via V4L2. Higher resolutions (up to the IMX477's native 4056×3040) require a libcamera-based driver.