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