Improbable-AI / walk-these-ways

Sim-to-real RL training and deployment tools for the Unitree Go1 robot.
https://gmargo11.github.io/walk-these-ways/
Other
562 stars 144 forks source link

Details about dance #57

Closed COST-97 closed 8 months ago

COST-97 commented 10 months ago

Hello: Thanks for your interesting works! I am interested in choreographed dance. Could you show me more details? Things like how to program a sequence of gait parameters synchronized to a jazz song? Thanks!

gmargo11 commented 9 months ago

Hi @COST-97 ,

Thanks for your interest!

To load the choreographed dance, I used the ElegantGaitProfile class: https://github.com/Improbable-AI/walk-these-ways/blob/f72872927db7cd76be9d3a8dba4cba4a7c1d89d1/go1_gym_deploy/utils/command_profile.py#L76

This class reads a sequence of gait commands from a json file. Here's an example .json file (the one used in the paper example) and a python script I used to generate different .json files (for dancing, jumping, etc): dance_files.zip

After you place the .json file in an accessible location, you can declare the ElegantGaitProfile and assign it a trigger button by expanding line 30 of deploy_policy.py https://github.com/Improbable-AI/walk-these-ways/blob/f72872927db7cd76be9d3a8dba4cba4a7c1d89d1/go1_gym_deploy/scripts/deploy_policy.py#L30 as follows:

# Original line
command_profile = RCControllerProfile(dt=control_dt, state_estimator=se, x_scale=max_vel, y_scale=0.6, yaw_scale=max_yaw_vel)

# Instantiate the dance profile
dance_profile = ElegantGaitProfile(dt=control_dt, filename="dance_in_walked_bud.json")

# Assign the trigger button
# Button assignments: 0=L2, 1=L1, 2=R2, 3=R1
# Do not assign R2 for dance moves since it also maps to the emergency stop
command_profile.add_triggered_command(button_idx=1, command_profile=dance_profile)

Then, when you are running the controller, and you press the trigger button (in this case, L1), the robot should execute the scripted dance. I took this code from an older internal branch and haven't tested it yet, but feel free to give it a try :) Or I may have a chance to test and commit it to the public branch myself at some point.

-Gabe