def __init__(self, node): msg.MessageObserver.__init__(self) self.node = node self.auv = control.AUV(node) self.motor_state_lock = threading.Lock() self.motor_state = {} self.motor_state[msg.MotorID.Prop] = 0 self.motor_state[msg.MotorID.HBow] = 0 self.motor_state[msg.MotorID.VBow] = 0 self.motor_state[msg.MotorID.HStern] = 0 self.motor_state[msg.MotorID.VStern] = 0 self.bearing = 0 self.pitch = 0 self.depth = 0 self.strafe = 0 self.prop = 0 self.last_telemetry_lock = threading.Lock() self.last_telemetry = None self.tk = tk.Tk() self.tk.bind_all('<Key>', self.onKey) #self.tk.withdraw() self.frame = tk.Frame(self.tk) self.frame.grid() self.motorlabel = tk.Label(self.frame, text=self.motorText()) self.motorlabel.grid(row=1, column=1) self.telemetrylabel = tk.Label(self.frame, text=self.telemetryText()) self.telemetrylabel.grid(row=2, column=1) self.demandlabel = tk.Label(self.frame, text=self.demandText()) self.demandlabel.grid(row=2, column=1) self.display_tick() self.node.addObserver(self) self.node.subMessage(msg.TelemetryMessage()) self.node.subMessage(msg.MotorStateMessage())
+ p_Controller + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_MotorDemand \ + r).streamline() p_ControllerStateMessage.setParseAction(lambda x: messaging.ControllerStateMessage(*x[0])) p_MotorStateMessage = pp.Group(l \ + p_MotorID + c \ + p_int \ + r).streamline() p_MotorStateMessage.setParseAction(lambda x: messaging.MotorStateMessage(*x[0])) p_ScriptResponseMessage = pp.Group(l \ + p_ScriptResponse \ + r).streamline() p_ScriptResponseMessage.setParseAction(lambda x: messaging.ScriptResponseMessage(*x[0])) p_GraphableMessage = pp.Group(l \ + p_str + c \ + p_float \ + r).streamline() p_GraphableMessage.setParseAction(lambda x: messaging.GraphableMessage(*x[0])) p_NodeAddedMessage = pp.Group(l \ + p_str + c \ + p_int + c \ + p_NodeType + c \ + p_LocalNodeInputNodeOutputMap + c \ + p_LocalNodeOutputNodeInputVecMap + c \
+ p_float + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_float + c \ + p_MotorDemand \ + r).streamline() p_ControllerStateMessage.setParseAction( lambda x: messaging.ControllerStateMessage(*x[0])) p_MotorStateMessage = pp.Group(l \ + p_MotorID + c \ + p_int \ + r).streamline() p_MotorStateMessage.setParseAction( lambda x: messaging.MotorStateMessage(*x[0])) p_ScriptResponseMessage = pp.Group(l \ + p_ScriptResponse \ + r).streamline() p_ScriptResponseMessage.setParseAction( lambda x: messaging.ScriptResponseMessage(*x[0])) p_GraphableMessage = pp.Group(l \ + p_str + c \ + p_float \ + r).streamline() p_GraphableMessage.setParseAction(lambda x: messaging.GraphableMessage(*x[0])) p_NodeAddedMessage = pp.Group(l \ + p_str + c \ + p_int + c \ + p_NodeType + c \ + p_LocalNodeInputNodeOutputMap + c \