Skip to main content

ros2_deepstream

Install​

  • Install sudo apt install gstreamer1.0-x
  • Check, if gst-launch-1.0 v4l2src device=/dev/video4 ! xvimagesink works
    • replace /dev/video4 with the right device number for the Realsense camera on your system
    • If this command does not work, then ros2 run single_stream_pkg single_stream --ros-args -p input_source:="/dev/video4" will not work, too!
  • If you use Docker, make sure /dev/video4 is mounted correctly to the container

Run​

ros2 run single_stream_pkg single_stream --ros-args -p input_source:="/dev/video4"

Moving the ros2_deepstream Package to other Locations​

You have to set the correct paths in single_stream_class.py. Change the following lines in single_stream_class.py according to the new location:

43 sys.path.insert(0, './src/ros2_deepstream')
53 location = os.getcwd() + "/src/ros2_deepstream/config_files/"
337 location = os.getcwd() + "/src/ros2_deepstream/config_files/"

Troubleshooting​

Error 1​

No protocol specified
No EGL Display
nvbufsurftransform: Could not get EGL display connection
  • fix:
    • If you are working via ssh, try both export DISPLAY=:0 and export DISPLAY=:1. One of these two should work.

Error 2​

File "/home/galaxis/Projects/carolo-cup-2023-signs/build/single_stream_pkg/single_stream_pkg/single_stream_class.py", line 44, in <module>
from common.is_aarch_64 import is_aarch64
ModuleNotFoundError: No module named 'common'

problem 1: wrong PYTHONPATH

fix 1: in single_stream_class.py set the right path in

43 sys.path.insert(0, './nodes/ObjectDetection/ros2_deepstream')
  • this path/to/ros2_deepstream will depend on your folder structure

problem 2: You are running the node while you are in the wrong directory. You must be in the root of the workspace where the folders src/, build/, log/ and install/ are.

fix 2: make sure to run the single_stream node from the workspace root (i.e. the folder dev_ws in dev_ws/src/ros2_deepstream)

Error 3​

memory type configured and i/p buffer mismatch ip_surf 0 muxer 3
  • problem: the specified streammux resolution is wrong
  • fix: in single_stream_pkg/single_stream_pkg/single_stream_class.py set
324 # streammux.set_property('width', 1920)
325 # streammux.set_property('height', 1080)
326 streammux.set_property('width', 640)
327 streammux.set_property('height', 540)
  • important: resolution must be set to exactly one of the following values ! Other resolutions will give the above error.
    • on phth's machine:
      • width: 640 x height: 540
      • 424 x 240
    • on AGX:
      • width: 640 x height: 480

Error 4​

import pyds
ModuleNotFoundError: No module named 'pyds'
  • fix:
    • install Deepstream Python bindings first
      • see Gst Python v1.14.5 (should already be installed on Jetson)
      • see bindings
        • Important: clone the right tag e.g. git clone --depth 1 --branch v1.1.1 https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git (because each deepstream version has its own tag! E.g. for 6.0.1 there is tag v1.1.1)
    • make sure you have installed all dependencies of ros2_deepstream

Error 5​

0:00:00.198028383 12688 0x7f4c002380 WARN nvinfer gstnvinfer.cpp:747:gst_nvinfer_start:<primary_gie> error: Configuration file parsing failed
0:00:00.198092705 12688 0x7f4c002380 WARN nvinfer gstnvinfer.cpp:747:gst_nvinfer_start:<primary_gie> error: Config file path: /opt/nvidia/deepstream/deepstream-5.0/samples/configs/tlt_pretrained_models/config_infer_primary_peoplenet.txt
** ERROR: <main:651>: Failed to set pipeline to PAUSED
Quitting
ERROR from primary_gie: Configuration file parsing failed
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(747): gst_nvinfer_start (): /GstPipeline:pipeline/GstBin:primary_gie_bin/GstNvInfer:primary_gie:
Config file path: /opt/nvidia/deepstream/deepstream-5.0/samples/configs/tlt_pretrained_models/config_infer_primary_peoplenet.txt
App run failed
  • problem: there is probably some syntactic error in the config file config_infer_primary_peoplenet.txt or some typo, etc.
  • fix:
    • check config_infer_primary_peoplenet.txt for typos or syntactic errors
    • usually Deepstream gives a hint, where this error can be found, further at the beginning of the log, but you have to read the log carefully

Error 6​

Traceback (most recent call last):
File "/root/docker_volume/ds_ws/install/single_stream_pkg/lib/python3.6/site-packages/single_stream_pkg/single_stream_class.py", line 149, in osd_sink_pad_buffer_probe
result.id = str(class_sign_pgie[obj_meta.class_id])
IndexError: list index out of range
  • problem: The label file does not have the right format. E.g. the label file format from Roboflow does not work with ros2_deepstream.
  • fix: Make sure the label file contains a semicolon separated list of all classes.

Error 7​

error: package directory 'multi_stream_pkg' 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