hylo.codeagents.scene_free_check¶
Package: hylo-code-agents · Core contracts
scene_free_check ¶
The checker for free-form scene programs (hylo.freescene/v0.1, env mujoco.free_scene).
report = check_free_scene("runs/scenes_free/cable/scene.py")
report.ok, report.text()
A free scene has no schema to validate against and no predicate language to reason about, so the checks are behavioural: build it, run it, and try to satisfy it. Stages, in order (later ones need the earlier ones to pass):
- program the source passes the scene-program allow-list (validate_scene_program, below) and defines ROBOT, INSTRUCTION, build(scene) and success(sim)
- load the environment builds the scene with the robot and compiles it (build errors, MuJoCo compiler errors, actuators or keyframes added, randomize errors come back with the program's own lines)
- physics per seed: no deep start overlaps (scene-scene, scene-table, scene-robot at its home posture); 2 s of doing nothing: the simulation does not diverge, nothing falls off the table, rigid bodies stay within 2 cm and 10 degrees, cable nodes and cloth vertices within 5 cm, joints stay put, and nothing is still moving at the end; success(sim) runs, returns a bool, is False at the start and stays False
- reach on the settled state, with hylo-manip's IK on the robot's RobotSpec: every movable thing (free body, cable, cloth, hinged or sliding part) has a point some arm reaches with a top-down or side approach and a pre-pose 8 cm back, and so does every point the program's targets(sim) names
- satisfiable demo(sim) runs with invisible hands (physics only, the robot holds still) and success(sim) becomes True during it or after the hands let go; every point a hand grabbed is reachable by an arm. Without a demo the stage is a warning ("unverified")
What it cannot verify: that the success function means what the instruction says (a demo that satisfies a wrong function passes), that a real gripper (rather than an invisible hand) can hold a thin cable or a cloth corner, and that both arms can act at once where a task needs two hands at the same time (each point is checked on its own).
SCENE_DENIED_ATTRS
module-attribute
¶
SCENE_DENIED_ATTRS = DENIED_ATTRS | {'from_file', 'to_file', 'from_zip', 'to_zip', 'from_xml_path', 'from_binary_path', 'mj_saveLastXML', 'mj_saveModel', 'mj_loadXML', 'mj_loadModel', 'mj_printModel', 'mj_printData', 'mj_printSchema', 'viewer', 'rollout', 'plugin_paths', 'mj_loadPluginLibrary', 'mj_loadAllPluginLibraries'}
FreeSceneChecker ¶
FreeSceneChecker(seeds: Sequence[int] = (0, 1, 2), settle_s: float = 2.0, reach: bool = True, satisfiable: bool = True, timeout_s: float = 600.0, env_type: str = FREE_ENV)
Checks scene programs; one environment per program (built through the registry, cameras off).
validate_scene_program ¶
Parse and check a scene program; raises CodeRejected listing the problems.
program_declarations ¶
The literal declarations and the defined functions of a scene program (without running it).
movable_points ¶
Sample points of everything a robot could move: free bodies (centre and top), jointed parts (centre), cables (both ends and the middle), cloth / flex (corners of its extent and its centre).
motion_problems ¶
motion_problems(start: dict, end: dict, mark: dict | None, tag: str, settle_s: float) -> list[Problem]
What moved, fell or drifted between two privileged states of a free scene.
summary ¶
A compact picture of the settled scene for the author: bodies (centre, extent), cable ends, flex extents, joint values.