Example #1
0
	def CheckForCommand(self):
		txt = open("control/Commands.txt")
		value = txt.read()
		val = value.split('-', 1)
		self.RawCommand = val[0]
		self.speed = int(val[1])
		self.FCollistion = False
		self.BCollistion = False
		self.Command = self.CommandMatcher[self.RawCommand]
		
		if self.RawCommand == "01":
			if hardware_controller.irFront():
				self.Command = "toCollision"			
		if self.RawCommand == "02":
			if hardware_controller.irBack():				
				self.Command = "toCollision"
Example #2
0
	def Execute(self):
		super(Collision , self).CheckForCommand()
		hardware_controller.stop()
		
		if self.RawCommand == "01":
			if not hardware_controller.irFront():
				hardware_controller.forward(self.speed)
		if self.RawCommand == "02":
			if not hardware_controller.irBack():
				hardware_controller.reverse(self.speed)
		if self.RawCommand == "03":
			hardware_controller.turnLeft(self.speed)
		if self.RawCommand == "04":
			hardware_controller.turnRight(self.speed)		
			
		#print(self.Command)
		self.Data.next_Transition(self.Command)