# Loaded by naowalk.py's gesture loader (_load_gestures). The filename's
# leading digit ("1") is which number key triggers this. Every gesture
# file just needs a run(motion, tts) function - motion is the connected
# ALMotion proxy, tts is ALTextToSpeech. Optionally set NAME below to
# control the display name shown in the on-screen controls hint.

NAME = "Wave"


def run(motion, tts):
    motion.setStiffnesses("RArm", 1.0)
    names = ["RShoulderPitch", "RShoulderRoll", "RElbowYaw", "RElbowRoll", "RWristYaw", "RHand"]
    angles = [[-1.5]*5, [-0.4,-0.7,-0.4,-0.7,-0.4], [0.6,1.1,0.6,1.1,0.6],
              [0.8,0.3,0.8,0.3,0.8], [0.0,1.5,0.0,-1.5,0.0], [1.0]*5]
    times = [[0.5,1.0,1.5,2.0,2.5]] * 6
    motion.angleInterpolation(names, angles, times, True)
    neutral = [1.5, -0.15, 1.2, 0.5, 0.0, 0.0]
    motion.angleInterpolationWithSpeed(names, neutral, 0.3)
    # Relaxed stiffness after completion
    motion.setStiffnesses("RArm", 0.3)
