From 8cd2723055b6daefb17c63eda10fef42da93879d Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 8 May 2013 17:28:39 +0200 Subject: host/simu/robots/apbirthday: simulate plate arm offset --- host/simu/robots/apbirthday/model/cannon.py | 4 ++-- host/simu/robots/apbirthday/view/robot.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/host/simu/robots/apbirthday/model/cannon.py b/host/simu/robots/apbirthday/model/cannon.py index c42feb94..04f26328 100644 --- a/host/simu/robots/apbirthday/model/cannon.py +++ b/host/simu/robots/apbirthday/model/cannon.py @@ -57,7 +57,7 @@ class Cannon (Observable): m.translate (self.robot_position.pos) m.rotate (self.robot_position.angle) x = -back - y = (50, -50) + y = (50 - 35, -50 - 35) for i, c in enumerate (self.contacts): s = True sensor_pos = m.apply ((x, y[i])) @@ -112,5 +112,5 @@ class Cannon (Observable): def __plate_drop_point (self): return (vector (self.robot_position.pos) - - vector.polar (self.robot_position.angle, 108 + 85)) + + vector (-back - 85, -35).rotate (self.robot_position.angle)) diff --git a/host/simu/robots/apbirthday/view/robot.py b/host/simu/robots/apbirthday/view/robot.py index 788ab952..96139b9b 100644 --- a/host/simu/robots/apbirthday/view/robot.py +++ b/host/simu/robots/apbirthday/view/robot.py @@ -65,16 +65,16 @@ class Robot (simu.inter.drawable.Drawable): plate = self.cannon_model.plate f = self.cannon_model.arm_cyl.pos if plate is not None: - self.draw_rectangle ((-back - f * 170, 85), (-back, -85), - fill = PINK) - self.draw_rectangle ((-back - f * 148, 85 - 22), - (-back - f * 22, -85 + 22), fill = PINK) + self.draw_rectangle ((-back - f * 170, 85 - 35), + (-back, -85 - 35), fill = PINK) + self.draw_rectangle ((-back - f * 148, 85 - 22 - 35), + (-back - f * 22, -85 + 22 - 35), fill = PINK) for c in plate.cherries: if c.pos: self.draw_circle ((-back - f * (c.pos[0] + 85), - c.pos[1]), c.radius, fill = colors[c.color]) - self.draw_rectangle ((-back - f * 170, 85), - (-back - f * 170 - (1 - f) * 22, -85), fill = PINK) + c.pos[1] - 35), c.radius, fill = colors[c.color]) + self.draw_rectangle ((-back - f * 170, 85 - 35), + (-back - f * 170 - (1 - f) * 22, -85 - 35), fill = PINK) # Draw robot body. self.draw_polygon ((front, side), (front, -side), (-back, -side), (-back, 81), (-50, side), fill = COLOR_ROBOT) -- cgit v1.2.3