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

@@ -1417,13 +1417,6 @@ class LeggedRobot(BaseTask):
# Penalize joint poses far away from default pose
return torch.sum(torch.abs(self.dof_pos - self.default_dof_pos), dim=1)
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_upright(self):
return (-1 - self.projected_gravity[:, 2]) / 2

View File

@@ -176,32 +176,6 @@ class GO2Cfg(LeggedRobotCfg):
}
min_legs_distance = 0.1 # min distance between legs to not be considered stumbling
class scales:
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.2
# lin_vel_z = -10.0
# base_height = -50.0
# action_rate = -0.005
# similar_to_default = -0.1
# dof_power = -1e-3 # 能够明显抑制跳跃
# dof_acc = -3e-7
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.5
# lin_vel_z = -2.0
# ang_vel_xy = -0.05
# dof_acc = -2.5e-7
# dof_power = -1e-3 # 能够明显抑制跳跃
# # torques = -1e-4 # 无用会走着走着倒了
# correct_base_height = -10.0
# action_rate = -0.01
# action_smoothness = -0.01
# collision = -1.0
# dof_pos_limits = -2.0
# feet_regulation = -0.05
# hip_to_default = -0.1
# similar_to_default = -0.05
# CTS reward
tracking_lin_vel = 1.0
tracking_ang_vel = 0.5
lin_vel_z = -2.0
@@ -215,11 +189,12 @@ class GO2Cfg(LeggedRobotCfg):
collision = -1.0
dof_pos_limits = -2.0
feet_regulation = -0.05
# CTS奖励训出来双脚距离非常近, 真机效果很差, 但是sim2sim能上20cm楼梯, 尝试加入hip_to_default奖励或similar_to_default奖励
hip_to_default = -0.05 # 在训练到y=1.5, 双脚会明显碰撞, 为避免该问题提升hip, 效果更差, 还是保持0.05 (y最大也只到0.1了)
# legs_distance = -1.5 # 奖励双脚距离, 避免CTS训练出来双脚距离过近, 尝试加入后robogauge flat验证效果变差, 删除
# CTS reward trains to have very close feet distance, real robot performance is poor, but sim2sim can climb 20cm stairs, try to add hip_to_default reward or similar_to_default reward
# training to y=1.5, font feet will collide noticeably, max y=1.0
hip_to_default = -0.05
# legs_distance = -1.5 # not good performance, avoid leg collision
# similar_to_default = -0.01
# feet_contact_forces = -1.0 # 尝试加入但并没有起到任何效果, 删除
# feet_contact_forces = -1.0 # try to add but no effect, remove
turn_over_roll_threshold = math.pi / 4 # threshold on roll to use turn over rewards
class turn_over_scales:
@@ -238,7 +213,7 @@ class GO2CfgPPO(LeggedRobotCfgPPO):
class runner(LeggedRobotCfgPPO.runner):
run_name = ''
experiment_name = 'go2_ppo'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgCTS(LeggedRobotCfgCTS):
@@ -246,7 +221,7 @@ class GO2CfgCTS(LeggedRobotCfgCTS):
num_steps_per_env = 24
run_name = ''
experiment_name = 'go2_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class policy(LeggedRobotCfgCTS.policy):
@@ -264,7 +239,7 @@ class GO2CfgMoECTS(LeggedRobotCfgMoECTS):
class runner(LeggedRobotCfgMoECTS.runner):
run_name = ''
experiment_name = 'go2_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
@@ -275,7 +250,7 @@ class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
class runner(LeggedRobotCfgMCPCTS.runner):
run_name = ''
experiment_name = 'go2_mcp_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
@@ -285,7 +260,7 @@ class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
class runner(LeggedRobotCfgACMoECTS.runner):
run_name = ''
experiment_name = 'go2_ac_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
@@ -295,7 +270,7 @@ class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
class runner(LeggedRobotCfgDualMoECTS.runner):
run_name = ''
experiment_name = 'go2_dual_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
@@ -305,5 +280,5 @@ class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
class runner(LeggedRobotCfgREMCTS.runner):
run_name = ''
experiment_name = 'go2_rem_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500

View File

@@ -117,7 +117,7 @@ class GO2Cfg(LeggedRobotCfg):
limit_ang_vel_at_zero_command_prob = 0.2 # probability of add limiting angular velocity commands when zero command is sampled
limit_vel_prob = 0.2 # probability of limiting linear velocity command
limit_vel_invert_when_continuous = True # invert the limit logic when using continuous sample limit velocity commands
limit_vel = {"lin_vel_x": [-1, 1], "lin_vel_y": [-1, 1], "ang_vel_yaw": [-1, 0, 1]} # sample vel commands from min [-1] or zero [0] or max [1] range only
limit_vel = {"lin_vel_x": [-1, 1], "lin_vel_y": [0], "ang_vel_yaw": [-1, 0, 1]} # sample vel commands from min [-1] or zero [0] or max [1] range only
stop_heading_at_limit = True # stop heading updates when vel is limited
dynamic_resample_commands = True # sample commands with low bounds
command_range_curriculum = [ { # list for command range curriculums at specific training iterations
@@ -134,21 +134,21 @@ class GO2Cfg(LeggedRobotCfg):
'heading': [-1.57, 1.57], # min max [rad]
}, { # list for command range curriculums at specific training iterations
'iter': 20000, # training iteration at which the command ranges are updated
'lin_vel_x': [-3.5, 3.5], # min max [m/s]
'lin_vel_x': [-2.0, 3.5], # min max [m/s]
'lin_vel_y': [-0.5, 0.5], # min max [m/s]
'ang_vel_yaw': [-1.0, 1.0], # min max [rad/s]
'heading': [-1.57, 1.57], # min max [rad]
}, { # list for command range curriculums at specific training iterations
'iter': 30000, # training iteration at which the command ranges are updated
'lin_vel_x': [-4.0, 4.0], # min max [m/s]
'lin_vel_y': [-0.0, 0.0], # min max [m/s]
'ang_vel_yaw': [-0.0, 0.0], # min max [rad/s]
'lin_vel_x': [-2.0, 4.0], # min max [m/s]
'lin_vel_y': [-0.5, 0.5], # min max [m/s]
'ang_vel_yaw': [-1.0, 1.0], # min max [rad/s]
'heading': [-1.57, 1.57], # min max [rad]
}, { # list for command range curriculums at specific training iterations
'iter': 40000, # training iteration at which the command ranges are updated
'lin_vel_x': [-4.5, 4.5], # min max [m/s]
'lin_vel_y': [-0.0, 0.0], # min max [m/s]
'ang_vel_yaw': [-0.0, 0.0], # min max [rad/s]
'lin_vel_x': [-2.0, 4.2], # min max [m/s]
'lin_vel_y': [-0.5, 0.5], # min max [m/s]
'ang_vel_yaw': [-1.0, 1.0], # min max [rad/s]
'heading': [-1.57, 1.57], # min max [rad]
}
]
@@ -185,10 +185,10 @@ class GO2Cfg(LeggedRobotCfg):
class rewards(LeggedRobotCfg.rewards):
soft_dof_pos_limit = 0.9
base_height_target = 0.38
base_height_target = 0.33
only_positive_rewards = False
max_contact_force = 147. # forces above this value are penalized, go2 weight 15kg
curriculum_rewards = [
curriculum_rewards = [ # reward scalars are linearly interpolated between start and end iters
{'reward_name': 'lin_vel_z', 'start_iter': 0, 'end_iter': 1500, 'start_value': 1.0, 'end_value': 0.0},
{'reward_name': 'correct_base_height', 'start_iter': 0, 'end_iter': 5000, 'start_value': 1.0, 'end_value': 10.0},
# {'reward_name': 'dof_power', 'start_iter': 0, 'end_iter': 3000, 'start_value': 1.0, 'end_value': 0.1},
@@ -206,33 +206,7 @@ class GO2Cfg(LeggedRobotCfg):
}
min_legs_distance = 0.1 # min distance between legs to not be considered stumbling
class scales:
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.2
# lin_vel_z = -10.0
# base_height = -50.0
# action_rate = -0.005
# similar_to_default = -0.1
# dof_power = -1e-3 # 能够明显抑制跳跃
# dof_acc = -3e-7
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.5
# lin_vel_z = -2.0
# ang_vel_xy = -0.05
# dof_acc = -2.5e-7
# dof_power = -1e-3 # 能够明显抑制跳跃
# # torques = -1e-4 # 无用会走着走着倒了
# correct_base_height = -10.0
# action_rate = -0.01
# action_smoothness = -0.01
# collision = -1.0
# dof_pos_limits = -2.0
# feet_regulation = -0.05
# hip_to_default = -0.1
# similar_to_default = -0.05
# CTS reward
tracking_lin_vel = 1.0
tracking_lin_vel = 2.0 # Increase for faster running
tracking_ang_vel = 0.5
lin_vel_z = -2.0
ang_vel_xy = -0.05
@@ -245,11 +219,13 @@ class GO2Cfg(LeggedRobotCfg):
collision = -1.0
dof_pos_limits = -2.0
feet_regulation = -0.05
# CTS奖励训出来双脚距离非常近, 真机效果很差, 但是sim2sim能上20cm楼梯, 尝试加入hip_to_default奖励或similar_to_default奖励
hip_to_default = -0.05 # 在训练到y=1.5, 双脚会明显碰撞, 为避免该问题提升hip, 效果更差, 还是保持0.05 (y最大也只到0.1了)
# legs_distance = -1.5 # 奖励双脚距离, 避免CTS训练出来双脚距离过近, 尝试加入后robogauge flat验证效果变差, 删除
# CTS reward trains to have very close feet distance, real robot performance is poor, but sim2sim can climb 20cm stairs, try to add hip_to_default reward or similar_to_default reward
# training to y=1.5, font feet will collide noticeably, max y=1.0
hip_to_default = -0.05
# legs_distance = -1.5 # not good performance, avoid leg collision
# similar_to_default = -0.01
# feet_contact_forces = -1.0 # 尝试加入但并没有起到任何效果, 删除
# feet_contact_forces = -1.0 # try to add but no effect, remove
x_command_hip_regular = -0.5 # when x command exists, encourage symmetrical hip positions
turn_over_roll_threshold = math.pi / 4 # threshold on roll to use turn over rewards
class turn_over_scales:
@@ -268,7 +244,7 @@ class GO2CfgPPO(LeggedRobotCfgPPO):
class runner(LeggedRobotCfgPPO.runner):
run_name = ''
experiment_name = 'go2_ppo'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgCTS(LeggedRobotCfgCTS):
@@ -276,7 +252,7 @@ class GO2CfgCTS(LeggedRobotCfgCTS):
num_steps_per_env = 24
run_name = ''
experiment_name = 'go2_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class policy(LeggedRobotCfgCTS.policy):
@@ -294,7 +270,7 @@ class GO2CfgMoECTS(LeggedRobotCfgMoECTS):
class runner(LeggedRobotCfgMoECTS.runner):
run_name = ''
experiment_name = 'go2_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
@@ -305,7 +281,7 @@ class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
class runner(LeggedRobotCfgMCPCTS.runner):
run_name = ''
experiment_name = 'go2_mcp_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
@@ -315,7 +291,7 @@ class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
class runner(LeggedRobotCfgACMoECTS.runner):
run_name = ''
experiment_name = 'go2_ac_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
@@ -325,7 +301,7 @@ class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
class runner(LeggedRobotCfgDualMoECTS.runner):
run_name = ''
experiment_name = 'go2_dual_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
@@ -335,5 +311,5 @@ class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
class runner(LeggedRobotCfgREMCTS.runner):
run_name = ''
experiment_name = 'go2_rem_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500

View File

@@ -191,32 +191,6 @@ class GO2Cfg(LeggedRobotCfg):
# }
min_legs_distance = 0.1 # min distance between legs to not be considered stumbling
class scales:
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.2
# lin_vel_z = -10.0
# base_height = -50.0
# action_rate = -0.005
# similar_to_default = -0.1
# dof_power = -1e-3 # 能够明显抑制跳跃
# dof_acc = -3e-7
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.5
# lin_vel_z = -2.0
# ang_vel_xy = -0.05
# dof_acc = -2.5e-7
# dof_power = -1e-3 # 能够明显抑制跳跃
# # torques = -1e-4 # 无用会走着走着倒了
# correct_base_height = -10.0
# action_rate = -0.01
# action_smoothness = -0.01
# collision = -1.0
# dof_pos_limits = -2.0
# feet_regulation = -0.05
# hip_to_default = -0.1
# similar_to_default = -0.05
# CTS reward
tracking_lin_vel = 1.0
tracking_ang_vel = 0.5
lin_vel_z = -2.0
@@ -230,11 +204,12 @@ class GO2Cfg(LeggedRobotCfg):
collision = -1.0
dof_pos_limits = -2.0
feet_regulation = -0.05
# CTS奖励训出来双脚距离非常近, 真机效果很差, 但是sim2sim能上20cm楼梯, 尝试加入hip_to_default奖励或similar_to_default奖励
hip_to_default = -0.05 # 在训练到y=1.5, 双脚会明显碰撞, 为避免该问题提升hip, 效果更差, 还是保持0.05 (y最大也只到0.1了)
# legs_distance = -1.5 # 奖励双脚距离, 避免CTS训练出来双脚距离过近, 尝试加入后robogauge flat验证效果变差, 删除
# CTS reward trains to have very close feet distance, real robot performance is poor, but sim2sim can climb 20cm stairs, try to add hip_to_default reward or similar_to_default reward
# training to y=1.5, font feet will collide noticeably, max y=1.0
hip_to_default = -0.05
# legs_distance = -1.5 # not good performance, avoid leg collision
# similar_to_default = -0.01
# feet_contact_forces = -1.0 # 尝试加入但并没有起到任何效果, 删除
# feet_contact_forces = -1.0 # try to add but no effect, remove
turn_over_roll_threshold = math.pi / 4 # threshold on roll to use turn over rewards
class turn_over_scales:
@@ -253,7 +228,7 @@ class GO2CfgPPO(LeggedRobotCfgPPO):
class runner(LeggedRobotCfgPPO.runner):
run_name = ''
experiment_name = 'go2_ppo'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgCTS(LeggedRobotCfgCTS):
@@ -261,7 +236,7 @@ class GO2CfgCTS(LeggedRobotCfgCTS):
num_steps_per_env = 24
run_name = ''
experiment_name = 'go2_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class policy(LeggedRobotCfgCTS.policy):
@@ -279,7 +254,7 @@ class GO2CfgMoECTS(LeggedRobotCfgMoECTS):
class runner(LeggedRobotCfgMoECTS.runner):
run_name = ''
experiment_name = 'go2_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
@@ -290,7 +265,7 @@ class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
class runner(LeggedRobotCfgMCPCTS.runner):
run_name = ''
experiment_name = 'go2_mcp_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
@@ -300,7 +275,7 @@ class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
class runner(LeggedRobotCfgACMoECTS.runner):
run_name = ''
experiment_name = 'go2_ac_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
@@ -310,7 +285,7 @@ class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
class runner(LeggedRobotCfgDualMoECTS.runner):
run_name = ''
experiment_name = 'go2_dual_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
@@ -320,5 +295,5 @@ class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
class runner(LeggedRobotCfgREMCTS.runner):
run_name = ''
experiment_name = 'go2_rem_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500

View File

@@ -191,32 +191,6 @@ class GO2Cfg(LeggedRobotCfg):
# }
min_legs_distance = 0.1 # min distance between legs to not be considered stumbling
class scales:
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.2
# lin_vel_z = -10.0
# base_height = -50.0
# action_rate = -0.005
# similar_to_default = -0.1
# dof_power = -1e-3 # 能够明显抑制跳跃
# dof_acc = -3e-7
# tracking_lin_vel = 1.0
# tracking_ang_vel = 0.5
# lin_vel_z = -2.0
# ang_vel_xy = -0.05
# dof_acc = -2.5e-7
# dof_power = -1e-3 # 能够明显抑制跳跃
# # torques = -1e-4 # 无用会走着走着倒了
# correct_base_height = -10.0
# action_rate = -0.01
# action_smoothness = -0.01
# collision = -1.0
# dof_pos_limits = -2.0
# feet_regulation = -0.05
# hip_to_default = -0.1
# similar_to_default = -0.05
# CTS reward
tracking_lin_vel = 1.0
tracking_ang_vel = 0.5
lin_vel_z = -2.0
@@ -230,11 +204,12 @@ class GO2Cfg(LeggedRobotCfg):
collision = -1.0
dof_pos_limits = -2.0
feet_regulation = -0.05
# CTS奖励训出来双脚距离非常近, 真机效果很差, 但是sim2sim能上20cm楼梯, 尝试加入hip_to_default奖励或similar_to_default奖励
hip_to_default = -0.05 # 在训练到y=1.5, 双脚会明显碰撞, 为避免该问题提升hip, 效果更差, 还是保持0.05 (y最大也只到0.1了)
# legs_distance = -1.5 # 奖励双脚距离, 避免CTS训练出来双脚距离过近, 尝试加入后robogauge flat验证效果变差, 删除
# CTS reward trains to have very close feet distance, real robot performance is poor, but sim2sim can climb 20cm stairs, try to add hip_to_default reward or similar_to_default reward
# training to y=1.5, font feet will collide noticeably, max y=1.0
hip_to_default = -0.05
# legs_distance = -1.5 # not good performance, avoid leg collision
# similar_to_default = -0.01
# feet_contact_forces = -1.0 # 尝试加入但并没有起到任何效果, 删除
# feet_contact_forces = -1.0 # try to add but no effect, remove
turn_over_roll_threshold = math.pi / 4 # threshold on roll to use turn over rewards
class turn_over_scales:
@@ -253,7 +228,7 @@ class GO2CfgPPO(LeggedRobotCfgPPO):
class runner(LeggedRobotCfgPPO.runner):
run_name = ''
experiment_name = 'go2_ppo'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgCTS(LeggedRobotCfgCTS):
@@ -261,7 +236,7 @@ class GO2CfgCTS(LeggedRobotCfgCTS):
num_steps_per_env = 24
run_name = ''
experiment_name = 'go2_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class policy(LeggedRobotCfgCTS.policy):
@@ -279,7 +254,7 @@ class GO2CfgMoECTS(LeggedRobotCfgMoECTS):
class runner(LeggedRobotCfgMoECTS.runner):
run_name = ''
experiment_name = 'go2_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
@@ -290,7 +265,7 @@ class GO2CfgMCPCTS(LeggedRobotCfgMCPCTS):
class runner(LeggedRobotCfgMCPCTS.runner):
run_name = ''
experiment_name = 'go2_mcp_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
@@ -300,7 +275,7 @@ class GO2CfgACMoECTS(LeggedRobotCfgACMoECTS):
class runner(LeggedRobotCfgACMoECTS.runner):
run_name = ''
experiment_name = 'go2_ac_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
@@ -310,7 +285,7 @@ class GO2CfgDualMoECTS(LeggedRobotCfgDualMoECTS):
class runner(LeggedRobotCfgDualMoECTS.runner):
run_name = ''
experiment_name = 'go2_dual_moe_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500
class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
@@ -320,5 +295,5 @@ class GO2CfgREMCTS(LeggedRobotCfgREMCTS):
class runner(LeggedRobotCfgREMCTS.runner):
run_name = ''
experiment_name = 'go2_rem_cts'
max_iterations = 120000
max_iterations = 150000
save_interval = 500

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