align hip_pos_penalty reward with isaacgym (switch to hip_pos_penalty_l1).

This commit is contained in:
wertyuilife
2026-03-30 19:18:31 +08:00
parent 3b5e47ec16
commit 0b3cd3ab2f
2 changed files with 4 additions and 4 deletions

View File

@@ -431,8 +431,8 @@ class RewardsCfg:
weight=-1.0,
params={"sensor_cfg": SceneEntityCfg("contact_forces", body_names=".*_thigh|.*_calf"), "threshold": 5.0},
)
hip_pos_penalty = RewTerm(
func=mdp.hip_pos_penalty,
hip_pos_penalty_l1 = RewTerm(
func=mdp.hip_pos_penalty_l1,
weight=-0.05,
params={
"command_name": "base_velocity",

View File

@@ -534,7 +534,7 @@ def flat_orientation_l2(env: ManagerBasedRLEnv, asset_cfg: SceneEntityCfg = Scen
return reward
def hip_pos_penalty(
def hip_pos_penalty_l1(
env: ManagerBasedRLEnv,
command_name: str,
asset_cfg: SceneEntityCfg,
@@ -547,7 +547,7 @@ def hip_pos_penalty(
command = env.command_manager.get_command(command_name)[:, [1, 2]]
cmd_large = torch.any(torch.abs(command) > command_threshold, dim=1)
running_reward = torch.linalg.norm(
(asset.data.joint_pos[:, asset_cfg.joint_ids] - asset.data.default_joint_pos[:, asset_cfg.joint_ids]), dim=1
(asset.data.joint_pos[:, asset_cfg.joint_ids] - asset.data.default_joint_pos[:, asset_cfg.joint_ids]), dim=1, ord=1
)
reward = torch.where(
cmd_large,