summaryrefslogtreecommitdiffhomepage
path: root/host/simu/robots
diff options
context:
space:
mode:
Diffstat (limited to 'host/simu/robots')
-rw-r--r--host/simu/robots/apbirthday/model/bag.py2
-rw-r--r--host/simu/robots/apbirthday/view/bag.py2
-rw-r--r--host/simu/robots/apbirthday/view/robot.py9
3 files changed, 11 insertions, 2 deletions
diff --git a/host/simu/robots/apbirthday/model/bag.py b/host/simu/robots/apbirthday/model/bag.py
index dd3d52f2..b6bf6c60 100644
--- a/host/simu/robots/apbirthday/model/bag.py
+++ b/host/simu/robots/apbirthday/model/bag.py
@@ -92,6 +92,8 @@ class Bag:
link_bag.gift_in,
link_bag.gift_out,
scheduler, 0., 1., 10., 10., 0.))
+ self.ballon = PneumaticCylinder (None, link_bag.ballon_funny_action,
+ scheduler, 0., 1., .1, .1, 0.)
self.path = link_bag.io_hub.path
self.pos_report = link_bag.io_hub.pos_report
diff --git a/host/simu/robots/apbirthday/view/bag.py b/host/simu/robots/apbirthday/view/bag.py
index 343ebc71..57c83049 100644
--- a/host/simu/robots/apbirthday/view/bag.py
+++ b/host/simu/robots/apbirthday/view/bag.py
@@ -40,7 +40,7 @@ class Bag:
self.robot_nb_switch = Switch (sensor_frame,
model_bag.robot_nb_switch, 'Nb robots')
self.robot = Robot (table, model_bag.position, model_bag.cake_arm,
- model_bag.cannon, model_bag.gifts_arm)
+ model_bag.cannon, model_bag.gifts_arm, model_bag.ballon)
self.distance_sensor = [DistanceSensorUS (self.robot, ds)
for ds in model_bag.distance_sensor]
self.cake_front = DistanceSensor (self.robot, model_bag.cake_front)
diff --git a/host/simu/robots/apbirthday/view/robot.py b/host/simu/robots/apbirthday/view/robot.py
index f473a341..429b0c6a 100644
--- a/host/simu/robots/apbirthday/view/robot.py
+++ b/host/simu/robots/apbirthday/view/robot.py
@@ -29,11 +29,12 @@ import math
COLOR_ROBOT = '#000000'
COLOR_AXES = '#202040'
COLOR_CANNON = '#808080'
+COLOR_BALLON = '#ff0000'
class Robot (simu.inter.drawable.Drawable):
def __init__ (self, onto, position_model, cake_arm_model, cannon_model,
- gifts_arm_model):
+ gifts_arm_model, ballon_model):
"""Construct and make connections."""
simu.inter.drawable.Drawable.__init__ (self, onto)
self.position_model = position_model
@@ -44,6 +45,8 @@ class Robot (simu.inter.drawable.Drawable):
self.cannon_model.register (self.update)
self.gifts_arm_model = gifts_arm_model
self.gifts_arm_model.register (self.update)
+ self.ballon_model = ballon_model
+ self.ballon_model.register (self.update)
def __position_notified (self):
"""Called on position modifications."""
@@ -100,6 +103,10 @@ class Robot (simu.inter.drawable.Drawable):
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)))
+ # Draw ballon.
+ if self.ballon_model.pos > .1:
+ self.draw_circle ((50, -100), self.ballon_model.pos * 75,
+ fill = COLOR_BALLON)
# Extends.
simu.inter.drawable.Drawable.draw (self)