class AudioPower: def __init__(self): self.atomo = AtomicMsgs() rospy.Subscriber("audio_sensors", audiodata, self.audio_cb) def audio_cb(self, data): print "Sudden sound change {}".format(data.suddenchange) self.atomo.audio_bang(data.suddenchange) self.atomo.audio_energy(data.Decibel)
class AudioPower: def __init__(self): self.atomo = AtomicMsgs() rospy.Subscriber("audio_sensors", audiodata, self.audio_cb) def audio_cb(self, data): #print "SuddenChange {}".format(data.SuddenChange) if data.SuddenChange: self.atomo.audio_bang(1.0) else: self.atomo.audio_bang(0.0) self.atomo.audio_energy(data.Decibel)