From d8166cc985d91855b71307d56e99eb2c3a6fb234 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 8 May 2013 15:43:52 +0200 Subject: digital/io-hub, digital/mimot, host/simu/robots: update robot size --- digital/io-hub/src/apbirthday/bot.hh | 8 +++---- digital/mimot/src/asserv/models.host.c | 4 ++-- host/simu/robots/apbirthday/model/__init__.py | 3 +++ host/simu/robots/apbirthday/model/cannon.py | 3 ++- host/simu/robots/apbirthday/model/gifts_arm.py | 3 ++- host/simu/robots/apbirthday/view/robot.py | 29 +++++++++++++------------- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/digital/io-hub/src/apbirthday/bot.hh b/digital/io-hub/src/apbirthday/bot.hh index fed8f20f..d422f8a4 100644 --- a/digital/io-hub/src/apbirthday/bot.hh +++ b/digital/io-hub/src/apbirthday/bot.hh @@ -34,13 +34,13 @@ #endif /// Distance from the robot axis to the front. -#define BOT_SIZE_FRONT 102 +#define BOT_SIZE_FRONT 96 /// Distance from the robot axis to the back. -#define BOT_SIZE_BACK 108 +#define BOT_SIZE_BACK 126 /// Distance from the robot axis to the side. -#define BOT_SIZE_SIDE 140 +#define BOT_SIZE_SIDE 142 /// Maximum distance from the robot base center to one of its edge. -#define BOT_SIZE_RADIUS 177 +#define BOT_SIZE_RADIUS 190 /// Distance between the front contact point and the robot center. #define BOT_FRONT_CONTACT_DIST BOT_SIZE_FRONT diff --git a/digital/mimot/src/asserv/models.host.c b/digital/mimot/src/asserv/models.host.c index bdcba555..3fe4fd1a 100644 --- a/digital/mimot/src/asserv/models.host.c +++ b/digital/mimot/src/asserv/models.host.c @@ -115,8 +115,8 @@ static const struct robot_t apbirthday_robot = * table. */ simu_table_test_apbirthday, /** Robot corners, from front left, then clockwise. */ - { { 102, 140 }, { 102, -140 }, { -108, -140 }, { -108, 70 }, - { -58, 140 } }, + { { 96, 142 }, { 96, -142 }, { -126, -142 }, { -126, 81 }, + { -80, 142 } }, /** Initialisation function. */ NULL, }; 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, -- cgit v1.2.3