summaryrefslogtreecommitdiff
path: root/digital/ai/tools/test_simu.py
diff options
context:
space:
mode:
Diffstat (limited to 'digital/ai/tools/test_simu.py')
-rw-r--r--digital/ai/tools/test_simu.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/digital/ai/tools/test_simu.py b/digital/ai/tools/test_simu.py
index d55417a5..11ea1b17 100644
--- a/digital/ai/tools/test_simu.py
+++ b/digital/ai/tools/test_simu.py
@@ -49,7 +49,8 @@ class ObstacleWithBeacon (obstacle_view.RoundObstacle):
class TestSimu (InterNode):
"""Interface, with simulated programs."""
- def __init__ (self, robot_class, robot_nb = 1, color_switch = True):
+ def __init__ (self, robot_class, robot_nb = 1,
+ color_switch_set_pos = False):
# Hub.
self.hub = mex.hub.Hub (min_clients = 1 + robot_class.client_nb
* robot_nb)
@@ -86,11 +87,12 @@ class TestSimu (InterNode):
r.view = r.robot_view.Bag (self.table, self.actuator_view,
self.sensor_frame, r.model)
# Color switch.
- if color_switch:
- def change_color (r = r):
- i = r.model.color_switch.state
- r.asserv.set_simu_pos (*r.robot_start_pos[i])
- r.model.color_switch.register (change_color)
+ def change_color (r = r):
+ i = r.model.color_switch.state
+ r.asserv.set_simu_pos (*r.robot_start_pos[i])
+ if color_switch_set_pos:
+ r.asserv.set_pos (*r.robot_start_pos[i])
+ r.model.color_switch.register (change_color)
def close (self):
self.forked_hub.kill ()