Unverified Commit 61c43084 authored by Farbod Farshidian's avatar Farbod Farshidian Committed by GitHub

Improves Spot gait reward (#451)

Adds a new reward for Spot's gait, which is based on the foot body name

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have run all the tests with `./isaaclab.sh --test` and they pass
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 8816fb76
...@@ -15,7 +15,7 @@ from omni.isaac.lab_tasks.utils.wrappers.rsl_rl import ( ...@@ -15,7 +15,7 @@ from omni.isaac.lab_tasks.utils.wrappers.rsl_rl import (
@configclass @configclass
class SpotFlatPPORunnerCfg(RslRlOnPolicyRunnerCfg): class SpotFlatPPORunnerCfg(RslRlOnPolicyRunnerCfg):
num_steps_per_env = 24 num_steps_per_env = 24
max_iterations = 35000 max_iterations = 20000
save_interval = 50 save_interval = 50
experiment_name = "spot_flat" experiment_name = "spot_flat"
empirical_normalization = False empirical_normalization = False
......
...@@ -64,7 +64,7 @@ class SpotCommandsCfg: ...@@ -64,7 +64,7 @@ class SpotCommandsCfg:
heading_command=False, heading_command=False,
debug_vis=True, debug_vis=True,
ranges=mdp.UniformVelocityCommandCfg.Ranges( ranges=mdp.UniformVelocityCommandCfg.Ranges(
lin_vel_x=(-2.0, 4.0), lin_vel_y=(-1.5, 1.5), ang_vel_z=(-2.0, 2.0) lin_vel_x=(-2.0, 3.0), lin_vel_y=(-1.5, 1.5), ang_vel_z=(-2.0, 2.0)
), ),
) )
...@@ -189,7 +189,12 @@ class SpotRewardsCfg: ...@@ -189,7 +189,12 @@ class SpotRewardsCfg:
air_time = RewardTermCfg( air_time = RewardTermCfg(
func=spot_mdp.air_time_reward, func=spot_mdp.air_time_reward,
weight=5.0, weight=5.0,
params={"mode_time": 0.3, "sensor_cfg": SceneEntityCfg("contact_forces", body_names=".*_foot")}, params={
"mode_time": 0.3,
"velocity_threshold": 0.5,
"asset_cfg": SceneEntityCfg("robot"),
"sensor_cfg": SceneEntityCfg("contact_forces", body_names=".*_foot"),
},
) )
base_angular_velocity = RewardTermCfg( base_angular_velocity = RewardTermCfg(
func=spot_mdp.base_angular_velocity_reward, func=spot_mdp.base_angular_velocity_reward,
...@@ -212,9 +217,16 @@ class SpotRewardsCfg: ...@@ -212,9 +217,16 @@ class SpotRewardsCfg:
}, },
) )
gait = RewardTermCfg( gait = RewardTermCfg(
func=spot_mdp.gait_reward, func=spot_mdp.GaitReward,
weight=10.0, weight=10.0,
params={"std": 0.1, "sensor_cfg": SceneEntityCfg("contact_forces", body_names=".*_foot")}, params={
"std": 0.1,
"max_err": 0.2,
"velocity_threshold": 0.5,
"synced_feet_pair_names": (("fl_foot", "hr_foot"), ("fr_foot", "hl_foot")),
"asset_cfg": SceneEntityCfg("robot"),
"sensor_cfg": SceneEntityCfg("contact_forces"),
},
) )
# -- penalties # -- penalties
...@@ -247,7 +259,11 @@ class SpotRewardsCfg: ...@@ -247,7 +259,11 @@ class SpotRewardsCfg:
joint_pos = RewardTermCfg( joint_pos = RewardTermCfg(
func=spot_mdp.joint_position_penalty, func=spot_mdp.joint_position_penalty,
weight=-0.7, weight=-0.7,
params={"asset_cfg": SceneEntityCfg("robot", joint_names=".*"), "stand_still_scale": 5.0}, params={
"asset_cfg": SceneEntityCfg("robot", joint_names=".*"),
"stand_still_scale": 5.0,
"velocity_threshold": 0.5,
},
) )
joint_torques = RewardTermCfg( joint_torques = RewardTermCfg(
func=spot_mdp.joint_torques_penalty, func=spot_mdp.joint_torques_penalty,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment