from math import *
from visual import *
import serial
######################################################################
#Opening the serial port for the compass output
######################################################################
try:
compass.close()
except:
print "compass ready"
try:
compass = serial.Serial(2,baudrate=9600, bytesize=8,parity = 'N',stopbits = 1,timeout=None, xonxoff=0, rtscts=0)
compass.open
output = compass.readline()
print(output)
except:
print('you fail')
######################################################################
RightSideWindow = display(x=0, y =0, witdth = 600, height = 600,scale =(1,1,1) ,background = (.05,.05,.05), autoscale = false)
RightSideWindow.range = 10
headingVect = arrow(pos =(0,0,0), axis = (2,0,0), shaftwidth = 1, color = (.2,.7,.7))
northBox = box(pos=(0,3,0), height = 2,width = .1,length = .1, color = (1,1,1))
southBox = box(pos=(0,-3,0), height = 2,width = .1,length = .1, color = (1,1,1))
eastBox = box(pos=(3,0,0), height = .1,width = .1,length = 2, color = (1,1,1))
westBox = box(pos=(-3,0,0), height = .1,width = .1,length = 2, color = (1,1,1))
northLabel = label(pos = (0,4.5,0),text = 'N')
southLabel = label(pos = (0,-4.5,0),text = 'S')
eastLabel = label(pos = (4.5,0,0),text = 'E')
northLabel = label(pos = (-4.5,0,0),text = 'W')
northeast = box(pos = (2.5*cos(pi/4),2.5*sin(pi/4),0),axis = (-cos(pi/4),sin(pi/4),0),height = 1,width = .1,length = .1)
northwest = box(pos = (-2.5*cos(pi/4),2.5*sin(pi/4),0),axis = (cos(pi/4),sin(pi/4),0),height = 1,width = .1,length = .1)
southwest = box(pos = (-2.5*cos(pi/4),-2.5*sin(pi/4),0),axis = (-cos(pi/4),sin(pi/4),0),height = 1,width = .1,length = .1)
northwest = box(pos = (2.5*cos(pi/4),-2.5*sin(pi/4),0),axis = (cos(pi/4),sin(pi/4),0),height = 1,width = .1,length = .1)
headingLabel = label(pos = (0,6,0), text = 'HEADING')
while 1:
output = compass.readline()
heading = (double(output)-9)*pi/180.
x = -cos(heading)*2
y = sin(heading)*2
headingVect.axis = (x,y,0)
Tuesday, January 24, 2012
Here is the prototype for the new Heads Up Display.
Andy and I worked on a nice little augmentation of the Otter Box which we will share at the next meeting.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment