Skip to main content
Version: 1.0.2

GMSL2 Camera

Hardware

AutomatePro can be ordered with 0, 2, or 4 GMSL2 (Gigabit Multimedia Serial Link) camera inputs. GMSL2 is a high-speed, low-latency camera link commonly used in automotive applications. It supports cable lengths up to 15 m and Power over Coax (PoC). AutomatePro can supply up to 12 W total to downstream GMSL2 cameras.

Recommended cameras are listed in the camera accessories. The number of populated FAKRA Z connectors depends on the ordered device configuration.

GMSL2 camera connectors

Onboard GMSL2 Specifications

ParameterValue
Onboard ICMAX9296AGT
StandardGMSL2
Max cable length15 m
Max data rate4.5 Gbps
PoC voltage12 VDC
FAKRA typeType Z (Water Blue)
Max power12 W total

ROS API

Nodes: automatepro_cam1_node, automatepro_cam2_node

Publishers

Replace <camera_name> with the configured camera name, usually cam1 or cam2.

TopicTypeDescription
/camera/<camera_name>/image_rawsensor_msgs/msg/ImageRaw camera frames in the configured output encoding.
/camera/<camera_name>/camera_infosensor_msgs/msg/CameraInfoCamera calibration and projection information.
/camera/<camera_name>/h264/videofoxglove_msgs/msg/CompressedVideoH.264 compressed video frames.
/camera/<camera_name>/h264/calibfoxglove_msgs/msg/CameraCalibrationCalibration metadata for the compressed stream.

Debug Service

ServiceTypeDescription
/automatepro_cam<N>_node/disable_camera_inputsstd_srvs/srv/SetBoolDebug-only service for simulating camera input loss and recovery behavior.

Verify Cameras

Run these checks from AutomatePro over SSH:

source /opt/ros/humble/setup.bash
ros2 node list | grep automatepro_cam
ros2 topic list | grep '/camera/'

For a single-frame check:

ros2 topic echo /camera/cam1/camera_info --once

If camera compression is enabled, verify the H.264 stream:

ros2 topic hz /camera/cam1/h264/video

Configuration

Cameras are exposed as V4L2 devices such as /dev/video0 and /dev/video1. The AutomatePro camera driver uses these devices through GStreamer and publishes ROS 2 image and compressed-video topics.

Driver: automatepro_camera_driver
Container: automatepro-core-driver

info

Runtime ROS configuration is stored in /opt/automatepro/config/ros. Packaged defaults are stored in /opt/automatepro/defconfig/ros.

Edit the camera parameter file:

sudo nano /opt/automatepro/config/ros/camera_params.yaml

Important parameter groups:

ParameterDefaultDescription
enabletrueEnables the camera node when the launch file starts it.
camera_namecam1, cam2Name used in camera topic namespaces.
frame_idcam1, cam2Frame ID stamped on camera messages.
resolution[640, 512]ROS output resolution.
formatbgr8ROS image encoding.
qos_history_depth1Queue depth for raw image publishers.
qos_reliabilityreliableRaw image QoS reliability, either reliable or best_effort.
qos_durabilityvolatileRaw image QoS durability, either volatile or transient_local.
camera_info.*Identity calibration by defaultCalibration values published on camera_info.
compression.enabletrueEnables H.264 output.
compression.encoderautoSelects the encoder: auto uses GPU encoding when available and falls back to CPU, gpu forces nvv4l2h264enc, and cpu forces x264enc.
compression.bitrate5000Target bitrate in kbps. Set to 0 for automatic bitrate calculation.
compression.bits_per_pixel0.1Used for automatic bitrate calculation when bitrate is 0.
compression.resolution[640, 512]Compressed stream resolution.
compression.framerate30Compressed stream frame rate.
compression.qos_*varies by cameraQoS settings for the compressed-video publishers.
rtp.enablefalseSends the H.264 stream over RTP/UDP when enabled.
rtp.ip192.168.20.100RTP destination IP address.
rtp.port5000 / 5001RTP destination UDP port.
watchdog.timeout2000Time in milliseconds without frames before recovery starts.
watchdog.cycle_time500Watchdog check interval in milliseconds.
recovery.max_recovery_attempts1Pipeline recovery attempts before GMSL2 restart escalation.
frame_validation.sample_pixelsoptionalEnables additional frame validation sampling when uncommented.
logging.levelinfoDriver log level.
logging.throttle_ms10000Throttle interval for repeated debug logs.
publish_rate0.0Raw image publish rate limit in Hz. 0.0 publishes every frame; H.264 output rate is controlled by compression.framerate.
sensor.device/dev/video0, /dev/video1V4L2 device. Normally fixed by hardware.
sensor.resolution[1920, 1536]Sensor capture resolution. Normally fixed by hardware.
sensor.frame_rate30Sensor capture frame rate.

Default Config

The default file includes one section for each camera node. The most commonly edited values are shown below:

automatepro_cam1_node:
ros__parameters:
enable: true
camera_name: "cam1"
frame_id: "cam1"
resolution: [640, 512]
format: "bgr8"

camera_info:
distortion_model: "plumb_bob"
d: [0.0, 0.0, 0.0, 0.0, 0.0]
k: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
r: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
p: [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0]

compression:
enable: true
encoder: "auto"
bitrate: 5000
bits_per_pixel: 0.1
keyframe: 30
resolution: [640, 512]
framerate: 30

rtp:
enable: false
ip: "192.168.20.100"
port: 5000

watchdog:
timeout: 2000
cycle_time: 500

recovery:
wait_time_gmsl2_restart: 10
max_recovery_attempts: 1
window_seconds: 60

publish_rate: 0.0

# Do not change the sensor block unless Lemvos support instructs you to.
sensor:
device: "/dev/video0"
model: "SG3S-ISX031C"
resolution: [1920, 1536]
frame_rate: 30
format: "UYVY"

automatepro_cam2_node:
ros__parameters:
enable: true
camera_name: "cam2"
frame_id: "cam2"
resolution: [640, 512]
format: "bgr8"

# Same structure as cam1. Defaults use /dev/video1 and RTP port 5001.
sensor:
device: "/dev/video1"
model: "SG3S-ISX031C"
resolution: [1920, 1536]
frame_rate: 30
format: "UYVY"
Important

Restart automatepro-core-driver after changing the configuration. Configuration values are loaded when the driver container starts and are only applied after the service restarts.

sudo systemctl restart automatepro-core-driver

Enable or Disable Camera Drivers

To disable the AutomatePro camera driver and use a different V4L2, OpenCV, GStreamer, or custom camera stack, edit /opt/automatepro/.env:

sudo nano /opt/automatepro/.env

Set the relevant flags to 0:

ROS_DRIVER_CAM_1=0
ROS_DRIVER_CAM_2=0

Apply the change:

sudo systemctl restart automatepro-core-driver

Now you can use the cameras with any standard V4L2 driver, OpenCV, GStreamer, or another camera driver. For more details on hardware acceleration and GStreamer, see the NVIDIA Jetson multimedia documentation.

Troubleshooting

Camera Topics Are Missing

  1. Check whether the camera driver is enabled:

    grep ROS_DRIVER_CAM /opt/automatepro/.env
  2. Check the services:

    systemctl status automatepro-gmsl2 automatepro-core-driver
  3. Inspect recent logs:

    sudo journalctl -u automatepro-gmsl2 -n 100 --no-pager
    sudo journalctl -u automatepro-core-driver -n 100 --no-pager

Restart Camera Hardware

If the camera hardware needs to be reinitialized:

sudo systemctl stop automatepro-core-driver
sudo systemctl restart automatepro-gmsl2
sudo systemctl start automatepro-core-driver

Automatic Recovery

The camera driver includes a watchdog. If frames stop arriving, it first attempts driver-level recovery. If hardware-level recovery is required, the driver sets recovery.reset_fail=true; the AutomatePro Driver Manager watches that parameter and triggers GMSL2 restart through the AutomatePro IPC path and systemd services.

Verify that the driver manager is running:

ros2 node list | grep automatepro_driver_manager
Important

Automatic GMSL2 hardware recovery requires ROS_DRIVER_MANAGER=1 in /opt/automatepro/.env and the automatepro_driver_manager node must be running.

Developer Notes: launch and recovery internals

automatepro_bringup starts camera nodes with core_driver.launch.py. Camera 1 and Camera 2 are controlled by the launch arguments enable_cam1 and enable_cam2.

The Driver Manager discovers camera nodes matching /automatepro_cam.*, checks lifecycle state, reads the recovery.reset_fail parameter, and creates a restart request under /opt/automatepro/ipc/ when a camera node is unconfigured with recovery.reset_fail=true. The automatepro-gmsl2-ipc.path unit triggers automatepro-gmsl2-reactor.service, which restarts automatepro-gmsl2.service.