@konitif/viewer-3d 0.284.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 (175) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +34 -0
  3. package/dist/balanceFootprintDefinition.d.ts +7 -0
  4. package/dist/balanceFootprintDefinition.d.ts.map +1 -0
  5. package/dist/balanceFootprintDefinition.js +2 -0
  6. package/dist/balanceFootprintDefinition.js.map +1 -0
  7. package/dist/diagnosticContactDefinition.d.ts +7 -0
  8. package/dist/diagnosticContactDefinition.d.ts.map +1 -0
  9. package/dist/diagnosticContactDefinition.js +2 -0
  10. package/dist/diagnosticContactDefinition.js.map +1 -0
  11. package/dist/handTipDefinition.d.ts +13 -0
  12. package/dist/handTipDefinition.d.ts.map +1 -0
  13. package/dist/handTipDefinition.js +2 -0
  14. package/dist/handTipDefinition.js.map +1 -0
  15. package/dist/index.d.ts +41 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +19 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/jointHandleDefinition.d.ts +23 -0
  20. package/dist/jointHandleDefinition.d.ts.map +1 -0
  21. package/dist/jointHandleDefinition.js +2 -0
  22. package/dist/jointHandleDefinition.js.map +1 -0
  23. package/dist/ledPlacementDefinition.d.ts +38 -0
  24. package/dist/ledPlacementDefinition.d.ts.map +1 -0
  25. package/dist/ledPlacementDefinition.js +2 -0
  26. package/dist/ledPlacementDefinition.js.map +1 -0
  27. package/dist/ledReferenceFrame.d.ts +26 -0
  28. package/dist/ledReferenceFrame.d.ts.map +1 -0
  29. package/dist/ledReferenceFrame.js +2 -0
  30. package/dist/ledReferenceFrame.js.map +1 -0
  31. package/dist/ledRingCalibration.d.ts +22 -0
  32. package/dist/ledRingCalibration.d.ts.map +1 -0
  33. package/dist/ledRingCalibration.js +2 -0
  34. package/dist/ledRingCalibration.js.map +1 -0
  35. package/dist/renderer/AnimationLoop.d.ts +18 -0
  36. package/dist/renderer/AnimationLoop.d.ts.map +1 -0
  37. package/dist/renderer/AnimationLoop.js +39 -0
  38. package/dist/renderer/AnimationLoop.js.map +1 -0
  39. package/dist/renderer/CameraController.d.ts +154 -0
  40. package/dist/renderer/CameraController.d.ts.map +1 -0
  41. package/dist/renderer/CameraController.js +469 -0
  42. package/dist/renderer/CameraController.js.map +1 -0
  43. package/dist/renderer/NavigationPhysicsObservation.d.ts +25 -0
  44. package/dist/renderer/NavigationPhysicsObservation.d.ts.map +1 -0
  45. package/dist/renderer/NavigationPhysicsObservation.js +81 -0
  46. package/dist/renderer/NavigationPhysicsObservation.js.map +1 -0
  47. package/dist/renderer/ObservedRobotGroundingProjection.d.ts +206 -0
  48. package/dist/renderer/ObservedRobotGroundingProjection.d.ts.map +1 -0
  49. package/dist/renderer/ObservedRobotGroundingProjection.js +522 -0
  50. package/dist/renderer/ObservedRobotGroundingProjection.js.map +1 -0
  51. package/dist/renderer/ObservedRobotPresentationBuffer.d.ts +71 -0
  52. package/dist/renderer/ObservedRobotPresentationBuffer.d.ts.map +1 -0
  53. package/dist/renderer/ObservedRobotPresentationBuffer.js +226 -0
  54. package/dist/renderer/ObservedRobotPresentationBuffer.js.map +1 -0
  55. package/dist/renderer/PerformanceMonitor.d.ts +38 -0
  56. package/dist/renderer/PerformanceMonitor.d.ts.map +1 -0
  57. package/dist/renderer/PerformanceMonitor.js +84 -0
  58. package/dist/renderer/PerformanceMonitor.js.map +1 -0
  59. package/dist/renderer/ProjectileInteraction.d.ts +57 -0
  60. package/dist/renderer/ProjectileInteraction.d.ts.map +1 -0
  61. package/dist/renderer/ProjectileInteraction.js +152 -0
  62. package/dist/renderer/ProjectileInteraction.js.map +1 -0
  63. package/dist/renderer/RobotComparisonVisibilityTransition.d.ts +12 -0
  64. package/dist/renderer/RobotComparisonVisibilityTransition.d.ts.map +1 -0
  65. package/dist/renderer/RobotComparisonVisibilityTransition.js +23 -0
  66. package/dist/renderer/RobotComparisonVisibilityTransition.js.map +1 -0
  67. package/dist/renderer/RobotPoseTransition.d.ts +34 -0
  68. package/dist/renderer/RobotPoseTransition.d.ts.map +1 -0
  69. package/dist/renderer/RobotPoseTransition.js +66 -0
  70. package/dist/renderer/RobotPoseTransition.js.map +1 -0
  71. package/dist/renderer/RobotPostureCompensation.d.ts +31 -0
  72. package/dist/renderer/RobotPostureCompensation.d.ts.map +1 -0
  73. package/dist/renderer/RobotPostureCompensation.js +60 -0
  74. package/dist/renderer/RobotPostureCompensation.js.map +1 -0
  75. package/dist/renderer/SelectionController.d.ts +24 -0
  76. package/dist/renderer/SelectionController.d.ts.map +1 -0
  77. package/dist/renderer/SelectionController.js +68 -0
  78. package/dist/renderer/SelectionController.js.map +1 -0
  79. package/dist/renderer/TemporalProjectionModel.d.ts +71 -0
  80. package/dist/renderer/TemporalProjectionModel.d.ts.map +1 -0
  81. package/dist/renderer/TemporalProjectionModel.js +363 -0
  82. package/dist/renderer/TemporalProjectionModel.js.map +1 -0
  83. package/dist/renderer/Viewer3DRenderer.d.ts +1137 -0
  84. package/dist/renderer/Viewer3DRenderer.d.ts.map +1 -0
  85. package/dist/renderer/Viewer3DRenderer.js +10655 -0
  86. package/dist/renderer/Viewer3DRenderer.js.map +1 -0
  87. package/dist/renderer/ViewerExperimentCollector.d.ts +27 -0
  88. package/dist/renderer/ViewerExperimentCollector.d.ts.map +1 -0
  89. package/dist/renderer/ViewerExperimentCollector.js +2 -0
  90. package/dist/renderer/ViewerExperimentCollector.js.map +1 -0
  91. package/dist/renderer/ViewerExperimentPort.d.ts +19 -0
  92. package/dist/renderer/ViewerExperimentPort.d.ts.map +1 -0
  93. package/dist/renderer/ViewerExperimentPort.js +2 -0
  94. package/dist/renderer/ViewerExperimentPort.js.map +1 -0
  95. package/dist/renderer/ViewerFrameSignals.d.ts +13 -0
  96. package/dist/renderer/ViewerFrameSignals.d.ts.map +1 -0
  97. package/dist/renderer/ViewerFrameSignals.js +73 -0
  98. package/dist/renderer/ViewerFrameSignals.js.map +1 -0
  99. package/dist/renderer/ViewerHistoryData.d.ts +59 -0
  100. package/dist/renderer/ViewerHistoryData.d.ts.map +1 -0
  101. package/dist/renderer/ViewerHistoryData.js +2 -0
  102. package/dist/renderer/ViewerHistoryData.js.map +1 -0
  103. package/dist/renderer/ViewerHistoryPort.d.ts +15 -0
  104. package/dist/renderer/ViewerHistoryPort.d.ts.map +1 -0
  105. package/dist/renderer/ViewerHistoryPort.js +2 -0
  106. package/dist/renderer/ViewerHistoryPort.js.map +1 -0
  107. package/dist/renderer/ViewerIncarnationHealth.d.ts +14 -0
  108. package/dist/renderer/ViewerIncarnationHealth.d.ts.map +1 -0
  109. package/dist/renderer/ViewerIncarnationHealth.js +13 -0
  110. package/dist/renderer/ViewerIncarnationHealth.js.map +1 -0
  111. package/dist/renderer/ViewerInputBindings.d.ts +19 -0
  112. package/dist/renderer/ViewerInputBindings.d.ts.map +1 -0
  113. package/dist/renderer/ViewerInputBindings.js +44 -0
  114. package/dist/renderer/ViewerInputBindings.js.map +1 -0
  115. package/dist/renderer/ViewerMetadata.d.ts +11 -0
  116. package/dist/renderer/ViewerMetadata.d.ts.map +1 -0
  117. package/dist/renderer/ViewerMetadata.js +8 -0
  118. package/dist/renderer/ViewerMetadata.js.map +1 -0
  119. package/dist/renderer/ViewerPlaybackCompletionPolicy.d.ts +29 -0
  120. package/dist/renderer/ViewerPlaybackCompletionPolicy.d.ts.map +1 -0
  121. package/dist/renderer/ViewerPlaybackCompletionPolicy.js +27 -0
  122. package/dist/renderer/ViewerPlaybackCompletionPolicy.js.map +1 -0
  123. package/dist/renderer/ViewerProjectileParticleRenderer.d.ts +21 -0
  124. package/dist/renderer/ViewerProjectileParticleRenderer.d.ts.map +1 -0
  125. package/dist/renderer/ViewerProjectileParticleRenderer.js +134 -0
  126. package/dist/renderer/ViewerProjectileParticleRenderer.js.map +1 -0
  127. package/dist/renderer/ViewerResizePresentation.d.ts +16 -0
  128. package/dist/renderer/ViewerResizePresentation.d.ts.map +1 -0
  129. package/dist/renderer/ViewerResizePresentation.js +12 -0
  130. package/dist/renderer/ViewerResizePresentation.js.map +1 -0
  131. package/dist/renderer/ViewerTemporalProjectionExperimentAdapter.d.ts +34 -0
  132. package/dist/renderer/ViewerTemporalProjectionExperimentAdapter.d.ts.map +1 -0
  133. package/dist/renderer/ViewerTemporalProjectionExperimentAdapter.js +130 -0
  134. package/dist/renderer/ViewerTemporalProjectionExperimentAdapter.js.map +1 -0
  135. package/dist/renderer/ViewerTemporalScheduler.d.ts +6 -0
  136. package/dist/renderer/ViewerTemporalScheduler.d.ts.map +1 -0
  137. package/dist/renderer/ViewerTemporalScheduler.js +12 -0
  138. package/dist/renderer/ViewerTemporalScheduler.js.map +1 -0
  139. package/dist/renderer/VisualGroundLayer.d.ts +110 -0
  140. package/dist/renderer/VisualGroundLayer.d.ts.map +1 -0
  141. package/dist/renderer/VisualGroundLayer.js +576 -0
  142. package/dist/renderer/VisualGroundLayer.js.map +1 -0
  143. package/dist/renderer/displayFrameRate.d.ts +5 -0
  144. package/dist/renderer/displayFrameRate.d.ts.map +1 -0
  145. package/dist/renderer/displayFrameRate.js +23 -0
  146. package/dist/renderer/displayFrameRate.js.map +1 -0
  147. package/dist/renderer/index.d.ts +20 -0
  148. package/dist/renderer/index.d.ts.map +1 -0
  149. package/dist/renderer/index.js +18 -0
  150. package/dist/renderer/index.js.map +1 -0
  151. package/dist/renderer/physics/ViewerJointResolution.d.ts +19 -0
  152. package/dist/renderer/physics/ViewerJointResolution.d.ts.map +1 -0
  153. package/dist/renderer/physics/ViewerJointResolution.js +24 -0
  154. package/dist/renderer/physics/ViewerJointResolution.js.map +1 -0
  155. package/dist/renderer/physics/ViewerPhysicsFrame.d.ts +9 -0
  156. package/dist/renderer/physics/ViewerPhysicsFrame.d.ts.map +1 -0
  157. package/dist/renderer/physics/ViewerPhysicsFrame.js +26 -0
  158. package/dist/renderer/physics/ViewerPhysicsFrame.js.map +1 -0
  159. package/dist/renderer/physics/ViewerPhysicsJointMapping.d.ts +11 -0
  160. package/dist/renderer/physics/ViewerPhysicsJointMapping.d.ts.map +1 -0
  161. package/dist/renderer/physics/ViewerPhysicsJointMapping.js +20 -0
  162. package/dist/renderer/physics/ViewerPhysicsJointMapping.js.map +1 -0
  163. package/dist/renderer/physics/ViewerPhysicsMetadata.d.ts +20 -0
  164. package/dist/renderer/physics/ViewerPhysicsMetadata.d.ts.map +1 -0
  165. package/dist/renderer/physics/ViewerPhysicsMetadata.js +49 -0
  166. package/dist/renderer/physics/ViewerPhysicsMetadata.js.map +1 -0
  167. package/dist/renderer/robotViewerMotion.d.ts +49 -0
  168. package/dist/renderer/robotViewerMotion.d.ts.map +1 -0
  169. package/dist/renderer/robotViewerMotion.js +253 -0
  170. package/dist/renderer/robotViewerMotion.js.map +1 -0
  171. package/dist/supportDefinition.d.ts +11 -0
  172. package/dist/supportDefinition.d.ts.map +1 -0
  173. package/dist/supportDefinition.js +2 -0
  174. package/dist/supportDefinition.js.map +1 -0
  175. package/package.json +52 -0
@@ -0,0 +1,522 @@
1
+ function finiteOrNull(value) {
2
+ return typeof value === 'number' && Number.isFinite(value) ? value : null;
3
+ }
4
+ const IDENTITY_QUATERNION = { x: 0, y: 0, z: 0, w: 1 };
5
+ const SUPPORT_PLANE_EPSILON = 1e-10;
6
+ const DEFAULT_MAX_INCLINATION_CORRECTION_RADIANS = Math.PI / 9;
7
+ const DEFAULT_MAX_SUPPORT_ANCHOR_CORRECTION_METERS = 0.08;
8
+ const DEFAULT_ACTIVE_SUPPORT_CONTACT_BAND_METERS = 0.025;
9
+ const DEFAULT_ACTIVE_SUPPORT_RELEASE_HYSTERESIS_METERS = 0.015;
10
+ const DEFAULT_TEMPORAL_SUPPORT_REACQUIRE_DISTANCE_METERS = 0.06;
11
+ function isFiniteSupportPoint(point) {
12
+ return Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z);
13
+ }
14
+ function resolveSupportCentroid(supportPoints) {
15
+ if (supportPoints.length === 0 || supportPoints.some((point) => !isFiniteSupportPoint(point))) {
16
+ return null;
17
+ }
18
+ const centroid = supportPoints.reduce((sum, point) => ({ x: sum.x + point.x, y: sum.y + point.y, z: sum.z + point.z }), { x: 0, y: 0, z: 0 });
19
+ return {
20
+ x: centroid.x / supportPoints.length,
21
+ y: centroid.y / supportPoints.length,
22
+ z: centroid.z / supportPoints.length
23
+ };
24
+ }
25
+ /**
26
+ * Selects only sole anchors that belong to the lowest contact band.
27
+ *
28
+ * The robot model exposes eight semantic FSR frames, but their presence does
29
+ * not mean both feet currently support the body. Feeding a lifted foot into
30
+ * the support plane makes its animated centroid a hidden root controller.
31
+ * This projection keeps the lowest, physically plausible contact subset,
32
+ * preserves its stable identities, and uses a wider release band for the
33
+ * previous support. That hysteresis prevents millimetric telemetry noise from
34
+ * repeatedly releasing and reacquiring the static-friction anchor.
35
+ */
36
+ export function resolveObservedRobotActiveSupportProjection(input) {
37
+ const contactBandMeters = Number.isFinite(input.contactBandMeters)
38
+ ? Math.max(0, input.contactBandMeters ?? 0)
39
+ : DEFAULT_ACTIVE_SUPPORT_CONTACT_BAND_METERS;
40
+ const releaseContactBandMeters = Number.isFinite(input.releaseContactBandMeters)
41
+ ? Math.max(contactBandMeters, input.releaseContactBandMeters ?? contactBandMeters)
42
+ : contactBandMeters + DEFAULT_ACTIVE_SUPPORT_RELEASE_HYSTERESIS_METERS;
43
+ const hasStableContactIds = input.contactIds?.length === input.supportPoints.length;
44
+ const hasSupportGroups = input.supportGroupIds?.length === input.supportPoints.length;
45
+ const previousActiveContactIdSet = new Set(input.previousActiveContactIds ?? []);
46
+ const finiteEntries = input.supportPoints
47
+ .map((point, index) => ({
48
+ point,
49
+ index,
50
+ contactId: hasStableContactIds ? input.contactIds[index] : String(index),
51
+ supportGroupId: hasSupportGroups ? input.supportGroupIds[index] : null
52
+ }))
53
+ .filter(({ point }) => isFiniteSupportPoint(point));
54
+ const supportMinimumY = finiteEntries.reduce((minimum, { point }) => Math.min(minimum, point.y), Number.POSITIVE_INFINITY);
55
+ if (!Number.isFinite(supportMinimumY)) {
56
+ return {
57
+ status: 'unavailable',
58
+ supportPoints: [],
59
+ activeIndices: [],
60
+ activeContactIds: [],
61
+ sourceContactCount: finiteEntries.length,
62
+ activeContactCount: 0,
63
+ supportMinimumY: null,
64
+ contactBandMeters,
65
+ releaseContactBandMeters
66
+ };
67
+ }
68
+ const activeSupportGroupIds = new Set();
69
+ if (hasSupportGroups) {
70
+ const minimumByGroup = new Map();
71
+ for (const { point, supportGroupId } of finiteEntries) {
72
+ if (!supportGroupId)
73
+ continue;
74
+ minimumByGroup.set(supportGroupId, Math.min(minimumByGroup.get(supportGroupId) ?? Number.POSITIVE_INFINITY, point.y));
75
+ }
76
+ const contactIdsByGroup = new Map();
77
+ for (const { contactId, supportGroupId } of finiteEntries) {
78
+ if (!supportGroupId)
79
+ continue;
80
+ const contactIds = contactIdsByGroup.get(supportGroupId) ?? [];
81
+ contactIds.push(contactId);
82
+ contactIdsByGroup.set(supportGroupId, contactIds);
83
+ }
84
+ for (const [supportGroupId, minimumY] of minimumByGroup) {
85
+ const wasPreviouslyActive = (contactIdsByGroup.get(supportGroupId) ?? []).some((contactId) => previousActiveContactIdSet.has(contactId));
86
+ const activeBandMeters = wasPreviouslyActive
87
+ ? releaseContactBandMeters
88
+ : contactBandMeters;
89
+ if (minimumY <= supportMinimumY + activeBandMeters) {
90
+ activeSupportGroupIds.add(supportGroupId);
91
+ }
92
+ }
93
+ }
94
+ // Once one anchor of a rigid sole reaches the contact band, keep the whole
95
+ // sole as one stable support identity. Selecting its corners independently
96
+ // makes tiny roll/pitch variations repeatedly release static friction.
97
+ const activeEntries = finiteEntries.filter(({ point, supportGroupId }) => hasSupportGroups
98
+ ? Boolean(supportGroupId && activeSupportGroupIds.has(supportGroupId))
99
+ : point.y <= supportMinimumY + contactBandMeters);
100
+ const resolved = activeEntries.length >= 3;
101
+ return {
102
+ status: resolved ? 'resolved' : 'unavailable',
103
+ supportPoints: resolved ? activeEntries.map(({ point }) => point) : [],
104
+ activeIndices: resolved ? activeEntries.map(({ index }) => index) : [],
105
+ activeContactIds: resolved ? activeEntries.map(({ contactId }) => contactId) : [],
106
+ sourceContactCount: finiteEntries.length,
107
+ activeContactCount: resolved ? activeEntries.length : 0,
108
+ supportMinimumY,
109
+ contactBandMeters,
110
+ releaseContactBandMeters
111
+ };
112
+ }
113
+ /**
114
+ * Keeps a stable support footprint across consecutive observed joint frames.
115
+ *
116
+ * Joint telemetry contains no authoritative world-space root translation.
117
+ * Once a valid foot-support subset is acquired, small centroid changes are
118
+ * therefore presentation artefacts caused by the articulated model and are
119
+ * cancelled as static friction. A changed contact subset or a discontinuity
120
+ * beyond the bounded threshold reacquires the anchor instead of inventing a
121
+ * robot trajectory.
122
+ */
123
+ export function resolveObservedRobotTemporalSupportAnchorProjection(input) {
124
+ const unavailable = () => ({
125
+ status: 'unavailable',
126
+ state: null,
127
+ supportContactCount: 0,
128
+ offsetX: 0,
129
+ offsetZ: 0,
130
+ requestedOffsetMeters: 0,
131
+ affectedRootAxes: [],
132
+ constraintModel: 'unconstrained',
133
+ physicsAffected: false
134
+ });
135
+ if (input.supportEligible === false ||
136
+ input.supportPoints.length < 3 ||
137
+ input.supportPoints.length !== input.activeIndices.length) {
138
+ return unavailable();
139
+ }
140
+ const centroid = resolveSupportCentroid(input.supportPoints);
141
+ if (!centroid || input.activeIndices.some((index) => !Number.isInteger(index) || index < 0)) {
142
+ return unavailable();
143
+ }
144
+ const stableContactIds = input.activeContactIds?.length === input.supportPoints.length
145
+ ? input.activeContactIds
146
+ : input.activeIndices.map(String);
147
+ const supportSignature = [...stableContactIds].sort().join('|');
148
+ const acquiredState = {
149
+ anchorX: centroid.x,
150
+ anchorZ: centroid.z,
151
+ supportSignature,
152
+ supportContactCount: input.supportPoints.length,
153
+ activeContactIds: [...stableContactIds].sort()
154
+ };
155
+ const previousState = input.previousState;
156
+ if (!previousState) {
157
+ return {
158
+ status: 'acquired',
159
+ state: acquiredState,
160
+ supportContactCount: input.supportPoints.length,
161
+ offsetX: 0,
162
+ offsetZ: 0,
163
+ requestedOffsetMeters: 0,
164
+ affectedRootAxes: [],
165
+ constraintModel: 'temporal-support-static-friction',
166
+ physicsAffected: false
167
+ };
168
+ }
169
+ if (previousState.supportSignature !== supportSignature ||
170
+ previousState.supportContactCount !== input.supportPoints.length) {
171
+ return {
172
+ status: 'reacquired',
173
+ state: acquiredState,
174
+ supportContactCount: input.supportPoints.length,
175
+ offsetX: 0,
176
+ offsetZ: 0,
177
+ requestedOffsetMeters: 0,
178
+ affectedRootAxes: [],
179
+ constraintModel: 'temporal-support-static-friction',
180
+ physicsAffected: false
181
+ };
182
+ }
183
+ const offsetX = previousState.anchorX - centroid.x;
184
+ const offsetZ = previousState.anchorZ - centroid.z;
185
+ const requestedOffsetMeters = Math.hypot(offsetX, offsetZ);
186
+ const reacquireDistanceMeters = Number.isFinite(input.reacquireDistanceMeters)
187
+ ? Math.max(0, input.reacquireDistanceMeters ?? 0)
188
+ : DEFAULT_TEMPORAL_SUPPORT_REACQUIRE_DISTANCE_METERS;
189
+ if (requestedOffsetMeters > reacquireDistanceMeters) {
190
+ return {
191
+ status: 'reacquired',
192
+ state: acquiredState,
193
+ supportContactCount: input.supportPoints.length,
194
+ offsetX: 0,
195
+ offsetZ: 0,
196
+ requestedOffsetMeters,
197
+ affectedRootAxes: [],
198
+ constraintModel: 'temporal-support-static-friction',
199
+ physicsAffected: false
200
+ };
201
+ }
202
+ return {
203
+ status: 'preserved',
204
+ state: previousState,
205
+ supportContactCount: input.supportPoints.length,
206
+ offsetX,
207
+ offsetZ,
208
+ requestedOffsetMeters,
209
+ affectedRootAxes: ['x', 'z'],
210
+ constraintModel: 'temporal-support-static-friction',
211
+ physicsAffected: false
212
+ };
213
+ }
214
+ /**
215
+ * Preserves the world-space support footprint while a missing root
216
+ * inclination is completed for presentation.
217
+ *
218
+ * Rotating the observed model around its authored root (usually near the
219
+ * torso) moves the sole anchors laterally. The inverse centroid delta makes
220
+ * the support polygon the effective pivot instead. Y remains owned by the
221
+ * grounding projection, and the bounded X/Z correction is a static-friction
222
+ * constraint only: it does not integrate velocity or alter observed joints.
223
+ */
224
+ export function resolveObservedRobotSupportAnchorProjection(input) {
225
+ const unavailable = (supportContactCount = 0) => ({
226
+ status: 'unavailable',
227
+ supportContactCount,
228
+ offsetX: 0,
229
+ offsetZ: 0,
230
+ requestedOffsetMeters: 0,
231
+ appliedOffsetMeters: 0,
232
+ affectedRootAxes: [],
233
+ constraintModel: 'unconstrained',
234
+ physicsAffected: false
235
+ });
236
+ if (input.supportEligible === false ||
237
+ input.supportPointsBefore.length < 3 ||
238
+ input.supportPointsBefore.length !== input.supportPointsAfter.length) {
239
+ return unavailable(input.supportPointsBefore.length);
240
+ }
241
+ const before = resolveSupportCentroid(input.supportPointsBefore);
242
+ const after = resolveSupportCentroid(input.supportPointsAfter);
243
+ if (!before || !after)
244
+ return unavailable(input.supportPointsBefore.length);
245
+ const requestedOffsetX = before.x - after.x;
246
+ const requestedOffsetZ = before.z - after.z;
247
+ const requestedOffsetMeters = Math.hypot(requestedOffsetX, requestedOffsetZ);
248
+ const maxCorrectionMeters = Number.isFinite(input.maxCorrectionMeters)
249
+ ? Math.max(0, input.maxCorrectionMeters ?? 0)
250
+ : DEFAULT_MAX_SUPPORT_ANCHOR_CORRECTION_METERS;
251
+ const scale = requestedOffsetMeters > maxCorrectionMeters && requestedOffsetMeters > SUPPORT_PLANE_EPSILON
252
+ ? maxCorrectionMeters / requestedOffsetMeters
253
+ : 1;
254
+ const offsetX = requestedOffsetX * scale;
255
+ const offsetZ = requestedOffsetZ * scale;
256
+ const appliedOffsetMeters = requestedOffsetMeters * scale;
257
+ return {
258
+ status: scale < 1 ? 'clamped' : 'preserved',
259
+ supportContactCount: input.supportPointsBefore.length,
260
+ offsetX,
261
+ offsetZ,
262
+ requestedOffsetMeters,
263
+ appliedOffsetMeters,
264
+ affectedRootAxes: ['x', 'z'],
265
+ constraintModel: 'support-centroid-static-friction',
266
+ physicsAffected: false
267
+ };
268
+ }
269
+ /**
270
+ * Fits y = ax + bz + c through the semantic sole anchors and returns the
271
+ * shortest world-space rotation that aligns that support plane with world up.
272
+ *
273
+ * This is deliberately a quasi-static contact constraint, not a dynamics
274
+ * simulation: observed joints remain authoritative and only the missing root
275
+ * roll/pitch presentation is inferred. The bounded correction cannot inject
276
+ * velocity, oscillation or a competing pose history.
277
+ */
278
+ export function resolveObservedRobotSupportInclinationProjection(input) {
279
+ const supportPoints = input.supportPoints.filter(isFiniteSupportPoint);
280
+ const unavailable = () => ({
281
+ status: 'unavailable',
282
+ supportContactCount: supportPoints.length,
283
+ supportNormal: null,
284
+ correctionQuaternion: { ...IDENTITY_QUATERNION },
285
+ correctionAngleRadians: 0,
286
+ correctionClamped: false,
287
+ affectedRootAxes: [],
288
+ constraintModel: 'unconstrained',
289
+ physicsAffected: false
290
+ });
291
+ if (!input.enabled || input.supportEligible === false || supportPoints.length < 3) {
292
+ return unavailable();
293
+ }
294
+ const center = supportPoints.reduce((sum, point) => ({ x: sum.x + point.x, y: sum.y + point.y, z: sum.z + point.z }), { x: 0, y: 0, z: 0 });
295
+ center.x /= supportPoints.length;
296
+ center.y /= supportPoints.length;
297
+ center.z /= supportPoints.length;
298
+ let xx = 0;
299
+ let xz = 0;
300
+ let zz = 0;
301
+ let xy = 0;
302
+ let zy = 0;
303
+ for (const point of supportPoints) {
304
+ const x = point.x - center.x;
305
+ const y = point.y - center.y;
306
+ const z = point.z - center.z;
307
+ xx += x * x;
308
+ xz += x * z;
309
+ zz += z * z;
310
+ xy += x * y;
311
+ zy += z * y;
312
+ }
313
+ const determinant = xx * zz - xz * xz;
314
+ if (!Number.isFinite(determinant) || Math.abs(determinant) <= SUPPORT_PLANE_EPSILON) {
315
+ return unavailable();
316
+ }
317
+ const slopeX = (xy * zz - zy * xz) / determinant;
318
+ const slopeZ = (zy * xx - xy * xz) / determinant;
319
+ const normalLength = Math.hypot(slopeX, 1, slopeZ);
320
+ if (!Number.isFinite(normalLength) || normalLength <= SUPPORT_PLANE_EPSILON) {
321
+ return unavailable();
322
+ }
323
+ const supportNormal = {
324
+ x: -slopeX / normalLength,
325
+ y: 1 / normalLength,
326
+ z: -slopeZ / normalLength
327
+ };
328
+ const rawAngle = Math.acos(Math.max(-1, Math.min(1, supportNormal.y)));
329
+ const maxCorrectionRadians = Number.isFinite(input.maxCorrectionRadians)
330
+ ? Math.max(0, Math.min(Math.PI / 2, input.maxCorrectionRadians ?? 0))
331
+ : DEFAULT_MAX_INCLINATION_CORRECTION_RADIANS;
332
+ const correctionAngleRadians = Math.min(rawAngle, maxCorrectionRadians);
333
+ if (correctionAngleRadians <= 1e-7) {
334
+ return {
335
+ status: 'aligned',
336
+ supportContactCount: supportPoints.length,
337
+ supportNormal,
338
+ correctionQuaternion: { ...IDENTITY_QUATERNION },
339
+ correctionAngleRadians: 0,
340
+ correctionClamped: false,
341
+ affectedRootAxes: [],
342
+ constraintModel: 'quasi-static-rigid-contact',
343
+ physicsAffected: false
344
+ };
345
+ }
346
+ // cross(supportNormal, worldUp), normalized. The axis is horizontal, so the
347
+ // correction contains roll/pitch only and cannot modify observed yaw.
348
+ const axisX = -supportNormal.z;
349
+ const axisZ = supportNormal.x;
350
+ const axisLength = Math.hypot(axisX, axisZ);
351
+ if (!Number.isFinite(axisLength) || axisLength <= SUPPORT_PLANE_EPSILON) {
352
+ return unavailable();
353
+ }
354
+ const halfAngle = correctionAngleRadians / 2;
355
+ const sinHalfAngle = Math.sin(halfAngle);
356
+ return {
357
+ status: 'corrected',
358
+ supportContactCount: supportPoints.length,
359
+ supportNormal,
360
+ correctionQuaternion: {
361
+ x: (axisX / axisLength) * sinHalfAngle,
362
+ y: 0,
363
+ z: (axisZ / axisLength) * sinHalfAngle,
364
+ w: Math.cos(halfAngle)
365
+ },
366
+ correctionAngleRadians,
367
+ correctionClamped: rawAngle > correctionAngleRadians + 1e-7,
368
+ affectedRootAxes: ['roll', 'pitch'],
369
+ constraintModel: 'quasi-static-rigid-contact',
370
+ physicsAffected: false
371
+ };
372
+ }
373
+ /**
374
+ * Decides whether sole anchors may complete the missing root inclination.
375
+ *
376
+ * The feet are only a valid support authority while their rendered envelope
377
+ * belongs to the lowest body contact band. When the torso, back, arms or any
378
+ * other collider is lower, the robot is treated as body-supported: its
379
+ * observed orientation is preserved and no "stand it back up" correction is
380
+ * invented locally.
381
+ */
382
+ export function resolveObservedRobotFootSupportEligibility(input) {
383
+ const footGeometryMinimumY = finiteOrNull(input.footGeometryMinimumY);
384
+ const bodyEnvelopeMinimumY = finiteOrNull(input.bodyEnvelopeMinimumY);
385
+ const contactBandMeters = Number.isFinite(input.contactBandMeters)
386
+ ? Math.max(0, input.contactBandMeters ?? 0)
387
+ : 0.025;
388
+ if (footGeometryMinimumY === null || bodyEnvelopeMinimumY === null) {
389
+ return {
390
+ eligible: false,
391
+ footGeometryMinimumY,
392
+ bodyEnvelopeMinimumY,
393
+ separationMeters: null
394
+ };
395
+ }
396
+ const separationMeters = footGeometryMinimumY - bodyEnvelopeMinimumY;
397
+ return {
398
+ eligible: separationMeters <= contactBandMeters,
399
+ footGeometryMinimumY,
400
+ bodyEnvelopeMinimumY,
401
+ separationMeters
402
+ };
403
+ }
404
+ /**
405
+ * Resolves the surface that must visually meet the support plane.
406
+ *
407
+ * FSR frames describe where support can be observed, but their origins live
408
+ * inside the foot assembly and are not guaranteed to coincide with the
409
+ * rendered sole. Prefer the rendered foot envelope for the vertical contact
410
+ * correction, while retaining the FSR count as evidence for the projection.
411
+ *
412
+ * Whole-body colliders decide which support regime is active, but simplified
413
+ * collision geometry is not a reliable visible contact surface. When both are
414
+ * available, align the rendered envelope to the floor and report explicitly
415
+ * that the contact was collider-guided. This covers back, belly and side
416
+ * contacts without making an approximate collider visibly float or penetrate.
417
+ */
418
+ export function resolveObservedRobotSupportSurface(input) {
419
+ const supportContactCount = Number.isFinite(input.supportContactCount)
420
+ ? Math.max(0, Math.trunc(input.supportContactCount ?? 0))
421
+ : 0;
422
+ const collisionEnvelopeMinimumY = finiteOrNull(input.collisionEnvelopeMinimumY);
423
+ const robotBoundsMinimumY = finiteOrNull(input.robotBoundsMinimumY);
424
+ if (collisionEnvelopeMinimumY !== null && robotBoundsMinimumY !== null) {
425
+ return {
426
+ supportMinimumY: robotBoundsMinimumY,
427
+ supportContactCount,
428
+ source: 'collision-guided-render-envelope'
429
+ };
430
+ }
431
+ if (collisionEnvelopeMinimumY !== null) {
432
+ return {
433
+ supportMinimumY: collisionEnvelopeMinimumY,
434
+ supportContactCount,
435
+ source: 'collision-envelope'
436
+ };
437
+ }
438
+ if (robotBoundsMinimumY !== null) {
439
+ return {
440
+ supportMinimumY: robotBoundsMinimumY,
441
+ supportContactCount,
442
+ source: 'robot-bounds'
443
+ };
444
+ }
445
+ const footGeometryMinimumY = finiteOrNull(input.footGeometryMinimumY);
446
+ if (footGeometryMinimumY !== null) {
447
+ return {
448
+ supportMinimumY: footGeometryMinimumY,
449
+ supportContactCount,
450
+ source: 'foot-geometry'
451
+ };
452
+ }
453
+ const contactMinimumY = finiteOrNull(input.contactMinimumY);
454
+ if (supportContactCount > 0 && contactMinimumY !== null) {
455
+ return {
456
+ supportMinimumY: contactMinimumY,
457
+ supportContactCount,
458
+ source: 'foot-contact-anchors'
459
+ };
460
+ }
461
+ return { supportMinimumY: null, supportContactCount: 0, source: 'robot-bounds' };
462
+ }
463
+ /**
464
+ * Completes the missing world-height component of an observed robot pose.
465
+ *
466
+ * Joint values remain observed facts. The vertical offset is an explicit,
467
+ * deterministic support-plane inference and never steps a physics simulation.
468
+ * This vertical stage never changes X/Z. The companion support-anchor
469
+ * projection may only apply the inverse centroid delta required to preserve
470
+ * static contact, without becoming the robot pose authority.
471
+ */
472
+ export function resolveObservedRobotGroundingProjection(input) {
473
+ const floorY = Number.isFinite(input.floorY) ? input.floorY : 0;
474
+ const supportContactCount = Number.isFinite(input.supportContactCount)
475
+ ? Math.max(0, Math.trunc(input.supportContactCount ?? 0))
476
+ : 0;
477
+ if (!input.enabled) {
478
+ return {
479
+ status: 'disabled',
480
+ source: 'unavailable',
481
+ floorY,
482
+ supportMinimumY: null,
483
+ supportContactCount: 0,
484
+ offsetY: 0,
485
+ inferred: false,
486
+ contactMode: 'unconstrained',
487
+ affectedRootAxes: [],
488
+ physicsAffected: false
489
+ };
490
+ }
491
+ if (typeof input.supportMinimumY !== 'number' || !Number.isFinite(input.supportMinimumY)) {
492
+ return {
493
+ status: 'unavailable',
494
+ source: 'unavailable',
495
+ floorY,
496
+ supportMinimumY: null,
497
+ supportContactCount: 0,
498
+ offsetY: 0,
499
+ inferred: false,
500
+ contactMode: 'unconstrained',
501
+ affectedRootAxes: [],
502
+ physicsAffected: false
503
+ };
504
+ }
505
+ return {
506
+ status: 'grounded',
507
+ source: input.source,
508
+ floorY,
509
+ supportMinimumY: input.supportMinimumY,
510
+ supportContactCount,
511
+ offsetY: floorY - input.supportMinimumY,
512
+ inferred: true,
513
+ contactMode: input.source === 'collision-guided-render-envelope' ||
514
+ input.source === 'collision-envelope' ||
515
+ input.source === 'robot-bounds'
516
+ ? 'collision-envelope-static-contact'
517
+ : 'support-plane-static-friction',
518
+ affectedRootAxes: ['y'],
519
+ physicsAffected: false
520
+ };
521
+ }
522
+ //# sourceMappingURL=ObservedRobotGroundingProjection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObservedRobotGroundingProjection.js","sourceRoot":"","sources":["../../src/renderer/ObservedRobotGroundingProjection.ts"],"names":[],"mappings":"AAqGA,SAAS,YAAY,CAAC,KAAgC;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAED,MAAM,mBAAmB,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAW,CAAC;AAChE,MAAM,q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;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM;QACN,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,mBAAmB;QACnB,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,eAAe;QACvC,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,KAAK,CAAC,MAAM,KAAK,kCAAkC;YACnD,KAAK,CAAC,MAAM,KAAK,oBAAoB;YACrC,KAAK,CAAC,MAAM,KAAK,cAAc;YAC7B,CAAC,CAAC,mCAAmC;YACrC,CAAC,CAAC,+BAA+B;QACrC,gBAAgB,EAAE,CAAC,GAAG,CAAC;QACvB,eAAe,EAAE,KAAK;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,71 @@
1
+ export type ObservedRobotPresentationMode = 'raw' | 'interpolated';
2
+ export type ObservedRobotPresentationFallbackReason = 'none' | 'insufficient_samples' | 'invalid_sample' | 'sample_gap' | 'discontinuity';
3
+ export interface ObservedRobotPresentationSample {
4
+ sampleId: string;
5
+ connectionId: string;
6
+ sourceObservedAtSeconds: number | null;
7
+ receivedAtMs: number;
8
+ jointValues: Readonly<Record<string, number>>;
9
+ }
10
+ export interface ObservedRobotPresentationConfig {
11
+ minimumTransitionMs: number;
12
+ maximumTransitionMs: number;
13
+ maximumSampleGapMs: number;
14
+ }
15
+ export interface ObservedRobotPresentationFrame {
16
+ mode: ObservedRobotPresentationMode;
17
+ state: 'raw' | 'interpolated' | 'fallback';
18
+ fallbackReason: ObservedRobotPresentationFallbackReason;
19
+ provenance: 'observed-raw' | 'observed-interpolated';
20
+ sourceSampleIds: readonly string[];
21
+ connectionId: string;
22
+ sourceObservedAtSeconds: number | null;
23
+ renderedAtMs: number;
24
+ latestReceivedAtMs: number;
25
+ interpolationAlpha: number;
26
+ transitionDurationMs: number;
27
+ active: boolean;
28
+ jointValues: Readonly<Record<string, number>>;
29
+ }
30
+ export interface ObservedRobotPresentationStatus {
31
+ mode: ObservedRobotPresentationMode;
32
+ state: ObservedRobotPresentationFrame['state'] | 'empty';
33
+ fallbackReason: ObservedRobotPresentationFallbackReason;
34
+ provenance: ObservedRobotPresentationFrame['provenance'] | null;
35
+ sourceSampleIds: readonly string[];
36
+ interpolationAlpha: number;
37
+ transitionDurationMs: number;
38
+ active: boolean;
39
+ }
40
+ /**
41
+ * Reconstructs only the visible pose of an observed robot between admitted
42
+ * telemetry samples. Source observations remain immutable and never inherit
43
+ * values produced by this presentation buffer.
44
+ *
45
+ * The transition clock is the local receipt clock. The upstream
46
+ * sourceObservedAtSeconds value is retained as provenance, but it is not used
47
+ * for interpolation because its clock domain is not part of the observation
48
+ * contract yet.
49
+ */
50
+ export declare class ObservedRobotPresentationBuffer {
51
+ private readonly config;
52
+ private mode;
53
+ private latestSample;
54
+ private transitionStartValues;
55
+ private transitionSourceSampleIds;
56
+ private transitionStartedAtMs;
57
+ private transitionDurationMs;
58
+ private pendingFallbackReason;
59
+ private status;
60
+ constructor(config?: Partial<ObservedRobotPresentationConfig>);
61
+ setMode(mode: ObservedRobotPresentationMode): void;
62
+ getMode(): ObservedRobotPresentationMode;
63
+ getStatus(): ObservedRobotPresentationStatus;
64
+ getConfig(): ObservedRobotPresentationConfig;
65
+ reset(reason?: ObservedRobotPresentationFallbackReason): void;
66
+ ingest(sample: ObservedRobotPresentationSample): boolean;
67
+ project(renderedAtMs: number): ObservedRobotPresentationFrame | null;
68
+ isActive(renderedAtMs: number): boolean;
69
+ private acceptFirstSample;
70
+ }
71
+ //# sourceMappingURL=ObservedRobotPresentationBuffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObservedRobotPresentationBuffer.d.ts","sourceRoot":"","sources":["../../src/renderer/ObservedRobotPresentationBuffer.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,6BAA6B,GAAG,KAAK,GAAG,cAAc,CAAC;AAEnE,MAAM,MAAM,uCAAuC,GAC/C,MAAM,GACN,sBAAsB,GACtB,gBAAgB,GAChB,YAAY,GACZ,eAAe,CAAC;AAEp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