release: SkillFactory v0.0.1
Add declarative single-leg import, fixed-anchor benchmark, masked shared-policy PPO prototype, regression tests, and consolidated documentation.
This commit is contained in:
@@ -1,135 +1,67 @@
|
||||
# Template for Isaac Lab Projects
|
||||
# SkillFactory v0.0.1
|
||||
|
||||
## Overview
|
||||
仓库:[chenlin/SkillFactory](https://gitea.robotquan.com/chenlin/SkillFactory)。
|
||||
|
||||
This project/repository serves as a template for building projects or extensions based on Isaac Lab.
|
||||
It allows you to develop in an isolated environment, outside of the core Isaac Lab repository.
|
||||
真实单腿资产的导入、固定支座仿真与共享策略训练原型。当前覆盖 **Go2 FL / Go1 FL**;第一周 Go2 基准已完成验收,共享 PPO 仅通过短更新测试,**尚无已收敛、冻结或验证泛化的 Skill**。
|
||||
|
||||
**Key Features:**
|
||||
## 运行环境
|
||||
|
||||
- `Isolation` Work outside the core Isaac Lab repository, ensuring that your development efforts remain self-contained.
|
||||
- `Flexibility` This template is set up to allow your code to be run as an extension in Omniverse.
|
||||
|
||||
**Keywords:** extension, template, isaaclab
|
||||
|
||||
## Installation
|
||||
|
||||
- Install Isaac Lab by following the [installation guide](https://isaac-sim.github.io/IsaacLab/main/source/setup/installation/index.html).
|
||||
We recommend using the conda or uv installation as it simplifies calling Python scripts from the terminal.
|
||||
|
||||
- Clone or copy this project/repository separately from the Isaac Lab installation (i.e. outside the `IsaacLab` directory):
|
||||
|
||||
- Using a python interpreter that has Isaac Lab installed, install the library in editable mode using:
|
||||
|
||||
```bash
|
||||
# use 'PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
|
||||
python -m pip install -e source/SkillFactory
|
||||
|
||||
- Verify that the extension is correctly installed by:
|
||||
|
||||
- Listing the available tasks:
|
||||
|
||||
Note: It the task name changes, it may be necessary to update the search pattern `"Template-"`
|
||||
(in the `scripts/list_envs.py` file) so that it can be listed.
|
||||
|
||||
```bash
|
||||
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
|
||||
python scripts/list_envs.py
|
||||
```
|
||||
|
||||
- Running a task:
|
||||
|
||||
```bash
|
||||
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
|
||||
python scripts/<RL_LIBRARY>/train.py --task=<TASK_NAME>
|
||||
```
|
||||
|
||||
- Running a task with dummy agents:
|
||||
|
||||
These include dummy agents that output zero or random agents. They are useful to ensure that the environments are configured correctly.
|
||||
|
||||
- Zero-action agent
|
||||
|
||||
```bash
|
||||
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
|
||||
python scripts/zero_agent.py --task=<TASK_NAME>
|
||||
```
|
||||
- Random-action agent
|
||||
|
||||
```bash
|
||||
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
|
||||
python scripts/random_agent.py --task=<TASK_NAME>
|
||||
```
|
||||
|
||||
### Set up IDE (Optional)
|
||||
|
||||
To setup the IDE, please follow these instructions:
|
||||
|
||||
- Run VSCode Tasks, by pressing `Ctrl+Shift+P`, selecting `Tasks: Run Task` and running the `setup_python_env` in the drop down menu.
|
||||
When running this task, you will be prompted to add the absolute path to your Isaac Sim installation.
|
||||
|
||||
If everything executes correctly, it should create a file .python.env in the `.vscode` directory.
|
||||
The file contains the python paths to all the extensions provided by Isaac Sim and Omniverse.
|
||||
This helps in indexing all the python modules for intelligent suggestions while writing code.
|
||||
|
||||
### Setup as Omniverse Extension (Optional)
|
||||
|
||||
We provide an example UI extension that will load upon enabling your extension defined in `source/SkillFactory/SkillFactory/ui_extension_example.py`.
|
||||
|
||||
To enable your extension, follow these steps:
|
||||
|
||||
1. **Add the search path of this project/repository** to the extension manager:
|
||||
- Navigate to the extension manager using `Window` -> `Extensions`.
|
||||
- Click on the **Hamburger Icon**, then go to `Settings`.
|
||||
- In the `Extension Search Paths`, enter the absolute path to the `source` directory of this project/repository.
|
||||
- If not already present, in the `Extension Search Paths`, enter the path that leads to Isaac Lab's extension directory directory (`IsaacLab/source`)
|
||||
- Click on the **Hamburger Icon**, then click `Refresh`.
|
||||
|
||||
2. **Search and enable your extension**:
|
||||
- Find your extension under the `Third Party` category.
|
||||
- Toggle it to enable your extension.
|
||||
|
||||
## Code formatting
|
||||
|
||||
We have a pre-commit template to automatically format your code.
|
||||
To install pre-commit:
|
||||
本机已验证:Isaac Sim 6.0.1、Isaac Lab 3.0.0(core 6.1.17)、Python 3.12、Torch 2.10 CUDA、Kit `PhysxCfg`。不修改外部 Lab/Unitree,不安装新运行时。
|
||||
|
||||
```bash
|
||||
pip install pre-commit
|
||||
# 仓库根目录;避免旧 conda/venv 抢占解释器
|
||||
unset CONDA_PREFIX VIRTUAL_ENV
|
||||
export PYTHONPATH="$PWD/source/SkillFactory${PYTHONPATH:+:$PYTHONPATH}"
|
||||
export PYTHONUNBUFFERED=1
|
||||
LAB=/home/cen/IsaacLab/isaaclab.sh
|
||||
```
|
||||
|
||||
Then you can run pre-commit with:
|
||||
路径可按机器调整。**不要在仓库根执行 `uv sync`**:根 `pyproject.toml` 的依赖源仍是 Lab 模板配置;使用已有 Lab 解释器。需要安装项目时用该解释器 `-m pip install -e source/SkillFactory`。Kit 必须在任务配置/动作类导入之前启动;以下仿真入口已处理。
|
||||
|
||||
## 通用单腿:导入 → 验证 → 短训练
|
||||
|
||||
```bash
|
||||
pre-commit run --all-files
|
||||
for leg in go2_fl go1_fl; do
|
||||
"$LAB" -p scripts/assets/extract_leg.py --spec "configs/legs/$leg.json"
|
||||
"$LAB" -p scripts/assets/convert_leg.py --bundle "assets/generated/legs/$leg"
|
||||
done
|
||||
|
||||
"$LAB" -p scripts/leg_worker.py --bundle assets/generated/legs/go2_fl \
|
||||
--num_envs 64 --steps 120 --output logs/leg_interface/verify
|
||||
|
||||
"$LAB" -p scripts/train_leg_skill.py \
|
||||
--bundles assets/generated/legs/go2_fl assets/generated/legs/go1_fl \
|
||||
--num_envs 16 --horizon 32 --updates 1 --output logs/leg_interface/train_smoke
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
新腿通过 JSON 声明源路径、安装切口、辅助支链、受控关节及足端,不按 Go2 名称硬编码。`extract_leg.py --source-root` 可覆盖示例机器路径。重提取后必须重新转换;分层 USD、网格、许可证与 manifest 整体保留。
|
||||
|
||||
### Pylance Missing Indexing of Extensions
|
||||
GUI:给验证命令加 `--num_envs 1 --viz kit`;默认无 GUI。接触验证加 `--contact-action 0,0,1`,该动作只适用于示例 Go2/Go1 的声明顺序,不是任意腿的通用压地指令。
|
||||
|
||||
In some VsCode versions, the indexing of part of the extensions is missing.
|
||||
In this case, add the path to your extension in `.vscode/settings.json` under the key `"python.analysis.extraPaths"`.
|
||||
## 保留的第一周基准
|
||||
|
||||
```json
|
||||
{
|
||||
"python.analysis.extraPaths": [
|
||||
"<path-to-ext-repo>/source/SkillFactory"
|
||||
]
|
||||
}
|
||||
```bash
|
||||
"$LAB" -p scripts/assets/extract_go2_leg.py
|
||||
"$LAB" -p scripts/assets/convert_go2_leg.py
|
||||
"$LAB" -p scripts/anchor_smoke.py --num_envs 1 --mode contact --steps 600 --viz kit
|
||||
# 完整验收约 11 分钟;开发时用 --suite contract
|
||||
"$LAB" -p scripts/verify_anchor.py --suite full --num_envs 64 \
|
||||
--duration 600 --reset_count 1334 --output logs/week1_anchor/acceptance
|
||||
```
|
||||
|
||||
### Pylance Crash
|
||||
## 测试与接口
|
||||
|
||||
If you encounter a crash in `pylance`, it is probable that too many files are indexed and you run out of memory.
|
||||
A possible solution is to exclude some of omniverse packages that are not used in your project.
|
||||
To do so, modify `.vscode/settings.json` and comment out packages under the key `"python.analysis.extraPaths"`
|
||||
Some examples of packages that can likely be excluded are:
|
||||
```bash
|
||||
"$LAB" -p scripts/list_envs.py --show_presets
|
||||
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 "$LAB" -p -m pytest tests -q
|
||||
# 可选:额外启动旧任务 B=1/16/64 Kit 集成测试
|
||||
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ANCHOR_RUNTIME_TESTS=1 "$LAB" -p -m pytest tests/test_anchor_contract.py -q
|
||||
"$LAB" -p -m ruff check source/SkillFactory scripts tests
|
||||
```
|
||||
|
||||
```json
|
||||
"<path-to-isaac-sim>/extscache/omni.anim.*" // Animation packages
|
||||
"<path-to-isaac-sim>/extscache/omni.kit.*" // Kit UI tools
|
||||
"<path-to-isaac-sim>/extscache/omni.graph.*" // Graph UI tools
|
||||
"<path-to-isaac-sim>/extscache/omni.services.*" // Services tools
|
||||
...
|
||||
```
|
||||
- [`docs/leg_interface.md`](docs/leg_interface.md):资产/token/动作契约、验收阈值与证据、实现边界。
|
||||
- `SkillFactory-LegSkill-v0`:结构化 token 与专用 PPO 原型入口;不能直接交给仅接受平坦观测的旧 RSL-RL trainer。
|
||||
- `SkillFactory-SingleLegAnchor-Go2-v0`:保留 `[B,19]` 验收接口。
|
||||
- `Template-Skillfactory-v0`:原 Cartpole 与 `scripts/rsl_rl/` 入口保留。
|
||||
|
||||
生成资产、日志、checkpoint 不入库;换机器需重建复验。当前采样器每轮重启 Kit,仅适合短接口测试,**不要据此直接长训或宣称高吞吐**。后续优先常驻采样、留出形态评估,再实现 latent 学习和冻结调用;固定支座结果不证明整机迁移。
|
||||
|
||||
Reference in New Issue
Block a user