Reading from gpsd / gpsfake using python-gps

I tried very hard to get gpsfake to work with python-gps in recent days. I am running gpsfake with the following example sentences that I found on the Internet:

gpsfake test_data.log 

test_data.log:

 $PMGNST,05.40,2,T,961,08.3,+04583,00*4C $GPGLL,5036.9881,N,00707.9142,E,125412.480,A*3F $GPGGA,125412.48,5036.9881,N,00707.9142,E,2,04,20.5,00269,M,,,,*17 $GPRMC,125412.48,A,5036.9881,N,00707.9142,E,00.0,000.0,230506,00,E*4F $GPGSA,A,2,27,04,08,24,,,,,,,,,20.5,20.5,*12 $GPGSV,3,1,10,13,81,052,,04,58,240,39,23,44,064,,24,43,188,36*75 $GPGSV,3,2,10,02,42,295,,27,34,177,40,20,21,113,,16,12,058,*7F $GPGSV,3,3,10,08,07,189,38,10,05,293,,131,11,117,,120,28,209,*76 

As soon as it starts, I run the Python script I found here :

 import gps import os import time if __name__ == '__main__': session = gps.gps(verbose=1) while 1: os.system('clear') session.next() # a = altitude, d = date/time, m=mode, # o=postion/fix, s=status, y=satellites print print ' GPS reading' print '----------------------------------------' print 'latitude ' , session.fix.latitude print 'longitude ' , session.fix.longitude print time.strftime("%H:%M:%S") print print ' Satellites (total of', len(session.satellites) , ' in view)' for i in session.satellites: print '\t', i time.sleep(3) 

I get a connection, but then it blocks in the gpscommon class, the read () method on line 80:

 frag = self.sock.recv(4096) 

which tells me that no data has been received or even sent.

When I try to connect via terminal using

 connect 127.0.0.1 2947 

the only answer

 {"class":"VERSION","release":"3.4","rev":"3.4","proto_major":3,"proto_minor":6} 

and nothing else.

Does anyone have an idea how to get the right data? I have tried various NMEA log files, so I think this is not the reason.

+4
source share
1 answer

To get location reports, you will need to start "Monitoring" what gpsd / gpsfake devices are monitoring, try sending:

 ?WATCH={"enable":true,"json":true}; 

This will update all devices in JSON format.

To stop updates:

 ?WATCH={"enable":false}; 

Once viewing is turned on, you will receive “TPV” responses containing location data and “SKY” responses with satellite data.

Additional customer information: http://www.catb.org/gpsd/client-howto.html

GPSd JSON format: http://www.catb.org/gpsd/gpsd_json.html

0
source

All Articles