v1.0.2; change high speed move, remove useless comments

This commit is contained in:
wty-yy
2026-01-26 16:22:01 +08:00
parent 164014325a
commit 2aed91e7ce
11 changed files with 106 additions and 203 deletions

View File

@@ -50,4 +50,19 @@ class Go2Robot(LeggedRobot):
# print(f"acc: {self.privileged_obs_buf[:,48+4+12:48+4+12+12].min(), self.privileged_obs_buf[:,48+4+12:48+4+12+12].max()}")
if self.add_noise:
self.obs_buf += (2 * torch.rand_like(self.obs_buf) - 1) * self.noise_scale_vec
self.obs_buf += (2 * torch.rand_like(self.obs_buf) - 1) * self.noise_scale_vec
def _reward_hip_to_default(self):
hip_dof_names = ['FL_hip_joint', 'FR_hip_joint', 'RL_hip_joint', 'RR_hip_joint']
hip_dof_indices = [0, 3, 6, 9]
hip_pos = self.dof_pos[:, hip_dof_indices]
default_hip_pos = self.default_dof_pos[:, hip_dof_indices]
return torch.sum(torch.abs(hip_pos - default_hip_pos), dim=1)
def _reward_x_command_hip_regular(self):
hip_dof_names = ['FL_hip_joint', 'FR_hip_joint', 'RL_hip_joint', 'RR_hip_joint']
hip_dof_indices = [0, 3, 6, 9]
hip_pos = self.dof_pos[:, hip_dof_indices]
x_command_ratio = torch.abs(self.commands[:,0]) / torch.norm(self.commands[:,:3], dim=1)
rew = torch.abs(hip_pos[:,0]+hip_pos[:,1]) + torch.abs(hip_pos[:,2]+hip_pos[:,3])
return rew * x_command_ratio