mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-11 20:11:48 +00:00
fix ruff
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
# docs-requirements.txt
|
||||
hf-doc-builder @ git+https://github.com/huggingface/doc-builder.git@main
|
||||
watchdog>=6.0.0
|
||||
watchdog>=6.0.0
|
||||
@@ -297,7 +297,9 @@ class OpenCVCamera(Camera):
|
||||
f"{self} failed to set capture_height={self.capture_height} ({actual_height=}, {height_success=})."
|
||||
)
|
||||
if not height_success:
|
||||
logger.warning(f"{self} set(CAP_PROP_FRAME_HEIGHT) returned False but {actual_height=} is correct.")
|
||||
logger.warning(
|
||||
f"{self} set(CAP_PROP_FRAME_HEIGHT) returned False but {actual_height=} is correct."
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def find_cameras() -> list[dict[str, Any]]:
|
||||
|
||||
@@ -379,14 +379,28 @@ def main() -> None:
|
||||
if args.grippers:
|
||||
try:
|
||||
grippers["L"] = build_gripper(
|
||||
"L", args.gripper_port_left, args.gripper_send_id, args.gripper_recv_id,
|
||||
args.gripper_motor_type, args.gripper_fd, args.gripper_open_deg,
|
||||
args.gripper_close_deg, args.gripper_kp, args.gripper_kd,
|
||||
"L",
|
||||
args.gripper_port_left,
|
||||
args.gripper_send_id,
|
||||
args.gripper_recv_id,
|
||||
args.gripper_motor_type,
|
||||
args.gripper_fd,
|
||||
args.gripper_open_deg,
|
||||
args.gripper_close_deg,
|
||||
args.gripper_kp,
|
||||
args.gripper_kd,
|
||||
)
|
||||
grippers["R"] = build_gripper(
|
||||
"R", args.gripper_port_right, args.gripper_send_id, args.gripper_recv_id,
|
||||
args.gripper_motor_type, args.gripper_fd, args.gripper_open_deg,
|
||||
args.gripper_close_deg, args.gripper_kp, args.gripper_kd,
|
||||
"R",
|
||||
args.gripper_port_right,
|
||||
args.gripper_send_id,
|
||||
args.gripper_recv_id,
|
||||
args.gripper_motor_type,
|
||||
args.gripper_fd,
|
||||
args.gripper_open_deg,
|
||||
args.gripper_close_deg,
|
||||
args.gripper_kp,
|
||||
args.gripper_kd,
|
||||
)
|
||||
except Exception as e: # noqa: BLE001
|
||||
print(f"WARNING: gripper setup failed ({e}); continuing without grippers.")
|
||||
|
||||
@@ -147,7 +147,9 @@ class ExoskeletonArm:
|
||||
smoothed: dict[str, float] = {}
|
||||
for joint, value in angles.items():
|
||||
prev = self._ema.get(joint)
|
||||
self._ema[joint] = value if prev is None else self._ema_alpha * value + (1 - self._ema_alpha) * prev
|
||||
self._ema[joint] = (
|
||||
value if prev is None else self._ema_alpha * value + (1 - self._ema_alpha) * prev
|
||||
)
|
||||
smoothed[joint] = self._ema[joint]
|
||||
return smoothed
|
||||
|
||||
|
||||
@@ -295,7 +295,9 @@ class UnitreeG1Teleoperator(Teleoperator):
|
||||
gripper_buttons = self._exo_gripper_buttons(left_raw, right_raw)
|
||||
return {**joint_action, **rc.remote_action, **gripper_buttons}
|
||||
|
||||
def _exo_gripper_buttons(self, left_raw: list[int] | None, right_raw: list[int] | None) -> dict[str, float]:
|
||||
def _exo_gripper_buttons(
|
||||
self, left_raw: list[int] | None, right_raw: list[int] | None
|
||||
) -> dict[str, float]:
|
||||
"""Exo joystick clicks as button flags: L3 (left stick) -> button.4, R3 (right) -> button.0.
|
||||
|
||||
Reads the raw joystick-button ADC channel directly (pressed pulls it below mid-scale),
|
||||
|
||||
Reference in New Issue
Block a user