GStreamer Camera Node for ROS 1

This GStreamer based camera ROS node is from https://github.com/ros-drivers/gscam. Some changes are made to customize the original ROS node for the uses with Robotics SDK for TDA4:

  • Added GStreamer pipelines that use the GStreamer plugins optimized for TDA4 devices, and added NV12 encoding mode.

  • Added an example camera_info.yaml for Logitech webcam C920 and associated LDC look-up-table file (required to use TI TDA4 LDC hardware accelerator).

  • Added launch files (under ‘launch’ folder) for Logitech webcam (in MJPG mode and YUYV mode), and OV5640 (in YUYV mode).

  • Added a launch file for IMX390 FPD-Link cameras.

  • Dependency: following modules are already built and installed in the the Robotics SDK ROS Docker images.

Note: The customization are made only for Robotics SDK for TDA4, and some of examples from the original GIT repository may not work with these changes.

Usage

Running gscam on TDA4

  1. Camera Calibration and Rectification Map Generation: See corresponding parts of mono_capture/README.md.

  2. Build the ROS node:

    cd $ROS_WS
    catkin_make --source /opt/robotics_sdk/ros1
    source devel/setup.bash
    
  3. Launch the “gscam” ROS node: Before launching the “gscam”, please make sure to update device in the launch file to point to correct camera device (/dev/videoX). For capturing in MJPG (motion JPEG) mode,

    roslaunch gscam v4l_mjpg.launch
    

    For capturing in YUYV mode,

    roslaunch gscam v4l_yuv.launch
    roslaunch gscam v4l_ov5640.launch # for OV5640 CSI camera
    

Note: The measured framerate for the output topic can be less than the framerate set in the launch file, depending on the light condition of the scenes. This is a normal behavior inherited from v4l2src and the ISP settings of, e.g., USB webcam.

Visualization on Remote PC

By default, the output topic raw_image is published in NV12 color format to make more efficient when the node is integrated with the vision vision CNN processing chain (including ti_vision_cnn ROS node) on TDA4. We provide a launch file for visualization on the remote Ubuntu (included in ti_viz_nodes ROS package).

In the PC Docker container,

roslaunch ti_viz_nodes gscam_nv12.launch

Usage: IMX390 Camera

Running gscam on TDA4

Please follow the hardware setup section of Edge AI documentation.

You can check the device ID and subdev ID for the IMX390 camera attached to the hardware setup by running /opt/edge_ai_apps/scripts/setup_cameras.sh on the TDA4 target host Linux. Accordingly please update the launch files below, or it’s also possible to pass as launch arguments.

To publish raw images in the native resolution (1936 x 1096),

roslaunch gscam v4l_imx390_raw.launch

We also provide a launch file that includes rectification and resizing in the GStreamer pipeline.

# 1080p
roslaunch gscam v4l_imx390.launch width:=1920 height:=1080
# 720p
roslaunch gscam v4l_imx390.launch width:=1280 height:=720

Note: The GStreamer pipeline in v4l_imx390.launch also includes the LDC plugin (tiovxldc). Raw resolution is 1936 x 1096. The LDC plugin performs rectification and then cropping to produce 1920 x 1080 images in NV12 format, followed by MSC plugin (tiovxmultiscaler) to resize the images to the output resolution.

Visualization on Remote PC

For visualization, run the following in the PC Docker container,

# native resolution (1936 x 1096)
roslaunch ti_viz_nodes gscam_nv12.launch width:=1936 height:=1096
# 1080p
roslaunch ti_viz_nodes gscam_nv12.launch width:=1920 height:=1080
# 720p
roslaunch ti_viz_nodes gscam_nv12.launch width:=1280 height:=720