def sendStateMessages(self): # send: # PressureMessage # StateMessage # should maybe also send RedHerringBatteryStatusMessage # # These should match the DepthCalibration message used: depth_offset = -9.48232 depth_mult = 0.010395 depth = float(-self.displacement[2]) pressure = int((depth - depth_offset) / depth_mult) # if somehow we're floating above the surface... if pressure < 0: pressure = 0 orientation = base_model.orientationToYPR(self.orientation) #print 'pressure=', pressure, 'orientation=', orientation self.node.send(messaging.PressureMessage(pressure, pressure)) self.node.send(messaging.StateMessage(orientation))
p_SetMotorMapMessage = pp.Group(l \ + p_MotorID + c \ + p_MotorMap \ + r).streamline() p_SetMotorMapMessage.setParseAction(lambda x: messaging.SetMotorMapMessage(*x[0])) p_ResetMCBMessage = pp.Group(l \ + r).streamline() p_ResetMCBMessage.setParseAction(lambda x: messaging.ResetMCBMessage(*x[0])) p_CalibrateNoRotationMessage = pp.Group(l \ + p_int \ + r).streamline() p_CalibrateNoRotationMessage.setParseAction(lambda x: messaging.CalibrateNoRotationMessage(*x[0])) p_StateMessage = pp.Group(l \ + p_floatYPR \ + r).streamline() p_StateMessage.setParseAction(lambda x: messaging.StateMessage(*x[0])) p_TelemetryMessage = pp.Group(l \ + p_floatYPR + c \ + p_float \ + r).streamline() p_TelemetryMessage.setParseAction(lambda x: messaging.TelemetryMessage(*x[0])) p_BatteryUseMessage = pp.Group(l \ + p_float + c \ + p_float + c \ + p_float \ + r).streamline() p_BatteryUseMessage.setParseAction(lambda x: messaging.BatteryUseMessage(*x[0])) p_ProcessStatusMessage = pp.Group(l \ + p_str + c \ + p_str + c \ + p_float + c \