def transmit_ball_location(self): ball = self._vision.get_ball() if ball is not None: ball_centre = ball[0] if self._side == 'left': ball_centre = flip_coordinates(ball_centre[0], ball_centre[1]) print '/vision/xy ball %f %f %s' % (ball_centre[0], ball_centre[1], self._frame_timestamp)
def transmit_robot_location(self, colour): (robot_centre, robot_rotation) = self._vision.get_robot(colour) name = 'us' if self._colour == colour else 'enemy' if robot_centre is not None: if self._side == 'left': robot_centre = flip_coordinates(robot_centre[0], robot_centre[1]) print '/vision/xy %s %f %f %s' % (name, robot_centre[0], robot_centre[1], self._frame_timestamp) if robot_rotation is not None: if self._side == 'left': robot_rotation = flip_rotation(robot_rotation) print '/vision/rotation %s %f %s' % (name, robot_rotation, self._frame_timestamp)