fix(ci): resolve quality workflow failures

这个提交包含在:
Elvin
2026-03-06 09:48:31 +08:00
父节点 ae8efef693
当前提交 fa435f8312
共有 6 个文件被更改,包括 46 次插入 和 31 次删除

查看文件

@ -15,7 +15,7 @@ concurrency:
jobs: jobs:
deploy: deploy:
# Temporarily disabled to keep the website non-public. # Temporarily disabled to keep the website non-public.
if: ${{ false }} if: false
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: environment:
name: github-pages name: github-pages

查看文件

@ -31,11 +31,11 @@
## 🧭 Table of Contents ## 🧭 Table of Contents
| Getting Started | Training Pipeline | Project Info | | Getting Started | Training Pipeline | Project Info |
| --- | --- | --- | | -------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------- |
| [⚡ Quick Start](#quick-start) | [4) Value Function Training](#value-function-training) | [Model & Dataset](#model--dataset) | | [⚡ Quick Start](#quick-start) | [4) Value Function Training](#value-function-training) | [Model & Dataset](#model--dataset) |
| [1) Installation](#installation) | [5) Value Inference](#value-inference) | [Community Channels](#community-channels) | | [1) Installation](#installation) | [5) Value Inference](#value-inference) | [Community Channels](#community-channels) |
| [2) Hardware Setup](#hardware-setup) | [6) Policy Training](#policy-training) | [Affiliations](#affiliations) | | [2) Hardware Setup](#hardware-setup) | [6) Policy Training](#policy-training) | [Affiliations](#affiliations) |
| [3) Data Collection](#data-collection) | [7) Closed-loop Rollout and Next Round](#closed-loop-rollout-and-next-round) | [Citation](#citation) / [License](#license) | | [3) Data Collection](#data-collection) | [7) Closed-loop Rollout and Next Round](#closed-loop-rollout-and-next-round) | [Citation](#citation) / [License](#license) |
<p align="center"><strong>Value Visual Results</strong></p> <p align="center"><strong>Value Visual Results</strong></p>
@ -67,11 +67,13 @@
</p> </p>
<a id="quick-start"></a> <a id="quick-start"></a>
## ⚡ Quick Start ## ⚡ Quick Start
**LeRobot-aligned foundation:** we use LeRobot as the base of this codebase because its inference and data-collection logic are highly aligned with real-world RL workflows. **LeRobot-aligned foundation:** we use LeRobot as the base of this codebase because its inference and data-collection logic are highly aligned with real-world RL workflows.
<a id="installation"></a> <a id="installation"></a>
### 1) Installation ### 1) Installation
```bash ```bash
@ -85,6 +87,7 @@ pip install -e .
For setup details and platform-specific dependencies, follow the official [LeRobot configuration guide](https://huggingface.co/docs/lerobot/installation). For setup details and platform-specific dependencies, follow the official [LeRobot configuration guide](https://huggingface.co/docs/lerobot/installation).
<a id="hardware-setup"></a> <a id="hardware-setup"></a>
### 2) Hardware Setup ### 2) Hardware Setup
#### SO Series (SO100/SO101) #### SO Series (SO100/SO101)
@ -198,6 +201,7 @@ For dual-arm camera mapping, it is fine to attach `front` under either the left-
If needed, you can also use temporary device paths (for example `/dev/ttyACM*` and `/dev/video*`) during initial debugging. If needed, you can also use temporary device paths (for example `/dev/ttyACM*` and `/dev/video*`) during initial debugging.
<a id="agilex-piper-setup"></a> <a id="agilex-piper-setup"></a>
#### AgileX PiPER #### AgileX PiPER
For PiPER setup, PiPER uses CAN interfaces instead of serial ports. For PiPER setup, PiPER uses CAN interfaces instead of serial ports.
@ -239,6 +243,7 @@ Optional PiPER flags:
``` ```
<a id="data-collection"></a> <a id="data-collection"></a>
### 3) Data Collection ### 3) Data Collection
Collect rollout data with `lerobot-human-inloop-record`. Collect rollout data with `lerobot-human-inloop-record`.
@ -314,6 +319,7 @@ lerobot-dataset-report --dataset <HF_USERNAME_OR_ORG>/<DATASET_NAME>
This prints: dataset meta, totals, episode-length stats/histogram, success/intervention metrics, task list, and full feature schema. This prints: dataset meta, totals, episode-length stats/histogram, success/intervention metrics, task list, and full feature schema.
<a id="value-function-training"></a> <a id="value-function-training"></a>
### 4) Value Function Training ### 4) Value Function Training
Train the value function on the current dataset. Current default: [Pi\*0.6](https://www.pi.website/blog/pistar06) (`--value.type=pistar06`). Train the value function on the current dataset. Current default: [Pi\*0.6](https://www.pi.website/blog/pistar06) (`--value.type=pistar06`).
@ -353,6 +359,7 @@ To plug in a different value function, minimal path in this repo:
- Remove/replace the current `pistar06`-only type checks in `src/lerobot/configs/value_train.py` and `src/lerobot/scripts/lerobot_value_infer.py`. - Remove/replace the current `pistar06`-only type checks in `src/lerobot/configs/value_train.py` and `src/lerobot/scripts/lerobot_value_infer.py`.
<a id="value-inference"></a> <a id="value-inference"></a>
### 5) Value Inference ### 5) Value Inference
Infer value signals and write value/advantage/indicator back to the dataset: Infer value signals and write value/advantage/indicator back to the dataset:
@ -408,6 +415,7 @@ complementary_info.acp_indicator_<TAG>
These columns are written back to the original dataset specified by `--dataset.repo_id`. These columns are written back to the original dataset specified by `--dataset.repo_id`.
<a id="policy-training"></a> <a id="policy-training"></a>
### 6) Policy Training ### 6) Policy Training
Train the policy with advantage-conditioned tags. Train the policy with advantage-conditioned tags.
@ -453,6 +461,7 @@ CUDA_VISIBLE_DEVICES=<GPU_ID_LIST> accelerate launch \
``` ```
<a id="closed-loop-rollout-and-next-round"></a> <a id="closed-loop-rollout-and-next-round"></a>
### 7) Closed-loop Rollout and Next Round ### 7) Closed-loop Rollout and Next Round
Deploy the trained policy in human-in-loop mode and collect the next dataset round: Deploy the trained policy in human-in-loop mode and collect the next dataset round:

查看文件

@ -17,7 +17,6 @@
import logging import logging
import time import time
from functools import cached_property from functools import cached_property
from typing import Any
from lerobot.cameras.utils import make_cameras_from_configs from lerobot.cameras.utils import make_cameras_from_configs
from lerobot.motors import MotorCalibration from lerobot.motors import MotorCalibration
@ -72,11 +71,11 @@ class PiperFollower(Robot):
@cached_property @cached_property
def observation_features(self) -> dict[str, type | tuple]: def observation_features(self) -> dict[str, type | tuple]:
return {**{key: float for key in PIPER_ACTION_KEYS}, **self._cameras_ft} return {**dict.fromkeys(PIPER_ACTION_KEYS, float), **self._cameras_ft}
@cached_property @cached_property
def action_features(self) -> dict[str, type]: def action_features(self) -> dict[str, type]:
return {key: float for key in PIPER_ACTION_KEYS} return dict.fromkeys(PIPER_ACTION_KEYS, float)
@property @property
def is_connected(self) -> bool: def is_connected(self) -> bool:
@ -97,10 +96,15 @@ class PiperFollower(Robot):
self.configure() self.configure()
should_auto_calibrate = ( should_auto_calibrate = (
not self.is_calibrated and calibrate and should_require_piper_calibration(self.config.calibration_mode) not self.is_calibrated
and calibrate
and should_require_piper_calibration(self.config.calibration_mode)
) )
if should_auto_calibrate: if should_auto_calibrate:
logger.info("No piper-follower calibration file found for '%s'. Running lerobot-calibrate flow.", self.id) logger.info(
"No piper-follower calibration file found for '%s'. Running lerobot-calibrate flow.",
self.id,
)
self.calibrate() self.calibrate()
# Enable behavior should be controlled by enable_on_connect, independent from calibrate flag. # Enable behavior should be controlled by enable_on_connect, independent from calibrate flag.
# This keeps connect(calibrate=False) commandable for callers that only want to skip interactive calibration. # This keeps connect(calibrate=False) commandable for callers that only want to skip interactive calibration.
@ -272,7 +276,9 @@ class PiperFollower(Robot):
joint_targets = [self._offset_to_target(key, action[key]) for key in joint_keys] joint_targets = [self._offset_to_target(key, action[key]) for key in joint_keys]
joint_commands = [unit_to_milli(value) for value in joint_targets] joint_commands = [unit_to_milli(value) for value in joint_targets]
self.arm.JointCtrl(*joint_commands) self.arm.JointCtrl(*joint_commands)
sent_action.update({key: milli_to_unit(raw) for key, raw in zip(joint_keys, joint_commands, strict=True)}) sent_action.update(
{key: milli_to_unit(raw) for key, raw in zip(joint_keys, joint_commands, strict=True)}
)
elif any(key in action for key in joint_keys): elif any(key in action for key in joint_keys):
logger.debug("Ignoring partial Piper joint action. Need all six joint keys to send command.") logger.debug("Ignoring partial Piper joint action. Need all six joint keys to send command.")

查看文件

@ -65,11 +65,11 @@ class PiperLeader(Teleoperator):
@cached_property @cached_property
def action_features(self) -> dict[str, type]: def action_features(self) -> dict[str, type]:
return {key: float for key in PIPER_ACTION_KEYS} return dict.fromkeys(PIPER_ACTION_KEYS, float)
@cached_property @cached_property
def feedback_features(self) -> dict[str, type]: def feedback_features(self) -> dict[str, type]:
return {key: float for key in PIPER_ACTION_KEYS} return dict.fromkeys(PIPER_ACTION_KEYS, float)
@property @property
def is_connected(self) -> bool: def is_connected(self) -> bool:
@ -94,8 +94,15 @@ class PiperLeader(Teleoperator):
self.arm.MasterSlaveConfig(0xFC, 0x00, 0x00, 0x00) self.arm.MasterSlaveConfig(0xFC, 0x00, 0x00, 0x00)
time.sleep(0.05) time.sleep(0.05)
self.configure() self.configure()
if not self.is_calibrated and calibrate and should_require_piper_calibration(self.config.calibration_mode): if (
logger.info("No piper-leader calibration file found for '%s'. Running lerobot-calibrate flow.", self.id) not self.is_calibrated
and calibrate
and should_require_piper_calibration(self.config.calibration_mode)
):
logger.info(
"No piper-leader calibration file found for '%s'. Running lerobot-calibrate flow.",
self.id,
)
self.calibrate() self.calibrate()
except Exception: except Exception:
self.arm.DisconnectPort() self.arm.DisconnectPort()

查看文件

@ -69,7 +69,4 @@ def should_require_piper_calibration(calibration_mode: str) -> bool:
return True return True
if calibration_mode == "off": if calibration_mode == "off":
return False return False
raise ValueError( raise ValueError(f"Invalid Piper calibration mode '{calibration_mode}'. Expected one of: required, off.")
f"Invalid Piper calibration mode '{calibration_mode}'. "
"Expected one of: required, off."
)

查看文件

@ -1,10 +1,11 @@
# ruff: noqa: N802
from types import SimpleNamespace from types import SimpleNamespace
import pytest import pytest
import lerobot.utils.piper_sdk as piper_sdk_utils
import lerobot.robots.piper_follower.piper_follower as piper_follower_module import lerobot.robots.piper_follower.piper_follower as piper_follower_module
import lerobot.teleoperators.piper_leader.piper_leader as piper_leader_module import lerobot.teleoperators.piper_leader.piper_leader as piper_leader_module
import lerobot.utils.piper_sdk as piper_sdk_utils
from lerobot.motors import MotorCalibration from lerobot.motors import MotorCalibration
from lerobot.robots.piper_follower import PiperFollower, PiperFollowerConfig from lerobot.robots.piper_follower import PiperFollower, PiperFollowerConfig
from lerobot.robots.utils import make_robot_from_config from lerobot.robots.utils import make_robot_from_config
@ -115,7 +116,9 @@ class FakePiperInterface:
def patch_fake_sdk(monkeypatch): def patch_fake_sdk(monkeypatch):
fake_loader = lambda: (FakePiperInterface, FakeLogLevel) def fake_loader():
return (FakePiperInterface, FakeLogLevel)
monkeypatch.setattr(piper_sdk_utils, "get_piper_sdk", fake_loader) monkeypatch.setattr(piper_sdk_utils, "get_piper_sdk", fake_loader)
monkeypatch.setattr(piper_follower_module, "get_piper_sdk", fake_loader) monkeypatch.setattr(piper_follower_module, "get_piper_sdk", fake_loader)
monkeypatch.setattr(piper_leader_module, "get_piper_sdk", fake_loader) monkeypatch.setattr(piper_leader_module, "get_piper_sdk", fake_loader)
@ -202,17 +205,10 @@ def test_piper_requires_calibration(monkeypatch):
teleop.connect(calibrate=False) teleop.connect(calibrate=False)
robot.connect(calibrate=False) robot.connect(calibrate=False)
try: try:
try: with pytest.raises(RuntimeError, match="require calibration"):
teleop.get_action() teleop.get_action()
assert False, "Expected teleop.get_action() to require calibration." with pytest.raises(RuntimeError, match="require calibration"):
except RuntimeError:
pass
try:
robot.send_action({"joint_1.pos": 0.0}) robot.send_action({"joint_1.pos": 0.0})
assert False, "Expected robot.send_action() to require calibration."
except RuntimeError:
pass
finally: finally:
teleop.disconnect() teleop.disconnect()
robot.disconnect() robot.disconnect()