summaryrefslogtreecommitdiff
path: root/digital/io-hub/tools/io_hub/io_hub.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/io-hub/tools/io_hub/io_hub.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/io-hub/tools/io_hub/io_hub.py')
-rw-r--r--digital/io-hub/tools/io_hub/io_hub.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/digital/io-hub/tools/io_hub/io_hub.py b/digital/io-hub/tools/io_hub/io_hub.py
index a363e5f6..06d237e9 100644
--- a/digital/io-hub/tools/io_hub/io_hub.py
+++ b/digital/io-hub/tools/io_hub/io_hub.py
@@ -44,9 +44,31 @@ class Proto:
def pwm_set_timed (self, index, value, time, rest_value):
self.proto.send ('w', 'BhHh', index, value, time, rest_value)
+ def goto (self, x, y, backward):
+ self.proto.send ('m', 'hhB', x, y, backward)
+
def clamp_move (self, pos):
self.proto.send ('c', 'B', pos)
+ def clamp_move_element (self, from_, to):
+ self.proto.send ('c', 'BB', from_, to)
+
+ def drop (self, order):
+ if order == 'drop_clear':
+ self.proto.send ('d', 'B', 0x00)
+ elif order == 'drop_forward':
+ self.proto.send ('d', 'B', 0x01)
+ elif order == 'drop_backward':
+ self.proto.send ('d', 'B', 0x02)
+ 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)