def randomTest(): import sys n = node.Node("pycauv",sys.argv[1:]) print "created node.Node" n.join("test") print "joined test group" n.join("pipeline") print "joined pipeline group" n.join("invalid group") print "attempted to join an invalid group" o = node.Observer() print o, "created node.Observer" dmo = messaging.DebugMessageObserver() print dmo, "created DebugMessageObserver" class MMO(node.Observer): def onDebugMessage(self, msg): print "mesage received:", msg def onImageMessageBuffered(self, msg): print "image received:", msg def onNodeAddedMessage(self, msg): print "node added:", msg.nodeId, msg.nodeType def onStatusMessageBuffered(self, msg): print "node status:", msg.nodeId, msg.status m = MMO() m.setDoubleBuffered(messaging.MessageType.Status, True) #pylint: disable=E1101 m.setDoubleBuffered(messaging.MessageType.Image, True) #pylint: disable=E1101 print m, "created Observer with overload" n.addObserver(m) print "added observer with overload" n.addObserver(o) print "added empty observer" n.addObserver(dmo) print "added debug observer" msg = messaging.DebugMessage(messaging.DebugType.Debug, "test message string!") print "created debug message:", msg for i in xrange(1, 11): try: print "setting message string" msg.msg = "msg string %d" % i print "Sending message", i, msg n.send(msg, "test") #print n.mailbox.receive(1000) except Exception, e: print e
p_NodeIOStatus.setParseAction(lambda x: messaging.NodeIOStatus(x[0])) p_OutputType << p_int p_OutputType.setParseAction(lambda x: messaging.OutputType(x[0])) p_Controller << p_int p_Controller.setParseAction(lambda x: messaging.Controller(x[0])) # Parse Messages p_MembershipChangedMessage = pp.Group(l \ + p_str \ + r).streamline() p_MembershipChangedMessage.setParseAction(lambda x: messaging.MembershipChangedMessage(*x[0])) p_DebugMessage = pp.Group(l \ + p_DebugType + c \ + p_str \ + r).streamline() p_DebugMessage.setParseAction(lambda x: messaging.DebugMessage(*x[0])) p_DebugLevelMessage = pp.Group(l \ + p_int \ + r).streamline() p_DebugLevelMessage.setParseAction(lambda x: messaging.DebugLevelMessage(*x[0])) p_MotorMessage = pp.Group(l \ + p_MotorID + c \ + p_int \ + r).streamline() p_MotorMessage.setParseAction(lambda x: messaging.MotorMessage(*x[0])) p_BearingAutopilotEnabledMessage = pp.Group(l \ + p_bool + c \ + p_float \ + r).streamline() p_BearingAutopilotEnabledMessage.setParseAction(lambda x: messaging.BearingAutopilotEnabledMessage(*x[0])) p_BearingAutopilotParamsMessage = pp.Group(l \
def logObject(self, d): warning('CHIL does not support generic object logging') self.logMessage(msg.DebugMessage(msg.DebugType.Debug, str(d)))
def addComment(self, comment_str): info('recoding comment "%s"' % comment_str) self.logMessage(msg.DebugMessage(msg.DebugType.Info, comment_str))