Windows IoT Core

is it possible to install “Windows IoT Core” on Jetson?

Hi Andrey1984,

We don’t support it.

@kayccc Thank you for following up! Maybe you could you suggest a method for passing GPS messages from Jertson to Microsoft Azure IoT hub?

Hi @Andrey1984, I haven’t personally used it before, but I think you would need to install one of their Azure IoT SDK’s on your Jetson:

@dusty_nv Thank you for your following up!
Maybe you had some experience with non-Microsoft methods for passing GPS with message broker like MQQT?

I don’t, but I just found that DeepStream has integration with Azure IoT framework (and it supports MQQT also):

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvmsgbroker.html

@dusty_nv , yes it has integration, but are there any insights on how to integrate GPS data with it?

Perhaps using metadata buffers? You may want to ask the question on the DeepStream forum to see how to best get the data into DeepStream.

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

So figuring out how to pass it through Deepstream might be overcomplicated, given the gps feed gonna be transmitted maybe?
I tried asking Message broker to send GPS - #7 by amycao
Maybe if to omit the DeepStream it would be less complicated to transfer the stream? Otherwise I will try to add more details to the DeepSteram post maybe someone will figure out how to do it

If you want to bypass DeepStream then it looks like the options are installing the Azure IoT SDK and using that, or using a message broker like MQTT directly. It looks like there is a Python package paho-mqtt for that.

yes, but I am missing the exact steps how to load the output of /dev/pst/26 to e.g. paho mqqt or any other equivalent e.g. mosquito;

The Dockerfile is simple:

FROM alpine
  
RUN apk update
RUN apk add mosquitto

CMD /usr/sbin/mosquitto                      

This image uses Alpine as a base then adds the mosquitto. Finally, it starts the broker with the CMD value.

To build it, run the command:

docker build -t mosquitto -f Dockerfile.mosquitto .

And to run on the default network:

docker run -it --rm --name mosquitto -p 1883:1883 mosquitto

What I am trying to find out is how exactly to subscribe the paho-mqtt to /dev/pts/26 - that is what I am trying to figure out there should be a simple command doing it probably. there should be a command like

python
import paho-mqtt

subscribe /dev/pts/26
instead of the latter it needs to be acttaul working line that I am trying to determine

My guess is that you will need to open the /dev/tty file in Python (or use pyserial module if needed), and extract the data programmatically in order to construct the messages for the broker. Or maybe there is some mosquitto command-line tool that relays messages from other files, I’m not sure.

with just python I could kind of read

 cat pts_v2.py 
import sys                                           

with open("/dev/pts/26", "wb+", buffering=0) as term:
        while True:
        	print(term.read(26).decode(), end='')
        sys.stdout.flush()

based on https://stackoverflow.com/a/46181793
like

python3 pts_v2.py 
$GPGGA,191157,3756.8819,N,02404.8014,E,1,04,5.6,455.4,M,34.5,M,,*4D
$GPRMC,191157,A,3756.8819,N,02404.8014,E,3442.9,42.0,060521,5,E,A*04
$GPGGA,191159,3758.8726,N,02405.7998,E,1,04,5.6,809.2,M,34.5,M,,*4E
$GPRMC,191159,A,3758.8726,N,02405.7998,E,3853.2,21.6,060521,5,E,A*00
$GPGGA,191201,3801.1623,N,02405.9797,E,1,04,5.6,1190.8,M,34.5,M,,*73
$GPRMC,191201,A,3801.1623,N,02405.9797,E,4129.4,3.5,060521,5,E,A*39
$GPGGA,191203,3803.4176,N,02405.2627,E,1,04,5.6,1544.6,M,34.5,M,,*73
$GPRMC,191203,A,3803.4176,N,02405.2627,E,4184.8,345.9,060521,5,E,A*3C
$GPGGA,191205,3805.2904,N,02403.7043,E,1,04,5.6,1819.2,M,34.5,M,,*7E
$GPRMC,191205,A,3805.2904,N,02403.7043,E,4029.8,326.8,060521,5,E,A*32
$GPGGA,191207,3806.4714,N,02401.4940,E,1,04,5.6,1974.4,M,34.5,M,,*71

but at this point it seems missing integration with message broker

Yea, you will need to look up the docs and integrate it. They have some examples here:

yep, found some example

will try with something like the example

docker run -it --rm --name mosquitto -p 1883:1883 mosquitto

then trying to run modified code so it would conenct/ publish to the mosquitto

import os
from gps import *
from time import *
import time
import threading
import json
import paho.mqtt.client as mqtt
MQTT_BROKER = os.getenv('MQTT')

gpsd = None 

class GpsPoller(threading.Thread):
  def __init__(self):
    threading.Thread.__init__(self)
    global gpsd #bring it in scope
    gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info
    self.current_value = None
    self.running = True #setting the thread running to true

  def run(self):
    global gpsd
    while gpsp.running:
      gpsd.next() #this will continue to loop and grab EACH set of gpsd info to clear the buffer

if __name__ == '__main__':
  gpsp = GpsPoller() # create the thread
  try:
    gpsp.start() # start it up
    while True:
      if gpsd.fix.latitude > 0:
        row = [ { 'latitude': str(gpsd.fix.latitude),
         'longitude': str(gpsd.fix.longitude),
         'utc': str(gpsd.utc),
         'time':   str(gpsd.fix.time),
         'altitude': str(gpsd.fix.altitude),
         'eps': str(gpsd.fix.eps),
         'epx': str(gpsd.fix.epx),
         'epv': str(gpsd.fix.epv),
         'ept': str(gpsd.fix.ept),
         'speed': str(gpsd.fix.speed),
         'climb': str(gpsd.fix.climb),
         'track': str(gpsd.fix.track),
         'mode': str(gpsd.fix.mode)} ]
json_string = json.dumps(row)
        client = mqtt.Client("P1")
        client.connect(MQTT_BROKER)
        client.publish("gps", payload=json_string, qos=0, retain=True)

        time.sleep(60)

  except (KeyboardInterrupt, SystemExit): #when you press ctrl+c
    gpsp.running = False
    gpsp.join() # wait for the thread to finish what it's doing

Upd
resolved