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.

17.4 KB
Raw Blame

Foosball: program play (match)

You play foosball against a scripted opponent (you are seat A). Table football on a physical table: you drive the four motorised rods of one team (goalkeeper rod with 3 figures, 2-rod 2, 5-rod 5, 3-rod 3) by slide and angle targets that the motors follow along a speed- and acceleration-limited path, and see the table only through an overhead camera; one game to 5 goals under the ITSF rules (opening sequence, possession time limits per rod, no spinning); in the match format the other team is a scripted computer team, in the duel format another player. This is Embodied Olympics task foosball-match-wallclock-program-standard (revision foosball-program-v2+core-0.2), one frozen instance: the scripted opponent at level 3, the world slowed S = 20 times; the seed is fixed and never shown. The simulator service is at http://localhost:8000.

Time

The world runs in real time at 1/S of real speed (S = timing.slowdown in game spec); your thinking costs game time. At the end of every unit the world freezes for the reviews.

Whenever the world freezes for a review (after every unit: a point, a shot, a heat; see game spec), send game ready "WHY" "PLAN" (a short review) before the next unit starts. Each review has a time limit: send game ready within 300 s of real time after the world freezes (timing.review_timeout_s in game spec), or your side loses the match (ready_timeout, a valid result, success 0, even when you are ahead). The world does not go on by itself after the limit: watch for the freeze (your program's log, game status) and review at once. Send game start within 1800 s of real time after the match service starts (start.window_s in game spec), or you lose the match (no_show, a valid result, success 0). The match does not run before that: read game spec and prepare your program first. The match is graded when your session ends: stay until it is over. If your session ends before the match is over, you lose the match (a valid result, success 0), also if you never sent game start.

Write a program

You may write a program that observes, measures in the images, computes your next action and sends it, without a new model response for each action. You stay in the loop: watch its log, and stop, fix and restart it whenever needed. Only you send game start and game ready.

  • Use only the camera images, the service's replies and this document; no simulator internals or hidden state.
  • One action at a time: an action sent before the previous one has returned is refused (HTTP 429).
  • Your container: Python 3.12 with numpy, SciPy and Pillow; the network reaches only your model's API and the package registries. Keep your scripts, logs and notes in /app/output/.

Interface

Use the game command, or the same calls as HTTP with JSON at http://localhost:8000/<SEAT>/ (your seat is $SEAT):

game command HTTP
game spec GET /spec the actions (types, fields, ranges), the cameras with their intrinsics, the rule constants
game status GET /status the current state, no image
game start POST /start {} you are ready; the match begins when every seat has started
game wait DT POST /wait {"dt": DT} let DT game seconds pass (0 < DT <= 1)
game observe POST /observe {} the state and the camera images (one PNG of tiles: observation.tiles)
game act JSON POST /act JSON one action
game ready "WHY" "PLAN" POST /ready {"why":"...","plan":"..."} your review after each of your actions

Errors: 400 = an invalid action (nothing happens), 409 = not now (not your turn, or a review is due), 429 = one action in flight, or more than 20 requests per second or 4 open requests from your seat (empty body: retry more slowly).

Rules

  • table football on a physical table: you drive the four motorised rods of one team (goalkeeper rod with 3 figures, 2-rod 2, 5-rod 5, 3-rod 3) by slide and angle targets that the motors follow along a speed- and acceleration-limited path, and see the table only through an overhead camera; one game to 5 goals under the ITSF rules (opening sequence, possession time limits per rod, no spinning); in the match format the other team is a scripted computer team, in the duel format another player.
  • real_time: this sport is real time (where the generic text above says otherwise, this line holds): game wait DT (POST /wait {"dt": DT}, 0 < DT <= 1) lets the world run DT game seconds; game ready "WHY" "PLAN" is due only after each rally, not after each action; acts are never out of turn, one in flight per seat (it may address several rods)
  • action: game act '{"type": "rods", "rods": {"midfield": {"slide": 0.03, "angle": 1.1, "omega": 40}, "goalie": {"slide": -0.05}}}' (POST /act with that body; "type" may be left out): new targets for any of your rods goalie, defence (2-rod), midfield (5-rod) and attack (3-rod); rods you do not name keep their targets. slide (m) moves the rod along your local v (0 = centre; within +-0.11 goalie, +-0.19 defence, +-0.06 midfield, +-0.11 attack); angle (rad) turns it (0 = figures hanging straight down, + = feet swing towards the opponent's goal, up to +-2.6; 1.5 is about level, so a ball passes underneath); optional omega (rad/s, at most 52) and speed (m/s, at most 2.0) cap the rod's angular and sliding speed for this target. Each rod follows a smooth path to the target (sliding at most 2.0 m/s and 40 m/s^2, turning at most 52 rad/s and 4000 rad/s^2) with limited force (60 N) and torque (5 N m); the rod itself never moves faster than 2.0 m/s or 52 rad/s (the top speeds of the KiRo table soccer robot), not even when the ball pushes it: a rod the ball held up catches up with its path at these speeds at most; an action takes effect 2 control steps (20 ms of game time) after it arrives: it reaches the motors 2 control steps after the control step that takes it (the reply's took_effect: taken_step, effect_step = taken_step + 2), and holds until replaced; the rods cannot make a full turn (stops at +-2.8 rad). Out of range: HTTP 400
  • format: first to 5 goals wins; every goal, possession-time foul, incomplete opening sequence, illegal spin, dead ball or ball off table ends a rally: the world freezes for the reviews, every rod returns to slide 0, angle 0, and the next rally starts with the restart; the game also ends after 240 s of play (frozen time does not count) or 40 rallies
  • kickoff: a rally starts with the ball at rest beside the central figure of the restart rod. The first kick-off is match.first_kickoff's (game spec); after a goal the team that conceded kicks off. Before the ball may leave the restart rod (the 5-rod, or the goalkeeper rod and 2-rod together), the restarting team must complete the opening sequence: a move by one figure, a contact by another figure, then a contact by any figure other than that second one (restart.opening_complete in the state). If the ball leaves first, the opponent gets the ball on its 5-rod (incomplete_opening). The world is not frozen during the opening
  • goal: the ball wholly over the goal line scores 1 point for the other team, whoever touched it last
  • possession: while the ball is within reach of a rod (a figure of it can touch the ball: within 0.077 m of the rod along u), that rod's possession clock runs; it restarts when the ball leaves the rod's reach. The goalkeeper rod and 2-rod count as one (the goalie rod). Limits: goalie rod 15 s, 5-rod 10 s, 3-rod 15 s. Over the limit is a foul: after the goalie rod or the 5-rod the opponent gets the ball on its 5-rod, after the 3-rod on its goalie rod. A foul gives no point
  • spinning: a transition (the ball leaving a rod's reach) after the rod turned more than 360 degrees before or after its contact is a foul (the opponent gets the ball on its 5-rod; a goal scored that way does not count); the rods' stops make a full turn impossible
  • dead_ball: a ball at rest for 1 s that no rod can reach is put back into play: between the two 5-rods by a kick-off (by the team that conceded the last goal, else the first kick-off's team), behind a 5-rod by the goalie rod of that half
  • ball_off_table: it goes to the goalie rod of the team that did not touch it last (a transparent cover 4 cm above the playfield normally keeps the ball on the table)
  • match_format: match: you are seat A (blue) against a scripted computer team (seat B, red) of level RCB_LEVEL 1-4 (match.opponent_level in game spec): it plays the same player policy as the reference player on the true ball position a reaction delay ago and never reads your commands; level 1 reacts after 140 ms (extrapolating the ball's motion over that time), slides at 0.6 m/s and kicks at 25 rad/s, shooting from every rod; level 2 after 110 ms (half the extrapolation), 1 m/s, 35 rad/s; level 3 after 90 ms, 1.6 m/s, 45 rad/s, aims past your figures, passes, lifts its rods out of its shots and splits the goal between goalkeeper and 2-rod; level 4 the same after 80 ms (the KiRo robot's reaction time; no level reacts faster) at the top speeds (2.0 m/s, 52 rad/s). Its rods are yours (the same top speeds). Success = winning the game
  • duel_format: duel: seat A (blue, defending the goal at world x = -0.60) against seat B (red, defending x = +0.60), identical rods and motors; FIRST_PLAYER has the first kick-off
  • observation: the state: your own rods (slide, angle, their velocities and the command at the motors), the score, fouls, the time of play and of the rally, the play time left, the referee's restart (which team and rod puts the ball into play, whether its opening sequence is complete) and the rallies that ended (last_rally, rallies: how, who scored or fouled, the restart); no ball or opponent coordinates and no seed. The image: one 384 x 240 RGB tile from the fixed overhead camera straight above the table centre at 1.45 m (32 degree vertical field of view; game spec camera / cameras), turned so that your own goal is on the left and the image's right and up are your local +u and +v. The ball is orange, seat A's figures blue, seat B's red, the rods grey; figures and rods can hide the ball
  • world: metres, seconds. World frame: x along the table (seat A's goal at x = -0.60, seat B's at x = +0.60), y across, z up, playfield z = 0 with its centre at (0, 0). Your local frame (the image, your rods, game spec geometry): u towards the opponent's goal, v to the left when you look along u (seat A: u = x, v = y; seat B: u = -x, v = -y)
  • table: playfield 1.20 x 0.68 m between side walls with rounded fillets (radius 0.02 m), goal mouths 0.20 m wide; ball radius 0.0175 m, 24 g, it rolls with little resistance (about 0.1 m/s^2), bounces off the walls and is stopped by a figure it runs into; a kick sends it off at about the foot's speed, at an angle when the foot hits it off centre. Rods 0.09 m above the playfield at u = -0.525 (your goalkeeper rod), -0.375 (2-rod), -0.075 (5-rod), 0.225 (3-rod), the opponent's at the negated u; figures at slide 0 (v): goalkeeper and 3-rod -0.20, 0, 0.20; 2-rod -0.12, 0.12; 5-rod -0.24, -0.12, 0, 0.12, 0.24; a foot is a capsule along u (radius 0.012 m, half length 0.014 m) 0.075 m below the rod. Physics 1000 Hz, control 100 Hz (10 ms steps)
  • Winner: the first player to score 5 goals wins; at the cap (240 s of play or 40 rallies) the player with more goals wins; at equal goals the player who scored the last goal; if nobody has scored, the player with the ball less time in its own half; last resort (not from the rulebook): the player who did not have the first kick-off. There are no draws.
  • Deviation D1 (rulebook 3): one game to 5 points instead of a match of several games (the points and games targets are set by the event)
  • Deviation D2 (rulebook 3, 7.1): a safety cap of 240 s of play or 40 rallies (the rulebook has no time limit); then the player with more goals wins, at equal goals the scorer of the last goal, at 0:0 the player with the ball less time in its own half, and if that is equal the player who did not have the first kick-off (the last resort; no draws)
  • Deviation D3 (rulebook 4, 5.1): the initial flip is the run-time parameter FIRST_PLAYER (who has the first kick-off); the referee places the ball at rest beside the central figure of the restart rod (its side and a few millimetres along the rod from the seed) and play starts when the reviews are in, instead of the ready protocol
  • Deviation D4 (rulebook 5.2, 5.3): no delay-of-game rule; the restart rod's possession clock already runs during the opening sequence (it starts with the possession clock figure)
  • Deviation D5 (rulebook 6, 7.1.1.1, 7.1.2, 17, 18): fouls are always given as the possession award (5-rod or goalie rod), without the non-offending team's option to continue, warnings, penalty shots or time-outs; the pause between points is the review
  • Deviation D9 (rulebook 7.2, 11, 12): the passing and wall rules and playing the ball dead are not judged (they need a referee's judgement of a stopped, pinned or intentional ball); the dead-ball restart for a ball at rest that no rod can reach is judged
  • Deviation D10 (rulebook - (embodiment, not from the rulebook)): the players are motorised rods after KiRo (University of Freiburg; T. Weigel, KiRo - a table soccer robot ready for the market, ICRA 2005), the table soccer robot that publishes the speeds of all its rods, on a table of KiRo's size (1.20 x 0.68 m): a rod slides at most 2.0 m/s and turns at most 52 rad/s (KiRo: up to 2 m/s, 3000 deg/s). The servo holds the rod itself within these speeds, also when it catches up with its path after the ball held it up, a safety net holds them against outside pushes too (D11), and no command can ask for more (speed <= 2.0, omega <= 52). KiRo's 2 m/s is an average rod speed, so capping the peak speed is stricter than KiRo. KiRo publishes no accelerations or motor forces: the path's 40 m/s^2 and 4000 rad/s^2 and the motors' 60 N and 5 N m are estimates. A full-speed kick sends the ball off faster than KiRo's shots (up to 3 m/s): 4.25 m/s on average in the upper-bound shot search, at most 5.4 m/s. Both teams, the scripted team too, have the same rods. A human player is not limited this way. Revision foosball-program-v2; v1 limited only the path (2.5 m/s, 80 rad/s) and the rods reached about 2.6 m/s and over 100 rad/s
  • Deviation D11 (rulebook - (simulation, not from the rulebook)): a temporary safety net of the simulation, not physics: a ball jammed between a foot, a side wall's rounded fillet and the cover gets contact forces of 100-230 N in the simulator, far beyond the motors (60 N, 5 N m) and unrealistic for a 24 g ball, and these pushed rods past their top speeds (with the servo alone: in 18 of 101 measured games, for a few ms, up to 58.7 rad/s and 2.11 m/s). After every 1 ms physics step a rod faster than its top speed is put back to it (and its position to where the top speed takes it); every such rod-step is counted in final.json (rod_speed_governed_steps; measured: the reference against the four levels, none in 58 of 80 games, 1-9 in the others). Open issue: fix the jammed-ball contact at its source, then remove the net

Geometry and physics

Everything you need is in game spec: the world frame, the release point, the cameras (pose, field of view, size, focal_px, principal_point_px; pinhole: u = cx + f * x_right / depth, v = cy - f * y_up / depth) and the execution scatter. The physics engine is mujoco (CPU, 1 kHz rigid bodies: a rolling, bouncing ball and 2 x 4 rods driven by force- and torque-limited motors).

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: 2 CPUs, 5 GiB of memory, 2048 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 14400 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 graded on what stands at that moment, as the sections above say. The service does not count this limit for you: the clocks it reports are the game's own. 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).