def __init__(self, args): self.keychains = map( lambda shapekey: Utils.DictKeyChain([ "m_coeffs", ShapekeyStore.getIndex(shapekey) ]), args["shapekey"].split(";") )
def _build_msg(cls, expr_entry=None): """ Takes an entry from the config file and returns a constructed ROS message. """ msg = fsMsgTrackingState() msg.m_coeffs = [0]*cls.M_COEFFS_LEN # Allow creation of a neutral face without an expression yaml entry. if expr_entry == None: return msg for shapekey in expr_entry: index = ShapekeyStore.getIndex(shapekey) if (index == None): rospy.logwarn("Invalid shapekey in expression data: %s", shapekey) else: msg.m_coeffs[index] = expr_entry[shapekey] return msg
def hit(self, rms): """ Publishes the current jaw-modified expression, given rms (root mean squared), the volume or the power of a small segment in the file. """ # Map the power number to the jaw coefficient. # Note that coefficient can't effectively go below 0 or over 1. # It will be cut to this range at the receiving end (pau2motors node) p = self.rms_params jaw_coeff = min(max(math.sqrt(rms * p["scale"]), p["min"]), p["max"]) # Copy pau expression message stored during handle_face_in(), # modify jaw and publish. cmd = copy.deepcopy(self.facepau) coeffs = list(cmd.m_coeffs) coeffs[ShapekeyStore.getIndex("JawOpen")] = jaw_coeff cmd.m_coeffs = coeffs self.pub.publish(cmd)
def __init__(self, args): self.keychains = map( lambda shapekey: Utils.DictKeyChain( ["m_coeffs", ShapekeyStore.getIndex(shapekey)]), args["shapekey"].split(";"))