emane-tutorial icon indicating copy to clipboard operation
emane-tutorial copied to clipboard

GPSD Telnet Content Issues in olsrdviewer.py Altitude JSON Field

Open hideogump opened this issue 5 years ago • 0 comments

I have the latest version of GPSD built on the CentOS platform as version 3.19.1 within the content of a radio container which includes the gpsd binary as well as the emane event daemon per the examples.

When using the olsrdviewer.py application to view the GPS position associated with a node, I get an exception thrown that leaves the lock unreleased, deadlocking the thread. This was easy enough to fix, per the modified source codes snippet listing below from within the GPS thread.

From observing the logging from the container's event daemon, as well as manually invoking a Telnet session to the gpsd, all looks well. A manual Telnet session outside of the container is listed below.

The problem occurs when parsing through the returned JSON code per the following line of Python code, coupled with the fact that the data returned from GPS does not include the 'alt' fields with the 'lat' field in its response, but instead provides 'altHAE' and 'altMSL' (Mean Sea Level).

Modifying the source to use the 'altMSL' field fixed things.

Is there any explanation for this format change for the altitude field?

                        self._locations[self._nodeId] = (
                            data['lat'], data['lon'], data['alt'])

Instead a single line of response is something like the following:

{u'altHAE': 146.0, u'altMSL': 180.0, u'class': u'TPV', u'climb': 0.0, u'device': u'/dev/pts/0', u'epc': 14.95, u'eph': 5.225, u'eps': 7.38, u'ept': 0.005, u'epv': 7.475, u'epx': 2.507, u'epy': 3.689, u'geoidSep': -34.0, u'lat': 39.274915, ...}


[rrpucsuser@localhost scripts]$ telnet radio1ctl 2947 Trying 10.99.0.1... Connected to radio1ctl. Escape character is '^]'. {"class":"VERSION","release":"3.19.1~dev","rev":"3.19.1~dev-2019-11-28T08:39:47","proto_major":3,"proto_minor":14} ?WATCH={"enable":true,"json":true} {"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/pts/0","driver":"NMEA0183","activated":"2019-11-30T19:52:34.091Z","flags":1,"native":0,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}]} {"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false} {"class":"TPV","device":"/dev/pts/0","mode":3,"time":"2019-11-30T19:52:35.000Z","ept":0.005,"lat":39.274915000,"lon":-84.446193333,"altHAE":146.000,"altMSL":180.000,"epx":2.507,"epy":3.689,"epv":7.475,"track":0.0000,"magtrack":353.9591,"magvar":-6.0,"speed":0.000,"climb":0.000,"eps":7.38,"epc":14.95,"geoidSep":-34.000,"eph":5.225,"sep":8.550} {"class":"SKY","device":"/dev/pts/0","xdop":0.67,"ydop":0.98,"vdop":1.30,"tdop":0.87,"hdop":1.10,"gdop":2.02,"pdop":1.80,"satellites":[{"PRN":1,"el":41.0,"az":104.0,"ss":41.0,"used":true,"gnssid":0,"svid":1},{"PRN":3,"el":9.0,"az":84.0,"ss":51.0,"used":true,"gnssid":0,"svid":3},


                    # Add exception handling to release lock upon exception to avoid deadlock
                    try:
                        if self._nodeId not in self._locations:
                            self._locations[self._nodeId] = None

                        self._locations[self._nodeId] = (
                            data['lat'], data['lon'], data['alt'])

                        print("NodeGPSDThread::run:releasing lock %d" %
                              self._nodeId)
                        self._lock.release()
                    except:
                        print("NodeGPSDThread::run:exception releasing lock %d" %
                              self._nodeId)
                        self._lock.release()

hideogump avatar Nov 30 '19 20:11 hideogump