feat(camera): discover and publish multiple capture devices

This commit is contained in:
2026-10-20 10:05:58 +09:00
parent 7e76921c5e
commit 87b452035b
6 changed files with 199 additions and 14 deletions
+36 -2
View File
@@ -9,14 +9,14 @@ The template folder remains `[lms-nav2-camera-test]nav2-camera-test_v1.0.0_ws`.
- Package: `camera_test_pkg`
- Launch: `camera.launch.py`
- Viewer topic: `/camera_test/image_jpeg` (`sensor_msgs/msg/CompressedImage`, sensor-data QoS)
- Only the selected `/dev/videoN` device is passed into the container.
- Only selected capture devices are passed into the container, never the whole `/dev` directory.
- No vehicle commands, fabricated calibration, or fixed camera mounting TF are published.
## Parameters
| Parameter | Default | Meaning |
| --- | --- | --- |
| `video_device` | `/dev/video0` | V4L2 camera device |
| `video_device` | `/dev/video0` | One V4L2 device, or `/dev` to discover up to eight capture endpoints |
| `width` / `height` | `640` / `480` | Capture resolution supported by the camera |
| `fps` | `30` | Capture frame rate |
| `publish_fps` | `10` | Maximum publication rate |
@@ -25,11 +25,45 @@ The template folder remains `[lms-nav2-camera-test]nav2-camera-test_v1.0.0_ws`.
| `jpeg_topic` | `/camera_test/image_jpeg` | Keep the default for the LMS viewer |
| `frame_id` | `camera_test_link` | Image frame identifier |
| `publish_raw` | `false` | Also publish `/camera_test/image_raw` |
| `raw_topic` | `/camera_test/image_raw` | Raw topic for single-camera operation |
`auto` negotiates raw/JPEG encoding, not resolution or frame rate. Use a mode
reported by `v4l2-ctl --device /dev/video0 --list-formats-ext` when defaults are unsupported.
This module provides a video preview, not calibrated visual SLAM input.
## Multiple Cameras
Set `video_device:=/dev` to inspect `/dev/video*` when the module starts.
Capture-capable nodes are selected using V4L2 device capabilities; metadata-only,
codec, non-character and inaccessible nodes are skipped. Device numbers are not
physical-camera counts: a device can expose multiple usable capture streams.
Discovery does not start streams on the host. Only the selected device nodes
and Jetson VI channels are passed to Docker.
Each endpoint has its own process and topics, for example
`/camera_test/cameras/video0/image_jpeg` and
`/camera_test/cameras/video2/image_jpeg`. Raw topics and frame IDs are also unique.
In automatic mode these per-device names replace `jpeg_topic`, `raw_topic` and
`frame_id`. Single-device operation retains the original names and overrides.
The updated LMS viewer displays only endpoints actually publishing JPEG frames,
with device labels and scrolling when needed. A failed camera does not stop
other camera processes. Restart the module after adding, removing or reconnecting
a camera so device discovery and failed capture processes are refreshed.
Update and rebuild this module on Jetson before using automatic discovery.
Old ARM64 prebuilt build/install archives must be regenerated before publishing.
The runtime image is unchanged. Update the LMS FE as well; the remote viewer
bridge receives the bundled bridge source on visualization startup.
```sh
./build.sh
ROS_DOMAIN_ID=77 ./run.sh video_device:=/dev publish_fps:=5
```
All selected cameras use the same resolution, capture FPS and pixel format.
Choose a mode supported by every camera, and reduce FPS/resolution if USB
bandwidth, encoding CPU usage or remote network traffic becomes excessive.
## LMS Installation
The environment profile supplies the runtime image artifact; the module supplies