From 2f37578582ba9831122d55e189fe4cce41aa758a Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 23 May 2011 20:40:28 +0200 Subject: digital/ai/tools: use new door and clamp command --- digital/ai/tools/test_simu_control_robospierre.py | 13 +++---------- digital/io-hub/tools/io_hub/io_hub.py | 6 ++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/digital/ai/tools/test_simu_control_robospierre.py b/digital/ai/tools/test_simu_control_robospierre.py index acd3ca7c..77f017c2 100644 --- a/digital/ai/tools/test_simu_control_robospierre.py +++ b/digital/ai/tools/test_simu_control_robospierre.py @@ -106,10 +106,7 @@ class TestSimuControl (TestSimu): self.asserv.goto_angle (a) def clamp_command (self): - if self.clamp_var.get (): - self.io.pwm_set_timed (2, -0x3ff, 255, 0) - else: - self.io.pwm_set_timed (2, 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) @@ -131,12 +128,8 @@ class TestSimuControl (TestSimu): self.clamp_to_scale.get ()) def doors_command (self): - if self.doors_var.get (): - pwm = -0x3ff - else: - pwm = 0x3ff - for i in (0, 1, 3, 4): - self.io.pwm_set_timed (i, pwm, 255, 0) + 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 (): diff --git a/digital/io-hub/tools/io_hub/io_hub.py b/digital/io-hub/tools/io_hub/io_hub.py index d6ae8618..aafc2d1d 100644 --- a/digital/io-hub/tools/io_hub/io_hub.py +++ b/digital/io-hub/tools/io_hub/io_hub.py @@ -60,6 +60,12 @@ class Proto: else: raise ValueError + def door (self, pos, open_): + self.proto.send ('d', 'BB', pos, (0, 1)[open_]) + + def clamp_openclose (self, open_): + self.proto.send ('d', 'BB', 0xff, (0, 1)[open_]) + def close (self): self.reset () self.proto.wait (lambda: True) -- cgit v1.2.3