def sayVoltage(self): msg = VoiceAnnouncement() msg.priority = VoiceAnnouncement.FIRST if self.voltage is not None: msg.words = "Battery voltage, %4.1f"%self.voltage else: msg.words = "No battery voltage reported" self.audioPub.publish(msg)
def voltageCallBack(self, float): self.voltage=float.data #rospy.logdebug("voltage_announcer received voltage %f", self.voltage) if ((self.voltage <= self.lowVoltageLimit) and not self.whine_guard): msg = VoiceAnnouncement() msg.priority = VoiceAnnouncement.FIRST msg.words = "Warning. Battery voltage, %4.1f"%self.voltage self.audioPub.publish(msg) self.whine_guard = True rospy.Timer(rospy.Duration(15.0), self.clear_guard, oneshot = True)
def say(self, utterance): msg = VoiceAnnouncement() msg.priority = VoiceAnnouncement.OVERRIDE msg.words = utterance self.audio_pub.publish(msg)