Message broker to send GPS

is there an example on how to add GPS information with deepstream message broker?

Is a dynamic or static

dynamic like in getting messages constantly from GPS unit so that they will be sent by MQTT e.g. to Azure so they will appear at Azure , so it will be possible see GPS location from there , for example

but static sample could also do as it could be looped probably

so either of the two

Hi,
Can you specify your pipeline?

@amycao Thank you for following up!
There is no pipeline at the moment.
I am trying to find an example on how to add GPS data somehow using the deepstream message broker example or somehow else.

“nvmsgbroker” plugin extracts NVDS_META_PAYLOAD type of metadata from the buffer and sends that payload to the server using APIs in nvmsgbroker C library.
for your GPS data, you can create custom objects and attach to buffer as NVDS_EVENT_MSG_META metadata.
To do that NvDsEventMsgMeta provides “extMsg” and “extMsgSize” fields. User can create custom structure, fill that structure and assign the pointer of that structure as “extMsg” and set the “extMsgSize” accordingly. If custom object contains fields that can’t be simply mem copied then user should also provide function to copy and free those objects.
Refer generate_event_msg_meta() to know how to use “extMsg” and “extMsgSize” fields for custom objects and how to provide copy/free function and attach that object to buffer as metadata.
but you need to first generate the GPS data. then integrate with deepstream like above.

1 Like

@amycao
devs are asking if there is nvmsgbroker Python library
seems there is NvDsEventMsgMeta — Deepstream Deepstream Version: 5.1 documentation
GPS messages are like this

{
'sender': string,
'time': float,
'counter': int,
'location': (float, float),
'latitude': float,
'longitude': float,
'shift': float,
'speed_ms': float,
'speed_accuracy': int,
'gps_fix_ok': 1|0,
'head_valid': 1|0,
}

We do not have Python version for deepstream plugins or library, you need to implement in c version, and add python binding for it. you can refer to this faq for how to add python binding.
DeepStream SDK FAQ - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums

@amycao
It is not exactly very clear how to use the metadata buffers, given I just want to forward like /dev/pts/26 output with it, right?

terminal 1:

nvidia@nx_xavier:~$  socat -d -d pty,raw,echo=0 pty,raw,echo=0
2021/05/06 13:13:55 socat[23720] N PTY is /dev/pts/25
2021/05/06 13:13:55 socat[23720] N PTY is /dev/pts/26
2021/05/06 13:13:55 socat[23720] N starting data transfer loop with FDs [5,5] and [7,7]

terminal 2:

sudo apt install csh -y
wget https://iweb.dl.sourceforge.net/project/gpsfeed/gpsfeed-latest.zip
unzip gpsfeed-latest.zip
nvidia@nx_xavier:~$ tclsh8.6 gpsfeed+.tcl 

From this point there will be opened GUI of the gpsfeed. - two
GUI windows;
e.g. in serial section goes insteead of default COM1 → /dev/pts/25; baudrate to ->9600
Then in second GUI window = pressing play [ in the top left - a circle icon with a dot in the center;]
Now from the third terminal the GPS feed is available

:~$ cat /dev/pts/26
$GPGGA,180756,3756.2421,N,02346.8948,E,1,04,5.6,724.4,M,34.5,M,,*43
$GPRMC,180756,A,3756.2421,N,02346.8948,E,,,060521,5,E,A*01
$GPGGA,180758,3751.4936,N,02349.1123,E,1,04,5.6,384.3,M,34.5,M,,*4D
$GPRMC,180758,A,3751.4936,N,02349.1123,E,9109.2,159.8,060521,5,E,A*30
$GPGGA,180800,3747.8756,N,02353.0000,E,1,04,5.6,134.0,M,34.5,M,,*4C
$GPRMC,180800,A,3747.8756,N,02353.0000,E,8541.7,139.7,060521,5,E,A*3E
$GPGGA,180802,3745.9547,N,02358.0261,E,1,04,5.6,9.7,M,34.5,M,,*49
$GPRMC,180802,A,3745.9547,N,02358.0261,E,7942.4,115.8,060521,5,E,A*31

mentioned in Windows IoT Core - #9 by Andrey1984

Sorry for the delay.
Is this still an issue?
Can you refer to comment 7#? which part you are not clear about?

hi @amycao
thank you for following up!
we are trying to figure out how to publish to Azure IoT broker from Jetson GPS emulator or Jetson GPS.
So far we got a solution that publishes to Mosquitto local server, but without Azure Iot authentication, or otherwise we have examples of Deepstream or some generic Azure IoT examples that could publish to azure Iot but not the GPS data.
Is there a simple way how we could implement it with DeepStream Azure IoT thing?

See inline.

@amycao is there a pre-build mechanism to supply geo location as GPS outputs?
property location
https://docs.nvidia.com/metropolis/deepstream/python-api/PYTHON_API/NvDsMeta_Schema/NvDsEventMsgMeta.html#pyds.NvDsEventMsgMeta.location

Geo-location of object
I am having hard times trying to figure out how exactly redirect the flow from GPS output to test5 example inputs
Could you extend what is the geo-location , please?
What is the coordinate option?
property coordinate
https://docs.nvidia.com/metropolis/deepstream/python-api/PYTHON_API/NvDsMeta_Schema/NvDsEventMsgMeta.html#pyds.NvDsEventMsgMeta.coordinate

With mosquitto / paho mqtt we just used to redirect GPS emulator web socket to the message server like:

service := "localhost:2222"
	

property location definition:

struct NvDsGeoLocation

Holds geolocation parameters.

Public Members

gdouble lat

Holds the location’s latitude.

gdouble lon

Holds the location’s longitude.

gdouble alt

Holds the location’s altitude.

coordinate definition:

struct NvDsCoordinate

Hold a coordinate’s position.

Public Members

gdouble x

Holds the coordinate’s X position.

gdouble y

Holds the coordinate’s Y position.

gdouble z

Holds the coordinate’s Z position.

We do not have structure for GPS data, just as stated before, you need to crate one. you can refer to structure NvDsPersonObject or NvDsVehicleObject and test5 sample for how to use.

@amycao Thank you for following up!

typedef struct NvDsGeoLocation {
   98   gdouble lat;
   99   gdouble lon;
  100   gdouble alt;
  101 } NvDsGeoLocation;
  102 
  106 typedef struct NvDsCoordinate {
  107   gdouble x;
  108   gdouble y;
  109   gdouble z;
  110 } NvDsCoordinate;

do you mean that in the very same file NVIDIA DeepStream SDK API Reference: nvdsmeta_schema.h Source File
we would have to define a struct like in the example above? Otherwise in which file the structure needs to be created? Apart of creating of the structure definition there should also be somewhere loading the data from GPS . In which file does it go?

Yes.

Apart of creating of the structure definition there should also be somewhere loading the data from GPS . In which file does it go?

You can refer to generate_event_msg_meta() for how to fill NvDsPersonObject or NvDsVehicleObject

@amycao
Thank you for pointing out the structures below,
But could you extend how to use them to import GPS feed? which command will load NMEA inputs from the GPS unit?

typedef struct NvDsVehicleObject {
  126   gchar *type;
  127   gchar *make;
  128   gchar *model;
  129   gchar *color;
  130   gchar *region;
  131   gchar *license;
  132 } NvDsVehicleObject;
  133 
  137 typedef struct NvDsPersonObject {
  138   gchar *gender;
  139   gchar *hair;
  140   gchar *cap;
  141   gchar *apparel;
  142   guint age;
  143 } NvDsPersonObject;

This example illustrates how to define variables that would come from NMEA sequence, but how to import it to get structured after the structure got defined?

I am not familiar with GPS, you can google search how to load NMEA inputs from the GPS unit.

1 Like

@amycao
maybe you could provide an example how to incorporate any serial output e.g .like from cat /dev/tty
ACM0 ?

@amycao are you famirial with serial inputs?