summaryrefslogtreecommitdiff
path: root/host/simu/robots/robospierre/view
diff options
context:
space:
mode:
Diffstat (limited to 'host/simu/robots/robospierre/view')
-rw-r--r--host/simu/robots/robospierre/view/bag.py4
-rw-r--r--host/simu/robots/robospierre/view/clamp.py41
-rw-r--r--host/simu/robots/robospierre/view/robot.py4
3 files changed, 35 insertions, 14 deletions
diff --git a/host/simu/robots/robospierre/view/bag.py b/host/simu/robots/robospierre/view/bag.py
index 0b5a85ad..d87cecb9 100644
--- a/host/simu/robots/robospierre/view/bag.py
+++ b/host/simu/robots/robospierre/view/bag.py
@@ -35,6 +35,8 @@ class Bag:
self.jack = Switch (sensor_frame, model_bag.jack, 'Jack')
self.color_switch = Switch (sensor_frame, model_bag.color_switch,
'Color')
+ self.strat_switch = Switch (sensor_frame, model_bag.strat_switch,
+ 'Strat')
self.robot = Robot (table, model_bag.position, model_bag.clamp)
self.clamp = (
ClampTop (actuator_view.add_view (ClampTop.width,
@@ -43,4 +45,6 @@ class Bag:
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
index bd5f6dab..07a10929 100644
--- a/host/simu/robots/robospierre/view/clamp.py
+++ b/host/simu/robots/robospierre/view/clamp.py
@@ -68,7 +68,7 @@ class ClampTop (Drawable):
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)
+ draw_pawn (self, slot.pawn)
self.trans_pop ()
# Draw clamp.
if self.model.rotation is not None:
@@ -82,7 +82,7 @@ class ClampTop (Drawable):
if load is not None:
self.trans_push ()
self.trans_translate ((150, 0))
- draw_pawn (self, load.radius, load.kind)
+ draw_pawn (self, load)
self.trans_pop ()
# Mobile side.
self.trans_rotate (-self.model.clamping / 43)
@@ -107,16 +107,23 @@ class ClampSide (Drawable):
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)
+ if pawn.kind == 'tower':
+ pawns = pawn.tower
+ else:
+ pawns = (pawn, )
+ for p in pawns:
+ self.draw_rectangle ((-100, 0), (100, 50), fill = YELLOW)
+ if p.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 p.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_translate ((0, 50))
self.trans_pop ()
def draw (self):
@@ -133,6 +140,7 @@ class ClampSide (Drawable):
self.draw_pawn ((-slot.x, slot.z), slot.pawn)
# Draw clamp.
if self.model.rotation is not None:
+ self.trans_push ()
self.trans_translate ((0, self.model.elevation))
m = TransMatrix ()
m.rotate (pi + self.model.rotation)
@@ -169,4 +177,13 @@ class ClampSide (Drawable):
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)
+ self.trans_pop ()
+ # Draw doors.
+ for slot in self.model.slots:
+ if slot.door_motor is not None:
+ self.trans_push ()
+ self.trans_translate ((-slot.x, slot.z + 50))
+ self.trans_rotate (-0.5 * pi + slot.door_motor.angle)
+ self.draw_line ((0, 0), (40, 0))
+ self.trans_pop ()
diff --git a/host/simu/robots/robospierre/view/robot.py b/host/simu/robots/robospierre/view/robot.py
index c0f6624c..90624000 100644
--- a/host/simu/robots/robospierre/view/robot.py
+++ b/host/simu/robots/robospierre/view/robot.py
@@ -63,7 +63,7 @@ class Robot (simu.inter.drawable.Drawable):
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)
+ draw_pawn (self, slot.pawn)
self.trans_pop ()
# Draw clamp.
if self.clamp_model.rotation is not None:
@@ -77,7 +77,7 @@ class Robot (simu.inter.drawable.Drawable):
if load:
self.trans_push ()
self.trans_translate ((150, 0))
- draw_pawn (self, load.radius, load.kind)
+ draw_pawn (self, load)
self.trans_pop ()
# Mobile side.
self.trans_rotate (- self.clamp_model.clamping / 47)