import os

NAME = "Gangnam Style"

# The Choregraphe project lives in a sibling folder with the same name
# as this file (minus the .py) - e.g. gestures/4_gangnam_style/ next
# to gestures/4_gangnam_style.py - containing manifest.xml and a
# GangnamStyle/behavior.xar subfolder, exactly what Choregraphe's
# "Export as package" produces.
PACKAGE_DIR = os.path.splitext(os.path.abspath(__file__))[0]
BEHAVIOR_SUBDIR = "GangnamStyle"


def run(motion, tts, teleop):
    # Deploys (first run only, cached after) + runs the actual
    # Choregraphe behavior on the robot - this blocks until it
    # finishes, same as the old hand-coded version did.
    teleop.behavior_runner.ensure_running(PACKAGE_DIR, BEHAVIOR_SUBDIR)

    # The .xar moves legs/hips, unlike the old arms-only version, so
    # bring him back to a known walk-ready stance afterward.
    teleop.idle_crouch()
