本文整理汇总了Python中gps函数的典型用法代码示例。如果您正苦于以下问题:Python gps函数的具体用法?Python gps怎么用?Python gps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gps函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
threading.Thread.__init__(self)
global gpsd #bring it in scope
gpsd = gps("localhost", "2947")
gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info
self.current_value = None
self.running = True #setting the thread running to true
示例2: __init__
def __init__(self):
threading.Thread.__init__(self)
self.daemon = True
self.gpsd = gps()
self.gpsd.stream(WATCH_ENABLE | WATCH_NEWSTYLE)
self.current_value = {}
self.running = True
示例3: __init__
def __init__(self):
logging.info("Starting GPS poller thread")
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
示例4: start_gpsd
def start_gpsd (self):
'''
method to connect to the gpsd socket, note that the systemd service
has been disabled as following the following adafruit blogpost:
https://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi?view=all
This means that the gpsd daemon needs to be manually started on every
boot of the pi.
'''
# start the gpsd daemon, if this is a posix system
if os.name == 'posix':
os.system ('sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock')
# now, try to create a link to this socket (this will fail on windows, but that is ok)
try:
self.ser = gps (mode = WATCH_ENABLE)
self.bs['gps_comms_on'] = True
except:
try:
del self.ser
except:
pass
self.bs['gps_comms_on'] = False
return
示例5: my_gps
def my_gps():
session = gps(mode=WATCH_ENABLE)
try:
while True:
data = session.next()
if data['class'] == "TPV":
os.system('clear')
print
print (' GPS Readings')
print ('latitude ' , session.fix.latitude)
print ('longitude ' , session.fix.longitude)
print ('velocity (m/s) ' , session.fix.speed)
print
except KeyError:
pass
except KeyboardInterrupt:
print
print ("Closed By User")
except StopIteration:
print
print ("GPSD has stopped")
finally:
session = None
示例6: __init__
def __init__(self, start=True):
threading.Thread.__init__(self)
global gpsd #bring it in scope
self.i = 0 # counter for averaging
self.average_number = 10 # number of values for average
gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info
self.data = [float('nan'), float('nan'), float('nan'), float('nan'), [], float('nan')] # averaged data
self.raw_data = self.data # not averaged data
self.lat_list = [float('nan')] * self.average_number
self.long_list = [float('nan')] * self.average_number
self.alt_list = [float('nan')] * self.average_number
#data = [gpsd.fix.latitude, gpsd.fix.longitude, gpsd.fix.altitude, gpsd.fix.track, gpsd.satellites, time.time()]
self.scale = 0.92 # for compass
self.x_offset = 27 # for compass
self.y_offset = -133 # for compass
self.degree_offset = 188 # offset to north in degree
self.sigma = 0.0000075 # standart-deviation for data; CAUTION: has to be adjusted for average_number;
# av_nmb = 1 --> sigma = 0.00005
# av_nmb = 5 --> sigma = 0.00001
# av_nmb = 10 --> sigma = 0.0000075
self.is_new = True # tells, whether new data is out of 2-sigma-range since last fetch
self.last = [0.0, 0.0] # last fetched data
if (start):
self.start()
示例7: __init__
def __init__(self):
# Initialize the Thread class
Thread.__init__(self)
# Check if the GPS module is connected by checking if /dev/ttyUSB0 exists
if(os.path.exists('/dev/ttyUSB0')):
try:
# Start gathering the GPS data stream
self.gpsSession = gps(mode=WATCH_ENABLE)
# Create a variable to store the thread's running status
self.running = False
# Set the GPS controller status to connected
RoverStatus.gpsControllerStatus = RoverStatus.ready
except:
# Change the GPS controller status to not connected because USB
# failed to communicate with the GPS module
RoverStatus.gpsControllerStatus = RoverStatus.notConnected
else:
# Set the GPS controller status to not connected
RoverStatus.gpsControllerStatus = RoverStatus.notConnected
示例8: __init__
def __init__(self, wifiNetworks, interval):
self.stopThread = threading.Event()
self.wifiNetworks = wifiNetworks
self.interval = interval
self.setWirelessInterface(None)
self.session = gps(mode=WATCH_ENABLE)
self.scanning = False
threading.Thread.__init__(self)
示例9: __init__
def __init__(self, conf, logger, queue):
threading.Thread.__init__(self)
self.session = gps(mode=WATCH_ENABLE)
self.conf = conf
self.logger = logger
self.queue = queue
self.last_speed = 1.0
self.nofix = False
示例10: __init__
def __init__(self):
threading.Thread.__init__(self)
global gpsd
# starting the stream of info
gpsd = gps(mode=WATCH_ENABLE)
self.current_value = None
self.running = True
示例11: __init__
def __init__(self,):
super(GPSReader, self).__init__()
try:
SharedData.gpsd = gps(mode=WATCH_ENABLE)
self.connected = True
except socket.error:
print "\tGPSReader: gpsd server is not available. GPSReader disabled."
self.connected = False
示例12: __init__
def __init__(self):
rospy.init_node('GPSD')
self.session = gps()
self.session.stream(WATCH_ENABLE|WATCH_NEWSTYLE)
self.currentVal = None
self.fixPublisherLL = rospy.Publisher('fixLL', GPSFix)
self.fixPublisherUTM = rospy.Publisher('fix', NavSatFix)
self.currentFixLL = GPSFix()
self.currentFixForUTM = NavSatFix()
示例13: __init__
def __init__(self):
rospy.init_node('gpsd_client')
#threading.Thread.__init__(self)
self.session = gps()
self.session.stream(WATCH_ENABLE|WATCH_NEWSTYLE)
self.current_value = None
self.fixpub = rospy.Publisher('gps/fix', GPSFix)
self.statuspub = rospy.Publisher('gps/status', GPSStatus)
self.current_fix = GPSFix()
示例14: __init__
def __init__(self):
threading.Thread.__init__(self)
#bring it in scope
global gpsd
#starting the stream of info
gpsd = gps(mode=WATCH_ENABLE)
self.current_value = None
#setting the thread running to true
self.running = True
示例15: __init__
def __init__(self):
threading.Thread.__init__(self)
# Call global variable into scope
global gpsd
# Starting datastream from GPS
gpsd = gps(mode=WATCH_ENABLE)
self.current_value = None
# Setting the thread running to true
self.running = True