当前位置: 首页>>代码示例>>Python>>正文


Python gps函数代码示例

本文整理汇总了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
开发者ID:nickwebcouk,项目名称:dashcam,代码行数:7,代码来源:gpsthread.py

示例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
开发者ID:jloosli,项目名称:incite,代码行数:7,代码来源:gpsPoller.py

示例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
开发者ID:ChroustJan,项目名称:balon,代码行数:7,代码来源:monitor.py

示例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
开发者ID:tbarchyn,项目名称:robo_sailboat_dev,代码行数:26,代码来源:gps_listener.py

示例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
开发者ID:mohamed-nageh,项目名称:LocationAds,代码行数:27,代码来源:GpsTest.py

示例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()
开发者ID:andrejev,项目名称:robotik,代码行数:28,代码来源:gpsdData.py

示例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
开发者ID:eagle138,项目名称:Rover-Onboard-Code,代码行数:29,代码来源:RoverGpsController.py

示例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)
开发者ID:FomkaV,项目名称:wifi-arsenal,代码行数:8,代码来源:wifiScanner.py

示例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
开发者ID:rstreif,项目名称:rvi_tools,代码行数:8,代码来源:gpssource.py

示例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
开发者ID:khinds10,项目名称:CarComputer,代码行数:8,代码来源:GPS.py

示例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
开发者ID:14nguyenh,项目名称:vBox,代码行数:9,代码来源:GPS.py

示例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()
开发者ID:JackieJ,项目名称:WartHog,代码行数:9,代码来源:gpsReceiver.py

示例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()
开发者ID:kineticgar,项目名称:UCLA-robomagellan,代码行数:9,代码来源:gpsd_client.py

示例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
开发者ID:onzyone,项目名称:obd2link,代码行数:9,代码来源:gps_test.py

示例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 
开发者ID:SaMnCo,项目名称:Snoopy,代码行数:9,代码来源:snoopy_gpsdlogger.py


注:本文中的gps函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。