Пример #1
0
    def __init__(self, sampleRate, sampleRateError, rotaionRate, rotationRateError, rangeOfMotion, buff, port):
    	self.sampleRate = sampleRate # sensor sends position data at this rate
    	if sampleRate <= 0:
    		print "Provide positive sample rate for proper sensor instantiation."
    	self.sampleRateError = sampleRateError
    	self.rotaionRate = rotaionRate # Degrees / second
    	self.rotationRateError = rotationRateError
    	self.orientation = 0 # Maximum angle = 45 degrees.
    	self.rangeOfMotion = rangeOfMotion
    	self.buff = buff

    	self.clockwiseRotation = True

        self.lastSample = None
        self.lastLocation = [0, 0]

        self.port = port
        self.comm = initComm(port)
        print("\nOpened sensor communication.\n")
        self.sequenceNum = 0
Пример #2
0
    def __init__(self, rotationSpeed, forwardSpeed, rotationSpeedError, forwardSpeedError, x, y, orientation, port, messagePeriod):
    	self.rotationSpeed = rotationSpeed # Degrees per second.
    	self.forwardSpeed = forwardSpeed
    	self.rotationSpeedError = rotationSpeedError
    	self.forwardSpeedError = forwardSpeedError
    	self.length = 5 # length = 5 cm
    	self.width = 3 # width = 3 cm
        #self.position = [None] * 10
        self.position = []
    	self.position.append((x, y))
        self.orientation = []
    	self.orientation.append(orientation)
    	self.buff = 0
    	self.movement = None
        self.messagePeriod = messagePeriod

        self.times = []
        self.times.append(0) # T0 = rover instantiation

    	self.initTime = time.time()

    	self.comm = initComm(port)
    	print("\nOpened rover location.\n")
    	self.sequenceNum = 0