How to combine deepstream-test3 with ros?

  • deepstream-app version 6.1.0
  • DeepStreamSDK 6.1.0
  • CUDA Driver Version: 11.4
  • CUDA Runtime Version: 11.0
  • TensorRT Version: 8.2
  • cuDNN Version: 8.4
  • libNVWarp360 Version: 2.0.1d3
  • device:A6000

How to combine deepstream-test3 with ros?
1,I add the callback function after nvtracker and everything works fine.
2,Now I want to send the nvtracker message through ros, but I find that when I add the code for ros to post the message in the callback function, the whole video gets stuck.
3,This must be a time consuming operation caused by ros joining, how should I go about combining ros publishing metadata?

 tiler_src_pad = gst_element_get_static_pad (nvtracker, "src");
    if (!tiler_src_pad)
        g_print ("Unable to get src pad\n");
        gst_pad_add_probe (tiler_src_pad, GST_PAD_PROBE_TYPE_BUFFER,
                           tiler_src_pad_buffer_probe, NULL, NULL);
    gst_object_unref (tiler_src_pad);
tiler_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info,
                            gpointer u_data)
  char msg_front[15] = "Helloworld!"; //pub msg
  frameMeta2Distance(msg_front);//This is the ros message distribution function
  return GST_PAD_PROBE_OK;

Is the ROS API synchronous or asynchronous? How much time is needed if you put it in the beginning of main?

Is this tiler_src_pad_buffer_probe callback function in the main thread? Or has a new thread been added?

The gstreamer probe API is synchronous with the pipeline. We do not recommend adding time-consuming method in it

I solved it!
It was caused by the sleep wait I added to ros.
Normally, ros is not a time consuming operation in the callback function and there is no problem using it for robot operations.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.