Exemple #1
0
 def getBall(self, image, headinfo):
     # Take snapshot and measure head angles
     ballLoc = ball.run(image, headinfo)
     if ballLoc:
         (x, y) = ballLoc
         if x < 0 or x > 6 or y < -4 or y > 4:
             ballLoc = None
         else:
             self.memProxy.insertData('dntBallDist', math.sqrt(x**2 + y**2))
     else:
         self.memProxy.insertData('dntBallDist', '')
     return ballLoc
 def getBall(self, image, headinfo):
     # Take snapshot and measure head angles
     ballLoc = ball.run(image, headinfo)
     if ballLoc:
         (x,y) = ballLoc
         if x < 0 or x > 6 or y < -4 or y > 4:
             ballLoc = None
         else:
             self.memProxy.insertData('dntBallDist', math.sqrt(x**2 + y**2))
     else:
         self.memProxy.insertData('dntBallDist', '')                
     return ballLoc
 def getBall(self, image, headinfo):
     # Take snapshot and measure head angles
     ballLoc = ball.run(image, headinfo)
     if ballLoc:
         # Right leds turn green
         self.ledProxy.fadeRGB('RightFaceLeds', 0x0000ff00, 0)
         (x,y) = ballLoc
         if x < 0 or x > 6 or y < -4 or y > 4:
             ballLoc = None
         else:
             self.memProxy.insertData('dntBallDist', math.sqrt(x**2 + y**2))
     else:
         
         self.memProxy.insertData('dntBallDist', 0)
         self.ledProxy.fadeRGB('RightFaceLeds',0x00ff0000, 0)
     return ballLoc