Skip to content

The first exam for code agents in the physical world: frozen robot tasks from many benchmark suites, each answered with a program and verified in a separate sandbox. Runs on Harbor.

13.7 KB
Raw Blame

RoboPaint · acrylic stroke copy · Fine Wind, Clear Morning (after Hokusai) — frozen instance

You control a simulated Franka Panda arm holding a round acrylic brush via Python: ManiSkill 3.0.1 / SAPIEN 3.0.3 physics (PhysX on the CPU) for the robot; the paint is libmypaint's brush engine (MyPaint). Task (笔触临摹, stroke copy): copy the painting shown in the picture /app/target.png (a small acrylic painting after Katsushika Hokusai's woodblock print Fine Wind, Clear Morning (Red Fuji), c. 1830-32) onto the main sheet, in at most 407 strokes.

This is a fixed scene instance: you may reset and retry as many times as you want. Your deliverable is one replayable trajectory, not a general policy.

The brush, the paints and the sheets

  • The brush is a rigid handle with a 15 mm soft tuft (no collision; the handle hits the paper 15 mm below its surface); the robot's tool point (TCP) is the tuft's tip. Hold it vertical (as at the start).
  • Paints (every colour the painting needs, premixed): 10 wells on a plate on the robot's left (+y), in two rows, radius 12 mm, paint surface z = 0.028 m (plate top 0.026 m, rigid); s.wells() gives each well's name, colour and centre. Dipping = the tip inside a well's circle and below the paint surface: the brush is then loaded with that paint on a fresh brush (the previous paint is gone; no mixing on the palette, it never runs dry). The brush starts dry.
  • Sheets (surface z = 0.020 m): the main sheet, a 227.18 mm square centred at world (-0.100, 0.000), is scored; the practice sheet, 227.18 x 99.41 mm centred at (-0.100, -0.1856), is for test strokes and is never scored or counted.
  • How the paint goes on: at every physics step (100 Hz) the tip over a sheet is one motion event for libmypaint 1.6.1 with the mypaint-brushes preset tanda/acrylic-03-paint (dab size scaled to the paper): an opaque acrylic paint whose mark width follows the pressure (press depth / 15 mm): straight strokes at 40 mm/s are about 1.6 mm wide at a 1 mm press, 2.4 mm at 3 mm, 3.5 mm at 5 mm, 5.2 mm at 7 mm, 7.5 mm at 9 mm, 11 mm at 11 mm and 16 mm at 13 mm; the dabs also depend on the speed and direction and carry the engine's own jitter (deterministic); later strokes cover earlier ones. The engine is MyPaintPainter in /opt/tools/rcb_brush.py (+ /opt/mypaint). One continuous contact is one stroke; paint is permanent (only s.reset() clears it).
  • The arm is position-controlled (PD, 20 Hz targets): a moving target is followed with a lag of about 0.1 s.

Target and score

  • The target is this picture: /app/target.png (1024 x 1024 px, RGB) shows the exemplar at its true size and place on the main sheet: the image covers the main sheet exactly, 0.2219 mm per pixel. Pixel (column u, row v), counted from 0 at the image's top-left, has its centre at sheet millimetres X = (u + 0.5) · 227.18 / 1024, Y = (v + 0.5) · 227.18 / 1024 (X to the robot's right, Y towards the robot, origin = the sheet's far-left corner as seen from the robot's base), i.e. at world x = -0.100 + 0.1136 - Y/1000, y = 0.1136 - X/1000 (m) (s.geo.mm_to_world(X, Y)). Image top = the sheet's far edge (+x), image left = the robot's left (+y): the same orientation as s.canvas() and canvas_cam.
  • Before scoring, the main sheet is aligned with the picture: your painting is moved by the single translation (no rotation or scaling, one shift for the whole sheet, whole pixels up to 5 mm along each axis) that best matches the picture; every quantity below is taken after that shift, which is reported (register_dx_mm, register_dy_mm). If the best match lies at the 5 mm limit, no shift is applied.
  • The grader compares the main sheet with the picture: both blurred (σ = 1 mm); ΔE = the CIELAB colour difference (ΔEab) per pixel over the region where either has paint (dilated by 2 mm): its mean and 90th percentile; SSIM of the lightness L (σ 1.5 mm windows); edge correlation = the correlation of the lightness-gradient magnitudes of the two blurred pictures over that region; paint IoU of the painted areas (paint coverage ≥ 0.5); the number of strokes on the main sheet (painted contacts). Success iff, after the best single shift of the sheet, at most 5 mm along each axis, mean ΔE ≤ 2.0, p90 ΔE ≤ 6.0, SSIM ≥ 0.92, edge correlation ≥ 0.8, paint IoU ≥ 0.95 and at most 407 strokes. final_reward = max(0, 1 - mean ΔE / 20) (scaled by 407 / strokes above 407). Reported as well: the mean ΔE after a 4 mm blur, the SSIM at a 0.5 mm blur, and per colour region of the picture (the connected areas nearest to one paint, at least 30 mm²) the fraction within ΔE 10: the minimum and the area-weighted mean. s.score() returns exactly these metrics for the current sheet: a scoring service (a separate container) replays the actions you have executed since your last s.reset() and scores the resulting sheet.

Process rules

Paint with brush strokes, the way a person paints: each stroke is one sweep of the loaded brush, pressed for the width you want. Colouring in or filling areas with a thin line, zigzag or serpentine fills, and contour-offset fills (paths that circle round and round inside an area) are not allowed and fail the task, even when the sheet matches the picture. The grader checks this on the replayed trajectory with two numbers you can check yourself; only painted strokes on the main sheet count (the practice sheet is free):

  • Paint path budget: path_mm ≤ 51700 mm. path_mm is the total length of the brush tip's path while it presses on the main sheet with paint (all strokes together, sampled at every physics step). The strokes of our reference solution add up to 17225 mm; the budget is 3 times that, rounded up.
  • Strokes are sweeps: scribble_share ≤ 0.1. A stroke's scribble ratio is its length divided by the diagonal of its bounding box on the sheet (taken as at least 10 mm): about 1 for a straight or curved sweep, 2 for a sweep out and back along the same line, more for a zigzag, a back-and-forth fill, a spiral or a loop. scribble_share is the share of path_mm in strokes whose ratio is above 2.5.

Success iff the picture rule above holds and both process rules hold. final_reward = the continuous score above × min(1, 51700 / path_mm) × (1 − scribble_share when the second rule fails). s.score() reports path_mm, max_path_mm, scribble_share, scribble_max (the largest ratio of a stroke), longest_stroke_mm, image_success (the picture rule alone), strict_ok (the process rules) and success (all).

Deliverable

Write the final trajectory to /app/output/trajectory.npz with Session.save_trajectory(...) (below). It is replayed open-loop from the same initial state in two fresh processes; it succeeds if both replays meet the success rule above and end in exactly the same state. Also leave the script that produced it at /app/output/gen.py.

Tooling (already installed; run python from any directory)

from rcb_brush import Session
s = Session(instance="/app/instance.json")    # a few seconds; builds the scene in the frozen state
s.reset()                          # back to the initial state: blank sheets, dry brush, robot at its start pose (exact)
p = s.primitives()                 # thin wrappers of the low-level action; each has a docstring: help(p["move_tip"])
p["move_tip"](pos, quat_wxyz=None, speed=0.05, settle=0)   # straight-line tip move, one IK solve per control step
p["move_joints"](q7, max_dq=0.03, settle=0); p["hold"](10); p["set_joint_targets"](q7, steps=1)
q, ok, err = s.ik(pos, quat_wxyz=None); s.fk(q7); s.tip_down_quat(yaw)   # kinematics (default orientation: the start pose)
s.tip_pose(); s.joint_positions(); s.press_depth(); s.pen_down()        # measured state
s.wells(); s.sheet_facts()         # the paint wells; the two sheets (centre, size, raster, mm per px)
s.canvas(); s.canvas("practice")   # the exact sheet images, uint8 RGB (row 0 = far edge, col 0 = left edge seen from the base)
s.ink(); s.ink("practice")         # the exact paint coverage, float32 [0, 1] (the score uses >= 0.5)
s.score()                          # the grader's metrics for the main sheet (+ success, final_reward)
s.strokes()                        # realized strokes: sheet, inked, colour, 100 Hz samples (tip x, y, press, ...)
s.brush_state()                    # the paint on the brush now (None = dry)
s.target_image(); s.geo            # the target picture (target.png as an array); the main sheet's frame (mm_to_world, world_to_px, ...)
s.render_frame("canvas_cam")       # RGB uint8 of one camera: canvas_cam, practice_cam, scene_cam, side_cam ("canvas" / "practice": exact)
s.render_grid()                    # cameras + the exact main sheet tiled
s.step(action)                     # one low-level action (7 joint targets, rad) = one control step (1/20 s)
s.record_start(); ...; actions = s.record_stop()    # (T, 7) actions, one row per control step
s.status()                         # score + {'sim_steps', 'n_contacts', 'loaded', 'state_sha', 'n_dips', 'max_tilt_deg_in_contact', ...}
s.replay(actions)                  # resets, replays open-loop, returns status (identical to a fresh process)
s.save_trajectory(actions, "/app/output/trajectory.npz")
s.render_video(actions, "/app/output/check.mp4")   # replays from the frozen state and writes a tiled camera video
s.camera_info(); s.render_depth("canvas_cam")      # per camera: K, extrinsics, image size, mount (all static); z-depth (m) on
                                                   #   render_frame's pixels, 0 = no reading (geometry only: the paint never shows)
s.robot_spec(); s.kinematics_spec()                # the robot's spec sheet (joint limits, PD gains, rates, tool frame "tip");
                                                   #   what s.kinematics() answers (frames, IK defaults)
s.kinematics({"op": "fk", "q": q7}); s.kinematics({"op": "ik", "targets": {"tip": pose7}, "seed": q7})   # stateless FK / IK (world)
s.joint_velocities(); s.joint_efforts()            # measured joint velocities (rad/s); a PD drive-effort estimate (N m)
s.state_sha(); s.n_steps                           # the state hash the replays compare; control steps since the last reset
s.camera_params("canvas_cam"); p["get_tip_pose"](); p["get_joint_targets"]()   # one camera's calibration; = s.tip_pose(), s.hold_action()
from rcb_brush import quat_mul, quat_slerp, quat_to_mat   # WXYZ quaternion helpers

The primitives are deliberately thin (IK moves without collision checking, joint moves, hold); everything else is yours to build.

The grader replays in two fresh processes, each exactly this CLI (a fresh process, so run it to self-check): python /opt/tools/rcb_brush.py replay --instance /app/instance.json --traj /app/output/trajectory.npz

Conventions

  • World frame: z up, table top z = 0, the robot's base at (-0.615, 0, 0), x forward (away from the base), y to the robot's left. Quaternions are WXYZ. At the start the brush points straight down with the tip at about (0.000, 0.000, 0.108).
  • Action (7): panda_joint1..7 absolute joint-position targets (rad), ManiSkill's pd_joint_pos controller. s.hold_action() is the no-op. Control runs at 20 Hz (physics 100 Hz).
  • Your only budget is the time limit (## Time limit); there is no step budget. A runaway guard stops an episode at 72000 control steps (1 h of simulated time). Everything runs on the CPU except camera rendering.
  • The exemplar is this robot's painting after Katsushika Hokusai, Fine Wind, Clear Morning (c. 1830-32), a public-domain work (Wikimedia Commons File:Fine Wind, Clear Morning by Hokusai (Shimane Art Museum).jpg, Public domain); the exemplar picture is CC0; libmypaint is ISC, the mypaint-brushes presets CC0 (/opt/mypaint).

External material

You may install packages you need (pip, apt), and you may read anything installed in your container, the simulator's and this benchmark's own source code included. Please solve the task yourself: do not search the web for, or download, a ready-made solution to it, such as published or reference solutions, recorded demonstrations, or policies trained for it. This is an honour rule; trials are reviewed. The network reaches your model's API and the package registries (PyPI, Debian / Ubuntu archives) only.

Resources

Your container: 8 CPUs, 12 GiB of memory, 2048 processes and threads, 10 GiB of disk (new files under /app, /tmp and /root) and one GPU, 3 GiB of its memory. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: /run/rcb-limits/usage.json.

Time limit

You have 3600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task.

This is wall-clock time from the start of your session; the time a simulator takes to start counts. When it is up you are stopped without warning and only what is in /app/output/ at that moment is graded, so save a deliverable as soon as you have one and overwrite it whenever you have a better one. Your session started when you received this task. /run/rcb-limits/usage.json, rewritten every few seconds, gives the time left on this limit (time_left_s) and its end (deadline_utc), counted from a little before your session started, so it never gives you more time than you have: read it (or run date) before you decide that time is short, never guess. Waiting counts too: a tool call that sends input to a process that keeps running (an interactive interpreter, a simulator loop, a server) can wait for the whole wait or yield time you give it even when the answer is printed at once, so give such calls a short wait and poll again if the output is not complete, or run one-shot scripts that exit when they are done. Installing packages is not cheating (## External material above).