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.
- Raspberry Pi 4 (4 GB)
- Raspberry Pi HQ Camera Module (IMX477, CSI)
Raspberry Pi OS 64-bit is required for driver compatibility.
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 mmalFor background, see the ros2_v4l2_camera Raspberry Pi support notes.
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/libThese are configured in ade/compose.cam.yaml.
Inside the container:
ros2 launch cam_sensor_kit_launch cam.launch.pyDisable Foxglove bridge:
ros2 launch cam_sensor_kit_launch cam.launch.py enable_foxglove:=falseView the stream in Lichtblick by connecting to ws://<pi-ip>:8765 and subscribing to /sensing/cam/image_raw.
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.