summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorNicolas Schodet2011-05-23 20:40:28 +0200
committerNicolas Schodet2011-05-23 20:40:28 +0200
commit2f37578582ba9831122d55e189fe4cce41aa758a (patch)
tree7ea284cb2955a921b137918aa2041f6fc89f8ea3 /digital
parentbd04b586866d0770905cf5e89c97face316719d2 (diff)
digital/ai/tools: use new door and clamp command
Diffstat (limited to 'digital')
-rw-r--r--digital/ai/tools/test_simu_control_robospierre.py13
-rw-r--r--digital/io-hub/tools/io_hub/io_hub.py6
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)