hylo.codeagents.replay_data¶
Package: hylo-code-agents · Core contracts
replay_data ¶
Recordings for the replay-to-sim workflow (RFC-0006 part 8): one camera's video plus whatever the source knows.
A Recording is the common input of every replay step: RGB frames and times, and when the source has them depth,
intrinsics, the camera pose, the robot's joint positions, TCP poses (hylo.core.robot convention: +x approach, +y
closing axis, origin between the pads) and gripper opening (1 open, 0 closed), the task text, and for our own
simulated episodes ground truth (object poses and sizes, segmentation, success) used only for evaluation.
Sources (load_source):
DIR a saved recording (DIR/recording.npz + DIR/recording.json)
panda:TASK:SEED record an episode now: mujoco.panda_table with its privileged oracle, RGB-D camera on
hf:REPO:EPISODE one episode of a LeRobot dataset on Hugging Face (fetched by replay_fetch.py in its own uv
environment), converted with a profile: libero, droid or video (camera images only)
FILE.mp4 | FRAME_DIR a video (e.g. a human hand demonstration); the hand becomes a parallel gripper later
Profiles say how a dataset's state maps to the robot: LIBERO (robosuite Panda: eef position, axis-angle, two finger positions; world frame with the robot base at about (-0.66, 0, 0.912)), DROID (Franka: end-effector position and XYZ Euler angles in the robot base frame, gripper position 0 open .. 1 closed).
EE_Z_APPROACH
module-attribute
¶
PROFILES
module-attribute
¶
PROFILES: dict[str, dict[str, Any]] = {'libero': {'convert': _libero, 'agent': 'panda', 'rotate180': False, 'frame': 'robot_world', 'base': pose(None, [-0.66, 0.0, 0.912]), 'max_opening': 0.08, 'notes': 'LIBERO (robosuite) Panda; eef pose in the LIBERO world frame; base pose fitted by IK; images of physical-intelligence/libero are already upright (pass rotate180 for raw LIBERO renders)'}, 'droid': {'convert': _droid, 'agent': 'panda', 'rotate180': False, 'frame': 'robot_base', 'base': np.eye(4), 'max_opening': 0.085, 'notes': 'DROID Franka with a Robotiq 2F-85; end-effector pose in the base frame'}, 'video': {'convert': None, 'agent': 'hand', 'rotate180': False, 'frame': 'camera', 'base': None, 'max_opening': 0.08, 'notes': 'camera images only; a human hand is tracked and retargeted'}}
Recording
dataclass
¶
Recording(name: str, rgb: ndarray, time: ndarray, instruction: str = '', agent: str = 'panda', depth: ndarray | None = None, K: ndarray | None = None, T_world_cam: ndarray | None = None, q: ndarray | None = None, tcp: ndarray | None = None, gripper: ndarray | None = None, gripper_cmd: ndarray | None = None, base: ndarray | None = None, meta: dict[str, Any] = dict(), gt: dict[str, Any] | None = None)
One recorded episode. Arrays are per frame (T). Poses are 4x4 in the replay world (metres, +z up), except
where meta["frame"] says the robot data is in its own base frame (external datasets before registration).
subsample ¶
Every step-th frame (and at most max_frames): the copy shares no arrays with self.
euler_xyz_to_R ¶
Extrinsic X, then Y, then Z (R = Rz Ry Rx), as DROID stores end-effector orientation.
fetch_lerobot ¶
fetch_lerobot(repo: str, episode: int, camera: str, out: str | Path, *, rotate180: bool = False, fps: float | None = None, max_frames: int | None = None, timeout: float = 3600) -> Path
Run replay_fetch.py in its own uv environment; returns the folder with recording.npz and source.json.
from_video ¶
from_video(path: str | Path, *, fps: float | None = None, max_frames: int | None = None, size: int | None = 480, instruction: str = '', licence: str = 'unknown') -> Recording
A video file or a folder of images (a human demonstration).
record_panda ¶
record_panda(task: str, seed: int, *, width: int = 400, height: int = 300, camera: str = 'front', every: int = 2, max_steps: int | None = None, extra_steps: int = 10) -> Recording
Record one mujoco.panda_table episode solved by oracle.panda_table (privileged): the camera's RGB-D and
segmentation, joint positions, measured and commanded hand, TCP, and ground-truth object poses every every
control steps. Needs an OpenGL backend for the camera (MUJOCO_GL=osmesa on a CPU).
load_source ¶
load_source(source: str, *, work: str | Path, profile: str | None = None, camera: str | None = None, fps: float | None = None, max_frames: int | None = None) -> Recording
A Recording from a source string (see the module doc).
main ¶
python -m hylo.codeagents.replay_data record TASK SEED OUT (records one of our Panda episodes)