Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Project Specific
scripts/benchmark/self_collision/cache/
scripts/playground/recordings/
.worktrees/
runs/
MUJOCO_LOG.TXT

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
1 change: 0 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

- Write the simplest correct code.
- Use straightforward control flow.
- Minimize lines of code. Fewer lines is a goal.
- Keep answers and explanations as SHORT and SIMPLE as possible.

2. Validate every change
Expand Down
60 changes: 37 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://github.com/openrobokit/robokit"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/robokit-banner.webp" alt="RoboKit" width="100%"></a>
<a href="https://github.com/openrobokit/robokit"><img src="https://openrobokit.com/assets/docs/robokit/assets/robokit-banner.webp" alt="RoboKit" width="100%"></a>
</p>

<p align="center">
Expand All @@ -14,48 +14,62 @@ that compose freely. Built-in tasks such as IK, motion planning, and retargeting
real robots.

<p align="center">
<a href="https://github.com/openrobokit/robokit"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/robokit-teaser.webp" alt="Thousands of robots solving in parallel" width="100%"></a><br>
<a href="https://github.com/openrobokit/robokit"><img src="https://openrobokit.com/assets/docs/robokit/assets/robokit-teaser.webp" alt="Thousands of robots solving in parallel" width="100%"></a><br>
<em>Thousands of robots solving in parallel.</em>
</p>

## Benchmarks

<p align="center">
<a href="https://github.com/openrobokit/robokit"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/robokit-benchmarks.webp" alt="RoboKit speedups: IK 12× vs PyRoKi; motion planning 3.5× vs cuRobo; hand retargeting 27× vs PyRoKi; humanoid retargeting 4× vs GMR; physics retargeting 2.8× vs SPIDER; grasp synthesis 60× vs Dex1B; rendering calibration 57× vs EasyHEC on the easy split." width="100%"></a>
<a href="https://github.com/openrobokit/robokit"><img src="https://openrobokit.com/assets/docs/robokit/assets/robokit-benchmarks.webp" alt="RoboKit speedups: locomotion MPC 3.4× vs DIAL-MPC; IK 12× vs PyRoKi; motion planning 3.5× vs cuRobo; hand retargeting 27× vs PyRoKi; humanoid retargeting 4× vs GMR; physics retargeting 3.5× vs SPIDER; grasp synthesis 60× vs Dex1B; RL time to score 1.7× vs mjlab; rendering calibration 57× vs EasyHEC on the easy split." width="100%"></a>
</p>

Bars are wall-clock time on the same task, baseline normalized to full width.
Check the paper for benchmark details.

## Optimization with Simulation
## Optimization/Learning with Simulation

<table>
<tr>
<td width="33%" valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/08_sharpa_pen.py"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/simulation/pen.webp" alt="Pen Spinning" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/08_sharpa_pen.py">Pen Spinning</a></strong> A Sharpa hand spins a pen in its fingers.
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/rl/14_nist_assembly.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/nist.webp" alt="NIST Assembly" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/rl/14_nist_assembly.py">NIST Assembly</a></strong> <code>RL</code> A Franka puts six NIST board parts in place, one after another (3&times; speed).
</td>
<td width="33%" valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/07_leap_cube.py"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/simulation/cube.webp" alt="Cube Rotation" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/07_leap_cube.py">Cube Rotation</a></strong> A LEAP hand turns a cube to random goals.
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/07_sharpa_pen.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/pen.webp" alt="Pen Spinning" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/07_sharpa_pen.py">Pen Spinning</a></strong> <code>MPC</code> A Sharpa hand spins a pen in its fingers.
</td>
<td width="33%" valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/03_xhand_arctic_articulated.py"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/simulation/notebook.webp" alt="Notebook Opening" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/03_xhand_arctic_articulated.py">Notebook Opening</a></strong> Two XHands open a hinged ARCTIC notebook.
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/04_g1_carry.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/g1-box.webp" alt="Box Carrying" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/04_g1_carry.py">Box Carrying</a></strong> <code>MPC</code> A G1 lifts and carries a box.
</td>
</tr>
<tr>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/05_g1_carry.py"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/simulation/g1-box.webp" alt="Box Carrying" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/05_g1_carry.py">Box Carrying</a></strong> A G1 lifts and carries a box.
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/rl/02_rough_joystick.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/go1-rough.webp" alt="Rough Terrain" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/rl/02_rough_joystick.py">Rough Terrain</a></strong> <code>RL</code> A Go1 walks up and down stairs, following the green velocity command.
</td>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/04_g1_climb.py"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/simulation/g1-climb.webp" alt="Climbing" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/04_g1_climb.py">Climbing</a></strong> A G1 climbs a box on hands and knees.
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/10_wuji_cube.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/wuji-cube.webp" alt="Cube Turning" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/10_wuji_cube.py">Cube Turning</a></strong> <code>MPC</code> A palm-up Wuji hand tumbles a cube through 90&deg; turns.
</td>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/11_go2_jump.py"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/simulation/go2.webp" alt="Jumping" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/11_go2_jump.py">Jumping</a></strong> A Go2 lands four 40 cm jumps on target footholds.
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/03_g1_climb.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/g1-climb.webp" alt="Climbing" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/03_g1_climb.py">Climbing</a></strong> <code>MPC</code> A G1 climbs a box on hands and knees.
</td>
</tr>
<tr>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/rl/03_lift.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/lift.webp" alt="Lift" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/rl/03_lift.py">Lift</a></strong> <code>RL</code> A YAM arm carries a cube to target positions (red dot).
</td>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/02_xhand_arctic.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/notebook.webp" alt="Notebook Opening" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/02_xhand_arctic.py">Notebook Opening</a></strong> <code>MPC</code> Two XHands open a hinged ARCTIC notebook.
</td>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/12_go2_jump.py"><img src="https://openrobokit.com/assets/docs/robokit/assets/simulation/go2.webp" alt="Jumping" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/sim_mpc/12_go2_jump.py">Jumping</a></strong> <code>MPC</code> A Go2 lands four 40 cm jumps on target footholds.
</td>
</tr>
</table>
Expand All @@ -65,37 +79,37 @@ Check the paper for benchmark details.
<table>
<tr>
<td width="33%" valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/ik.md"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/built-in-tasks/ik.webp" alt="IK" width="100%"></a><br>
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/ik.md"><img src="https://openrobokit.com/assets/docs/robokit/assets/built-in-tasks/ik.webp" alt="IK" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/ik.md">IK</a></strong> Multi-link targets, fixed or floating base.
</td>
<td width="33%" valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/motion_planning.md"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/built-in-tasks/motion-planning.webp" alt="Motion Planning" width="100%"></a><br>
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/motion_planning.md"><img src="https://openrobokit.com/assets/docs/robokit/assets/built-in-tasks/motion-planning.webp" alt="Motion Planning" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/motion_planning.md">Motion Planning</a></strong> Collision-free trajectories, offline or online.
</td>
<td width="33%" valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/hand_eye_calibration.md"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/built-in-tasks/hand-eye-calibration.webp" alt="Hand-Eye Calibration" width="100%"></a><br>
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/hand_eye_calibration.md"><img src="https://openrobokit.com/assets/docs/robokit/assets/built-in-tasks/hand-eye-calibration.webp" alt="Hand-Eye Calibration" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/hand_eye_calibration.md">Hand-Eye Calibration</a></strong> Camera pose from rendered robot masks.
</td>
</tr>
<tr>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/humanoid_retargeting.md"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/built-in-tasks/humanoid-retargeting.webp" alt="Humanoid Retargeting" width="100%"></a><br>
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/humanoid_retargeting.md"><img src="https://openrobokit.com/assets/docs/robokit/assets/built-in-tasks/humanoid-retargeting.webp" alt="Humanoid Retargeting" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/humanoid_retargeting.md">Humanoid Retargeting</a></strong> Human motion capture to a humanoid.
</td>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/hand_retargeting.md"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/built-in-tasks/hand-retargeting.webp" alt="Hand Retargeting" width="100%"></a><br>
<a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/hand_retargeting.md"><img src="https://openrobokit.com/assets/docs/robokit/assets/built-in-tasks/hand-retargeting.webp" alt="Hand Retargeting" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/docs/guide/hand_retargeting.md">Hand Retargeting</a></strong> Human hand motion to a robot hand.
</td>
<td valign="top">
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/grasp/"><img src="https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/built-in-tasks/grasp-optimization.webp" alt="Grasp Optimization" width="100%"></a><br>
<a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/grasp/"><img src="https://openrobokit.com/assets/docs/robokit/assets/built-in-tasks/grasp-optimization.webp" alt="Grasp Optimization" width="100%"></a><br>
<strong><a href="https://github.com/openrobokit/robokit/blob/main/src/robokit/examples/grasp/">Grasp Optimization</a></strong> Force-closure grasps for any hand or body.
</td>
</tr>
</table>

## How it works

[![RoboKit framework](https://raw.githubusercontent.com/openrobokit/robokit/main/docs/assets/robokit-framework.webp)](https://github.com/openrobokit/robokit)
[![RoboKit framework](https://openrobokit.com/assets/docs/robokit/assets/robokit-framework.webp)](https://github.com/openrobokit/robokit)

| Component | Role | Read more |
| --- | --- | --- |
Expand Down
Binary file removed docs/assets/built-in-tasks/grasp-optimization.webp
Binary file not shown.
Binary file removed docs/assets/built-in-tasks/hand-eye-calibration.webp
Binary file not shown.
Binary file removed docs/assets/built-in-tasks/hand-retargeting.webp
Binary file not shown.
Binary file removed docs/assets/built-in-tasks/humanoid-retargeting.webp
Binary file not shown.
Binary file removed docs/assets/built-in-tasks/ik.webp
Binary file not shown.
Binary file removed docs/assets/built-in-tasks/motion-planning.webp
Binary file not shown.
Binary file removed docs/assets/robokit-banner.webp
Binary file not shown.
Binary file removed docs/assets/robokit-benchmarks.webp
Binary file not shown.
Binary file removed docs/assets/robokit-framework.webp
Binary file not shown.
Binary file removed docs/assets/robokit-teaser.webp
Binary file not shown.
Binary file removed docs/assets/simulation/cube.webp
Binary file not shown.
Binary file removed docs/assets/simulation/g1-box.webp
Binary file not shown.
Binary file removed docs/assets/simulation/g1-climb.webp
Binary file not shown.
Binary file removed docs/assets/simulation/go2.webp
Binary file not shown.
Binary file removed docs/assets/simulation/notebook.webp
Binary file not shown.
Binary file removed docs/assets/simulation/pen.webp
Binary file not shown.
14 changes: 7 additions & 7 deletions docs/concepts/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## SE(3) Representation

- **Quaternion**: Scalar first ordering $(q_w, q_x, q_y, q_z)$.
- **7D Pose**: Translation first, rotation second: $(x, y, z, q_w, q_x, q_y, q_z)$.
- **Quaternion**: Scalar first ordering $(q_w, q_x, q_y, q_z)$ (follows MuJoCo).
- **7D Pose**: Translation first, rotation second: $(x, y, z, q_w, q_x, q_y, q_z)$ (follows MuJoCo's free-joint `qpos`).

## Twist Representation

Expand All @@ -22,16 +22,16 @@ Example (3 instances × 2 candidates): `[i0s0, i0s1, i1s0, i1s1, i2s0, i2s1]`

**Utility functions:**

| Function | Purpose | Example |
| ------------------- | ---------------------------------------- | ------------------------------- |
| `warp_utils.repeat` | Expand instances for multiple candidates | `[i0, i1]` → `[i0, i0, i1, i1]` |
| `warp_utils.tile` | Expand candidate table for multiple instances | `[s0, s1]` → `[s0, s1, s0, s1]` |
| Function | Purpose | Example |
| ------------------- | ------------------------------- | ------------------------------- |
| `warp_utils.repeat` | Expand instances for candidates | `[i0, i1]` → `[i0, i0, i1, i1]` |
| `warp_utils.tile` | Expand candidates for instances | `[s0, s1]` → `[s0, s1, s0, s1]` |

## Notation

### Transformations

- `T_dst_src` denotes transformations $\mathbf{T}_{\mathrm{dst}\leftarrow\mathrm{src}} \in SE(3)$ that map vectors from source to destination frame: $\mathbf{p}^{\mathrm{dst}} = \mathbf{T}_{\mathrm{dst}\leftarrow\mathrm{src}}\, \mathbf{p}^{\mathrm{src}}$.
- `T_dst_src` is a transform $\mathbf{T}_{\mathrm{dst}\leftarrow\mathrm{src}} \in SE(3)$ from the source to the destination frame: $\mathbf{p}^{\mathrm{dst}} = \mathbf{T}_{\mathrm{dst}\leftarrow\mathrm{src}}\, \mathbf{p}^{\mathrm{src}}$.
- Components:
- `t_dst_src`: Translation vector $(x, y, z)$
- `q_wxyz_dst_src`: Rotation quaternion $(q_w, q_x, q_y, q_z)$
Expand Down
44 changes: 21 additions & 23 deletions docs/concepts/geom.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Geometry

`robokit.geom` runs batched SDF queries against scenes built from mixed geometric
representations. Each query point gets its signed distance to the scene (negative inside,
positive outside), the surface normal, and the closest surface point. Collision terms,
motion planning, and grasp optimization build on it.
`robokit.geom` runs batched SDF queries against scenes of mixed geometry types. Each query
point gets its signed distance (negative inside), the surface normal and the closest surface
point. Collision terms, motion planning and grasp optimization build on it.

## Overview

Expand Down Expand Up @@ -39,22 +38,22 @@ assert scene.num_scenes == 1
# docs: endhide
```

`update` never reallocates: buffers keep their identity, so a query captured in a CUDA graph
keeps working after the environment moves.
`update` copies in place and never reallocates. A query captured in a CUDA graph keeps working
after the scene moves.

## Geom Types

| Geom | Elements | SDF |
| ------------- | ----------------------------- | --------------------------------- |
| `BoxGeom` | half extents | analytical |
| `SphereGeom` | radii | analytical |
| `PlaneGeom` | local `z=0` halfspaces, posed | analytical |
| `CapsuleGeom` | radii + half heights | analytical |
| `MeshGeom` | triangle meshes | mesh BVH, optional baked-SDF tier |
| `VolumeGeom` | pre-baked `SdfVolume` grids | NanoVDB trilinear sample |
| Geom | Elements | SDF |
| ------------- | ----------------------------- | ---------------------- |
| `BoxGeom` | half extents | analytical |
| `SphereGeom` | radii | analytical |
| `PlaneGeom` | local `z=0` halfspaces, posed | analytical |
| `CapsuleGeom` | radii + half heights | analytical |
| `MeshGeom` | triangle meshes | mesh BVH or baked grid |
| `VolumeGeom` | pre-baked `SdfVolume` grids | trilinear grid sample |

Every geom takes `scene_offsets` (which scene owns which elements), optional `poses` / `scales`,
and an optional `capacity` to grow later without reallocating CUDA memory.
Every geom takes `scene_offsets`, which assign its elements to scenes. `poses` and `scales` are
optional. Set `capacity` to add elements later without reallocating.

## Query

Expand Down Expand Up @@ -82,17 +81,16 @@ np.testing.assert_allclose(sdf.numpy(), [0.5])
# docs: endhide
```

- Batching: one `WarpScene` holds `num_scenes` independent scenes; `scene_offsets` (CSR) or a
per-point `scene_indices` maps each query point to its scene.
- Batching: one `WarpScene` holds `num_scenes` independent scenes. `scene_offsets` or per-point
`scene_indices` map each query point to its scene.
- Masking: `query_mask` skips masked points.
- Gradients: `query_sdf_torch(points, offsets, poses={geom: T})` is differentiable with respect
to the points and any pose/scale overrides.
- Gradients: `query_sdf_torch(points, offsets, poses={geom: T})` is differentiable in the points
and any pose or scale overrides.

### Mesh Level-of-Detail

Mesh queries speed up significantly with a baked signed distance grid:
`MeshGeom(enable_sdf=True, sdf_voxel_size=0.01)` bakes one per mesh, disk-cached under
`~/.robokit/sdf_cache`. Queries then cascade:
A baked SDF grid speeds up mesh queries. `MeshGeom(enable_sdf=True, sdf_voxel_size=0.01)` bakes
one per mesh and caches it under `~/.robokit/sdf_cache`. Queries then cascade:

```
outside the padded AABB -> AABB distance + padding
Expand Down
Loading
Loading