def _em(self, emotion,intensity): msg = MakeFaceExpr() msg.exprname = emotion msg.intensity = intensity self.current_emotion = emotion self.current_intensity = intensity/11. self.pub.publish(msg)
def cont(self, run_time): # Publish expression message after some delay once node is started if (not self.shown) and (run_time > self.start_time + 0.05): self.shown = True self.runner.topics['expression'].publish( MakeFaceExpr(self.data['expression'], self._magnitude(self.data['magnitude']))) logger.info("Publish expression {}".format(self.data))
def stop(self, run_time): try: self.runner.topics['expression'].publish( MakeFaceExpr('Neutral', self._magnitude(self.data['magnitude']))) time.sleep(min(1, self.duration)) logger.info("Neutral expression") self.runner.services['head_pau_mux']("/blender_api/get_pau") logger.info("Call head_pau_mux topic {}".format("/blender_api/get_pau")) except Exception as ex: logger.error(ex)
def sendVisime(self, visime): if self.lipsync_enabled and self.lipsync_blender and (visime['name'] != 'Sil'): #Need to have global shapekey_store class. msg = Viseme() # Duration should be overlapping duration = visime['duration'] msg.duration.nsecs = duration * 1e9 * BaseVisemes.visemes_param[ visime['name']]['duration'] msg.name = visime['name'] msg.magnitude = BaseVisemes.visemes_param[ visime['name']]['magnitude'] msg.rampin = BaseVisemes.visemes_param[visime['name']]['rampin'] msg.rampout = BaseVisemes.visemes_param[visime['name']]['rampout'] self.vis_topic.publish(msg) if self.lipsync_enabled and not self.lipsync_blender: msg = MakeFaceExpr() msg.exprname = 'vis_' + visime['name'] msg.intensity = 1.0 self.expr_topic.publish(msg)