コード例 #1
0
 def set8x8(self, index, gridType):
     # simulation
     self.display.set8x8(index, gridType)
     # real
     commObject = CommRequest('b')
     commObject.markDone()
     return commObject
コード例 #2
0
 def set7segment(self, number):
     commandObj = CommRequest('N' + '|' + str(number))
     if number < 1 or number > 6:
         commandObj.response = 'INVALID'
         commandObj.markDone()
     else:
         self.ard.requestCommand(commandObj)
     return commandObj
コード例 #3
0
 def readSensor(self, value):
     commObject = CommRequest('S%s' % value)
     returnvalue = None
     if value == 1:
         returnvalue = self.read_distance()
     elif value == 2:
         returnvalue = self.read_electromagnetic()
     elif value == 3:
         returnvalue = self.read_capacitive()
     commObject.response = returnvalue
     commObject.markDone()
     return commObject
コード例 #4
0
 def set8x8(self, index, gridType):
     # types:
     # T = objective tunnel,
     # D = dead end,
     # E = empty
     commandObj = CommRequest(gridType + '|' + str(index))
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #5
0
 def goForward(self):
     commObject = CommRequest('f')
     self.drive(1)
     self.forwardCounter += 1
     self.play_sound(self.sound1)
     print "FORWARDS: %s \nTURNS: %s" % (self.forwardCounter,
                                         self.turnCounter)
     # commObject.markDone()
     self.move_to_do = commObject
     return commObject
コード例 #6
0
 def rotateClockwise(self):
     commObject = CommRequest('r')
     self.changeDirection(-1)
     self.MAP.rotateClockwise()
     self.turnCounter += 1
     self.play_sound(self.sound5)
     print "FORWARDS: %s \nTURNS: %s" % (self.forwardCounter,
                                         self.turnCounter)
     # commObject.markDone()
     self.move_to_do = commObject
     return commObject
コード例 #7
0
 def moveForward(self):
     commandObj = CommRequest('f')
     self.nxtC.requestCommand(commandObj)
     return commandObj
コード例 #8
0
 def beginningObstacleThresholdCalibration(self):
     commandObj = CommRequest('@')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #9
0
 def goCalibrateIR(self, side):
     to_return = CommRequest('c|' + side)
     self.move_to_do = to_return
     return to_return
コード例 #10
0
 def moveRight(self):
     commandObj = CommRequest('r')
     self.nxtC.requestCommand(commandObj)
     return commandObj
コード例 #11
0
 def getStopButton(self):
     commandObj = CommRequest('B' + '|S')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #12
0
 def setReadyLight(self):
     commandObj = CommRequest('R')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #13
0
 def goCalibrateIR(self, side):
     commandObj = CommRequest('c|' + side)
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #14
0
 def goCalibrate(self):
     commandObj = CommRequest('c')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #15
0
 def moveBackward(self):
     commandObj = CommRequest('b')
     self.nxtC.requestCommand(commandObj)
     return commandObj
コード例 #16
0
 def moveLeft(self):
     commandObj = CommRequest('l')
     self.nxtC.requestCommand(commandObj)
     return commandObj
コード例 #17
0
 def getEMFreading(self):
     commandObj = CommRequest('S' + '|E', returnAsList=True)
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #18
0
        if automatic:
                if resp.startswith("BAD") or resp.startswith("BAd"):
                        automatic = False
                        print "was on: %s" % possibilities[index]
                        print 'attempting to flush...'
                        time.sleep(0.1)
                        ard_funcs.ard.serial.flushInput()
                        ard_funcs.ard.serial.flushOutput()
                        continue
                index = (index+1)%3
                user_inp = possibilities[index]
                #time.sleep(0.001)
	else:
                user_inp = raw_input('> ')
	if user_inp == 'y':
                commandObj = CommRequest("L|Y")
                ard_funcs.ard.requestCommand(commandObj)
		resp = wait_till_done(commandObj)
		print "%s: %s" % (user_inp,resp) 
	elif user_inp == 'b':
                commandObj = CommRequest("L|B")
                ard_funcs.ard.requestCommand(commandObj)
		resp = wait_till_done(commandObj)
		print "%s: %s" % (user_inp,resp) 
	elif user_inp == 'g':
                commandObj = CommRequest("L|G")
                ard_funcs.ard.requestCommand(commandObj)
		resp = wait_till_done(commandObj)
		print "%s: %s" % (user_inp,resp) 
	elif user_inp == 'n':
                commandObj = CommRequest("L|N")
コード例 #19
0
 def getObstacleReport(self):
     commandObj = CommRequest('S' + '|O')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #20
0
 def performTap(self):
     commandObj = CommRequest('A')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #21
0
 def moveLeft(self):
     print("in arduinofuncs moveLeft function")
     commandObj = CommRequest('l')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #22
0
 def goBackward(self):
     commObject = CommRequest('b')
     self.drive(-1)
     self.forwardCounter += 1
     commObject.markDone()
     return commObject
コード例 #23
0
 def beginningRightCalibration(self):
     commandObj = CommRequest(']')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #24
0
 def setReadyLight(self):
     commObject = CommRequest('b')
     commObject.markDone()
     return commObject
コード例 #25
0
 def beginningBackCalibration(self):
     commandObj = CommRequest('v')
     self.ard.requestCommand(commandObj)
     return commandObj
コード例 #26
0
 def set7segment(self, number):
     commObject = CommRequest('b')
     commObject.markDone()
     return commObject
コード例 #27
0
 def checkEMF2(self):
     commandObj = CommRequest('2')
     self.ard.requestCommand(commandObj)
     return commandObj