@viamrobotics/motion-tools 1.10.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/HoverUpdater.svelte.d.ts +0 -3
  2. package/dist/HoverUpdater.svelte.js +8 -50
  3. package/dist/WorldObject.svelte.d.ts +27 -0
  4. package/dist/WorldObject.svelte.js +8 -55
  5. package/dist/{draw → buf/draw}/v1/drawing_pb.d.ts +6 -0
  6. package/dist/{draw → buf/draw}/v1/drawing_pb.js +7 -0
  7. package/dist/buf/draw/v1/service_connect.d.ts +122 -0
  8. package/dist/buf/draw/v1/service_connect.js +126 -0
  9. package/dist/buf/draw/v1/service_pb.d.ts +382 -0
  10. package/dist/buf/draw/v1/service_pb.js +612 -0
  11. package/dist/components/App.svelte +3 -2
  12. package/dist/components/Arrows/Arrows.svelte +16 -3
  13. package/dist/components/FileDrop/file-dropper.d.ts +1 -1
  14. package/dist/components/FileDrop/snapshot-dropper.js +1 -1
  15. package/dist/components/FileDrop/useFileDrop.svelte.d.ts +2 -1
  16. package/dist/components/Focus.svelte +1 -8
  17. package/dist/components/Frame.svelte +1 -1
  18. package/dist/components/Geometry.svelte +112 -71
  19. package/dist/components/Geometry.svelte.d.ts +6 -7
  20. package/dist/components/Lasso/Lasso.svelte +153 -0
  21. package/dist/components/Lasso/Lasso.svelte.d.ts +6 -0
  22. package/dist/components/Lasso/Line.svelte +44 -0
  23. package/dist/components/Lasso/Line.svelte.d.ts +11 -0
  24. package/dist/components/PointerMissBox.svelte +0 -1
  25. package/dist/components/Points.svelte +1 -1
  26. package/dist/components/Scene.svelte +3 -6
  27. package/dist/components/SceneProviders.svelte +2 -0
  28. package/dist/components/Snapshot.svelte +1 -1
  29. package/dist/components/Snapshot.svelte.d.ts +1 -1
  30. package/dist/components/hover/HoveredEntityTooltip.svelte +2 -1
  31. package/dist/components/overlay/Details.svelte +20 -0
  32. package/dist/components/overlay/left-pane/TreeContainer.svelte +0 -2
  33. package/dist/components/overlay/settings/Settings.svelte +51 -0
  34. package/dist/components/overlay/widgets/Camera.svelte +20 -12
  35. package/dist/components/xr/ArmTeleop.svelte +469 -0
  36. package/dist/components/xr/ArmTeleop.svelte.d.ts +10 -0
  37. package/dist/components/xr/CameraFeed.svelte +194 -47
  38. package/dist/components/xr/CameraFeed.svelte.d.ts +8 -0
  39. package/dist/components/xr/Controllers.svelte +45 -38
  40. package/dist/components/xr/Controllers.svelte.d.ts +2 -17
  41. package/dist/components/xr/Hands.svelte +2 -4
  42. package/dist/components/xr/JointLimitsWidget.svelte +212 -0
  43. package/dist/components/xr/JointLimitsWidget.svelte.d.ts +13 -0
  44. package/dist/components/xr/OriginMarker.svelte +1 -15
  45. package/dist/components/xr/XR.svelte +86 -5
  46. package/dist/components/xr/XRConfigPanel.svelte +449 -0
  47. package/dist/components/xr/XRConfigPanel.svelte.d.ts +11 -0
  48. package/dist/components/xr/XRControllerSettings.svelte +240 -0
  49. package/dist/components/xr/XRControllerSettings.svelte.d.ts +3 -0
  50. package/dist/components/xr/XRToast.svelte +215 -0
  51. package/dist/components/xr/XRToast.svelte.d.ts +3 -0
  52. package/dist/components/xr/math.d.ts +14 -0
  53. package/dist/components/xr/math.js +26 -0
  54. package/dist/components/xr/toasts.svelte.d.ts +20 -0
  55. package/dist/components/xr/toasts.svelte.js +32 -0
  56. package/dist/components/xr/useOrigin.svelte.d.ts +2 -2
  57. package/dist/components/xr/useOrigin.svelte.js +4 -4
  58. package/dist/ecs/traits.d.ts +9 -0
  59. package/dist/ecs/traits.js +9 -0
  60. package/dist/ecs/useTrait.svelte.d.ts +3 -3
  61. package/dist/frame.d.ts +0 -3
  62. package/dist/hooks/useArmKinematics.svelte.d.ts +12 -0
  63. package/dist/hooks/useArmKinematics.svelte.js +31 -0
  64. package/dist/hooks/useGeometries.svelte.js +46 -35
  65. package/dist/hooks/useObjectEvents.svelte.js +24 -7
  66. package/dist/hooks/usePartConfig.svelte.d.ts +0 -35
  67. package/dist/hooks/usePartConfig.svelte.js +2 -2
  68. package/dist/hooks/usePointcloudObjects.svelte.js +44 -63
  69. package/dist/hooks/usePointclouds.svelte.js +10 -6
  70. package/dist/hooks/usePose.svelte.js +4 -1
  71. package/dist/hooks/useResourceByName.svelte.d.ts +7 -0
  72. package/dist/hooks/useResourceByName.svelte.js +2 -2
  73. package/dist/hooks/useSettings.svelte.d.ts +14 -0
  74. package/dist/hooks/useSettings.svelte.js +10 -0
  75. package/dist/hooks/useWorldState.svelte.d.ts +0 -8
  76. package/dist/lib.d.ts +1 -3
  77. package/dist/lib.js +1 -3
  78. package/dist/plugins/bvh.svelte.d.ts +8 -0
  79. package/dist/plugins/bvh.svelte.js +69 -0
  80. package/dist/ply.d.ts +1 -1
  81. package/dist/ply.js +5 -0
  82. package/dist/snapshot.d.ts +2 -2
  83. package/dist/snapshot.js +2 -2
  84. package/dist/three/InstancedArrows/raycast.d.ts +2 -4
  85. package/dist/three/InstancedArrows/raycast.js +5 -5
  86. package/dist/transform.js +1 -0
  87. package/package.json +7 -5
  88. package/dist/assert.d.ts +0 -14
  89. package/dist/assert.js +0 -21
  90. package/dist/components/BatchedGeometry.svelte +0 -0
  91. package/dist/components/BatchedGeometry.svelte.d.ts +0 -26
  92. package/dist/components/Detections.svelte +0 -41
  93. package/dist/components/Detections.svelte.d.ts +0 -3
  94. package/dist/components/DetectionsPlane.svelte +0 -23
  95. package/dist/components/DetectionsPlane.svelte.d.ts +0 -21
  96. package/dist/components/Geometry2.svelte +0 -211
  97. package/dist/components/Geometry2.svelte.d.ts +0 -19
  98. package/dist/components/overlay/left-pane/Widgets.svelte +0 -65
  99. package/dist/components/overlay/left-pane/Widgets.svelte.d.ts +0 -3
  100. package/dist/entries.d.ts +0 -1
  101. package/dist/entries.js +0 -3
  102. package/dist/hooks/index.d.ts +0 -0
  103. package/dist/hooks/index.js +0 -1
  104. package/dist/test.d.ts +0 -1
  105. package/dist/test.js +0 -1
  106. package/dist/three/BoxHelper.d.ts +0 -50
  107. package/dist/three/BoxHelper.js +0 -134
  108. /package/dist/{common → buf/common}/v1/common_pb.d.ts +0 -0
  109. /package/dist/{common → buf/common}/v1/common_pb.js +0 -0
  110. /package/dist/{draw → buf/draw}/v1/metadata_pb.d.ts +0 -0
  111. /package/dist/{draw → buf/draw}/v1/metadata_pb.js +0 -0
  112. /package/dist/{draw → buf/draw}/v1/scene_pb.d.ts +0 -0
  113. /package/dist/{draw → buf/draw}/v1/scene_pb.js +0 -0
  114. /package/dist/{draw → buf/draw}/v1/snapshot_pb.d.ts +0 -0
  115. /package/dist/{draw → buf/draw}/v1/snapshot_pb.js +0 -0
  116. /package/dist/{draw → buf/draw}/v1/transforms_pb.d.ts +0 -0
  117. /package/dist/{draw → buf/draw}/v1/transforms_pb.js +0 -0
  118. /package/dist/components/{BentPlaneGeometry.svelte → xr/BentPlaneGeometry.svelte} +0 -0
  119. /package/dist/components/{BentPlaneGeometry.svelte.d.ts → xr/BentPlaneGeometry.svelte.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import type { World, Entity } from 'koota';
2
- import type { Snapshot } from './draw/v1/snapshot_pb';
3
- import { type SceneMetadata } from './draw/v1/scene_pb';
2
+ import type { Snapshot } from './buf/draw/v1/snapshot_pb';
3
+ import { type SceneMetadata } from './buf/draw/v1/scene_pb';
4
4
  import type { Settings } from './hooks/useSettings.svelte';
5
5
  export declare const applySceneMetadata: (settings: Settings, metadata: SceneMetadata) => Settings;
6
6
  export declare const spawnSnapshotEntities: (world: World, snapshot: Snapshot) => Entity[];
package/dist/snapshot.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Vector3, Vector4 } from 'three';
2
2
  import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js';
3
- import { RenderArmModels } from './draw/v1/scene_pb';
4
- import {} from './draw/v1/drawing_pb';
3
+ import { RenderArmModels } from './buf/draw/v1/scene_pb';
4
+ import {} from './buf/draw/v1/drawing_pb';
5
5
  import { traits } from './ecs';
6
6
  import { Geometry } from '@viamrobotics/sdk';
7
7
  import { parseMetadata } from './WorldObject.svelte';
@@ -1,8 +1,6 @@
1
- import { Object3D, BufferGeometry, Raycaster, type Intersection } from 'three';
1
+ import { Raycaster, type Intersection } from 'three';
2
2
  import type { InstancedArrows } from './InstancedArrows';
3
- export declare function meshBoundsRaycast(this: Object3D & {
4
- geometry: BufferGeometry;
5
- }, raycaster: Raycaster, intersects: Intersection[]): void;
3
+ export declare function meshBoundsRaycast(this: InstancedArrows, raycaster: Raycaster, intersects: Intersection[]): void;
6
4
  /**
7
5
  * Currently unused. In the future will be used for click only (not mousemove) due to complexity.
8
6
  */
@@ -1,4 +1,4 @@
1
- import { Object3D, BufferGeometry, Ray, Matrix4, Raycaster, Vector3, Box3, RawShaderMaterial, } from 'three';
1
+ import { Ray, Matrix4, Raycaster, Vector3, Box3, RawShaderMaterial } from 'three';
2
2
  const vec3 = new Vector3();
3
3
  const inverseMatrix = new Matrix4();
4
4
  const localRay = new Ray();
@@ -41,10 +41,10 @@ function closestPointsRaySegment(ray, a, b, outRay, outSeg) {
41
41
  return outRay.distanceToSquared(outSeg);
42
42
  }
43
43
  export function meshBoundsRaycast(raycaster, intersects) {
44
- if (this.geometry.boundingBox === null) {
45
- this.geometry.computeBoundingBox();
44
+ if (this.shaftMesh.geometry.boundingBox === null) {
45
+ this.shaftMesh.geometry.computeBoundingBox();
46
46
  }
47
- box.copy(this.geometry.boundingBox ?? box);
47
+ box.copy(this.shaftMesh.geometry.boundingBox ?? box);
48
48
  if (!raycaster.ray.intersectsBox(box)) {
49
49
  return;
50
50
  }
@@ -119,7 +119,7 @@ export function raycast(raycaster, intersects) {
119
119
  distance: bestDistance,
120
120
  point: bestPointWorld,
121
121
  object: this.shaftMesh,
122
- instanceId: bestInstanceId,
122
+ index: bestInstanceId,
123
123
  });
124
124
  }
125
125
  }
package/dist/transform.js CHANGED
@@ -8,6 +8,7 @@ const scale = new Vector3();
8
8
  export const createPose = (pose) => {
9
9
  // We should only default to the 0,0,1,0 orientation vector if the entire vector component is missing
10
10
  const oZ = pose?.oX === undefined && pose?.oY === undefined && pose?.oZ === undefined ? 1 : (pose?.oZ ?? 0);
11
+ // pose expects theta in degrees
11
12
  return {
12
13
  x: pose?.x ?? 0,
13
14
  y: pose?.y ?? 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/motion-tools",
3
- "version": "1.10.0",
3
+ "version": "1.11.1",
4
4
  "description": "Motion visualization with Viam",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -30,6 +30,7 @@
30
30
  "@threlte/rapier": "3.2.0",
31
31
  "@threlte/xr": "1.0.8",
32
32
  "@types/bun": "1.2.21",
33
+ "@types/earcut": "^3.0.0",
33
34
  "@types/lodash-es": "4.17.12",
34
35
  "@types/three": "0.181.0",
35
36
  "@typescript-eslint/eslint-plugin": "8.42.0",
@@ -115,10 +116,6 @@
115
116
  "./lib": {
116
117
  "types": "./dist/lib.d.ts",
117
118
  "svelte": "./dist/lib.js"
118
- },
119
- "./test": {
120
- "types": "./dist/test.d.ts",
121
- "svelte": "./dist/test.js"
122
119
  }
123
120
  },
124
121
  "repository": {
@@ -132,11 +129,15 @@
132
129
  ],
133
130
  "dependencies": {
134
131
  "@bufbuild/protobuf": "1.10.1",
132
+ "@connectrpc/connect": "1.7.0",
133
+ "@connectrpc/connect-web": "1.7.0",
135
134
  "@neodrag/svelte": "^2.3.3",
136
135
  "@tanstack/svelte-query-devtools": "^6.0.2",
136
+ "earcut": "^3.0.2",
137
137
  "expr-eval": "^2.0.2",
138
138
  "koota": "0.6.5",
139
139
  "lodash-es": "4.17.23",
140
+ "three-mesh-bvh": "^0.9.8",
140
141
  "uuid-tool": "^2.0.3"
141
142
  },
142
143
  "scripts": {
@@ -147,6 +148,7 @@
147
148
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
148
149
  "format": "prettier --write .",
149
150
  "lint": "prettier --check . && eslint .",
151
+ "knip": "npx knip --include files,exports,types",
150
152
  "test:unit": "vitest",
151
153
  "test:client": "go test ./client/... -count=1",
152
154
  "test:draw": "go test ./draw/... -count=1",
package/dist/assert.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /** Assertion functions for runtime and type safety. */
2
- export declare class AssertionError extends Error {
3
- constructor(message: string);
4
- }
5
- /**
6
- * Assert that a value is defined.
7
- *
8
- * @example
9
- * const stringify = (value: number | undefined): number => {
10
- * assertExists(value)
11
- * return `${value}` // TS now knows that value is of type `number`
12
- * }
13
- */
14
- export declare const assertExists: <T>(value: T, message: string) => asserts value is NonNullable<T>;
package/dist/assert.js DELETED
@@ -1,21 +0,0 @@
1
- /** Assertion functions for runtime and type safety. */
2
- export class AssertionError extends Error {
3
- constructor(message) {
4
- super(message);
5
- this.name = 'AssertionError';
6
- }
7
- }
8
- /**
9
- * Assert that a value is defined.
10
- *
11
- * @example
12
- * const stringify = (value: number | undefined): number => {
13
- * assertExists(value)
14
- * return `${value}` // TS now knows that value is of type `number`
15
- * }
16
- */
17
- export const assertExists = (value, message) => {
18
- if (value === null || value === undefined) {
19
- throw new AssertionError(message);
20
- }
21
- };
File without changes
@@ -1,26 +0,0 @@
1
- export default BatchedGeometry;
2
- type BatchedGeometry = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
8
- };
9
- declare const BatchedGeometry: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
- $$bindings?: Bindings;
17
- } & Exports;
18
- (internal: unknown, props: {
19
- $$events?: Events;
20
- $$slots?: Slots;
21
- }): Exports & {
22
- $set?: any;
23
- $on?: any;
24
- };
25
- z_$$bindings?: Bindings;
26
- }
@@ -1,41 +0,0 @@
1
- <script lang="ts">
2
- import { VisionClient } from '@viamrobotics/sdk'
3
- import DetectionsPlane from './DetectionsPlane.svelte'
4
- import {
5
- createResourceClient,
6
- createResourceQuery,
7
- useResourceNames,
8
- } from '@viamrobotics/svelte-sdk'
9
- import { usePartID } from '../hooks/usePartID.svelte'
10
-
11
- const partID = usePartID()
12
- const cameras = useResourceNames(() => partID.current, 'camera')
13
- const services = useResourceNames(() => partID.current, 'vision')
14
- const visionClients = $derived(
15
- services.current.map((service) =>
16
- createResourceClient(
17
- VisionClient,
18
- () => partID.current,
19
- () => service.name
20
- )
21
- )
22
- )
23
-
24
- const queries = $derived(() =>
25
- visionClients.map((client) =>
26
- createResourceQuery(client, 'captureAllFromCamera', [
27
- cameras.current[0].name,
28
- {
29
- returnImage: true,
30
- returnClassifications: false,
31
- returnDetections: true,
32
- returnObjectPointClouds: false,
33
- },
34
- ])
35
- )
36
- )
37
-
38
- $inspect(queries)
39
- </script>
40
-
41
- <DetectionsPlane detections={[]} />
@@ -1,3 +0,0 @@
1
- declare const Detections: import("svelte").Component<Record<string, never>, {}, "">;
2
- type Detections = ReturnType<typeof Detections>;
3
- export default Detections;
@@ -1,23 +0,0 @@
1
- <script lang="ts">
2
- import { T } from '@threlte/core'
3
- import { Detection } from '@viamrobotics/sdk'
4
-
5
- export let detections: Detection[]
6
- </script>
7
-
8
- <T.Group scale={0.001}>
9
- {#each detections as { xMin, xMax, yMin, yMax }, index (index)}
10
- {#if xMin !== undefined && xMax !== undefined && yMin !== undefined && yMax !== undefined}
11
- <T.Mesh
12
- scale={[Number(xMax - xMin), Number(yMax - yMin), 1]}
13
- position={[Number(xMin), Number(yMin), 0]}
14
- >
15
- <T.PlaneGeometry />
16
- <T.MeshStandardMaterial
17
- transparent
18
- opacity={0.5}
19
- />
20
- </T.Mesh>
21
- {/if}
22
- {/each}
23
- </T.Group>
@@ -1,21 +0,0 @@
1
- import { Detection } from '@viamrobotics/sdk';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const DetectionsPlane: $$__sveltets_2_IsomorphicComponent<{
16
- detections: Detection[];
17
- }, {
18
- [evt: string]: CustomEvent<any>;
19
- }, {}, {}, string>;
20
- type DetectionsPlane = InstanceType<typeof DetectionsPlane>;
21
- export default DetectionsPlane;
@@ -1,211 +0,0 @@
1
- <script lang="ts">
2
- import { T, useThrelte, type Props as ThrelteProps } from '@threlte/core'
3
- import { type Snippet } from 'svelte'
4
- import { meshBounds } from '@threlte/extras'
5
- import { BufferGeometry, Color, DoubleSide, FrontSide, Group, Mesh } from 'three'
6
- import { Line2, LineGeometry, LineMaterial } from 'three/examples/jsm/Addons.js'
7
- import { CapsuleGeometry } from '../three/CapsuleGeometry'
8
- import { colors, darkenColor } from '../color'
9
- import AxesHelper from './AxesHelper.svelte'
10
- import type { Entity } from 'koota'
11
- import { traits, useTrait } from '../ecs'
12
- import { poseToObject3d } from '../transform'
13
- import type { Pose } from '@viamrobotics/sdk'
14
-
15
- interface Props extends ThrelteProps<Group> {
16
- entity: Entity
17
- color?: string
18
- model?: Group
19
- pose?: Pose
20
- renderMode?: 'model' | 'colliders' | 'colliders+model'
21
- ref?: Group
22
- children?: Snippet<[{ ref: Group }]>
23
- }
24
-
25
- let {
26
- entity,
27
- color: overrideColor,
28
- model,
29
- renderMode = 'colliders',
30
- pose,
31
- ref = $bindable(),
32
- children,
33
- ...rest
34
- }: Props = $props()
35
-
36
- const colorUtil = new Color()
37
-
38
- const { invalidate } = useThrelte()
39
- const name = useTrait(() => entity, traits.Name)
40
- const entityColor = useTrait(() => entity, traits.Color)
41
- const opacity = useTrait(() => entity, traits.Opacity)
42
- const box = useTrait(() => entity, traits.Box)
43
- const capsule = useTrait(() => entity, traits.Capsule)
44
- const sphere = useTrait(() => entity, traits.Sphere)
45
- const bufferGeometry = useTrait(() => entity, traits.BufferGeometry)
46
- const linePositions = useTrait(() => entity, traits.LinePositions)
47
- const lineWidth = useTrait(() => entity, traits.LineWidth)
48
- const center = useTrait(() => entity, traits.Center)
49
- const showAxesHelper = useTrait(() => entity, traits.ShowAxesHelper)
50
-
51
- const geometryType = $derived.by(() => {
52
- if (box.current) return 'box'
53
- if (capsule.current) return 'capsule'
54
- if (sphere.current) return 'sphere'
55
- if (bufferGeometry.current) return 'buffer'
56
- if (linePositions.current) return 'line'
57
- })
58
-
59
- const color = $derived.by(() => {
60
- if (overrideColor) {
61
- return overrideColor
62
- }
63
- if (entityColor.current) {
64
- return colorUtil
65
- .setRGB(entityColor.current.r, entityColor.current.g, entityColor.current.b)
66
- .getHexString()
67
- }
68
- return colors.default
69
- })
70
-
71
- const group = new Group()
72
- ref = group
73
-
74
- const mesh = $derived.by(() => {
75
- if (geometryType === undefined) {
76
- return
77
- }
78
-
79
- const result = geometryType === 'line' ? new Line2() : new Mesh()
80
-
81
- if (geometryType === 'line') {
82
- result.raycast = meshBounds
83
- }
84
-
85
- return result
86
- })
87
-
88
- $effect.pre(() => {
89
- if (mesh && center.current) {
90
- poseToObject3d(center.current, mesh)
91
- invalidate()
92
- }
93
- })
94
-
95
- const entityPose = useTrait(() => entity, traits.Pose)
96
- const resolvedPose = $derived(pose ?? entityPose.current)
97
- $effect.pre(() => {
98
- if (resolvedPose) {
99
- poseToObject3d(resolvedPose, group)
100
- invalidate()
101
- }
102
- })
103
-
104
- let geo = $state.raw<BufferGeometry>()
105
-
106
- const oncreate = (bufferGeometry: BufferGeometry) => {
107
- geo = bufferGeometry
108
- }
109
-
110
- $effect.pre(() => {
111
- if (mesh && bufferGeometry.current) {
112
- mesh.geometry = bufferGeometry.current
113
- oncreate(bufferGeometry.current)
114
-
115
- return () => {
116
- geo = undefined
117
- mesh?.geometry?.dispose()
118
- }
119
- }
120
- })
121
- </script>
122
-
123
- <T
124
- is={group}
125
- {...rest}
126
- >
127
- {#if geometryType}
128
- {#if showAxesHelper.current}
129
- <AxesHelper
130
- width={3}
131
- length={0.1}
132
- />
133
- {/if}
134
-
135
- <T
136
- is={mesh}
137
- name={entity}
138
- userData.name={name}
139
- bvh={{ enabled: geometryType === 'buffer' }}
140
- >
141
- {#if model && renderMode.includes('model')}
142
- <T is={model} />
143
- {/if}
144
-
145
- {#if !model || renderMode.includes('colliders')}
146
- {#if linePositions.current}
147
- <T
148
- is={LineGeometry}
149
- oncreate={(ref) => {
150
- if (linePositions.current) {
151
- ref.setPositions(linePositions.current)
152
- }
153
- }}
154
- />
155
- {:else if box.current}
156
- {@const { x, y, z } = box.current ?? { x: 0, y: 0, z: 0 }}
157
- <T.BoxGeometry
158
- args={[x * 0.001, y * 0.001, z * 0.001]}
159
- {oncreate}
160
- />
161
- {:else if sphere.current}
162
- {@const { r } = sphere.current ?? { r: 0 }}
163
- <T.SphereGeometry
164
- args={[r * 0.001]}
165
- {oncreate}
166
- />
167
- {:else if capsule.current}
168
- {@const { r, l } = capsule.current ?? { r: 0, l: 0 }}
169
- <T
170
- is={CapsuleGeometry}
171
- args={[r * 0.001, l * 0.001]}
172
- {oncreate}
173
- />
174
- {/if}
175
- {/if}
176
-
177
- {#if linePositions.current}
178
- <T
179
- is={LineMaterial}
180
- {color}
181
- width={lineWidth.current ? lineWidth.current * 0.001 : 0.5}
182
- />
183
- {:else}
184
- <T.MeshToonMaterial
185
- {color}
186
- side={geometryType === 'buffer' ? DoubleSide : FrontSide}
187
- transparent={(opacity.current ?? 0.7) < 1}
188
- opacity={opacity.current ?? 0.7}
189
- />
190
-
191
- {#if geo && renderMode.includes('colliders')}
192
- <T.LineSegments
193
- raycast={() => null}
194
- bvh={{ enabled: false }}
195
- >
196
- <T.EdgesGeometry args={[geo, 0]} />
197
- <T.LineBasicMaterial color={darkenColor(color, 10)} />
198
- </T.LineSegments>
199
- {/if}
200
- {/if}
201
- </T>
202
- {:else if showAxesHelper.current}
203
- <AxesHelper
204
- name={name.current}
205
- width={3}
206
- length={0.1}
207
- />
208
- {/if}
209
-
210
- {@render children?.({ ref: group })}
211
- </T>
@@ -1,19 +0,0 @@
1
- import { type Props as ThrelteProps } from '@threlte/core';
2
- import { type Snippet } from 'svelte';
3
- import { Group } from 'three';
4
- import type { Entity } from 'koota';
5
- import type { Pose } from '@viamrobotics/sdk';
6
- interface Props extends ThrelteProps<Group> {
7
- entity: Entity;
8
- color?: string;
9
- model?: Group;
10
- pose?: Pose;
11
- renderMode?: 'model' | 'colliders' | 'colliders+model';
12
- ref?: Group;
13
- children?: Snippet<[{
14
- ref: Group;
15
- }]>;
16
- }
17
- declare const Geometry2: import("svelte").Component<Props, {}, "ref">;
18
- type Geometry2 = ReturnType<typeof Geometry2>;
19
- export default Geometry2;
@@ -1,65 +0,0 @@
1
- <script lang="ts">
2
- import { Switch } from '@viamrobotics/prime-core'
3
- import Drawer from './Drawer.svelte'
4
- import { useSettings } from '../../../hooks/useSettings.svelte'
5
- import { useResourceByName } from '../../../hooks/useResourceByName.svelte'
6
- import { usePartID } from '../../../hooks/usePartID.svelte'
7
-
8
- const settings = useSettings()
9
- const resourceByName = useResourceByName()
10
- const partID = usePartID()
11
-
12
- const cameras = $derived(
13
- Object.values(resourceByName.current).filter((resource) => resource?.subtype === 'camera')
14
- )
15
-
16
- const currentRobotCameraWidgets = $derived(
17
- settings.current.openCameraWidgets[partID.current] || []
18
- )
19
- </script>
20
-
21
- <Drawer name="Widgets">
22
- <div class="flex flex-col gap-2 overflow-scroll p-3">
23
- <div class="flex items-center justify-between gap-4 py-2">
24
- Arm positions
25
- <Switch
26
- bind:on={settings.current.enableArmPositionsWidget}
27
- on:change={(event) => {
28
- settings.current.enableArmPositionsWidget = event.detail
29
- }}
30
- />
31
- </div>
32
-
33
- <div class="mt-4">
34
- <h3 class="text-sm"><strong>Camera Widgets</strong></h3>
35
- {#each cameras as camera (camera?.name)}
36
- {#if camera}
37
- {@const isOpen = currentRobotCameraWidgets.includes(camera.name)}
38
- <div class="flex items-center justify-between gap-4 py-2">
39
- {camera.name}
40
- <Switch
41
- on={isOpen}
42
- on:change={(event) => {
43
- if (event.detail) {
44
- settings.current.openCameraWidgets = {
45
- ...settings.current.openCameraWidgets,
46
- [partID.current]: [...currentRobotCameraWidgets, camera.name],
47
- }
48
- } else {
49
- settings.current.openCameraWidgets = {
50
- ...settings.current.openCameraWidgets,
51
- [partID.current]: currentRobotCameraWidgets.filter(
52
- (widget) => widget !== camera.name
53
- ),
54
- }
55
- }
56
- }}
57
- />
58
- </div>
59
- {/if}
60
- {:else}
61
- <div class="py-2">No cameras detected</div>
62
- {/each}
63
- </div>
64
- </div>
65
- </Drawer>
@@ -1,3 +0,0 @@
1
- declare const Widgets: import("svelte").Component<Record<string, never>, {}, "">;
2
- type Widgets = ReturnType<typeof Widgets>;
3
- export default Widgets;
package/dist/entries.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const typeSafeObjectFromEntries: <const T extends ReadonlyArray<readonly [PropertyKey, unknown]>>(entries: T) => { [K in T[number] as K[0]]: K[1]; };
package/dist/entries.js DELETED
@@ -1,3 +0,0 @@
1
- export const typeSafeObjectFromEntries = (entries) => {
2
- return Object.fromEntries(entries);
3
- };
File without changes
@@ -1 +0,0 @@
1
- "use strict";
package/dist/test.d.ts DELETED
@@ -1 +0,0 @@
1
- export { createRandomPcdBinary } from './test/createRandomPcdBinary';
package/dist/test.js DELETED
@@ -1 +0,0 @@
1
- export { createRandomPcdBinary } from './test/createRandomPcdBinary';
@@ -1,50 +0,0 @@
1
- import { Box3, LineSegments, Object3D } from 'three';
2
- /**
3
- * Helper object to graphically show the world-axis-aligned bounding box
4
- * around an object. The actual bounding box is handled with {@link Box3},
5
- * this is just a visual helper for debugging. It can be automatically
6
- * resized with {@link BoxHelper#update} when the object it's created from
7
- * is transformed. Note that the object must have a geometry for this to work,
8
- * so it won't work with sprites.
9
- *
10
- * ```js
11
- * const sphere = new THREE.SphereGeometry();
12
- * const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
13
- * const box = new THREE.BoxHelper( object, 0xffff00 );
14
- * scene.add( box );
15
- * ```
16
- *
17
- * @augments LineSegments
18
- */
19
- declare class BoxHelper extends LineSegments {
20
- type: string;
21
- matrixAutoUpdate: boolean;
22
- object: Object3D | undefined;
23
- /**
24
- * Constructs a new box helper.
25
- *
26
- * @param {Object3D} [object] - The 3D object to show the world-axis-aligned bounding box.
27
- * @param {number|Color|string} [color=0xffff00] - The box's color.
28
- */
29
- constructor(object: Object3D, color?: number);
30
- /**
31
- * Updates the helper's geometry to match the dimensions of the object,
32
- * including any children.
33
- */
34
- update(): void;
35
- /**
36
- * Updates the wireframe box for the passed object.
37
- *
38
- * @param {Object3D} object - The 3D object to create the helper for.
39
- * @return {BoxHelper} A reference to this instance.
40
- */
41
- setFromObject(object: Object3D): this;
42
- setFromBox3(box: Box3): this;
43
- copy(source: BoxHelper, recursive: boolean): this;
44
- /**
45
- * Frees the GPU-related resources allocated by this instance. Call this
46
- * method whenever this instance is no longer used in your app.
47
- */
48
- dispose(): void;
49
- }
50
- export { BoxHelper };