Why is output of GPS using python zero or Nan? -
i'm having troubles gps output. when type:
$ cat /dev/ttyusb0
i have nmea sentences coming out (it's want)
$gpgga,134131.000,4548.0018,n,01557.1026,e,1,06,1.5,123.8,m,42.4,m,,0000*56 $gpgsa,a,3,12,15,24,17,22,18,,,,,,,2.3,1.5,1.8*30 $gpgsv,3,1,12,24,76,320,29,12,49,254,44,15,42,195,17,17,38,057,15*7a $gpgsv,3,2,12,25,15,249,,09,12,112,,26,11,162,,18,09,267,19*75 $gpgsv,3,3,12,22,08,297,23,14,08,323,,04,06,114,,28,03,061,*78 $gprmc,134131.000,a,4548.0018,n,01557.1026,e,1.71,291.64,210513,,,a*67
but, when try see output python (this basic code):
import gps session=gps.gps('localhost','2947') session.stream() print session
i got this:
time: (nan) lat/lon: 0.000000 0.000000 altitude: ? speed: ? track: ? status: status_no_fix mode: mode_no_fix quality: 0 p=0.00 h=0.00 v=0.00 t=0.00 g=0.00 y: 0 satellites in view:
i tried else's code nan or 0:
#! /usr/bin/python # written dan mandle http://dan.mandle.me september 2012 # license: gpl 2.0 import os gps import * time import * import time import threading gpsd = none #seting global variable os.system('clear') #clear terminal (optional) class gpspoller(threading.thread): def __init__(self): threading.thread.__init__(self) global gpsd #bring in scope gpsd = gps(mode=watch_enable) #starting stream of info self.current_value = none self.running = true #setting thread running true def run(self): global gpsd while gpsp.running: gpsd.next() #this continue loop , grab each set of gpsd info to$ if __name__ == '__main__': gpsp = gpspoller() # create thread try: gpsp.start() # start while true: #it may take second or 2 data #print gpsd.fix.latitude,', ',gpsd.fix.longitude,' time: ',gpsd.utc os.system('clear') print print ' gps reading' print '----------------------------------------' print 'latitude ' , gpsd.fix.latitude print 'longitude ' , gpsd.fix.longitude print 'time utc ' , gpsd.utc,' + ', gpsd.fix.time print 'altitude (m)' , gpsd.fix.altitude print 'eps ' , gpsd.fix.eps print 'epx ' , gpsd.fix.epx print 'epv ' , gpsd.fix.epv print 'ept ' , gpsd.fix.ept print 'speed (m/s) ' , gpsd.fix.speed print 'climb ' , gpsd.fix.climb print 'track ' , gpsd.fix.track print 'mode ' , gpsd.fix.mode print print 'sats ' , gpsd.satellites time.sleep(5) #set whatever
output:
gps reading ---------------------------------------- latitude 0.0 longitude 0.0 time utc + nan altitude (m) nan eps nan epx nan epv nan ept nan speed (m/s) nan climb nan track nan mode 1 sats []
so know why zeros , unknown?
please help, i'm trying fix week now.
thanks
Comments
Post a Comment