Using ZED Camera
1. Overview
This application note explains how to use the ZED camera with the Emcraft software distribution for the Renesas RZ/V2H SoC.
2. High-level Overview
The ZED camera support may be seen as a part of the ROS2 support layer. Information on the ROS2 support layer is available from Using ROS2 Layer and APIs .
The ZED camera support is adapted from the TI’s Robotic SDK https://software-dl.ti.com/jacinto7/esd/robotics-sdk/latest/docs/source/README.html, which is based on the OpenCV
library.
3. ZED Camera Support Packages
The Emcraft software distribution installs to the target image the following ZED camera support packages:
ROS2 Package | Version | Summary | Notes |
---|---|---|---|
| 0.0.1-1 | A ZED camera driver ROS node based on |
|
NOTE: More ROS2 demo nodes from the TI’s SDK are going to be adapted soon.
3.1. Understanding ZED Packages Build Process
Emcraft makes use of a separate build environment to build the ZED camera support packages integrated into the Emcraft software distribution for the RZ/V2H SoC.
The build environment is based on the GitHub - ros/meta-ros: OpenEmbedded Layers for ROS 1 and ROS 2 Yocto meta-layer and is configured to build packages for the ARM64 and AMD64 architectures. The built binary packages are then published via a private Debian package archive. The Emcraft software distribution for the RZ/V2H SoC has the PPA included to the APT source list.
4. Verifying ZED Camera Support
4.1. Running ZED Capture ROS2 Node
4.2. Using ROS2 Interface to the ZED Camera
Step through the following procedure to demonstrate use of the ROS2 interface to the ZED camera:
Open a terminal window and login onto the RZ/V2H EVK board using
ssh
:<terminal 1>$ ssh user@<evk IP>
Connect the ZED camera to the EVK USB 3.x interface.
Check that ZED camera is recognized by USB:
user@rzv2hevkalphaemc:~$ v4l2-ctl --list-devices ... ZED 2i: ZED 2i (usb-15860000.usb-1): /dev/video0 /dev/video1 /dev/media5 ...
Run the ROS2 camera node wrapper:
<terminal 1>$ ros2 launch zed_capture zed_capture_launch.py zed_sn_str:=SN10026720
Note: If the camera is attached to a different
/dev/videoX
node, then add thecam_id:=<node num>
argument toros2 launch
(egcam_id:=2
for/dev/video2
).
The node will start with providing logs and information on the detected ZED camera:Open another terminal window and login onto the EVK:
Verify that the camera related topics are present:
Capture the camera information via the
camera/left/camera_info
topic:The application will start receiving the camera info message:
Capture the camera information via the
camera/right/camera_info
topic:The application will start receiving the camera info message:
Capture the camera information via the
camera/left/camera_info
topic:The application will start receiving the camera info message:
Capture the camera information via the
camera/right/camera_info
topic:The application will start receiving the camera info message:
5. Recording Capture and Playing Back the Captured Data in RVIZ
The ZED camera video capture can be played back on a host with installed rviz2
. The capture is streamed by the ROS2 layer using the RTPS protocol as being captured, hence it can be played back online. Also, in the absence of an Ethernet connection between the RZ/V2H EVK and the host running rviz2
, the ROS2 data can be captured into a bag and then played back by the host.
The capturing can be performed by the ros2 bag
command and requires the ros-humble-ros2bag
package to be installed:
The capture can be started by the following command:
The command will start writing bagged data:
The stream bandwidth is rather high, so consider stopping the capture by Ctrl-C
after a while (say, 30 seconds).
The data is written to the folder. Use tar
to compress it:
Then copy file to the host with rviz2
.
On the host, start rviz2
.
Add two Image
visualisations, and the corresponding input topic names: /camera/left/image_raw
and /camera/right/image_raw
, as depicted in the screenshots below:
Repeat this sequence for the left and right camera topics:
Switch back to the terminal window and extract the data bag:
And then start the playback:
rviz2
would start visualising the captured data. The image below depicts the image visualisation: