镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-20 18:17:06 +00:00
fix(ci): make pre-commit quality checks pass
这个提交包含在:
@ -36,7 +36,9 @@ repos:
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
- id: end-of-file-fixer
|
||||
exclude: ^src/lerobot/assets/(piper_description|piper_x_description)/
|
||||
- id: trailing-whitespace
|
||||
exclude: ^src/lerobot/assets/(piper_description|piper_x_description)/
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.1
|
||||
|
||||
@ -18,7 +18,6 @@ from dataclasses import dataclass, field
|
||||
|
||||
from lerobot.cameras import CameraConfig
|
||||
|
||||
|
||||
from ..config import RobotConfig
|
||||
|
||||
|
||||
|
||||
@ -24,10 +24,10 @@ from lerobot.processor import RobotAction, RobotObservation
|
||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||
from lerobot.utils.piper_sdk import (
|
||||
PIPER_ACTION_KEYS,
|
||||
guard_piper_ctrl_mode_on_connect,
|
||||
PIPER_JOINT_ACTION_KEYS,
|
||||
PIPER_JOINT_NAMES,
|
||||
get_piper_sdk,
|
||||
guard_piper_ctrl_mode_on_connect,
|
||||
milli_to_unit,
|
||||
parse_piper_log_level,
|
||||
unit_to_milli,
|
||||
@ -93,11 +93,7 @@ class PiperFollower(Robot):
|
||||
connected_cameras = []
|
||||
try:
|
||||
self.configure()
|
||||
should_auto_calibrate = (
|
||||
not self.is_calibrated
|
||||
and calibrate
|
||||
and self.config.require_calibration
|
||||
)
|
||||
should_auto_calibrate = not self.is_calibrated and calibrate and self.config.require_calibration
|
||||
if should_auto_calibrate:
|
||||
logger.info(
|
||||
"No piper-follower calibration file found for '%s'. Running lerobot-calibrate flow.",
|
||||
|
||||
@ -141,7 +141,6 @@ def setup_interface_with_fallback(interface: str, cfg: CANSetupConfig) -> tuple[
|
||||
return False, None, " | ".join(attempt_msgs)
|
||||
|
||||
|
||||
|
||||
def test_motor(bus, motor_id: int, timeout: float, use_fd: bool):
|
||||
"""Test a single motor and return responses."""
|
||||
import can
|
||||
|
||||
@ -25,10 +25,10 @@ from lerobot.processor import RobotAction
|
||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||
from lerobot.utils.piper_sdk import (
|
||||
PIPER_ACTION_KEYS,
|
||||
guard_piper_ctrl_mode_on_connect,
|
||||
PIPER_JOINT_ACTION_KEYS,
|
||||
PIPER_JOINT_NAMES,
|
||||
get_piper_sdk,
|
||||
guard_piper_ctrl_mode_on_connect,
|
||||
milli_to_unit,
|
||||
parse_piper_log_level,
|
||||
unit_to_milli,
|
||||
@ -55,8 +55,8 @@ def _ensure_not_lfs_pointer(path_obj: Any, relpath: str) -> None:
|
||||
raise RuntimeError(
|
||||
"Bundled PiPER assets are still Git LFS pointer files. "
|
||||
"Please run `git lfs pull --include="
|
||||
"\"src/lerobot/assets/piper_description/**,src/lerobot/assets/piper_x_description/**\" "
|
||||
"--exclude=\"*\"` and `git lfs checkout src/lerobot/assets/piper_description "
|
||||
'"src/lerobot/assets/piper_description/**,src/lerobot/assets/piper_x_description/**" '
|
||||
'--exclude="*"` and `git lfs checkout src/lerobot/assets/piper_description '
|
||||
"src/lerobot/assets/piper_x_description`, then retry. "
|
||||
f"(file: {relpath})"
|
||||
)
|
||||
@ -109,11 +109,7 @@ class PiperLeader(Teleoperator):
|
||||
self._manual_control_enabled = None
|
||||
try:
|
||||
self.configure()
|
||||
if (
|
||||
not self.is_calibrated
|
||||
and calibrate
|
||||
and self.config.require_calibration
|
||||
):
|
||||
if not self.is_calibrated and calibrate and self.config.require_calibration:
|
||||
logger.info(
|
||||
"No piper-leader calibration file found for '%s'. Running lerobot-calibrate flow.",
|
||||
self.id,
|
||||
@ -214,7 +210,9 @@ class PiperLeader(Teleoperator):
|
||||
return
|
||||
if enabled and self._manual_control_enabled is not True:
|
||||
if not self._wait_enable(self.config.enable_timeout_s):
|
||||
logger.warning("Piper leader did not report enabled state before entering gravity compensation.")
|
||||
logger.warning(
|
||||
"Piper leader did not report enabled state before entering gravity compensation."
|
||||
)
|
||||
if self.config.sync_gripper:
|
||||
self._set_gripper_enabled(False)
|
||||
self._ensure_gravity_comp_loop().start()
|
||||
|
||||
@ -9,9 +9,19 @@ import lerobot.robots.piper_follower.piper_follower as piper_follower_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.robots.piper_follower import PiperFollower, PiperFollowerConfig, PiperXFollower, PiperXFollowerConfig
|
||||
from lerobot.robots.piper_follower import (
|
||||
PiperFollower,
|
||||
PiperFollowerConfig,
|
||||
PiperXFollower,
|
||||
PiperXFollowerConfig,
|
||||
)
|
||||
from lerobot.robots.utils import make_robot_from_config
|
||||
from lerobot.teleoperators.piper_leader import PiperLeader, PiperLeaderConfig, PiperXLeader, PiperXLeaderConfig
|
||||
from lerobot.teleoperators.piper_leader import (
|
||||
PiperLeader,
|
||||
PiperLeaderConfig,
|
||||
PiperXLeader,
|
||||
PiperXLeaderConfig,
|
||||
)
|
||||
from lerobot.teleoperators.utils import make_teleoperator_from_config
|
||||
from lerobot.utils.piper_sdk import PIPER_ACTION_KEYS
|
||||
|
||||
@ -442,7 +452,9 @@ def test_piper_leader_gravity_comp_manual_control_uses_mit(monkeypatch):
|
||||
("device_kind", "port", "robot_id"),
|
||||
[("leader", "can1", None), ("follower", "can0", "piper_role_guard")],
|
||||
)
|
||||
def test_piper_connect_fails_and_writes_follower_role_when_in_teach_mode(monkeypatch, device_kind, port, robot_id):
|
||||
def test_piper_connect_fails_and_writes_follower_role_when_in_teach_mode(
|
||||
monkeypatch, device_kind, port, robot_id
|
||||
):
|
||||
patch_fake_sdk(monkeypatch)
|
||||
|
||||
if device_kind == "leader":
|
||||
@ -459,11 +471,9 @@ def test_piper_connect_fails_and_writes_follower_role_when_in_teach_mode(monkeyp
|
||||
|
||||
def test_piper_lfs_pointer_urdf_raises_actionable_error(tmp_path):
|
||||
pointer_file = tmp_path / "lfs_pointer.urdf"
|
||||
pointer_file.write_text(
|
||||
"version https://git-lfs.github.com/spec/v1\n"
|
||||
"oid sha256:deadbeef\n"
|
||||
"size 123\n"
|
||||
)
|
||||
pointer_file.write_text("version https://git-lfs.github.com/spec/v1\noid sha256:deadbeef\nsize 123\n")
|
||||
|
||||
with pytest.raises(RuntimeError, match="Git LFS pointer files"):
|
||||
piper_leader_module._ensure_not_lfs_pointer(pointer_file, "assets/piper_description/urdf/pointer.urdf")
|
||||
piper_leader_module._ensure_not_lfs_pointer(
|
||||
pointer_file, "assets/piper_description/urdf/pointer.urdf"
|
||||
)
|
||||
|
||||
在新工单中引用
屏蔽一个用户