Skip to content

Fix pose cloud example to use a linear constraint#5149

Closed
btshrewsbury-viam wants to merge 2 commits into
mainfrom
docs/pose-clouds-linear-constraint
Closed

Fix pose cloud example to use a linear constraint#5149
btshrewsbury-viam wants to merge 2 commits into
mainfrom
docs/pose-clouds-linear-constraint

Conversation

@btshrewsbury-viam

@btshrewsbury-viam btshrewsbury-viam commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What

Two fixes to the code example on Relax a goal with a pose cloud, so it matches both the figure and the canonical pouring demo:

  1. Constraint: OrientationConstraintLinearConstraint{LineToleranceMm: 5, OrientationToleranceDegs: 5} (a straight, level path, not just level at the goal).
  2. Grasp orientation: the goal orientation was OZ: -1 (a top-down grasp), but the figure shows the gripper holding the cup from the side. Set it to OX: 1 (tool points horizontally) to match the figure.

Why

On the PR that added the page (#5098), Dan Gottlieb (@dgottlieb) was skeptical the orientation-only approach reliably keeps the cup from spilling and pointed at the viam-pouring-demo (pour/motion.go, pour/vinocart.go) as the shape a user should write. That demo uses a LinearConstraint and grasps the cup from the side with OX/OY leeway.

The two changes interact: with a side grasp (OX: 1, tool horizontal), the old Theta: 180 would roll the cup about a horizontal axis and tip it. So the pose cloud now relaxes OX/OY instead (approach from any side ≈ any rotation about vertical) with a small OZ to keep the approach horizontal and the cup upright — the demo's pattern. This also makes the example exercise the OX/OY/OZ rows of the page's tolerance table and lines up with the page's existing orientation-normalization callout (set a non-zero OX on the goal so the leeway is measured from the intended grasp). The RDK PoseCloud doc comment confirms the physics: a large orientation leeway with a large theta lets "the cup start to tip and spill."

Changes

All in docs/motion-planning/move-an-arm/pose-clouds.md:

  • Code block: goal orientation {OZ: -1}{OX: 1, OZ: 0, Theta: 180}; pose cloud {X, Y, Z, Theta: 180}{X: 75, Y: 75, Z: 0, OX: 1, OY: 1, OZ: 0.1}; constraint → LinearConstraint.
  • Comments and surrounding prose updated to describe the side grasp and the straight, level path.
  • The figure, its alt text ("any rotation while staying upright"), and the "Grasp ranges" bullet already describe a side grasp at any rotation, so they now match the code.

Verification

  • API verified against source: rdk/motionplan/constraint.go:42-45 and rdk/referenceframe/pose_cloud.go:17-72.
  • Constraint and grasp pattern match viam-pouring-demo#54.
  • Figure re-rendered and read to confirm the side grasp.
  • Gates: prettier, markdownlint, vale (0/0/0), and make build-prod all pass.

🤖 Generated with Claude Code

The code example on the pose-clouds page kept the cup upright with an
OrientationConstraint, which only bounds the pointing direction at the goal.
The canonical pouring demo (viam-pouring-demo, PR #54) uses a LinearConstraint
with both LineToleranceMm and OrientationToleranceDegs, moving the cup along a
straight, level path so it does not spill. This matches dgottlieb's review note
on #5098 that the orientation-only approach may not reliably prevent spills.

Switch the example and its surrounding prose to the linear constraint. The
place-a-cup-on-the-table scenario, pose cloud, and figures are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for viam-docs ready!

Name Link
🔨 Latest commit 1c94b74
🔍 Latest deploy log https://app.netlify.com/projects/viam-docs/deploys/6a4d09a5519cc50008eea2ea
😎 Deploy Preview https://deploy-preview-5149--viam-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 38 (🔴 down 6 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 70 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@viambot viambot added the safe to build This pull request is marked safe to build from a trusted zone label Jul 6, 2026
The figure shows the gripper holding the cup from the side, with the tool
pointing horizontally, but the code used OZ:-1 (a top-down grasp). Set the goal
orientation to OX:1 so the code matches the figure.

With a horizontal grasp, Theta:180 would roll the cup about a horizontal axis
and tip it. Relax OX and OY instead, so the planner can approach from any side
(the cup may rest at any rotation about vertical), with a small OZ leeway to keep
the approach horizontal and the cup upright. This matches the pouring demo and
exercises the OX/OY/OZ rows of the tolerance table.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ghost

Copy link
Copy Markdown

Hey btshrewsbury-viam — CI is green and no reviewer is assigned yet. Could you request one when you have a chance?

Auto-comment from overwatch. Will not re-nudge for 7 days.

@btshrewsbury-viam

Copy link
Copy Markdown
Collaborator Author

Closing in favor of #5197, which carries both commits from this PR (with cleaned commit messages so the CLA check passes) plus the motion-planning happy-path correction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to build This pull request is marked safe to build from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants