https://github.com/clydemcqueen/gscam2
ROS2 camera driver for GStreamer-based video streams, supports intra-process communication
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.4%) to scientific vocabulary
Keywords
Repository
ROS2 camera driver for GStreamer-based video streams, supports intra-process communication
Basic Info
Statistics
- Stars: 65
- Watchers: 4
- Forks: 12
- Open Issues: 7
- Releases: 0
Topics
Metadata Files
README.md
gscam2 
ROS2 port of gscam. Supports ROS2 intra-process comms.
Update 15-Jun-22: gscam has been released for ROS2. It does not support IPC.
Update 16-Mar-21: the package name has been updated to match the repository name (gscam2)
Install and build
Tested on ROS2 Foxy, Galactic, Humble and Rolling. See the Dockerfile for install and build instructions.
Usage
Make sure your GStreamer pipeline runs successfully in gst-launch-1.0. For example, here's a pipeline that works for the Blue Robotics HD USB Camera: ~~~ gst-launch-1.0 -v v4l2src device=/dev/video1 do-timestamp=true ! queue ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! queue ! avdec_h264 ! autovideosink ~~~
Here's the same pipeline in gscam2: ~~~ export GSCAMCONFIG="v4l2src device=/dev/video1 do-timestamp=true ! queue ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! avdech264 ! videoconvert" ros2 run gscam2 gscam_main ~~~
Here's an example with parameters: ~~~ ros2 run gscam2 gscammain --ros-args --remap /imageraw:=/mycamera/imageraw --params-file gscamparams.yaml -p camerainfourl:=file://$PWD/mycamerainfo.ini ~~~ ... where gscamparams.yaml is: ~~~ gscampublisher: rosparameters: gscamconfig: 'v4l2src device=/dev/video1 do-timestamp=true ! queue ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! avdech264 ! videoconvert' preroll: True usegsttimestamps: True cameraname: 'mycamera' frameid: 'mycameraframe' ~~~
Here's an example that uses a GStreamer tee to split the stream, with one stream producing ROS images and the second stream writing to MP4 files: ~~~ export GSCAMCONFIG="v4l2src device=/dev/video1 do-timestamp=true ! queue ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! tee name=fork ! queue ! splitmuxsink location=video%02d.mov max-size-bytes=10000000 fork. ! avdech264 ! videoconvert" ros2 run gscam2 gscam_main ~~~ There's a bug where the last MP4 file is not closed correctly.
Intra-process comms
IPC test -- CLI composition: ~~~
First shell
ros2 run rclcppcomponents componentcontainer
Second shell (ignore the deprecation warning, see https://github.com/ros2/ros2cli/issues/336)
ros2 component load /ComponentManager gscam2 gscam2::ImageSubscriberNode -e useintraprocesscomms:=true ros2 component load /ComponentManager gscam2 gscam2::GSCamNode -e useintraprocesscomms:=true ~~~
Launch file composition: ~~~ ros2 launch gscam2 composition_launch.py ~~~
Manual composition -- handy for debugging: ~~~ ros2 run gscam2 ipctestmain ~~~
Finding GStreamer plugins
GStreamer scans various paths for plugins and builds a plugin registry. The search process is described here.
gscam uses a parameter gst_plugin_path instead than the commandline option --gst-plugin-path.
The paths in gst_plugin_path are searched last, not first.
If you have custom plugins you may need to override the plugin path. Here's an example showing how this works: ~~~
Disable default locations
export GSTPLUGINPATH="" export GSTPLUGINSYSTEM_PATH=""
Provide the pipeline configuration
export GSCAM_CONFIG=videotestsrc pattern=snow ! video/x-raw,width=1280,height=720 ! videoconvert
Run gscam_main, providing a custom plugin path
ros2 run gscam2 gscammain --ros-args -p gstplugin_path:="/home/me/myplugins" ~~~
Parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
| gst_plugin_path | string | | Similar to --gst-plugin-path, searchs path for plugins |
| gscam_config | string | | GStreamer pipeline configuration |
| sync_sink | bool | True | Enable GstBaseSink synchronization |
| preroll | bool | False | Transition to GSTSTATEPLAYING twice |
| use_gst_timestamps | bool | False | Use gst time instead of ROS time |
| image_encoding | string | sensor_msgs::image_encodings::RGB8 | ROS image encoding |
| camera_info_url | string | | URL to camera info file, e.g., file:///path/to/file |
| camera_name | string | | Replaces ${NAME} in the URL |
| frame_id | string | camera_frame | Camera frame ID |
Topics
camera_infoimage_rawimage_raw/compressed- only if image is encoded as a jpeg stream
Camera info file formats
Uses the ROS standard camera calibration formats.
Files must end in .ini or .yaml.
Owner
- Name: Clyde McQueen
- Login: clydemcqueen
- Kind: user
- Location: Seattle
- Repositories: 14
- Profile: https://github.com/clydemcqueen
Xoogler ramping up on all things computer vision, ROS and maritime robotics.
GitHub Events
Total
- Watch event: 21
- Issue comment event: 2
- Pull request event: 1
- Fork event: 9
Last Year
- Watch event: 21
- Issue comment event: 2
- Pull request event: 1
- Fork event: 9
Dependencies
- actions/checkout v2 composite
- ros-tooling/action-ros-ci 0.2.5 composite
- osrf/ros $TARGET_ROS_DISTRO-desktop build