def __init__(self, world, name, center, width = 35, height = 45, beacon_point = Point(0, 0)): # For simple bounding circle computations let the radius be half diagonal WorldObject.__init__(self, center, sqrt(width**2 + height**2)/2) self.wr = width/2 self.hr = height/2 self.world = world self.name = name self.beacon_point = beacon_point # "Forward" is the unit direction vector where the robot is facing # (0, 1) is the "default" (height along the Y axis) self.forward = Point(0, 1) self.left = Point(-self.forward.y, self.forward.x) # Those are state parameters self.leftSpeed = 0 self.rightSpeed = 0 # Camera sensor parameters self.CAMERA_DEPTH = 120 self.CAMERA_SIDE = 100 # Write concurrency lock (we assume reads are atomic, and even if not, just ignore read errors) self.data_lock = thread.allocate_lock() # Whether there's a ball in the grabber self.grabbed_ball = None self.grabbed_ball_lock = thread.allocate_lock()
def __init__(self, world, name, role): RADIUS = 130 / 5 # The diameter of the telliskivi robot is 260mm. In pixels it makes a radius of 26 self.WHEEL_RADIUS = 105 / 5 self.FORWARD_EDGE_FRONT = 85 / 5 self.FORWARD_EDGE_LEFT = 100 / 5 # 98.86mm CENTER = Point(12 + RADIUS, 12 + RADIUS) if (role == "TOPLEFT") else Point( world.width - 12 - RADIUS, world.height - 12 - RADIUS) WorldObject.__init__(self, CENTER, RADIUS) self.world = world self.name = name self.wr = RADIUS self.hr = RADIUS self.beacon_point = Point( world.width + 50, world.cy) if role == "TOPLEFT" else Point(-50, world.cy) self.beacon_point_en = Point(0, world.cy) if role == "TOPLEFT" else Point( world.width, world.cy) self.goal_center = Point(world.width, world.cy) if role == "TOPLEFT" else Point( 0, world.cy) # "Forward" is the unit direction vector where the robot is facing # (0, 1) is the "default" (height along the Y axis) self.forward = Point(0, 1) self.left = Point(-self.forward.y, self.forward.x) if role == "TOPLEFT": self.rotate(3.1415 / 2) else: self.rotate(-3.1415 / 2) # Those are state parameters self.leftSpeed = 0 self.rightSpeed = 0 # Camera sensor parameters self.CAMERA_DEPTH = 1000 # Let's say the camera sees as far as the end of the field (~5 meters = 1000 px) self.CAMERA_SIDE = 340 # The camera's side angle is 20 degree, i.e. at 1000 pixels it stretches to 340px # Write concurrency lock (we assume reads are atomic, and even if not, just ignore read errors) self.data_lock = thread.allocate_lock() # Whether there's a ball in the grabber self.grabbed_ball = None self.grabbed_ball_lock = thread.allocate_lock()
def __init__(self, world, name, role): RADIUS = 130/5 # The diameter of the telliskivi robot is 260mm. In pixels it makes a radius of 26 self.WHEEL_RADIUS = 105/5 self.FORWARD_EDGE_FRONT = 85/5 self.FORWARD_EDGE_LEFT = 100/5 # 98.86mm CENTER = Point(12+RADIUS, 12+RADIUS) if (role == "TOPLEFT") else Point(world.width - 12 - RADIUS, world.height - 12 - RADIUS) WorldObject.__init__(self, CENTER, RADIUS) self.world = world self.name = name self.wr = RADIUS self.hr = RADIUS self.beacon_point = Point(world.width + 50, world.cy) if role == "TOPLEFT" else Point(-50, world.cy) self.beacon_point_en = Point(0, world.cy) if role == "TOPLEFT" else Point(world.width, world.cy) self.goal_center = Point(world.width, world.cy) if role == "TOPLEFT" else Point(0, world.cy) # "Forward" is the unit direction vector where the robot is facing # (0, 1) is the "default" (height along the Y axis) self.forward = Point(0, 1) self.left = Point(-self.forward.y, self.forward.x) if role == "TOPLEFT": self.rotate(3.1415/2) else: self.rotate(-3.1415/2) # Those are state parameters self.leftSpeed = 0 self.rightSpeed = 0 # Camera sensor parameters self.CAMERA_DEPTH = 1000 # Let's say the camera sees as far as the end of the field (~5 meters = 1000 px) self.CAMERA_SIDE = 340 # The camera's side angle is 20 degree, i.e. at 1000 pixels it stretches to 340px # Write concurrency lock (we assume reads are atomic, and even if not, just ignore read errors) self.data_lock = thread.allocate_lock() # Whether there's a ball in the grabber self.grabbed_ball = None self.grabbed_ball_lock = thread.allocate_lock()
def __init__(self, world, name, role): width = 40 height = 40 center = Point(int(12+height/2), int(12+width/2)) if role == "TOPLEFT" else Point(world.width-(12+height/2), world.height-(12+width/2)) WorldObject.__init__(self, center, int(sqrt(width**2 + height**2)/2) ) self.world = world self.name = name self.wr = width/2 self.hr = height/2 self.beacon_point = Point(world.width + 50, world.cy) if role == "TOPLEFT" else Point(-50, world.cy) self.beacon_point_en = Point(0, world.cy) if role == "TOPLEFT" else Point(world.width, world.cy) self.goal_center = Point(world.width, world.cy) if role == "TOPLEFT" else Point(0, world.cy) # "Forward" is the unit direction vector where the robot is facing # (0, 1) is the "default" (height along the Y axis) self.forward = Point(0, 1) self.left = Point(-self.forward.y, self.forward.x) if role == "TOPLEFT": self.rotate(3.1415/2) else: self.rotate(-3.1415/2) # Those are state parameters self.leftSpeed = 0 self.rightSpeed = 0 # Camera sensor parameters self.CAMERA_DEPTH = 800 # Kaugus kuhu naeme self.CAMERA_SIDE = 500 # Laius kuhu naeme # Write concurrency lock (we assume reads are atomic, and even if not, just ignore read errors) self.data_lock = thread.allocate_lock() # Whether there's a ball in the grabber self.grabbed_ball = None self.grabbed_ball_lock = thread.allocate_lock()