Skip to content
Spacefolder Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Correct a robot placement

Navigation quality, TypeScript SDK example and recorded choice for the robotics benchmark.

KPI · Placement success probability minus contact probability.

Navigation score by prior navigations per World.

After 1,000 navigations per World

Spacefolder chose the highest-value action on 83 of 96 held-out navigations.

Approach Expected utility Score / 100
Spacefolder 0.589 98.25
Vector search + SQL for matching situations¹ 0.589 98.25
SQL for all situations¹ 0.448 68.53
First listed action 0.086 0.00
Ground truth 0.597 100.00

¹ Stack analogies. The replay averaged each action’s outcomes in memory, grouping by exact situation for the first baseline and pooling all situations for the second.

TypeScript SDK example

TypeScript SDK · Navigate API

import { SpacefolderClient } from "@spacefolder/sdk";

const sf = new SpacefolderClient();
const navigation = await sf.navigate({
  nav_id: crypto.randomUUID(),
  world_id: "robotics_example",
  entity_type: "task_attempt",
  entity_id: "placement-042",
  context: { scene: "Part displaced mainly along the fixture x axis" },
  actions: {
    no_action: {"name": "decision.configuration_retained", "data": {}},
    correct_x: {"name": "robot.pose_correction", "data": {"frame": "fixture", "translation_m": {"x": -0.002, "y": 0, "z": 0}}},
    correct_xyz: {"name": "robot.pose_correction", "data": {"frame": "fixture", "translation_m": {"x": -0.002, "y": 0.001, "z": -0.0005}}},
    adjust_grasp: {"name": "robot.grasp_correction", "data": {"grasp_id": "grasp-7", "gripper_width_m": 0.03, "grip_force_n": 9.0}},
  },
  predictions: {
    success: {"event": "task.succeeded", "horizon": "5s"},
    contact: {"event": "safety.contact_detected", "horizon": "5s"},
  },
});

let chosen: string | undefined;
let best = -Infinity;
for (const action of ["no_action", "correct_x", "correct_xyz", "adjust_grasp"] as const) {
  const success = navigation.actions?.[action]?.predictions.success;
  if (!success || !("probability" in success) || typeof success.probability !== "number") continue;
  const contact = navigation.actions?.[action]?.predictions.contact;
  if (!contact || !("probability" in contact) || typeof contact.probability !== "number") continue;
  const utility = success.probability - contact.probability;
  if (utility > best) {
    best = utility;
    chosen = action;
  }
}
console.log(JSON.stringify({ chosen }, null, 2));

Example output

Part displaced mainly along the fixture x axis

{
  "chosen": "correct_x"
}

Dispatch the controller-permitted correction in the virtual workcell. Attribute placement and contact observations to the same attempt over five seconds.