Пример #1
0
 def monitor(self, switch_name, rate_name) :
    file = open("log/"+self.name+".txt","a")
    while True :
       if get(switch_name).on :
         gps = get("gps")
         if gps.HDOP < 5.0 :   #  ignore low accuracy readings
            compass = get("compass")
            file.write( ",".join(("gps",gps.dateTime,str(round(gps.latitude,5)),str(round(gps.longitude,5)),str(gps.altitude),
                        str(gps.speedOverGround),str(gps.courseOverGround),str(compass.bearing) ,"\n")))
            file.flush()
       time.sleep(get(rate_name).value)
Пример #2
0
   def replay(self,interval_secs) :
       file = open("log/"+self.name+".txt","r")
       gps = get("gps")
       gps.HDOP = 1.5
#       compass = get("compass")
       for line in file.readlines():
          if line == "":
             continue
          data = line.strip().split(",")
          if data[0] == "gps" :
              gps.dateTime = data[1]
              gps.latitude = float(data[2])
              gps.longitude = float(data[3])
              gps. altitude = float(data[4] )
              gps.speedOverGround= float(data[5])
              gps.courseOverGround= float(data[6])
              gps.put()
#              compass.device_heading = float(data[7])
#              compass.put()
          time.sleep(interval_secs)
       file.close()
Пример #3
0
#!/usr/bin/env python
import time,sys

import speak
import conv
import xmlutils
import control
from persistant import get
import position

control.Control("speed",step=10,initial=60)

while True :
   if get("speed").on :
      position = get("gps")
      speed = int(float(position.speedOverGround))
      course = int(float(position.courseOverGround))
      points = conv.degree_to_compass_point(course)
      text = points + " at " + str(speed) + " knots " 
      speak.say(text)
      print(text)

   time.sleep(get("speed").value)
Пример #4
0
#!/usr/bin/env python
import time, sys

import speak
import conv
import xmlutils
import control
from persistant import get
import position

control.Control("speed", step=10, initial=60)

while True:
    if get("speed").on:
        position = get("gps")
        speed = int(float(position.speedOverGround))
        course = int(float(position.courseOverGround))
        points = conv.degree_to_compass_point(course)
        text = points + " at " + str(speed) + " knots "
        speak.say(text)
        print(text)

    time.sleep(get("speed").value)
Пример #5
0
#!/usr/bin/env python

from reflect import *
from persistant import get
import sys

name = sys.argv[1]
obj = get(name)
reflect = Reflect(obj)
print name
reflect.print_attributes()