Code Monkey home page Code Monkey logo

gstreamer_camera_driver's Introduction

GStreamer Camera Driver for CARMA

This is a fork of the ROS GSCam package that is used for broadcasting any GStreamer-based video stream via the standard ROS Camera API. This fork has been modified to allow for building a Docker image that can serve as a camera driver for the CARMA Platform.

GStreamer Library Support

This driver supports the following versions of GStreamer:

0.10.x: Deprecated

1.x: Default

Ubuntu 20.04 Installation

Assuming the CARMA Platform is installed at ~/carma_ws/src,

cd ~/carma_ws/src
git clone https://github.com/GoodarzMehr/gstreamer_camera_driver.git
cd gstreamer_camera_driver/docker
sudo ./build-image.sh -d

After the Docker image is successfully built, add the following lines to the appropriate docker-compose.yml file in the carma-config directory.

gstreamer-camera-driver:
  image: usdotfhwastoldev/carma-gstreamer-camera-driver:develop
  container_name: gstreamer-camera-driver
  network_mode: host
  volumes_from:
    - container:carma-config:ro
  environment:
    - ROS_IP=127.0.0.1
  volumes:
    - /opt/carma/logs:/opt/carma/logs
    - /opt/carma/.ros:/home/carma/.ros
    - /opt/carma/vehicle/calibration:/opt/carma/vehicle/calibration
  command: bash -c '. ./devel/setup.bash && export ROS_NAMESPACE=$${CARMA_INTR_NS} && wait-for-it.sh localhost:11311 -- roslaunch /opt/carma/vehicle/config/drivers.launch drivers:=gstreamer_camera'

Finally, add the following lines to the drivers.launch file in the same directory as docker-compose.yml.

<include if="$(arg gstreamer_camera)" file="$(find gscam_driver)/launch/left_imx390.launch">
</include>

left_imx390.launch is used as an example here and can be replaced with any other launch file in the gstreamer_camera_driver/launch directory.

ROS API

gscam_driver

This can be run as both a node and a nodelet.

Nodes

  • gscam

Published Topics

Publication frequencies are given for a Leopard Imaging LI-IMX390-GMSL2 camera operating at a resolution of 1920x1080 at 30 frames per second (fps).

  • camera/image_raw [sensor_msgs/Image]: publishes the video stream obtained from the camera (30 Hz).
  • camera/camera_info [sensor_msgs/CameraInfo]: publishes the camera calibration file (30 Hz).
  • camera/driver_discovery [cav_msgs/DriverStatus]: publishes the CARMA DriverStatus message (1.25 Hz).

Subscribed Topics

N/A

Services

  • set_camera_info [sensor_msgs/SetCameraInfo]: stores the given CameraInfo as the camera's calibration information.

Parameters

  • camera_name: the name of the camera (corrsponding to the camera info).
  • camera_info_url: a url (file://path/to/file, package://pkg_name/path/to/file) to the camera calibration file.
  • gscam_config: the GStreamer pipeline description.
  • frame_id: the TF2 frame ID.
  • reopen_on_eof: re-open the stream if it ends (EoF).
  • sync_sink: synchronizes appsink (sometimes setting this to false can resolve problems with sub-par frame rates).
  • preroll: preroll the stream if needed.
  • use_gst_timestamp: use GstClock instead of ROS Time.
  • publish_timestamp: publish the timestamp of image frames.

Examples

See the example launch files in the gstreamer_camera_driver/launch directory. Each launch file launches a Leopard Imaging LI-IMX390-GMSL2 camera connected via a TCP/IP connection.

Original GSCam Documentation Build Status

This is a ROS package originally developed by the Brown Robotics Lab for broadcasting any GStreamer-based video stream via the standard ROS Camera API. This fork has several fixes incorporated into it to make it broadcast correct sensor_msgs/Image messages with proper frames and timestamps. It also allows for more ROS-like configuration and more control over the GStreamer interface.

Note that this pacakge can be built both in a rosbuild and catkin workspaces.

GStreamer Library Support

gscam supports the following versions of GStreamer

0.1.x: Default

Install dependencies via rosdep.

1.0.x: Experimental

Dependencies:

  • gstreamer1.0-tools
  • libgstreamer1.0-dev
  • libgstreamer-plugins-base1.0-dev
  • libgstreamer-plugins-good1.0-dev

Ubuntu Install

12.04

sudo add-apt-repository ppa:gstreamer-developers/ppa
sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev

14.04

sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev

Usage:

  • Use the CMake flag -DGSTREAMER_VERSION_1_x=On when building
  • See the Video4Linux2 launchfile example for an example of the differences in the GStreamer config lines

Notes:

  • This has been tested with v4l2src

ROS API (stable)

gscam

This can be run as both a node and a nodelet.

Nodes

  • gscam

Topics

  • camera/image_raw
  • camera/camera_info

Services

  • camera/set_camera_info

Parameters

  • ~camera_name: The name of the camera (corrsponding to the camera info)
  • ~camera_info_url: A url (file://path/to/file, package://pkg_name/path/to/file) to the camera calibration file.
  • ~gscam_config: The GStreamer configuration string.
  • ~frame_id: The TF frame ID.
  • ~reopen_on_eof: Re-open the stream if it ends (EOF).
  • ~sync_sink: Synchronize the app sink (sometimes setting this to false can resolve problems with sub-par framerates).

C++ API (unstable)

The gscam c++ library can be used, but it is not guaranteed to be stable.

Examples

See example launchfiles and configs in the examples directory. Currently there are examples for:

  • Video4Linux2: Standard video4linux-based cameras like USB webcams.
    • GST-1.0: Use the roslaunch argument GST10:=True for GStreamer 1.0 variant
  • Nodelet: Run a V4L-based camera in a nodelet
  • Video File: Any videofile readable by GStreamer
  • DeckLink: BlackMagic DeckLink SDI capture cards (note: this requires the gst-plugins-bad plugins)

gstreamer_camera_driver's People

Contributors

goodarzmehr avatar jbohren avatar k-okada avatar cedricpradalier avatar sirver avatar rctoris avatar dhood avatar kubark42 avatar bulwahn avatar mikaelarguedas avatar blutack avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.