computing-stable-placements
Which faces can this part rest on, how firmly, and how far must it turn to get there?
textperceive (OBB or cloud) -> rests (this skill) -> choose a rest -> place / flip / regrasp
What it computes
TSR's stable_poses_mesh, unchanged in substance: the convex hull of the
object, its facets grouped into faces by coplanarity (a 4D grid over normal
and offset, matched against each group's first plane), and for each face the
centre of mass projected onto it. A face is a rest when the projection lies
inside the face's support polygon (the 2D hull of its contact points) by more
than the length tolerance; the tipping angle is
atan(support_margin / com_height): how far the object must be tilted about
the nearest support edge before the COM passes over it. Rests are sorted most
stable first (upstream place_mesh).
Each rest in rests:
| field | meaning |
|---|---|
label | +x ... -z (the OBB's local face) or face-k for a cloud |
tipping_deg, support_margin_m, com_height_m | stability, as above |
center_height_m | height of the reference point (OBB centre, or the COM for a cloud) over the support when resting |
turn_deg, rotation_to_rest | the minimal world rotation from the current orientation that puts this face down (yaw is then free) |
face_normal_world | the face's outward normal now |
footprint_radius_m | farthest horizontal reach from the COM at rest (what a free yaw sweeps) |
pose | with goal_position: the reference point's world pose resting there (rotation = rotation_to_rest x current) |
current_index is the rest whose face points within current_tol_deg (10)
of straight down, or -1: the object is not resting on a stable face (tilted,
leaning on something, or held).
Inputs
object_obb(world, half-extents): the exact path, a box with the COM at its centre unlesscomis given. Use it for bricks, dominoes, holders, jigsaw pieces.points(world cloud) withsupport_z: a top-down camera sees no underside, so the cloud is closed down to the support:closing: prism(default): footprint of the points in the upper half of the object's height (mixed depth pixels at the edges fall below it), simplified (3 mm Douglas-Peucker) and extruded from the support to the top (p98). Exact geometry, so upstream's tight tolerances apply.closing: drop: every point plus its drop onto the support; the hull of the raw cloud, with faces merged within 0.05 rad and 2 mm.closing: none/ nosupport_z: the cloud as given (a registered mesh's vertices, a multi-view scan).
com: defaults to the OBB centre or the hull's volume centroid (uniform density). Pass it for top-heavy or compound parts.min_margin_deg(0, upstream's default): drop rests that tip more easily. 5 degrees removes the knife-edge rests a noisy footprint produces.surface_half_extents[hx, hy]: drop rests whose footprint does not fit at every yaw (upstream_fits, about the COM here).
Checks
Exact geometry (unit tests): a domino 48 x 24 x 7.5 mm and a LEGO 2x4 brick
31.8 x 15.8 x 11.4 mm give six rests each with tipping angles equal to the
analytic atan(min half-side / half-height) to 0.01 deg (domino: flat 72.65,
on its long edge 17.35, on its end 8.88; brick: 54.19 / 35.81 / 19.72). A COM
moved 10 mm toward one end of the domino gives 15.0 and 6.3 deg on the two
ends (atan(3.75/14), atan(3.75/34)). A box cloud tilted 30 deg reports six
rests with turns 30.6 / 60 / 90 / 120 / 150 deg and no current rest.
Real station (overhead D405 frame top_before.npz of a gsota probe run,
points inside each holder's measured footprint + 6 mm, over the table), against
the holders' wrist-measured boxes:
| grey holder (wrist: 76.2 x 100.4 x 24.5 mm) | rests | flat rest: tipping, COM height | current |
|---|---|---|---|
| measured box, OBB path | 6 | 72.2 deg, 12.2 mm | flat |
| OBB fitted to the cloud (minAreaRect of the upper points, p98 top: 73.0 x 97.0 x 23.7 mm) | 6 | 72.0 deg, 11.8 mm; sides 18.0 / 13.7 deg vs 17.8 / 13.7 | flat |
cloud, prism (7-gon 73.0 x 99.5 x 23.7 mm) | 7 | 68.8 deg, 11.8 mm | flat |
cloud, drop (raw hull) | 3 | 76.1 deg, 9.3 mm | flat |
- For box-like parts fit an OBB first. The fitted OBB matched every rest
of the measured box within 0.2 deg and 1.7 mm. The prism keeps the flat rest
and the current one right, but its footprint polygon has cut corners (the
holder's footprint fills 78 % of its rectangle), so one short side splits
into two bent segments: rests at 4.0 deg and the side angles off by up to
3 deg. The raw
drophull is a rounded frustum (mixed pixels widen its base to 88 x 112 mm): 3 rests of 6, COM 3 mm low. - Uniform density is an assumption. The black holder with 12 markers
standing in it (cloud top 126 mm) becomes a solid 68 x 91 x 124 mm prism
whose most stable rest is on its side (34 deg vs 25.6 deg upright); the real
object's mass is in the holder. Pass
comfor such parts. - No arm motion, so no simulation check; nothing was placed to confirm a rest physically.
Relation to other skills
- standing-a-lying-domino-by-reorient-and-regrasp, tipping-over-a-surface-edge: the motions that change the rest; this skill says which rest to aim for and whether the part is on one now.
- placing-with-contact-descent / placing-into-container-obb: use
best_pose/center_height_mfor the release height.
Changes from TSR
Adapted from src/tsr/placement/_stable_poses.py and the place_mesh /
_fits logic of stable_placer.py (BSD-2-Clause, licence in
LICENSE.tsr):
- Input is a world OBB or a perceived cloud instead of a mesh in its own frame;
the cloud closings (
prism,drop) and the cloud tolerances are new. - COM defaults to the hull's volume centroid.
- Output is per-rest world numbers (turn, normal now, pose at a goal) instead of TSR templates with sampling bounds; the current rest is identified.
- The surface fit is measured about the COM, from given half-extents.
- The analytic primitives (cylinder, sphere, torus, compound shapes) are not ported; a cylinder lying on its side is not a rest in upstream either.


