Skip to main content

ros-gst-bridge

Why do we need it?​

  • The ros2_deepstream package cannot natively subscribe to the ROS2 image topic published by the ros2_intel_realsense node.
  • Using this package, however, we can take ROS2 image topics and input them into the Gstreamer pipeline of the ros2_deepstream package as a rosimagesrc (in that sense this package is like a bridge).
    • the ros2_deepstream node has been modified accordingly
  • Note: If you do not use ros-gst-bridge, the ros2_intel_realsense node will block both the Realsense RGB camera and the depth camera, so that ros2_deepstream cannot access the Realsense RGB camera in the first place. So, you will have to find another workaround to get an RGB image stream for ros2_deepstream. Using the car's main camera is possible, but then you must implement another perspective transformation in ros2_intel_realsense. This idea, however, messes up ROS modularity and the resulting accuracy and performance of this method is also questionable. Therefore, I decided to stick to the ros2_intel_realsense package's intended use.

Install​

  • switch to branch dashing before building!!!
git clone https://github.com/pharath/ros-gst-bridge.git
cd path/to/ros-gst-bridge/
git checkout dashing
cd ../../dev_ws/
source /opt/ros/eloquent/setup.bash
colcon build

Source Script​

The bridge will only work, if you source source_ws.sh:

# ====== "source_ws.sh" ========

echo "source /opt/ros/eloquent/setup.bash"
source /opt/ros/eloquent/setup.bash
echo "source install/local_setup.bash"
source install/local_setup.bash
if [ "$DISPLAY" != ":0" ]; then
echo "export DISPLAY=:0"
export DISPLAY=:0
else
echo "DISPLAY variable is already set to ':0'."
fi

# For gst_bridge:
#
# Note: If you don't set GST_PLUGIN_PATH, you must use the
# option "--gst-plugin-path=install/gst_bridge/lib/gst_bridge/"
# in the gst-launch-1.0 pipeline
export GST_PLUGIN_PATH=install/gst_bridge/lib/gst_bridge/

Video Explanation (by the Developer of ros-gst-bridge)​

rosgsttutorial.jpg

Troubleshooting​

Errors​

Error 1​

error: package directory 'gst_pipeline' does not exist ros2
  • fix: instead of
# from compile.sh
colcon build --executor parallel --parallel-worker ${USE_CORES} --cmake-args " -DCMAKE_BUILD_TYPE=${CONFIG_CMAKE_BUILD_TYPE}" " -DJETSON_DEVICE=${DEVICE}" " -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" --symlink-install`

just run

colcon build --executor parallel --parallel-worker ${USE_CORES} --symlink-install