Example #1
0
def pipelineTest():
    import sys
    n = node.Node("pycauv-pl",sys.argv[1:])
    model = pipeline.Model(n)
    print 'Setting debug level to -3'
    n.send(messaging.DebugLevelMessage(-3), "debug")
    
    print 'Adding stuff to the pipeline...'
    n.send(messaging.ClearPipelineMessage(), "pipeline")
    n.send(messaging.AddNodeMessage(messaging.NodeType.FileInput,
                                    messaging.NodeInputArcVec(),
                                    messaging.NodeOutputArcVec()), "pipeline")
    n.send(messaging.AddNodeMessage(messaging.NodeType.GuiOutput,
                                    messaging.NodeInputArcVec(),
                                    messaging.NodeOutputArcVec()), "pipeline")

    print 'Getting pipeline state...'
    saved = model.get()
    print 'before:', saved
    print 'Clearing pipeline state...'
    model.clear()
    print 'Setting pipeline state...'
    model.set(saved)
    print 'after:', model.get()
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 \
    + p_float + c \
    + p_float + c \
    + p_float + c \
    + p_float + c \
# 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 \
    + p_float + c \
    + p_float + c \
    + p_float + c \