summaryrefslogtreecommitdiffhomepage
path: root/host/simu/robots/apbirthday
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-08 15:43:52 +0200
committerNicolas Schodet2013-05-08 15:43:52 +0200
commitd8166cc985d91855b71307d56e99eb2c3a6fb234 (patch)
treee5bcce104fd6a8bd6bd7048ee23dca2a88999067 /host/simu/robots/apbirthday
parentd255fd1f9352808546bc5ff423f4f8fbc06d2400 (diff)
digital/io-hub, digital/mimot, host/simu/robots: update robot size
Diffstat (limited to 'host/simu/robots/apbirthday')
-rw-r--r--host/simu/robots/apbirthday/model/__init__.py3
-rw-r--r--host/simu/robots/apbirthday/model/cannon.py3
-rw-r--r--host/simu/robots/apbirthday/model/gifts_arm.py3
-rw-r--r--host/simu/robots/apbirthday/view/robot.py29
4 files changed, 22 insertions, 16 deletions
diff --git a/host/simu/robots/apbirthday/model/__init__.py b/host/simu/robots/apbirthday/model/__init__.py
index e69de29b..692091c7 100644
--- a/host/simu/robots/apbirthday/model/__init__.py
+++ b/host/simu/robots/apbirthday/model/__init__.py
@@ -0,0 +1,3 @@
+front = 96
+back = 126
+side = 142
diff --git a/host/simu/robots/apbirthday/model/cannon.py b/host/simu/robots/apbirthday/model/cannon.py
index 4fc78fd8..c42feb94 100644
--- a/host/simu/robots/apbirthday/model/cannon.py
+++ b/host/simu/robots/apbirthday/model/cannon.py
@@ -27,6 +27,7 @@ from simu.utils.trans_matrix import TransMatrix
from simu.utils.vector import vector
import random
from math import pi
+from simu.robots.apbirthday.model import back
class Cannon (Observable):
@@ -55,7 +56,7 @@ class Cannon (Observable):
m = TransMatrix ()
m.translate (self.robot_position.pos)
m.rotate (self.robot_position.angle)
- x = -108
+ x = -back
y = (50, -50)
for i, c in enumerate (self.contacts):
s = True
diff --git a/host/simu/robots/apbirthday/model/gifts_arm.py b/host/simu/robots/apbirthday/model/gifts_arm.py
index 0f43bc6a..7f9c5247 100644
--- a/host/simu/robots/apbirthday/model/gifts_arm.py
+++ b/host/simu/robots/apbirthday/model/gifts_arm.py
@@ -25,6 +25,7 @@
from utils.observable import Observable
from simu.utils.vector import vector
from math import pi
+from simu.robots.apbirthday.model import side
class GiftsArm (Observable):
@@ -38,7 +39,7 @@ class GiftsArm (Observable):
def __arm_notified (self):
if self.arm_cyl.pos > .9:
push_point = (vector (self.robot_position.pos)
- + vector.polar (self.robot_position.angle - pi / 2, 140 + 100)
+ + vector.polar (self.robot_position.angle - pi / 2, side + 100)
- vector.polar (self.robot_position.angle, 100))
gift = self.table.nearest (push_point, level = 0, max = 150)
if gift is not None and hasattr (gift, 'state'):
diff --git a/host/simu/robots/apbirthday/view/robot.py b/host/simu/robots/apbirthday/view/robot.py
index 429b0c6a..788ab952 100644
--- a/host/simu/robots/apbirthday/view/robot.py
+++ b/host/simu/robots/apbirthday/view/robot.py
@@ -25,6 +25,7 @@
import simu.inter.drawable
from simu.view.table_eurobot2013 import PINK, colors
import math
+from simu.robots.apbirthday.model import front, back, side
COLOR_ROBOT = '#000000'
COLOR_AXES = '#202040'
@@ -64,20 +65,20 @@ 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 ((-108 - f * 170, 85), (-108, -85),
+ self.draw_rectangle ((-back - f * 170, 85), (-back, -85),
fill = PINK)
- self.draw_rectangle ((-108 - f * 148, 85 - 22),
- (-108 - f * 22, -85 + 22), fill = PINK)
+ self.draw_rectangle ((-back - f * 148, 85 - 22),
+ (-back - f * 22, -85 + 22), fill = PINK)
for c in plate.cherries:
if c.pos:
- self.draw_circle ((-108 - f * (c.pos[0] + 85),
+ self.draw_circle ((-back - f * (c.pos[0] + 85),
c.pos[1]), c.radius, fill = colors[c.color])
- self.draw_rectangle ((-108 - f * 170, 85),
- (-108 - f * 170 - (1 - f) * 22, -85), fill = PINK)
+ self.draw_rectangle ((-back - f * 170, 85),
+ (-back - f * 170 - (1 - f) * 22, -85), fill = PINK)
# Draw robot body.
- self.draw_polygon ((102, 140), (102, -140), (-108, -140),
- (-108, 70), (-58, 140), fill = COLOR_ROBOT)
- self.draw_circle ((70, self.cannon_model.cannon_hit[1]), 20,
+ self.draw_polygon ((front, side), (front, -side), (-back, -side),
+ (-back, 81), (-50, side), fill = COLOR_ROBOT)
+ self.draw_circle ((50, self.cannon_model.cannon_hit[1]), 20,
fill = COLOR_CANNON)
# Draw Robot axis.
self.draw_line ((-50, 0), (50, 0), fill = COLOR_AXES,
@@ -93,16 +94,16 @@ class Robot (simu.inter.drawable.Drawable):
f = m.arm_cyl.pos
for x, y, pos in ((m.far_x, m.far_y, m.far_cyl.pos),
(m.near_x, m.near_y, m.near_cyl.pos)):
- e = (y - 140) * f + 140
+ e = (y - side) * f + side
gray = pos * 0x40
fill = '#%02x%02x%02x' % (gray, gray, gray)
- self.draw_polygon ((x - 20, 140), (x - 20, e), (x + 20, e),
- (x + 20, 140), fill = fill)
+ self.draw_polygon ((x - 20, side), (x - 20, e), (x + 20, e),
+ (x + 20, side), fill = fill)
# Draw gifts arm.
m = self.gifts_arm_model
a = math.pi + m.arm_cyl.pos * math.pi / 6
- self.draw_line ((0, -140), (0 + 108 * math.cos (a),
- -140 + 108 * math.sin (a)))
+ self.draw_line ((0, -side), (0 + back * math.cos (a),
+ -side + back * math.sin (a)))
# Draw ballon.
if self.ballon_model.pos > .1:
self.draw_circle ((50, -100), self.ballon_model.pos * 75,