UserPreferences

SensorProgram


You are not allowed to edit this page. Are you logged in? Click on UserPreferences in upper-righthand corner.

Clear message

  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 

from pyrobot.brain import Brain

class Sensor(Brain):

    # print the min and max value of the front sensors while moving
    def step(self):
        self.move(0.5,0)
        self.front = [s.distance() for s in self.robot.range["front"]]
        print "min front: ", min(self.front), "max front: ", max(self.front)

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