replace joint_pos_limits reward with isaaclabs'; clean code; update readme.
This commit is contained in:
@@ -182,9 +182,10 @@ xml_path: "{ROOT_DIR}/resources/go2/your-custom-scene.xml"
|
||||
|
||||
- Different tracking reward formulation (fixed sigma vs. dynamic sigma)
|
||||
- Different rewards:
|
||||
- lower dof_acc_l2 weight in Lab due to physics-step level implementation and sensitivity to outliers
|
||||
- lower joint_acc_l2 weight in Lab due to physics-step level implementation and sensitivity to outliers
|
||||
- extra joint_pos_penalty_l1 reward in Lab due to better performance
|
||||
- Lack domain_rand: randomize_motor_strength
|
||||
- Extra domain_rand: randomize_com_positions_other (lead to better performance)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -403,10 +403,10 @@ class RewardsCfg:
|
||||
weight=-1.0,
|
||||
params={"sensor_cfg": SceneEntityCfg("contact_forces", body_names=".*_thigh|.*_calf"), "threshold": 5.0},
|
||||
)
|
||||
dof_pos_limits = RewTerm(
|
||||
func=mdp.dof_pos_limits,
|
||||
joint_pos_limits = RewTerm(
|
||||
func=mdp.joint_pos_limits,
|
||||
weight=-2.0,
|
||||
params={"asset_cfg": SceneEntityCfg("robot")},
|
||||
params={"asset_cfg": SceneEntityCfg("robot", joint_names=JOINT_NAMES)},
|
||||
)
|
||||
feet_regulation = RewTerm(
|
||||
func=mdp.feet_regulation,
|
||||
|
||||
@@ -373,23 +373,8 @@ class Go2RLGymCommandCfg(CommandTermCfg):
|
||||
'ang_vel_yaw': [-2.0, 2.0], # min max [rad/s]
|
||||
}]
|
||||
"""List for command range curriculums at specific training iterations"""
|
||||
# terrain_max_command_ranges: dict[str, dict] = {
|
||||
# 'random_rough':
|
||||
# {'lin_vel_x': [-1.5, 1.5], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
# 'hf_pyramid_slope':
|
||||
# {'lin_vel_x': [-1.5, 1.5], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
# 'hf_pyramid_slope_inv':
|
||||
# {'lin_vel_x': [-1.5, 1.5], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
# 'pyramid_stairs':
|
||||
# {'lin_vel_x': [-1.0, 1.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
# 'pyramid_stairs_inv':
|
||||
# {'lin_vel_x': [-1.0, 1.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
# 'boxes':
|
||||
# {'lin_vel_x': [-1.0, 1.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
# 'flat':
|
||||
# {'lin_vel_x': [-2.0, 2.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-2.0, 2.0]},
|
||||
# }
|
||||
terrain_max_command_ranges: dict[str, dict] = {
|
||||
#### go2 terrains ####
|
||||
'wave':
|
||||
{'lin_vel_x': [-1.5, 1.5], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
'slope_up':
|
||||
@@ -410,6 +395,19 @@ class Go2RLGymCommandCfg(CommandTermCfg):
|
||||
{'lin_vel_x': [-1.0, 1.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
'flat':
|
||||
{'lin_vel_x': [-2.0, 2.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-2.0, 2.0]},
|
||||
#### robotlab default terrains ####
|
||||
'random_rough':
|
||||
{'lin_vel_x': [-1.5, 1.5], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
'hf_pyramid_slope':
|
||||
{'lin_vel_x': [-1.5, 1.5], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
'hf_pyramid_slope_inv':
|
||||
{'lin_vel_x': [-1.5, 1.5], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
'pyramid_stairs':
|
||||
{'lin_vel_x': [-1.0, 1.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
'pyramid_stairs_inv':
|
||||
{'lin_vel_x': [-1.0, 1.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
'boxes':
|
||||
{'lin_vel_x': [-1.0, 1.0], 'lin_vel_y': [-1.0, 1.0], 'ang_vel_yaw': [-1.5, 1.5]},
|
||||
}
|
||||
resampling_time: float = 5.0
|
||||
resampling_time_range: tuple[float, float] = (5.0, 5.0)
|
||||
|
||||
@@ -605,20 +605,3 @@ def feet_regulation(
|
||||
reward = (feet_xy_vel_w.pow(2).sum(dim=-1) * torch.exp(-feet_height / (0.025 * base_height_target))).sum(dim=-1)
|
||||
|
||||
return reward
|
||||
|
||||
def dof_pos_limits(
|
||||
env: ManagerBasedRLEnv,
|
||||
asset_cfg: SceneEntityCfg = SceneEntityCfg("robot"),
|
||||
) -> torch.Tensor:
|
||||
asset = env.scene[asset_cfg.name]
|
||||
|
||||
joint_pos = asset.data.joint_pos
|
||||
joint_limits = asset.data.soft_joint_pos_limits
|
||||
|
||||
lower = joint_limits[..., 0]
|
||||
upper = joint_limits[..., 1]
|
||||
|
||||
out_of_limits = -(joint_pos - lower).clamp(max=0.0)
|
||||
out_of_limits += (joint_pos - upper).clamp(min=0.0)
|
||||
|
||||
return torch.sum(out_of_limits, dim=1)
|
||||
|
||||
@@ -92,7 +92,7 @@ DEFAULT_TERRAIN_CFG = terrain_gen.TerrainGeneratorCfg(
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Gym-aligned terrain setup
|
||||
# Go2 Terrain setup
|
||||
# -----------------------------------------------------------------------------
|
||||
@height_field_to_mesh
|
||||
def wave_terrain(difficulty: float, cfg) -> np.ndarray:
|
||||
|
||||
Reference in New Issue
Block a user