summaryrefslogtreecommitdiffhomepage
path: root/digital/mimot/tools/mimot/mex.py
diff options
context:
space:
mode:
authorNicolas Schodet2011-03-30 22:25:25 +0200
committerNicolas Schodet2011-03-30 23:52:36 +0200
commit712fcb0da93d06f65e0a3e33ab6211f101593000 (patch)
treeb725dc1fab5ff8692d898db417da89c7e8807390 /digital/mimot/tools/mimot/mex.py
parenta663069b33a6ed5344187dcd1ab48022a681ae1b (diff)
digital/mimot: use message type registry, refs #157
Diffstat (limited to 'digital/mimot/tools/mimot/mex.py')
-rw-r--r--digital/mimot/tools/mimot/mex.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/digital/mimot/tools/mimot/mex.py b/digital/mimot/tools/mimot/mex.py
index a190c1cc..5724189e 100644
--- a/digital/mimot/tools/mimot/mex.py
+++ b/digital/mimot/tools/mimot/mex.py
@@ -26,9 +26,6 @@
from utils.observable import Observable
import simu.mex.msg
-ID_AUX = 0xc8
-ID_LIMITS = 0xcc
-
class Mex:
"""Handle communications with simulated mimot."""
@@ -46,9 +43,9 @@ class Mex:
class Pack:
"""Handle reception of several Aux for one message."""
- def __init__ (self, node, list):
+ def __init__ (self, node, instance, list):
self.__list = list
- node.register (ID_AUX, self.__handle)
+ node.register (instance + ':aux', self.__handle)
def __handle (self, msg):
angles = msg.pop ('%dl' % len (self.__list))
@@ -77,8 +74,9 @@ class Mex:
class Pack:
"""Handle emission of several limits for one message."""
- def __init__ (self, node):
+ def __init__ (self, node, instance):
self.node = node
+ self.mtype = node.reserve (instance + ':limits')
self.limits = [ None, None, None, None ]
def set (self, index, min, max):
@@ -87,7 +85,7 @@ class Mex:
self.__send ()
def __send (self):
- m = simu.mex.msg.Msg (ID_LIMITS)
+ m = simu.mex.msg.Msg (self.mtype)
for l in self.limits:
if l is None:
li = -1
@@ -96,10 +94,10 @@ class Mex:
m.push ('l', li)
self.node.send (m)
- def __init__ (self, node):
+ def __init__ (self, node, instance = 'mimot0'):
self.aux = (self.Aux (), self.Aux ())
- self.__aux_pack = self.Aux.Pack (node, self.aux)
- self.__limits_pack = self.Limits.Pack (node)
+ self.__aux_pack = self.Aux.Pack (node, instance, self.aux)
+ self.__limits_pack = self.Limits.Pack (node, instance)
for index, aux in enumerate (self.aux):
aux.limits = self.Limits (self.__limits_pack, index)