Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 2.79 KB

File metadata and controls

74 lines (52 loc) · 2.79 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

ROCm_Robotics_RL_Lab is an RL training lab for robotic simulation on AMD GPUs. The validated workflow in this repository uses robosuite's Panda robot on the Lift task, Stable-Baselines3 (SAC / PPO), Gymnasium wrappers, and OpenGL-based evaluation / video capture.

Commands

# Activate venv (see README.md / README_zh.md for setup instructions)
source .venv/bin/activate

# Quickstart (50k steps SAC on Lift)
python scripts/quickstart.py

# SAC training
python scripts/train_sac.py --total-timesteps 500000 --n-envs 4

# PPO training
python scripts/train_ppo.py --total-timesteps 1000000 --n-envs 8

# Evaluate a trained model
python scripts/evaluate.py --model models/sac_lift_final.zip --algo sac --n-episodes 10
python scripts/evaluate.py --model models/best/best_model.zip --algo sac --no-render
python scripts/evaluate.py --model <path> --algo ppo --record-video --video-dir videos/

# Monitor training
tensorboard --logdir logs/

Architecture

Training Script (train_sac.py / train_ppo.py)
    ├── Stable-Baselines3 (SAC or PPO agent)
    └── Gymnasium Environment Stack:
            SuccessRewardWrapper        ← optional terminal reward shaping
                └── RobosuiteGymWrapper ← dict→flat obs, gym API adapter
                    └── robosuite Lift  ← Panda robot manipulation task
                        └── MuJoCo      ← physics simulation

Key Files

  • scripts/train_sac.py — Main SAC training entrypoint for Panda Lift, including success-oriented checkpointing.
  • scripts/train_ppo.py — PPO baseline training entrypoint for Panda Lift.
  • scripts/evaluate.py — Evaluation script with success-rate reporting and optional video recording.
  • environments/gym_wrapper.py — robosuite→Gymnasium adapters and success-reward wrapper.
  • model_loading.py — SB3 checkpoint loading / validation helpers.

Observation Space

The main Lift training scripts currently use selected robosuite observations via:

  • robot0_proprio-state
  • object-state

Older checkpoints may still require the full flattened observation, and model_loading.py handles that compatibility check.

Environment Parameters

  • Task: robosuite Lift
  • Robot: Panda
  • Control frequency: 20Hz
  • Episode horizon: 500 steps
  • Vectorization: SubprocVecEnv for n_envs > 1, DummyVecEnv for a single env

Notes

  • The repository contains a custom pick_cube_place_cup.py environment prototype, but the documented and verified training flow is Panda Lift.
  • Success rate is the primary metric for judging training quality; reward alone is not reliable.
  • Use --no-render for headless evaluation to avoid display / GLFW issues.