-
Notifications
You must be signed in to change notification settings - Fork 1
app-16292: add docs page for the Gizmos plugin #739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Devin T. Currie (DTCurrie)
wants to merge
24
commits into
app-16292/4-gizmos-plugin
Choose a base branch
from
app-16292/5-gizmo-docs
base: app-16292/4-gizmos-plugin
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
71295f1
Add docs page for the Gizmos plugin
DTCurrie c1dc3e9
docs: move exit() from Read-only table to Methods section
github-actions[bot] ba03c57
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie a94fb2a
Merge branch 'app-16292/5-gizmo-docs' of github.com:viam-labs/motion-…
DTCurrie 6ce71de
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie 53aba0e
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie d66e179
docs(gizmos): add Aside note for coordinate system and reference geom…
github-actions[bot] e4738ed
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie 1e0e2d6
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie b564fb5
format
DTCurrie 0e54723
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie a861ff0
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie 3de6350
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie 725568b
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie 2d25161
usage docs
DTCurrie 8f092fa
Merge branch 'app-16292/4-gizmos-plugin' of github.com:viam-labs/moti…
DTCurrie 80e6771
Merge branch 'app-16292/4-gizmos-plugin' of github.com:viam-labs/moti…
DTCurrie 68bc71c
Merge branch 'app-16292/4-gizmos-plugin' into app-16292/5-gizmo-docs
DTCurrie a121781
Apply suggestions from code review
DTCurrie 93bd437
Merge branch 'app-16292/4-gizmos-plugin' of github.com:viam-labs/moti…
DTCurrie c31f4e1
Merge branch 'app-16292/5-gizmo-docs' of github.com:viam-labs/motion-…
DTCurrie f174267
Merge branch 'app-16292/4-gizmos-plugin' of github.com:viam-labs/moti…
DTCurrie d9faeaf
use tag
DTCurrie 25d79b6
Merge branch 'app-16292/4-gizmos-plugin' of github.com:viam-labs/moti…
DTCurrie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| --- | ||
| title: <Gizmos /> | ||
| description: Add a toolset for placing editable reference geometry, lines, arrows, and normals inside a motion-tools visualizer. | ||
| --- | ||
|
|
||
| `<Gizmos />` adds a "Gizmos" dashboard toggle with a popover of tools for placing editable scene aids: a coordinate system, reference planes, reference geometries (box / sphere / capsule), polylines with optional measurement, arrows, and vertex or surface normals. | ||
|
|
||
| Each tool places a Koota entity in the world, selects it, and renders a custom Details panel for editing its parameters in place. Switching the visualizer's interaction mode back to `navigate`, `measure`, or `select` exits gizmo mode automatically. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```svelte | ||
| <script lang="ts"> | ||
| import { Visualizer } from '@viamrobotics/motion-tools' | ||
| import { Gizmos } from '@viamrobotics/motion-tools/plugins' | ||
| </script> | ||
|
|
||
| <div class="h-screen w-screen"> | ||
| <Visualizer> | ||
| <Gizmos /> | ||
| </Visualizer> | ||
| </div> | ||
| ``` | ||
|
|
||
| A new toggle appears in the top dashboard with the `shapes` icon. Clicking it opens a popover that lets you pick which gizmo to place; selecting one switches the visualizer into `'gizmo'` interaction mode and arms the chosen tool. Click in the scene to place the gizmo. The placed entity is auto-selected so its Details panel opens for further editing. | ||
|
|
||
| `<Gizmos />` takes no props. | ||
|
|
||
| ## Available gizmos | ||
|
|
||
| | Gizmo | Mode key | Behavior | | ||
| | ------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- | | ||
| | Coordinate system | `coordinate-system` | Place a labeled XYZ triad at a clicked surface point. | | ||
| | Reference plane | `reference-plane` | Place a `yz` / `xz` / `xy` plane either at a clicked point ("free") or at a numeric offset from world origin. | | ||
| | Reference geometry | `reference-geometry` | Drop a `box`, `sphere`, or `capsule` (solid or wireframe) at world origin or at a clicked point. | | ||
| | Polyline | `polyline` | Click to build a multi-segment line in world or screen space. Optional segment / total measurement labels. | | ||
| | Arrow | `arrow` | Place an arrow oriented to a chosen world axis or to the clicked surface normal. | | ||
| | Vertex normals | `vertex-normals` | Render the per-vertex normals of a clicked mesh. | | ||
| | Surface normals | `surface-normals` | Render the per-face normals of a clicked surface. | | ||
|
|
||
| ## Reading and driving plugin state | ||
|
|
||
| Use `useGizmos` to read or mutate the plugin's state from anywhere inside `<Visualizer />`. The hook is reactive (Svelte 5 runes), so reading its properties subscribes to changes: | ||
|
|
||
| ```svelte | ||
| <script lang="ts"> | ||
| import { useGizmos } from '@viamrobotics/motion-tools/plugins' | ||
|
|
||
| const gizmos = useGizmos() | ||
| </script> | ||
|
|
||
| <p>Active gizmo: {gizmos.mode}</p> | ||
| <button onclick={gizmos.exit}>Exit gizmo mode</button> | ||
| ``` | ||
|
|
||
| Mutable properties (read/write): | ||
|
|
||
| | Property | Type | Description | | ||
| | ---------------------- | ----------------------------------- | ------------------------------------------------------ | | ||
| | `mode` | `GizmoMode` | Active tool (`'idle'` when no tool is armed). | | ||
| | `planeAxis` | `'yz' \| 'xz' \| 'xy'` | Axis-aligned plane for the reference-plane tool. | | ||
| | `planeConstruction` | `'free' \| 'offset'` | Placement strategy for the reference-plane tool. | | ||
| | `planeOffset` | `number` | Offset (mm) from world origin in `'offset'` mode. | | ||
| | `geometryShape` | `'box' \| 'sphere' \| 'capsule'` | Shape used by the reference-geometry tool. | | ||
| | `geometryConstruction` | `'at-origin' \| 'free'` | Placement strategy for reference geometries. | | ||
| | `isGeometryWireframe` | `boolean` | Render reference geometries as wireframe instead of solid. | | ||
| | `lineSpace` | `'world' \| 'screen'` | Coordinate space used by the polyline tool. | | ||
| | `lineMeasure` | `'none' \| 'segment' \| 'total'` | Measurement labels rendered on polylines. | | ||
| | `arrowAxis` | `'x' \| 'y' \| 'z' \| 'surface'` | Direction the arrow tool orients to. | | ||
| | `vertexNormalsLength` | `number` | Length (mm) of vertex-normals lines. | | ||
| | `surfaceNormalsLength` | `number` | Length (mm) of surface-normals lines. | | ||
|
|
||
| Read-only: | ||
|
|
||
| | Property | Description | | ||
| | ------------------- | -------------------------------------------------------------------------- | | ||
| | `planeAxisVector` | Cloned `THREE.Vector3` normal for the current `planeAxis`. | | ||
| | `geometryTrait` | Pre-configured size trait for the current `geometryShape`. | | ||
| | `exit()` | Switch the visualizer back to `'navigate'` and set `mode` to `'idle'`. | | ||
|
|
||
| ## Traits | ||
|
|
||
| For lower-level access (e.g. iterating placed gizmos in your own queries), the plugin exports its Koota traits under the `gizmoTraits` namespace: | ||
|
|
||
| ```ts | ||
| import { gizmoTraits } from '@viamrobotics/motion-tools/plugins' | ||
| ``` | ||
|
|
||
| Every placed entity carries the generic `Gizmo` marker (with `PendingGizmo` added while the user is still placing it). Specific gizmos additionally carry a typed trait: `ReferencePlane`, `GizmoArrow`, `VertexNormals`, `SurfaceNormals`, or `PolylineMeasure`. Filter on these from your own queries to scope behavior to user-placed gizmos vs. robot frames. | ||
|
DTCurrie marked this conversation as resolved.
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.