Example #1
0
launcher = launchControl()
roomba = RoombaAPI(ROOMBA_PORT, ROOMBA_BAUD)

haptics = hapticFeedback(roomba,HAPTICS_PORT,HAPTICS_BAUD)

#emg = EmgInterface(EMG_PORT, EMG_BAUD);
#emg = EmgInterface("/dev/tty.M13762-BluetoothSerialP",115200)
emg = EmgInterface('00:07:80:4B:F4:2B',5)

#ui = RemoteUI()

#State variable [forward,left,right,vacuum on,vacuum off,m-up,m-down,m-fire]


roomba.connect()
roomba.safe() #set safe control mode ///Use other mode
#roomba.full()
emg.start()

def processState(state,oldstate):
	if state[0:3] == [0,0,0]: #roomba stop condition
		roomba.stop()
		print "stop"
	if state[0] == 1 and oldstate[0] == 0: #Go forward
		roomba.forward()
		print "forward"
	if state[1] == 1 and oldstate[1] == 0: #Go left
		roomba.left()
		print "left"
	if state[2] == 1 and oldstate[2] == 0: #Go Right
		roomba.right()