update mujoco sim2sim - heading direction command added

This commit is contained in:
HYUNHONOH98 2025-02-21 12:59:46 +09:00
parent 209fdce28d
commit 91344163ea
2 changed files with 7 additions and 1 deletions

View File

@ -1,7 +1,7 @@
#
# policy_path: "{LEGGED_GYM_ROOT_DIR}/deploy/pre_train/g1/motion.pt"
# policy_path: "{LEGGED_GYM_ROOT_DIR}/logs/g1/walk_with_dr_test_v21/exported/policy.pt"
policy_path: "{LEGGED_GYM_ROOT_DIR}/policies/2025-02-16_22-42-31/policy.pt"
policy_path: "{LEGGED_GYM_ROOT_DIR}/policies/navigation_less_obs/policy.pt"
# xml_path: "{LEGGED_GYM_ROOT_DIR}/resources/robots/g1_description/scene.xml"
xml_path: "{LEGGED_GYM_ROOT_DIR}/resources/robots/g1_description/g1_29dof_rev_1_0.xml"

View File

@ -127,6 +127,12 @@ if __name__ == "__main__":
torch.as_tensor(cmd[:3]).float().to("cpu")
).float().numpy()
robot_forward_vec_w = math_utils.quat_apply(torch.as_tensor(quat).float().to("cpu"), torch.tensor([1,0,0]).float().to("cpu"))
robot_heading_w = torch.atan2(robot_forward_vec_w[1], robot_forward_vec_w[0])
cmd[3] = math_utils.wrap_to_pi(cmd[3] - robot_heading_w)
ic(cmd)
qj = (qj - default_angles) * dof_pos_scale
dqj = dqj * dof_vel_scale