From 4909f63bea2598489a5895f9bbe1e2622093caa1 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 30 Apr 2011 20:45:16 +0200 Subject: digital/io/tools, host/simu: add robospierre --- host/simu/robots/robospierre/__init__.py | 0 host/simu/robots/robospierre/link/__init__.py | 0 host/simu/robots/robospierre/link/bag.py | 35 +++++ host/simu/robots/robospierre/model/__init__.py | 0 host/simu/robots/robospierre/model/bag.py | 57 ++++++++ host/simu/robots/robospierre/model/clamp.py | 172 +++++++++++++++++++++++++ host/simu/robots/robospierre/view/__init__.py | 0 host/simu/robots/robospierre/view/bag.py | 48 +++++++ host/simu/robots/robospierre/view/clamp.py | 172 +++++++++++++++++++++++++ host/simu/robots/robospierre/view/robot.py | 111 ++++++++++++++++ 10 files changed, 595 insertions(+) create mode 100644 host/simu/robots/robospierre/__init__.py create mode 100644 host/simu/robots/robospierre/link/__init__.py create mode 100644 host/simu/robots/robospierre/link/bag.py create mode 100644 host/simu/robots/robospierre/model/__init__.py create mode 100644 host/simu/robots/robospierre/model/bag.py create mode 100644 host/simu/robots/robospierre/model/clamp.py create mode 100644 host/simu/robots/robospierre/view/__init__.py create mode 100644 host/simu/robots/robospierre/view/bag.py create mode 100644 host/simu/robots/robospierre/view/clamp.py create mode 100644 host/simu/robots/robospierre/view/robot.py (limited to 'host/simu/robots/robospierre') diff --git a/host/simu/robots/robospierre/__init__.py b/host/simu/robots/robospierre/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/host/simu/robots/robospierre/link/__init__.py b/host/simu/robots/robospierre/link/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/host/simu/robots/robospierre/link/bag.py b/host/simu/robots/robospierre/link/bag.py new file mode 100644 index 00000000..2760aec0 --- /dev/null +++ b/host/simu/robots/robospierre/link/bag.py @@ -0,0 +1,35 @@ +# simu - Robot simulation. {{{ +# +# Copyright (C) 2011 Nicolas Schodet +# +# APBTeam: +# Web: http://apbteam.org/ +# Email: team AT apbteam DOT org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# }}} +"""Robospierre bag of links.""" +import io.mex +import asserv.mex +import mimot.mex + +class Bag: + + def __init__ (self, node): + self.asserv = asserv.mex.Mex (node) + self.io = io.mex.Mex (node) + self.mimot = mimot.mex.Mex (node) + diff --git a/host/simu/robots/robospierre/model/__init__.py b/host/simu/robots/robospierre/model/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/host/simu/robots/robospierre/model/bag.py b/host/simu/robots/robospierre/model/bag.py new file mode 100644 index 00000000..e6810e18 --- /dev/null +++ b/host/simu/robots/robospierre/model/bag.py @@ -0,0 +1,57 @@ +# simu - Robot simulation. {{{ +# +# Copyright (C) 2011 Nicolas Schodet +# +# APBTeam: +# Web: http://apbteam.org/ +# Email: team AT apbteam DOT org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# }}} +"""Robospierre bag of models.""" +from simu.model.switch import Switch +from simu.model.position import Position +from simu.model.motor_basic import MotorBasic +from simu.model.distance_sensor_sensopart import DistanceSensorSensopart +from simu.robots.robospierre.model.clamp import Clamp +from math import pi + +class Bag: + + def __init__ (self, scheduler, table, link_bag): + self.jack = Switch (link_bag.io.jack) + self.color_switch = Switch (link_bag.io.color_switch) + self.contact = [ Switch (contact) for contact in link_bag.io.contact ] + self.position = Position (link_bag.asserv.position) + self.clamping_motor = MotorBasic (link_bag.io.pwm[0], scheduler, + 2 * pi, 0, pi) + self.clamp = Clamp (table, self.position, link_bag.mimot.aux[0], + link_bag.mimot.aux[1], self.clamping_motor) + self.distance_sensor = [ + DistanceSensorSensopart (link_bag.io.adc[0], scheduler, table, + (20, -20), -pi * 10 / 180, (self.position, ), 2), + DistanceSensorSensopart (link_bag.io.adc[1], scheduler, table, + (20, 20), pi * 10 / 180, (self.position, ), 2), + DistanceSensorSensopart (link_bag.io.adc[2], scheduler, table, + (-20, 20), pi - pi * 10 / 180, (self.position, ), 2), + DistanceSensorSensopart (link_bag.io.adc[3], scheduler, table, + (-20, -20), pi + pi * 10 / 180, (self.position, ), 2), + ] + link_bag.io.adc[4].value = 0 + link_bag.io.adc[5].value = 0 + self.path = link_bag.io.path + self.pos_report = link_bag.io.pos_report + diff --git a/host/simu/robots/robospierre/model/clamp.py b/host/simu/robots/robospierre/model/clamp.py new file mode 100644 index 00000000..ff27a7ea --- /dev/null +++ b/host/simu/robots/robospierre/model/clamp.py @@ -0,0 +1,172 @@ +# simu - Robot simulation. {{{ +# +# Copyright (C) 2011 Nicolas Schodet +# +# APBTeam: +# Web: http://apbteam.org/ +# Email: team AT apbteam DOT org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# }}} +"""Robospierre clamp.""" +from utils.observable import Observable +from simu.utils.trans_matrix import TransMatrix +from math import pi, cos, sin + +class Slot: + """Slot which can contain a pawn.""" + + def __init__ (self, x, y, z, side): + self.x = x + self.y = y + self.z = z + self.side = side + self.pawn = None + +class Clamp (Observable): + + ELEVATION_STROKE = 120.0 + ELEVATION_MOTOR_STROKE = 120.0 * 5.0 / 6.0 + + ROTATION_STROKE = pi + ROTATION_MOTOR_STROKE = pi * 115.0 / 12.0 + + CLAMPING_STROKE = 10 + CLAMPING_MOTOR_STROKE = pi + + BAY_OFFSET = 150 + BAY_ZOFFSET = 60 + + SLOT_FRONT_BOTTOM = 0 + SLOT_FRONT_MIDDLE = 1 + SLOT_FRONT_TOP = 2 + SLOT_BACK_BOTTOM = 3 + SLOT_BACK_MIDDLE = 4 + SLOT_BACK_TOP = 5 + SLOT_SIDE = 6 + + def __init__ (self, table, robot_position, elevation_motor, + rotation_motor, clamping_motor): + Observable.__init__ (self) + self.table = table + self.robot_position = robot_position + self.elevation_motor = elevation_motor + self.rotation_motor = rotation_motor + self.clamping_motor = clamping_motor + self.slots = ( + Slot (self.BAY_OFFSET, 0, 0 * self.BAY_ZOFFSET, 0), + Slot (self.BAY_OFFSET, 0, 1 * self.BAY_ZOFFSET, 0), + Slot (self.BAY_OFFSET, 0, 2 * self.BAY_ZOFFSET, 0), + Slot (-self.BAY_OFFSET, 0, 0 * self.BAY_ZOFFSET, 1), + Slot (-self.BAY_OFFSET, 0, 1 * self.BAY_ZOFFSET, 1), + Slot (-self.BAY_OFFSET, 0, 2 * self.BAY_ZOFFSET, 1), + Slot (0, self.BAY_OFFSET, 2 * self.BAY_ZOFFSET, None)) + self.load = None + self.robot_position.register (self.__robot_position_notified) + self.elevation_motor.register (self.__elevation_notified) + self.rotation_motor.register (self.__rotation_notified) + self.clamping_motor.register (self.__clamping_notified) + + def __robot_position_notified (self): + # Update bottom slots. + changed = False + for sloti in (self.SLOT_FRONT_BOTTOM, self.SLOT_BACK_BOTTOM): + slot = self.slots[sloti] + if slot.pawn is None: + p = self.__get_floor_elements (slot.side) + if p is not None: + slot.pawn = p + p.pos = None + p.notify () + changed = True + if changed: + self.notify () + + def __elevation_notified (self): + if self.elevation_motor.angle is None: + self.elevation = None + else: + # Update elevation. + self.elevation = (self.elevation_motor.angle + * self.ELEVATION_STROKE / self.ELEVATION_MOTOR_STROKE) + self.notify () + + def __rotation_notified (self): + if self.rotation_motor.angle is None: + self.rotation = None + else: + # Update rotation. + self.rotation = (self.rotation_motor.angle * self.ROTATION_STROKE + / self.ROTATION_MOTOR_STROKE) + self.notify () + + def __clamping_notified (self): + if self.clamping_motor.angle is None: + self.clamping = None + else: + # Update clamping. + self.clamping = (self.clamping_motor.angle * self.CLAMPING_STROKE + / self.CLAMPING_MOTOR_STROKE) + if self.clamping == 0 and self.load is None: + # Load an element. + slot = self.__get_clamp_slot () + if slot: + self.load, slot.pawn = slot.pawn, self.load + elif self.clamping == self.CLAMPING_STROKE \ + and self.load is not None: + # Unload an element. + slot = self.__get_clamp_slot () + if slot and slot.pawn is None: + self.load, slot.pawn = slot.pawn, self.load + self.notify () + + def __get_floor_elements (self, side): + """Return an elements in front (side = 0) or in back (side = 1) of the + robot, on the floor.""" + if self.robot_position.pos is None: + return None + # Matrix to transform an obstacle position into robot coordinates. + m = TransMatrix () + m.rotate (-self.robot_position.angle) + m.translate ((-self.robot_position.pos[0], + -self.robot_position.pos[1])) + # Look up elements. + xoffset = (self.BAY_OFFSET, -self.BAY_OFFSET)[side] + xmargin = 20 + ymargin = 50 + for o in self.table.obstacles: + if o.level == 1 and o.pos is not None: + pos = m.apply (o.pos) + if (pos[0] > xoffset - xmargin + and pos[0] < xoffset + xmargin + and pos[1] > -ymargin and pos[1] < ymargin): + return o + return None + + def __get_clamp_slot (self): + """Return the slot in which the clamp is.""" + if self.rotation is None or self.elevation is None: + return None + margin = 10 + x = cos (self.rotation) * self.BAY_OFFSET + y = sin (self.rotation) * self.BAY_OFFSET + for slot in self.slots: + if abs (slot.z - self.elevation) < margin \ + and abs (slot.x - x) < margin \ + and abs (slot.y - y) < margin: + return slot + return None + diff --git a/host/simu/robots/robospierre/view/__init__.py b/host/simu/robots/robospierre/view/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/host/simu/robots/robospierre/view/bag.py b/host/simu/robots/robospierre/view/bag.py new file mode 100644 index 00000000..361c79d3 --- /dev/null +++ b/host/simu/robots/robospierre/view/bag.py @@ -0,0 +1,48 @@ +# simu - Robot simulation. {{{ +# +# Copyright (C) 2011 Nicolas Schodet +# +# APBTeam: +# Web: http://apbteam.org/ +# Email: team AT apbteam DOT org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# }}} +"""Robospierre bag of views.""" +from simu.view.switch import Switch +from simu.view.distance_sensor_us import DistanceSensorUS +from simu.view.path import Path +from simu.view.pos_report import PosReport +from simu.robots.robospierre.view.robot import Robot +from simu.robots.robospierre.view.clamp import ClampTop, ClampSide + +class Bag: + + def __init__ (self, table, actuator_view, sensor_frame, model_bag): + self.jack = Switch (sensor_frame, model_bag.jack, 'Jack') + self.color_switch = Switch (sensor_frame, model_bag.color_switch, + 'Color') + self.robot = Robot (table, model_bag.position, model_bag.clamp) + self.clamp = ( + ClampTop (actuator_view.add_view (ClampTop.width, + ClampTop.height), model_bag.clamp), + ClampSide (actuator_view.add_view (ClampSide.width, + ClampSide.height), model_bag.clamp)) + self.distance_sensor = [DistanceSensorUS (self.robot, ds) + for ds in model_bag.distance_sensor] + self.path = Path (table, model_bag.path) + self.pos_report = PosReport (table, model_bag.pos_report) + diff --git a/host/simu/robots/robospierre/view/clamp.py b/host/simu/robots/robospierre/view/clamp.py new file mode 100644 index 00000000..bd5f6dab --- /dev/null +++ b/host/simu/robots/robospierre/view/clamp.py @@ -0,0 +1,172 @@ +# simu - Robot simulation. {{{ +# +# Copyright (C) 2011 Nicolas Schodet +# +# APBTeam: +# Web: http://apbteam.org/ +# Email: team AT apbteam DOT org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# }}} +"""Robospierre clamp.""" +from simu.inter.drawable import Drawable +from simu.utils.trans_matrix import TransMatrix +from math import pi, sin, cos + +from simu.view.table_eurobot2011 import YELLOW, draw_pawn + +DGREY = '#404040' +GREY = '#808080' +BLACK = '#000000' + +class ClampTop (Drawable): + + width = 420 + height = 420 + + def __init__ (self, onto, model): + Drawable.__init__ (self, onto) + self.model = model + self.model.register (self.__notified) + + def __notified (self): + self.update () + + def draw (self): + self.reset () + # Draw base from top. + self.trans_rotate (pi) + self.draw_arc ((0, 0), 190, start = pi * 35 / 180, + extent = pi * 110 / 180, style = 'arc', + outline = GREY) + self.draw_arc ((0, 0), 190, start = pi + pi * 35 / 180, + extent = pi * 110 / 180, style = 'arc', + outline = GREY) + self.draw_arc ((150, 0), 110, start = pi / 2, + extent = pi, style = 'arc', outline = GREY) + self.draw_arc ((-150, 0), 110, start = 3 * pi / 2, + extent = pi, style = 'arc', outline = GREY) + self.draw_arc ((0, 150), 100, start = pi, + extent = pi, style = 'arc', outline = GREY, dash = (2, 3)) + self.draw_line ((-40, 0), (40, 0), fill = GREY, arrow = 'last') + # Draw slots. + for slot in self.model.slots: + if slot.pawn is not None: + self.trans_push () + self.trans_scale (1 - slot.z / 1000.0) + self.trans_translate ((slot.x, slot.y)) + draw_pawn (self, slot.pawn.radius, slot.pawn.kind) + self.trans_pop () + # Draw clamp. + if self.model.rotation is not None: + self.trans_rotate (self.model.rotation) + # Fixed side. + self.draw_line ((0, 3), (47, 3)) + self.draw_arc ((150, 0), 103, start = pi / 2, extent = pi / 2, + style = 'arc') + # Pawn. + load = self.model.load + if load is not None: + self.trans_push () + self.trans_translate ((150, 0)) + draw_pawn (self, load.radius, load.kind) + self.trans_pop () + # Mobile side. + self.trans_rotate (-self.model.clamping / 43) + self.draw_line ((0, -3), (47, -3)) + self.draw_arc ((150, 0), 103, start = pi, extent = pi / 2, + style = 'arc') + +class ClampSide (Drawable): + + width = 420 + height = 370 + + def __init__ (self, onto, model): + Drawable.__init__ (self, onto) + self.model = model + self.model.register (self.__notified) + + def __notified (self): + self.update () + + def draw_pawn (self, pos, pawn): + if pawn is not None: + self.trans_push () + self.trans_translate (pos) + self.draw_rectangle ((-100, 0), (100, 50), fill = YELLOW) + if pawn.kind == 'king': + self.draw_polygon ((-50, 50), (-10, 170), (-50, 170), (-50, 190), + (-10, 190), (-10, 230), (10, 230), (10, 190), (50, 190), + (50, 170), (5, 170), (50, 50), fill = YELLOW, + outline = BLACK) + elif pawn.kind == 'queen': + self.draw_polygon ((-50, 50), (-10, 180), (10, 180), (50, 50), + fill = YELLOW, outline = BLACK) + self.draw_circle ((0, 180), 50, fill = YELLOW) + self.trans_pop () + + def draw (self): + self.reset () + # Draw base from side. + self.trans_translate ((0, -165)) + self.draw_line ((-150, 0), (150, 0), fill = GREY) + self.draw_line ((-20, 60), (20, 60), fill = GREY) + self.draw_line ((-20, 120), (20, 120), fill = GREY) + self.draw_line ((0, 0), (0, 330), fill = GREY) + # Draw slots. + for slot in self.model.slots: + if slot.pawn is not None: + self.draw_pawn ((-slot.x, slot.z), slot.pawn) + # Draw clamp. + if self.model.rotation is not None: + self.trans_translate ((0, self.model.elevation)) + m = TransMatrix () + m.rotate (pi + self.model.rotation) + # 2D projection of a 3D circular clamp. + ltip = m.apply ((150, 103))[0] + lbase = m.apply ((47, 0))[0] + lcenter = m.apply ((150, 0))[0] + m.rotate (- self.model.clamping / 43) + rtip = m.apply ((150, -103))[0] + rbase = m.apply ((47, 0))[0] + rcenter = m.apply ((150, 0))[0] + s, c = sin (self.model.rotation), cos (self.model.rotation) + dattr = dict (outline = BLACK, fill = DGREY) + attr = dict (outline = BLACK, fill = GREY) + if c >= 0: + if s >= 0: + self.draw_rectangle ((lbase, 10), (lcenter + 103, 40), **dattr) + self.draw_rectangle ((rtip, 10), (rbase, 40), **dattr) + self.draw_pawn ((lcenter, 0), self.model.load) + self.draw_rectangle ((ltip, 10), (lcenter + 103, 40), **attr) + else: + self.draw_rectangle ((rtip, 10), (rcenter + 103, 40), **dattr) + self.draw_pawn ((lcenter, 0), self.model.load) + self.draw_rectangle ((ltip, 10), (lbase, 40), **attr) + self.draw_rectangle ((rbase, 10), (rcenter + 103, 40), **attr) + else: + if s >= 0: + self.draw_rectangle ((lbase, 10), (ltip, 40), **dattr) + self.draw_rectangle ((rbase, 10), (rcenter - 103, 40), **dattr) + self.draw_pawn ((lcenter, 0), self.model.load) + self.draw_rectangle ((rtip, 10), (rcenter - 103, 40), **attr) + else: + self.draw_rectangle ((ltip, 10), (lcenter - 103, 40), **dattr) + self.draw_pawn ((lcenter, 0), self.model.load) + self.draw_rectangle ((lbase, 10), (lcenter - 103, 40), **attr) + self.draw_rectangle ((rbase, 10), (rtip, 40), **attr) + diff --git a/host/simu/robots/robospierre/view/robot.py b/host/simu/robots/robospierre/view/robot.py new file mode 100644 index 00000000..c0f6624c --- /dev/null +++ b/host/simu/robots/robospierre/view/robot.py @@ -0,0 +1,111 @@ +# simu - Robot simulation. {{{ +# +# Copyright (C) 2011 Nicolas Schodet +# +# APBTeam: +# Web: http://apbteam.org/ +# Email: team AT apbteam DOT org +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# }}} +"""Robospierre robot view.""" +import simu.inter.drawable +from math import pi + +from simu.view.table_eurobot2011 import draw_pawn + +COLOR_ROBOT = '#000000' +COLOR_CLAMP = '#606060' +COLOR_AXES = '#202040' + +class Robot (simu.inter.drawable.Drawable): + + def __init__ (self, onto, position_model, clamp_model): + """Construct and make connections.""" + simu.inter.drawable.Drawable.__init__ (self, onto) + self.position_model = position_model + self.position_model.register (self.__position_notified) + self.clamp_model = clamp_model + self.clamp_model.register (self.__clamp_notified) + + def __position_notified (self): + """Called on position modifications.""" + self.pos = self.position_model.pos + self.angle = self.position_model.angle + self.update () + + def __clamp_notified (self): + """Called on clamp modifications.""" + self.update () + + def draw (self): + """Draw the robot.""" + self.reset () + if self.pos is not None: + self.trans_translate (self.pos) + self.trans_rotate (self.angle) + # Draw slots. + for slot in self.clamp_model.slots: + if slot.pawn is not None: + self.trans_push () + self.trans_scale (1 - slot.z / 1000.0) + self.trans_translate ((slot.x, slot.y)) + draw_pawn (self, slot.pawn.radius, slot.pawn.kind) + self.trans_pop () + # Draw clamp. + if self.clamp_model.rotation is not None: + self.trans_push () + # Fixed side. + self.trans_rotate (self.clamp_model.rotation) + self.draw_arc ((150, 0), 103, start = pi / 2, extent = pi / 2, + style = 'arc', outline = COLOR_CLAMP) + # Draw load. + load = self.clamp_model.load + if load: + self.trans_push () + self.trans_translate ((150, 0)) + draw_pawn (self, load.radius, load.kind) + self.trans_pop () + # Mobile side. + self.trans_rotate (- self.clamp_model.clamping / 47) + self.draw_arc ((150, 0), 103, start = pi, extent = pi / 2, + style = 'arc', outline = COLOR_CLAMP) + # Done. + self.trans_pop () + # Draw robot body. + self.draw_polygon ((0, 190), (150, 110), (95, 95), (55, 55), + (40, -0), (55, -55), (95, -95), (150, -110), (0, -190), + (-150, -110), (-95, -95), (-55, -55), (-40, -0), + (-55, 55), (-95, 95), (-150, 110), (0, 190), + fill = COLOR_ROBOT) + self.draw_arc ((0, 0), 190, start = pi * 35 / 180, + extent = pi * 110 / 180, style = 'chord', + outline = COLOR_ROBOT, fill = COLOR_ROBOT) + self.draw_arc ((0, 0), 190, start = pi + pi * 35 / 180, + extent = pi * 110 / 180, style = 'chord', + outline = COLOR_ROBOT, fill = COLOR_ROBOT) + # Draw Robot axis. + self.draw_line ((-50, 0), (50, 0), fill = COLOR_AXES, + arrow = 'last') + # Draw Robot wheels. + f = 221 # Wheel spacing + wr = 60 / 2 # Wheel radius + self.draw_line ((0, +f / 2), (0, -f / 2), fill = COLOR_AXES) + self.draw_line ((-wr, f / 2), (+wr, f / 2), fill = COLOR_AXES) + self.draw_line ((-wr, -f / 2), (+wr, -f / 2), fill = COLOR_AXES) + # Extends. + simu.inter.drawable.Drawable.draw (self) + -- cgit v1.2.3