feat: add Go1 training and MuJoCo deployment
This commit is contained in:
43
deploy/deploy_mujoco/configs/go1.yaml
Normal file
43
deploy/deploy_mujoco/configs/go1.yaml
Normal file
@@ -0,0 +1,43 @@
|
||||
policy_path: "{ROOT_DIR}/deploy/pre_train/go1/policy.pt"
|
||||
xml_path: "{ROOT_DIR}/resources/go1/stairs_and_slope.xml"
|
||||
|
||||
render_fps: 300
|
||||
video_fps: 60
|
||||
save_video: false
|
||||
|
||||
simulation_duration: 60000000.0
|
||||
simulation_dt: 0.002
|
||||
control_decimation: 10
|
||||
base_init_pos: [0.0, 0.0, 0.34]
|
||||
base_init_quat: [1.0, 0.0, 0.0, 0.0]
|
||||
|
||||
# Deployment defaults to no extra delay. Training randomizes 0-4 physics steps;
|
||||
# this script's delay buffer is measured in 20 ms policy steps instead.
|
||||
actuator_delay_min: 0
|
||||
actuator_delay_max: 0
|
||||
actuator_delay_seed: 0
|
||||
|
||||
kps: [28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0]
|
||||
kds: [0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7]
|
||||
|
||||
default_angles: [-0.1, 0.8, -1.5, 0.1, 0.8, -1.5,
|
||||
-0.1, 1.0, -1.5, 0.1, 1.0, -1.5]
|
||||
|
||||
lin_vel_scale: 2.0
|
||||
ang_vel_scale: 0.25
|
||||
dof_pos_scale: 1.0
|
||||
dof_vel_scale: 0.05
|
||||
action_pos_scale: 0.25
|
||||
cmd_scale: [1.0, 1.0, 1.0]
|
||||
num_actions: 12
|
||||
num_obs: 45
|
||||
max_cmd: [1.0, 1.0, 1.0]
|
||||
cmd_init: [0.5, 0.0, 0.0]
|
||||
history_len: 10
|
||||
|
||||
mujoco_joint_names: &joint_names
|
||||
[FR_hip_joint, FR_thigh_joint, FR_calf_joint,
|
||||
FL_hip_joint, FL_thigh_joint, FL_calf_joint,
|
||||
RR_hip_joint, RR_thigh_joint, RR_calf_joint,
|
||||
RL_hip_joint, RL_thigh_joint, RL_calf_joint]
|
||||
model_joint_names: *joint_names
|
||||
12
deploy/deploy_mujoco/deploy_go1.py
Normal file
12
deploy/deploy_mujoco/deploy_go1.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Run an exported Go1 CTS policy in MuJoCo.
|
||||
|
||||
The model, observations, actions, and MuJoCo actuators all use the Unitree SDK
|
||||
joint order: FR, FL, RR, RL. The exported policy maintains its own history and
|
||||
therefore consumes one 45-dimensional observation frame per call.
|
||||
"""
|
||||
|
||||
from deploy_go2 import main
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main("go1.yaml")
|
||||
@@ -12,6 +12,8 @@ Notes:
|
||||
This script currently uses CONFIG_NAME = "go2.yaml" and does not expose CLI flags.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
@@ -95,9 +97,9 @@ def build_single_obs(features: dict[str, np.ndarray], layout: list[tuple[str, in
|
||||
return np.concatenate([features[name] for name, _ in layout], axis=0).astype(np.float32, copy=False)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
def main(config_name: str = CONFIG_NAME) -> None:
|
||||
"""Run MuJoCo simulation and deploy the CTS policy in closed-loop control."""
|
||||
cfg = load_config(CONFIG_NAME)
|
||||
cfg = load_config(config_name)
|
||||
layout = [
|
||||
("ang_vel", 3),
|
||||
("gravity", 3),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Shared helpers for MuJoCo deployment scripts."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import deque
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
Reference in New Issue
Block a user