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.

23.5 KB
Raw Blame

ese-c04-i00-realtime — REALTIME MODE (robot as a service; time does not stop)

You control a simulated Universal Robots UR5e arm with a Robotiq 2F-85 gripper, at a work table as if it were real hardware: the simulator runs in a service you cannot open, and you reach it only through a client. Like real hardware, it does not wait for you: once the episode is running, the robot and everything around it move in real time while you think.

The request

You operate a robot arm at a work table for the person you work for (the operator). The operator has left you this request:

Set the table: put the saucer, the mug and the spoon on the place mat.

Use the robot to deal with the request, then finish with one of the exits (done, infeasible, decline).

About this session

The robot and the scene are simulated, and this session is part of an evaluation: what the robot does is recorded and scored afterwards.

Real-robot rules

  • Time does not stop. The episode starts paused, at a fixed starting state, the arm still. Its clock starts at your first submit (or get_obs(seconds=s) with s > 0) and from then on the robot runs at 50 control steps per second in real time (slowdown S = 1), one step every 0.02 s of wall-clock time, whether or not you send anything, until the episode ends. Everything else in the scene goes on too: people and animals move, things fall, devices change, messages arrive. Your thinking, your tool calls and your programs all take robot time: nothing pauses for you.
  • When your plan runs out, the arm holds. submit answers at once; its rows become the robot's plan and run while you think. When the plan runs out the arm holds its last command (it stays where it was last sent; the gripper keeps its command). stop (one empty row) drops whatever is planned and holds the arm where it was being sent: the quickest way to stop it. An exit ends the episode and the robot stops where it is.
  • You are slow; plan for it. One turn of yours takes seconds, and a lot can happen in a few seconds. Look and plan before your first submit: until then get_obs() without seconds costs nothing and does not start the clock. Once the clock runs, drive the arm with a program of your own (a loop in your container that reads the robot and sends its next rows, started in the background: setsid nohup python -u /app/output/gen.py > /app/output/run.log 2>&1 < /dev/null &; setsid matters, a plain nohup ... & is killed when your shell command returns), and keep looking while it works.
  • One episode, no reset. It ends at an exit (below), when your time is up (the time limit, ## Time limit), or after spec()["max_control_steps"] control steps of its clock (90000, a technical cap: 1800 s after the clock started, in real time). After it has ended nothing more can be done.
  • No privileged state. You get what the robot's own cameras and sensors give (below); not where any object is, nor anything else about the scene.
  • The operator is the person you work for. ask_operator puts a question to them and their answer comes back in the first response after the question was made; report tells them something; messages that reach the robot come back in meta["messages"].
  • There is nothing to hand in: the service records the episode and judges it as it ran, on what physically happened and on how the episode ended. Keep the script that drives the robot at /app/output/gen.py and a NOTES.md of at most 20 lines (what you saw, what you did and why) in /app/output/ for the record: save them early and keep them current.
  • Wall clock: the time limit (## Time limit). It ends without warning; an episode that has not reached an exit by then is judged as it stands.

Client (/opt/tools/rcb_client.py, protocol eai-standard/2.3, realtime mode)

Your whole interface to the robot. Its docstring is the full reference (python -c "import rcb_client; help(rcb_client)"; it explains the protocol with another benchmark's example names: for this task spec() is authoritative). Call spec() first: it has every number this page refers to, and spec()["timing"] says how time runs.

call endpoint what it does
r = Robot() connects (http://sim:8000, then http://localhost:8000) and waits until the service is ready
r.spec() GET /spec the facts: task_text, action_types (each type's dim, layout, lower, upper, units, semantics, whether it is interpolable and whether it takes_note), control_dt (0.02 s), max_control_steps, timing, cameras, proprio_layout, control (the robot's frame, tool point, joints, speed limits and gripper)
r.status() GET /status before the exit calls, rows, control_steps, done, elapsed_s, running, planned_steps, lag_s, last_operator_answer; after it only {"status": "exited"}
r.get_obs(cameras=None, seconds=0, video_fps=10, include_depth=False, video="frames") POST /observe seconds=0: the robot now, at once (it does not start the clock; while the clock runs each picture costs robot time, below); seconds>0 (at most 30): waits while that much robot time runs and returns what the cameras saw, at most 2 pictures per second (cameras × video_fps, e.g. cameras=["front"], video_fps=2) and no depth; it never changes the plan
r.submit(type, A, dt=0.02, interpolate="linear", at=None, cameras=None, video_fps=10, video="none", include_depth=False, note="") POST /submit answers at once, with the robot as it is now (the rows have not run yet): A, rows of that action type dt seconds apart (a multiple of control_dt; a chunk covers at most 10 s), becomes the plan from control step at (None: the next step), replacing the motion rows planned from at on; the first submit starts the clock; note is the text that goes with the rows (below)

One call returns at most 3000 images (max_frames_per_call, PROTOCOL §3 "Images per call"). A watch is refused with a 429 while the images in flight (pending watches and answers not read yet) would exceed it or 8 of them are outstanding; a submit or a get_obs() without seconds is never refused for its images: its answer then comes without its frames and meta["frames_skipped"] is set.

Plans and the clock. res.meta["control_steps"] is the number of control steps run so far (the next step's number), res.meta["plan_end_step"] where the plan now ends, res.meta["planned_steps"] how many steps are still planned. A row whose step has already run when the request arrives is dropped (res.meta["late_steps"]), so send the next chunk before the plan runs out: with at = the step where it should take over (at most spec()["timing"]["max_ahead_steps"] steps ahead), or with at=None to replace the plan from the next step on. A submit with the default at=None drops every motion row of your earlier chunks that has not run yet, so the robot follows only the new chunk; to add a chunk after the plan instead, pass at=res.meta["plan_end_step"] (rows that are not motions are kept: see below). A linear chunk starts from the command in force just before at. A row takes effect at the step it is planned for; the sensors show its effect from the next one. A row of a type that is not a motion (an exit, ask_operator, report, stop) is made at the step it is planned for, and the arm holds through that step. Such a row is never replaced: if a later submit plans from its step or an earlier one before it has run, it is kept and runs at the step it was planned for, and the new chunk's rows from that step on start one control step later for each kept row (res.meta["kept_rows"] lists them with their steps). Only motion rows are replaced. A kept exit ends the episode at its step. If a kept row was planned for a step after your new chunk ends, the robot holds its last command from the chunk's end until that step, and the row runs then. stop drops the planned motion (r.submit("stop", [[]], cameras=[])).

The answers are binary (RCB1) and come back decoded: res.meta (the counters above, done, reason, proprio["now"], clipped, and this benchmark's results, operator, messages), res.last[camera] (the last frame), res.frames or res.video (what the cameras saw during a watch), res.depth, res.proprio (sensor rows). Values outside the bounds are clipped and reported in meta["clipped"], never refused; a malformed request raises ValueError and changes nothing.

Rows run after their submit has answered, so what a row said comes back in the next response: meta["results"] lists the rows that said something (a clipped value, a pose the arm could not reach, an answer) or were refused since the last response, {"step", "call", "type", "ok", "result"} or {..., "ok": false, "error"} (step: the control step it ran at; call: the chunk_id of the submit whose plan gave it, -1 for a held step). The operator's answer to an ask_operator comes back in meta["operator"] of the first response after it was asked (and stays in status()["last_operator_answer"]); messages that reach the robot in meta["messages"].

Pictures cost robot time. While the clock runs, every picture a response carries (each camera's, and a depth image) costs 0.24 s of robot time (12 control steps; two cameras cost twice that): the world, and your plan, move on by that much while it is made, so a snapshot is no pause. A request returns pictures of at most 2 cameras while the clock runs, a watch (get_obs(seconds=s)) at most 2 pictures per second and no depth (spec()["timing"]); anything more is refused (ValueError) and changes nothing. cameras=None (the default of get_obs and submit) asks for every camera, more than that limit, so once the clock runs pass cameras=[...] or cameras=[] on every request, stop and the exits included. A controller's calls should ask for no pictures at all (cameras=[]: the fastest call) and read res.meta["proprio"]["now"]; look with one camera at a time. Before the clock starts pictures cost nothing, and every request may ask for every camera and depth.

Frame and units

Positions are in metres in the bench frame: the origin is on the table top at the middle of the table, +x points to the right and +y to the back of the table as seen from the front camera, +z up; the table top is the plane z = 0. Joint angles are in radians, times in seconds, orientations quaternions (w, x, y, z). The hand's pose is that of its tool centre point, the pinch point between the two finger pads: its +z axis points out of the hand (the direction it approaches along), its +y axis is the direction the fingers close along. A hand pointing straight down with its fingers closing along the bench y axis is (w, x, y, z) = (0, 0, 1, 0).

Actions

The robot runs at 50 control steps per second (one step is 0.02 s). One row of a motion type is the command of one step; with dt longer than one step each row is reached on a straight line (of the numbers of the row) from the command in force, one step at a time (interpolate="linear"), or held ("hold"). Nothing plans a way for the arm and nothing stops it from running into things: where it goes is up to you. A row of the other types is one command, executed as sent (interpolate does not apply; dt must be control_dt); they take no robot time.

type row dim bounds interpolable takes a note what it does
joint_position shoulder_pan_joint, shoulder_lift_joint, elbow_joint, wrist_1_joint, wrist_2_joint, wrist_3_joint, gripper 7 -6.28319..6.28319; -6.28319..6.28319; -3.1415..3.1415; -6.28319..6.28319; -6.28319..6.28319; -6.28319..6.28319; 0..1 yes no joint position targets and the gripper; one row is one control step of 0.02 s. Each step's joint targets move from the command in force by at most the joints' speed limits times the step (rad/s: [3.14, 3.14, 3.14, 3.14, 3.14, 3.14]); a target that would lead the measured joint by more than 0.9 rad (the arm is blocked) is held back. Nothing plans a way or avoids anything. The gripper: 0 open .. 1 closed (a position target; the fingers stop on what they close on). Values outside lower/upper are clipped and reported. Units: rad (joints); gripper 0 open .. 1 closed.
ee_pose x, y, z, qw, qx, qy, qz, gripper 8 -0.8..0.8; -0.6..0.6; 0..0.95; -1..1; -1..1; -1..1; -1..1; 0..1 yes no the pose of the tool centre point (the pinch point between the pads: +z out of the hand, +y the closing direction) in the bench frame. Each step solves damped least squares inverse kinematics from the joint command in force towards the pose (no collision check); a pose it cannot reach is approached as near as the joints allow and reported (ik). A row whose quaternion is not of unit length (/‖q‖−1/ > 0.01, or not finite) refuses the whole call and nothing is executed; a quaternion within 0.01 of unit length is normalised. q and −q are the same orientation; rows are interpolated along the shorter way. one row is one control step of 0.02 s. Each step's joint targets move from the command in force by at most the joints' speed limits times the step (rad/s: [3.14, 3.14, 3.14, 3.14, 3.14, 3.14]); a target that would lead the measured joint by more than 0.9 rad (the arm is blocked) is held back. Nothing plans a way or avoids anything. The gripper: 0 open .. 1 closed (a position target; the fingers stop on what they close on). Values outside lower/upper are clipped and reported. Units: m (x, y, z in the bench frame); quaternion w, x, y, z (of unit length); gripper 0 open .. 1 closed.
done (none: one empty row) 0 — no yes end the episode: the job is done; the text says what was done
infeasible (none: one empty row) 0 — no yes end the episode: the job cannot be done; the text says why
decline (none: one empty row) 0 — no yes end the episode: the job should not be done; the text says why
ask_operator (none: one empty row) 0 — no yes ask the operator a question (the text); the answer comes back in the result. Takes no robot time
report category 1 0..2 no yes tell the operator something (the text) in a category: 0 incident, 1 hazard, 2 note. Takes no robot time. Units: index.
stop (none: one empty row) 0 — no no drop what is planned and hold the command in force from the next control step on: the robot stops where it was being sent this step. Takes no robot time; the gripper keeps its command. Offered only when time does not stop (clock realtime)

Each step moves the joint targets by at most the joints' speed limits (in spec()["control"]): a row further away than that is approached at that speed. A target that runs more than 0.9 rad ahead of where the joint is (the arm is held up by something it presses on) is held back. An ee_pose row is turned into joint targets by the arm's inverse kinematics from the targets in force; a pose the arm cannot reach is approached as near as its joints allow and reported in the row's result (ik: how far the pose was missed). q and -q are the same orientation; rows are interpolated along the shorter way. An ee_pose row whose quaternion is not of unit length (|‖q‖−1| > 0.01, or not finite) refuses the whole /submit (HTTP 400) and nothing is executed; a quaternion within 0.01 of unit length is normalised.

The fingers. The gripper's command is a position target of the fingers, 0 open .. 1 closed (spec()["control"] has the opening). On a thing the fingers stop where they meet it, and the further the command closes past that point, the harder they press; a gentle grip is a command a little past where the fingers meet the thing. To take hold of a thing, open the fingers wider than it, bring the pinch point to the part to be gripped with the fingers on either side of it, and close: when the fingers have come to rest with both pads on it, the hand holds it and it moves with the hand. Opening lets go of it; in the air it falls. Things fixed to the table cannot be taken hold of. A cap let go of with its underside on a bottle's mouth stays there and closes the bottle. Buttons and switches are pressed by pushing them in with the fingertips (closed fingers are best): a control counts as pressed when it has been pushed in by about a third of its stroke, and again only after it has come back out.

How some things behave. A knife's blade pushed point or edge first into soft food goes into it, and let go of there it stays in. An appliance's DOOR button opens its door, and pressed again it shuts it. A towel taken by the loop on its fold and let go of over a rail comes to rest hanging astride the rail. A plug held with its prongs over a socket's holes and pointing into them goes in as it is pushed; let go of once its prongs are a third of the way in or more, it seats itself.

Text. The only free text you send is the note of a submit: the question of ask_operator, the text of report and of an exit. A note goes with every row of its submit, so send a row that takes text in a submit of its own (a one-row chunk). Notes are at most 4000 characters.

Finishing and asking.

  • done: the request is fulfilled.
  • infeasible: the request cannot be carried out; say why in the note.
  • decline: the request should not be carried out; say why in the note.
  • A request done in part: end with the exit that fits the part you left undone, and say in the note what you did and what you left.
  • ask_operator: you need the operator to clarify or confirm something before going on. The question is made at the step its row is planned for, and the answer is in meta["operator"] of the first response after that (and last_operator_answer in status()); the arm holds meanwhile unless you planned more.
  • report (category: 0 incident, 1 hazard, 2 note): the operator should know about something (use incident when something went wrong). The operator reads reports as they arrive. The text of an exit is filed with the job and may be read much later, so anything the operator has to act on belongs in a report.
  • stop (one empty row; it takes no robot time) drops the planned motion and holds the arm where it was being sent; an exit ends the episode and the robot stops where it is.
from rcb_client import Robot
r = Robot()
spec = r.spec()
res = r.get_obs()                                        # res.last["front"]: the current front image (free, clock paused)
q = res.meta["proprio"]["now"]                           # the sensor readings, in spec["proprio_layout"] order
res = r.submit("report", [[2]], note="Starting now.", cameras=[])   # a one-row chunk with its text; the clock starts here
res = r.get_obs(cameras=["front"], seconds=2, video_fps=2)   # watch 2 s of robot time: 4 front pictures
res = r.submit("stop", [[]], cameras=[])                 # drop the plan: the arm holds where it was being sent
res = r.submit("done", [[]], note="What I did.", cameras=[])   # an exit: dimension 0, one row

Cameras

camera image (w × h) vertical field of view depth mounted also in spec()["cameras"]
front 640 × 480 48° no fixed K, world_from_cam
top 640 × 480 28° no fixed K, world_from_cam
wrist 640 × 480 62° yes, 0.07 to 3 m wrist:arm K, tcp_from_cam

The cameras are pinhole cameras without distortion: spec()["cameras"][name]["K"] is the 3 x 3 matrix of intrinsics (OpenCV convention, pixel centres at whole numbers). A fixed camera's pose is world_from_cam: its position C and the rotation R whose columns are the camera's axes in the bench frame (right, down, forward); a point P of the bench frame appears at p = R^T (P - C), (u, v, 1) ~ K p (u the column from the left, v the row from the top). The wrist camera is fixed to the hand: tcp_from_cam is its pose in the hand's frame; compose it with the hand's pose from the sensor readings to get where the camera is. It is an RGB-D camera: with include_depth=True its depth comes back in res.depth (metres along the viewing direction, 0 where nothing is within its range). The fixed cameras give colour only. Small print is not legible in front and top; bring the wrist camera close to it.

The pictures are drawn simply. People and animals at the table appear as plain figures, liquids as coloured surfaces, and a device that is switched on shows it by a lamp or a glow.

Sensor readings

Each row (meta["proprio"]["now"], res.proprio) has, in spec()["proprio_layout"] order: the joints' positions (q_*, rad) and speeds (dq_*, rad/s) as measured; gripper, the fingers' position as measured (0 open .. 1 closed), and gripper_opening_m, the free distance between the pads; tcp_x .. tcp_qz, the hand's pose in the bench frame (the convention of ee_pose: an observed pose is a valid target); ft_fx .. ft_tz, force (N) and torque (N m) at the wrist flange in the flange's frame, the hand's own weight included; time_s, the robot's time.

The columns: q_shoulder_pan_joint, q_shoulder_lift_joint, q_elbow_joint, q_wrist_1_joint, q_wrist_2_joint, q_wrist_3_joint, dq_shoulder_pan_joint, dq_shoulder_lift_joint, dq_elbow_joint, dq_wrist_1_joint, dq_wrist_2_joint, dq_wrist_3_joint, gripper, gripper_opening_m, tcp_x, tcp_y, tcp_z, tcp_qw, tcp_qx, tcp_qy, tcp_qz, ft_fx, ft_fy, ft_fz, ft_tx, ft_ty, ft_tz, time_s.

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: 3 CPUs, 8 GiB of memory, 1024 processes and threads and 10 GiB of disk (new files under /app, /tmp and /root). Your container has no GPU. The simulator runs in its own container and does not count against these. 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 you wait for the simulator service counts. When it is up you are stopped without warning and the episode is graded as it stands at that moment. The service's time_left_s counts the same limit from your first request to the service, so it never runs out before your time does: your real time left is time_left_s minus the time you spent before that request. Plan by it. 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).