summaryrefslogtreecommitdiff
path: root/digital/ai/tools/test_simu_control_robospierre.py
diff options
context:
space:
mode:
authorNicolas Schodet2012-03-21 00:46:03 +0100
committerNicolas Schodet2012-03-21 18:56:51 +0100
commit1e7c8a8a9811c45091e6c471482086113f059f40 (patch)
treed7faa80dd162799c394ec23925cc53b6dbff008e /digital/ai/tools/test_simu_control_robospierre.py
parent0feb542a8cf7630a5d442387727414f5251aad83 (diff)
parentdcb79f383269440ec2c5a54b6d7792fbb0110d5a (diff)
Merge branch 'master' into efrei-robotique
Conflicts: digital/mimot/src/dirty/aux.c digital/mimot/src/dirty/aux.h digital/mimot/src/dirty/contacts.h digital/mimot/src/dirty/main.c digital/mimot/src/dirty/models.host.c digital/mimot/src/dirty/twi_proto.c digital/mimot/tools/mimot/init.py
Diffstat (limited to 'digital/ai/tools/test_simu_control_robospierre.py')
-rw-r--r--digital/ai/tools/test_simu_control_robospierre.py63
1 files changed, 55 insertions, 8 deletions
diff --git a/digital/ai/tools/test_simu_control_robospierre.py b/digital/ai/tools/test_simu_control_robospierre.py
index b1cccf4b..c1a16c3c 100644
--- a/digital/ai/tools/test_simu_control_robospierre.py
+++ b/digital/ai/tools/test_simu_control_robospierre.py
@@ -30,10 +30,13 @@ class TestSimuControl (TestSimu):
ELEVATION_STROKE = 0x3b0b
- ROTATION_STROKE = 0x11c6
+ ROTATION_STROKE = 0x233e
- def __init__ (self, robot_class):
- TestSimu.__init__ (self, robot_class)
+ def __init__ (self, robot_class, *args):
+ TestSimu.__init__ (self, robot_class, *args, color_switch = False)
+ self.io = self.robots[0].io
+ self.asserv = self.robots[0].asserv
+ self.mimot = self.robots[0].mimot
def create_widgets (self):
TestSimu.create_widgets (self)
@@ -46,6 +49,12 @@ class TestSimuControl (TestSimu):
indicatoron = False,
variable = self.clamp_var, command = self.clamp_command)
self.clamp_button.pack ()
+ self.doors_var = IntVar ()
+ self.doors_var.set (1)
+ self.doors_button = Checkbutton (self.control_frame, text = 'Doors',
+ indicatoron = False,
+ variable = self.doors_var, command = self.doors_command)
+ self.doors_button.pack ()
self.elevation_up_button = Button (self.control_frame,
text = 'Elevation up', padx = 0, pady = 0,
command = self.elevation_up_command)
@@ -69,12 +78,35 @@ class TestSimuControl (TestSimu):
text = 'Move clamp', padx = 0, pady = 0,
command = self.clamp_move_command)
self.clamp_move_button.pack ()
+ self.clamp_to_scale = Scale (self.control_frame, orient = HORIZONTAL,
+ from_ = 0, to = 6)
+ self.clamp_to_scale.pack ()
+ self.clamp_element_move_button = Button (self.control_frame,
+ text = 'Move element', padx = 0, pady = 0,
+ command = self.clamp_move_element_command)
+ self.clamp_element_move_button.pack ()
+ self.drop_var = IntVar ()
+ self.drop_button = Checkbutton (self.control_frame, text = 'Drop',
+ indicatoron = False,
+ variable = self.drop_var, command = self.drop_command)
+ self.drop_button.pack ()
+ self.backward_var = IntVar ()
+ self.backward_button = Checkbutton (self.control_frame,
+ text = 'Backward', variable = self.backward_var)
+ self.backward_button.pack ()
+ self.goto_var = IntVar ()
+ self.goto_button = Checkbutton (self.control_frame,
+ text = 'Goto FSM', variable = self.goto_var)
+ self.goto_button.pack ()
self.table_view.bind ('<1>', self.move)
self.table_view.bind ('<3>', self.orient)
def move (self, ev):
pos = self.table_view.screen_coord ((ev.x, ev.y))
- self.asserv.goto (pos[0], pos[1])
+ if self.goto_var.get ():
+ self.io.goto (pos[0], pos[1], self.backward_var.get ())
+ else:
+ self.asserv.goto (pos[0], pos[1], self.backward_var.get ())
def orient (self, ev):
x, y = self.table_view.screen_coord ((ev.x, ev.y))
@@ -84,10 +116,7 @@ class TestSimuControl (TestSimu):
self.asserv.goto_angle (a)
def clamp_command (self):
- if self.clamp_var.get ():
- self.io.pwm_set_timed (0, -0x3ff, 255, 0)
- else:
- self.io.pwm_set_timed (0, 0x3ff, 255, 0)
+ self.io.clamp_openclose (not self.clamp_var.get ())
def elevation_up_command (self):
self.mimot.speed_pos ('a0', self.ELEVATION_STROKE / 2)
@@ -104,6 +133,24 @@ class TestSimuControl (TestSimu):
def clamp_move_command (self):
self.io.clamp_move (self.clamp_pos_scale.get ())
+ def clamp_move_element_command (self):
+ self.io.clamp_move_element (self.clamp_pos_scale.get (),
+ self.clamp_to_scale.get ())
+
+ def doors_command (self):
+ for i in (0, 2, 3, 5):
+ self.io.door (i, not self.doors_var.get ())
+
+ def drop_command (self):
+ if self.drop_var.get ():
+ if self.backward_var.get ():
+ order = 'drop_backward'
+ else:
+ order = 'drop_forward'
+ else:
+ order = 'drop_clear'
+ self.io.drop (order)
+
def change_color (self, *dummy):
pass