Skip to content

refactor: extract shared locomotion reward functions (#149) - #183

Merged
TATP-233 merged 1 commit into
mainfrom
feat/extract-locomotion-rewards
Apr 9, 2026
Merged

TATP-233 merged 1 commit into
mainfrom
feat/extract-locomotion-rewards

Conversation

@TATP-233

@TATP-233 TATP-233 commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Introduces RewardContext dataclass in common/rewards.py bundling all state reward functions need
  • Extracts 16 shared reward functions (tracking_lin_vel, action_rate, base_height, etc.) as standalone fn(ctx: RewardContext) -> np.ndarray
  • Joystick environments reference shared functions directly in _reward_fns dispatch tables — no wrapper methods
  • Eliminates ~38 duplicate _reward_* methods + 3 module-level helpers across G1/Go1/Go2
  • Robot-specific rewards (feet_phase, contact, foot_drag, etc.) remain as methods with ctx signature
  • No reward behavior changes — each task's _reward_fns dict has the exact same keys as before

Test plan

  • make check (ruff format + ruff check + mypy + pyright) — all pass
  • make test — 329 passed, 12 skipped
  • uv run python scripts/train_rsl_rl.py task=go2_joystick algo.max_iterations=3 — reward curves unchanged

Closes #149

Introduce RewardContext dataclass and 16 shared reward functions that
joystick environments reference directly in their _reward_fns dispatch
tables, eliminating ~38 duplicate _reward_* methods across G1/Go1/Go2.
@TATP-233
TATP-233 merged commit 501083f into main Apr 9, 2026
5 checks passed
@TATP-233
TATP-233 deleted the feat/extract-locomotion-rewards branch April 9, 2026 17:20
TATP-233 added a commit that referenced this pull request May 4, 2026
refactor: extract shared locomotion reward functions (#149)
TATP-233 added a commit that referenced this pull request May 30, 2026
refactor: extract shared locomotion reward functions (#149)
TATP-233 added a commit that referenced this pull request Sep 4, 2026
refactor: extract shared locomotion reward functions (#149)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Work: 提取 Locomotion Reward Functions 共享库 — 消除 40+ 重复函数

2 participants