UserPreferences

MyBrain2


from pyrobot.brain import Brain
from time import sleep

class MyBrain(Brain):
   def setup(self):
      # Called during construction
      # initialize your vars here
      pass
      
   # Only method you have to define is the step method:

   def step(self):
      # Called many times a second
      translate, rotate = 0.5, 0
      if self.robot.stall == 1: #and self.robot.th == 0:
         translate = -1
         self.move(translate, rotate)
         sleep(.1)
         translate = 0
         rotate = 1
         self.move(translate, rotate)
         print self.robot.th
         sleep(1.35)
         print self.robot.th
      else:
         translate, rotate = 0.5, 0
         self.move(translate, rotate)
         

def INIT(engine):
   return MyBrain('MyBrain', engine)