From 95256d766d7dd686e1e7e99d42d05cf207a9abc2 Mon Sep 17 00:00:00 2001 From: Xingdong Zuo Date: Tue, 28 Jul 2026 02:29:44 +0900 Subject: [PATCH] feat(lekiwi): support LeKiwi in lerobot-replay CLI (#3739) Register the `lekiwi` robot module in `lerobot_replay.py` so episodes can be replayed on a LeKiwi via `--robot.type=lekiwi_client`. The module is already registered in `lerobot_calibrate.py` and `lerobot_setup_motors.py`; this fills the gap so the replay CLI recognizes the same robot. Replayed actions are loaded from the dataset as torch tensors, which `json.dumps` cannot serialize when `LeKiwiClient.send_action` ships them over ZMQ. Coerce each action value to a plain float before sending. This is scoped to the LeKiwi network client and does not affect any other robot. Co-authored-by: Steven Palma --- src/lerobot/robots/lekiwi/lekiwi_client.py | 4 ++++ src/lerobot/scripts/lerobot_replay.py | 1 + 2 files changed, 5 insertions(+) diff --git a/src/lerobot/robots/lekiwi/lekiwi_client.py b/src/lerobot/robots/lekiwi/lekiwi_client.py index 1bc3dadc4..2850842a2 100644 --- a/src/lerobot/robots/lekiwi/lekiwi_client.py +++ b/src/lerobot/robots/lekiwi/lekiwi_client.py @@ -323,6 +323,10 @@ class LeKiwiClient(Robot): np.ndarray: the action sent to the motors, potentially clipped. """ + # Action values may be torch tensors (e.g. replayed from a dataset) or numpy + # scalars; json.dumps only serializes Python primitives, so coerce each value to a + # plain float before sending. + action = {key: float(value) for key, value in action.items()} self.zmq_cmd_socket.send_string(json.dumps(action)) # action is in motor space # TODO(Steven): Remove the np conversion when it is possible to record a non-numpy array value diff --git a/src/lerobot/scripts/lerobot_replay.py b/src/lerobot/scripts/lerobot_replay.py index 1851f7c2b..b2ab2b731 100644 --- a/src/lerobot/scripts/lerobot_replay.py +++ b/src/lerobot/scripts/lerobot_replay.py @@ -61,6 +61,7 @@ from lerobot.robots import ( # noqa: F401 earthrover_mini_plus, hope_jr, koch_follower, + lekiwi, make_robot_from_config, omx_follower, openarm_follower,