Skip to content

Commit

Permalink
fixing gait progress
Browse files Browse the repository at this point in the history
  • Loading branch information
is2ac2 committed Jul 18, 2024
1 parent fa8be99 commit c9b3612
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sim/humanoid_gym/envs/only_legs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class terrain(LeggedRobotCfg.terrain):
restitution = 0.0

class noise:
add_noise = False
add_noise = True
noise_level = 0.6 # scales other values

class noise_scales:
Expand Down
20 changes: 13 additions & 7 deletions sim/humanoid_gym/envs/only_legs_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,27 @@ def compute_ref_state(self):
sin_pos = torch.sin(2 * torch.pi * phase)
sin_pos_l = sin_pos.clone()
sin_pos_r = sin_pos.clone()
# breakpoint()
# self.ref_dof_pos = torch.zeros_like(self.dof_pos)
default_clone = self.default_dof_pos.clone()
self.ref_dof_pos = self.default_dof_pos.repeat(self.num_envs, 1)

self.ref_dof_pos = torch.zeros_like(self.dof_pos)
scale_1 = self.cfg.rewards.target_joint_pos_scale
scale_2 = 2 * scale_1

# left foot stance phase set to default joint pos
sin_pos_l[sin_pos_l > 0] = 0
self.ref_dof_pos[:, self.legs_joints["left_hip_pitch"]] = sin_pos_l * scale_1
self.ref_dof_pos[:, self.legs_joints["left_knee_pitch"]] = sin_pos_l * scale_2
self.ref_dof_pos[:, self.legs_joints["left_ankle_roll"]] = sin_pos_l * scale_1
self.ref_dof_pos[:, self.legs_joints["left_hip_pitch"]] += sin_pos_l * scale_1
self.ref_dof_pos[:, self.legs_joints["left_knee_pitch"]] += sin_pos_l * scale_2
self.ref_dof_pos[:, self.legs_joints["left_ankle_roll"]] += sin_pos_l * scale_1

# right foot stance phase set to default joint pos
sin_pos_r[sin_pos_r < 0] = 0
self.ref_dof_pos[:, self.legs_joints["right_hip_pitch"]] = sin_pos_r * scale_1
self.ref_dof_pos[:, self.legs_joints["right_knee_pitch"]] = sin_pos_r * scale_2
self.ref_dof_pos[:, self.legs_joints["right_ankle_roll"]] = sin_pos_r * scale_1
self.ref_dof_pos[:, self.legs_joints["right_hip_pitch"]] += sin_pos_r * scale_1
self.ref_dof_pos[:, self.legs_joints["right_knee_pitch"]] += sin_pos_r * scale_2
self.ref_dof_pos[:, self.legs_joints["right_ankle_roll"]] += sin_pos_r * scale_1

# breakpoint()

# Double support phase
self.ref_dof_pos[torch.abs(sin_pos) < 0.1] = 0
Expand Down
3 changes: 2 additions & 1 deletion sim/humanoid_gym/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def play(args: argparse.Namespace) -> None:
env_cfg.domain_rand.joint_angle_noise = 0.0
env_cfg.noise.curriculum = False
env_cfg.noise.noise_level = 0.5
env_cfg.sim.physx.solver_type = 0

train_cfg.seed = 123145
logger.info("train_cfg.runner_class_name: %s", train_cfg.runner_class_name)
Expand Down Expand Up @@ -90,7 +91,7 @@ def play(args: argparse.Namespace) -> None:

if FIX_COMMAND:
env.commands[:, 0] = 0.0
env.commands[:, 1] = -0.5 # negative left, positive right
env.commands[:, 1] = -0.2 # negative left, positive right
env.commands[:, 2] = 0.0
env.commands[:, 3] = 0.0

Expand Down

0 comments on commit c9b3612

Please sign in to comment.