@wandelbots/wandelbots-js-react-components 5.4.1 → 5.4.2-pr.ci-pr-preview.586.f684aae
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.
- package/dist/3d.cjs.js +1 -1
- package/dist/3d.d.ts +1 -1
- package/dist/3d.d.ts.map +1 -1
- package/dist/3d.es.js +1 -1
- package/dist/MotionGroupVisualizer-B-e22qXF.cjs +2 -0
- package/dist/MotionGroupVisualizer-B-e22qXF.cjs.map +1 -0
- package/dist/MotionGroupVisualizer-CIASsBC6.js +1433 -0
- package/dist/MotionGroupVisualizer-CIASsBC6.js.map +1 -0
- package/dist/Setup.d.ts +1 -1
- package/dist/Setup.d.ts.map +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts.map +1 -1
- package/dist/components/AppHeader.d.ts +1 -1
- package/dist/components/AppHeader.d.ts.map +1 -1
- package/dist/components/ConsoleFilter.d.ts +1 -1
- package/dist/components/ConsoleFilter.d.ts.map +1 -1
- package/dist/components/CopyableText.d.ts.map +1 -1
- package/dist/components/CycleTimer/DefaultVariant.d.ts.map +1 -1
- package/dist/components/CycleTimer/SmallVariant.d.ts.map +1 -1
- package/dist/components/DataGrid.d.ts +1 -1
- package/dist/components/DataGrid.d.ts.map +1 -1
- package/dist/components/LoadingCover.d.ts.map +1 -1
- package/dist/components/LogPanel.d.ts +1 -1
- package/dist/components/LogPanel.d.ts.map +1 -1
- package/dist/components/LogViewer.d.ts +1 -1
- package/dist/components/LogViewer.d.ts.map +1 -1
- package/dist/components/ProgramControl.d.ts.map +1 -1
- package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
- package/dist/components/RobotCard.d.ts.map +1 -1
- package/dist/components/RobotListItem.d.ts.map +1 -1
- package/dist/components/RobotSetupReadinessIndicator.d.ts.map +1 -1
- package/dist/components/SelectableFab.d.ts +1 -1
- package/dist/components/SelectableFab.d.ts.map +1 -1
- package/dist/components/TabBar.d.ts +1 -1
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/ThemeSelect.d.ts +1 -1
- package/dist/components/ThemeSelect.d.ts.map +1 -1
- package/dist/components/Timer/TimerDefaultVariant.d.ts.map +1 -1
- package/dist/components/Timer/TimerSmallVariant.d.ts.map +1 -1
- package/dist/components/TransparentOverlay.d.ts +2 -2
- package/dist/components/TransparentOverlay.d.ts.map +1 -1
- package/dist/components/VelocitySlider.d.ts +1 -1
- package/dist/components/VelocitySlider.d.ts.map +1 -1
- package/dist/components/experimental/utils/AdornedSelect.d.ts +1 -1
- package/dist/components/experimental/utils/AdornedSelect.d.ts.map +1 -1
- package/dist/components/jogging/JoggingBlocked.d.ts +1 -1
- package/dist/components/jogging/JoggingBlocked.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianAxisControl.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingFreedriveTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointLimitDetector.d.ts +1 -1
- package/dist/components/jogging/JoggingJointLimitDetector.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointTab.d.ts +2 -2
- package/dist/components/jogging/JoggingJointTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointValueControl.d.ts.map +1 -1
- package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +1 -1
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/components/jogging/JoggingToggleButtonGroup.d.ts +1 -1
- package/dist/components/jogging/JoggingToggleButtonGroup.d.ts.map +1 -1
- package/dist/components/jogging/JoggingVelocitySlider.d.ts +1 -1
- package/dist/components/jogging/JoggingVelocitySlider.d.ts.map +1 -1
- package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/components/modal/NoMotionGroupModal.d.ts.map +1 -1
- package/dist/components/robots/DHLinearAxis.d.ts.map +1 -1
- package/dist/components/robots/DHRobot.d.ts.map +1 -1
- package/dist/components/robots/GenericRobot.d.ts +1 -1
- package/dist/components/robots/GenericRobot.d.ts.map +1 -1
- package/dist/components/robots/LinearAxisAnimator.d.ts +1 -1
- package/dist/components/robots/LinearAxisAnimator.d.ts.map +1 -1
- package/dist/components/robots/MotionGroupVisualizer.d.ts +2 -2
- package/dist/components/robots/MotionGroupVisualizer.d.ts.map +1 -1
- package/dist/components/robots/RobotAnimator.d.ts +1 -1
- package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
- package/dist/components/robots/SupportedLinearAxis.d.ts.map +1 -1
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/robots/robotModelLogic.d.ts.map +1 -1
- package/dist/components/safetyBar/ControllerTypeIndicator.d.ts +1 -1
- package/dist/components/safetyBar/ControllerTypeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/IndicatorWithExplanation.d.ts +2 -1
- package/dist/components/safetyBar/IndicatorWithExplanation.d.ts.map +1 -1
- package/dist/components/safetyBar/OperationModeIndicator.d.ts +1 -1
- package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyBar.d.ts +1 -1
- package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts +1 -1
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
- package/dist/components/utils/converters.d.ts +2 -2
- package/dist/components/utils/converters.d.ts.map +1 -1
- package/dist/components/utils/hooks.d.ts.map +1 -1
- package/dist/components/utils/interpolation.d.ts.map +1 -1
- package/dist/core.cjs.js +1 -1
- package/dist/core.es.js +2 -2
- package/dist/externalizeComponent.d.ts.map +1 -1
- package/dist/icons/DropdownArrowIcon.d.ts +1 -1
- package/dist/icons/DropdownArrowIcon.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +3 -3
- package/dist/interpolation-BIB6FC35.cjs +198 -0
- package/dist/interpolation-BIB6FC35.cjs.map +1 -0
- package/dist/interpolation-lSTX6ZXZ.js +14559 -0
- package/dist/interpolation-lSTX6ZXZ.js.map +1 -0
- package/dist/lib/JoggerConnection.d.ts +1 -1
- package/dist/lib/JoggerConnection.d.ts.map +1 -1
- package/dist/themes/createDarkTheme.d.ts +1 -1
- package/dist/themes/createDarkTheme.d.ts.map +1 -1
- package/dist/themes/createLightTheme.d.ts +1 -1
- package/dist/themes/createLightTheme.d.ts.map +1 -1
- package/dist/theming-D_pShDEg.js +32236 -0
- package/dist/theming-D_pShDEg.js.map +1 -0
- package/dist/theming-L5E8VSae.cjs +84 -0
- package/dist/theming-L5E8VSae.cjs.map +1 -0
- package/package.json +4 -3
- package/src/3d.ts +2 -2
- package/src/Setup.tsx +2 -6
- package/src/components/3d-viewport/PresetEnvironment.tsx +1 -0
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +43 -23
- package/src/components/3d-viewport/TrajectoryRenderer.tsx +1 -1
- package/src/components/3d-viewport/collider/ColliderCollection.tsx +3 -2
- package/src/components/AppHeader.tsx +9 -12
- package/src/components/ConsoleFilter.tsx +1 -1
- package/src/components/CopyableText.tsx +4 -1
- package/src/components/CycleTimer/DefaultVariant.tsx +8 -5
- package/src/components/CycleTimer/SmallVariant.tsx +3 -1
- package/src/components/DataGrid.tsx +4 -1
- package/src/components/LoadingCover.tsx +4 -1
- package/src/components/LogPanel.tsx +1 -1
- package/src/components/LogViewer.tsx +13 -17
- package/src/components/ProgramControl.tsx +7 -2
- package/src/components/ProgramStateIndicator.tsx +3 -2
- package/src/components/RobotCard.tsx +6 -1
- package/src/components/RobotListItem.tsx +4 -1
- package/src/components/RobotSetupReadinessIndicator.tsx +4 -2
- package/src/components/SelectableFab.tsx +2 -2
- package/src/components/TabBar.tsx +7 -3
- package/src/components/ThemeSelect.tsx +2 -1
- package/src/components/Timer/TimerDefaultVariant.tsx +9 -6
- package/src/components/Timer/TimerSmallVariant.tsx +2 -1
- package/src/components/Timer/useTimerLogic.ts +9 -9
- package/src/components/TransparentOverlay.tsx +2 -2
- package/src/components/VelocitySlider.tsx +3 -1
- package/src/components/experimental/utils/AdornedSelect.tsx +4 -8
- package/src/components/jogging/JoggingBlocked.tsx +6 -2
- package/src/components/jogging/JoggingCartesianAxisControl.tsx +5 -7
- package/src/components/jogging/JoggingCartesianTab.tsx +6 -8
- package/src/components/jogging/JoggingFreedriveTab.tsx +1 -2
- package/src/components/jogging/JoggingJointLimitDetector.tsx +41 -43
- package/src/components/jogging/JoggingJointTab.tsx +12 -20
- package/src/components/jogging/JoggingJointValueControl.tsx +44 -30
- package/src/components/jogging/JoggingOptions.tsx +143 -139
- package/src/components/jogging/JoggingPanel.test.tsx +77 -85
- package/src/components/jogging/JoggingPanel.tsx +10 -13
- package/src/components/jogging/JoggingStore.ts +18 -13
- package/src/components/jogging/JoggingToggleButtonGroup.tsx +3 -3
- package/src/components/jogging/JoggingVelocitySlider.tsx +2 -10
- package/src/components/jogging/PoseCartesianValues.tsx +2 -1
- package/src/components/jogging/PoseJointValues.tsx +2 -1
- package/src/components/jogging/__fixtures__/motionStreamMockData.ts +0 -1
- package/src/components/modal/NoMotionGroupModal.tsx +7 -10
- package/src/components/robots/DHLinearAxis.tsx +62 -45
- package/src/components/robots/DHRobot.tsx +47 -45
- package/src/components/robots/GenericRobot.tsx +24 -24
- package/src/components/robots/LinearAxis.tsx +0 -1
- package/src/components/robots/LinearAxisAnimator.tsx +4 -1
- package/src/components/robots/MotionGroupVisualizer.tsx +53 -53
- package/src/components/robots/RobotAnimator.test.tsx +2 -2
- package/src/components/robots/RobotAnimator.tsx +4 -1
- package/src/components/robots/SupportedLinearAxis.tsx +10 -3
- package/src/components/robots/SupportedRobot.tsx +10 -3
- package/src/components/robots/robotModelLogic.ts +22 -11
- package/src/components/safetyBar/ControllerTypeIndicator.tsx +2 -1
- package/src/components/safetyBar/IndicatorWithExplanation.tsx +13 -11
- package/src/components/safetyBar/OperationModeIndicator.tsx +2 -1
- package/src/components/safetyBar/SafetyBar.tsx +3 -1
- package/src/components/safetyBar/SafetyStateIndicator.tsx +2 -1
- package/src/components/utils/converters.ts +10 -7
- package/src/components/utils/errorHandling.ts +1 -1
- package/src/components/utils/hooks.tsx +1 -0
- package/src/components/utils/interpolation.test.ts +53 -38
- package/src/components/utils/interpolation.ts +1 -0
- package/src/externalizeComponent.tsx +3 -1
- package/src/icons/DropdownArrowIcon.tsx +1 -2
- package/src/lib/JoggerConnection.ts +24 -24
- package/src/themes/createDarkTheme.ts +2 -3
- package/dist/MotionGroupVisualizer-1twp8wG6.js +0 -1328
- package/dist/MotionGroupVisualizer-1twp8wG6.js.map +0 -1
- package/dist/MotionGroupVisualizer-Dq_KWGsa.cjs +0 -2
- package/dist/MotionGroupVisualizer-Dq_KWGsa.cjs.map +0 -1
- package/dist/interpolation-B3pbgXYX.cjs +0 -42
- package/dist/interpolation-B3pbgXYX.cjs.map +0 -1
- package/dist/interpolation-D4ATdkEg.js +0 -7912
- package/dist/interpolation-D4ATdkEg.js.map +0 -1
- package/dist/theming-BJ6pB6jG.cjs +0 -115
- package/dist/theming-BJ6pB6jG.cjs.map +0 -1
- package/dist/theming-LwkvEF-K.js +0 -22417
- package/dist/theming-LwkvEF-K.js.map +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { tryParseJson } from "@wandelbots/nova-js"
|
|
2
2
|
import {
|
|
3
|
+
JointTypeEnum,
|
|
3
4
|
type CoordinateSystem,
|
|
4
|
-
type
|
|
5
|
+
type KinematicModel,
|
|
5
6
|
type MotionGroupDescription,
|
|
6
7
|
type RobotTcp,
|
|
7
|
-
type KinematicModel,
|
|
8
|
-
JointTypeEnum,
|
|
9
8
|
} from "@wandelbots/nova-js/v2"
|
|
10
9
|
import { countBy } from "lodash-es"
|
|
11
10
|
import keyBy from "lodash-es/keyBy"
|
|
@@ -43,11 +42,11 @@ export type IncrementJogInProgress = {
|
|
|
43
42
|
axis: JoggingAxis
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
type TabType = "cartesian" | "joint" | "debug"
|
|
45
|
+
type TabType = "cartesian" | "joint" | "debug"
|
|
47
46
|
export type CartesianMotionType = "translate" | "rotate"
|
|
48
47
|
|
|
49
48
|
export class JoggingStore {
|
|
50
|
-
selectedTabId: TabType = "cartesian"
|
|
49
|
+
selectedTabId: TabType = "cartesian"
|
|
51
50
|
|
|
52
51
|
/** Locks to prevent UI interactions during certain operations */
|
|
53
52
|
locks = new Set<string>()
|
|
@@ -163,9 +162,10 @@ export class JoggingStore {
|
|
|
163
162
|
),
|
|
164
163
|
])
|
|
165
164
|
|
|
166
|
-
const kinematicModel: KinematicModel =
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
const kinematicModel: KinematicModel =
|
|
166
|
+
await nova.api.motionGroupModels.getMotionGroupKinematicModel(
|
|
167
|
+
description.motion_group_model,
|
|
168
|
+
)
|
|
169
169
|
|
|
170
170
|
const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({
|
|
171
171
|
id,
|
|
@@ -174,7 +174,13 @@ export class JoggingStore {
|
|
|
174
174
|
orientation: tcp.pose.orientation as Vector3Simple,
|
|
175
175
|
}))
|
|
176
176
|
|
|
177
|
-
return new JoggingStore(
|
|
177
|
+
return new JoggingStore(
|
|
178
|
+
jogger,
|
|
179
|
+
coordinatesystems || [],
|
|
180
|
+
description,
|
|
181
|
+
tcps,
|
|
182
|
+
kinematicModel.inverse_solver,
|
|
183
|
+
)
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
constructor(
|
|
@@ -214,6 +220,7 @@ export class JoggingStore {
|
|
|
214
220
|
this.disposers.push(autorun(() => this.saveToLocalStorage()))
|
|
215
221
|
|
|
216
222
|
// Assign joggingStore to window
|
|
223
|
+
// biome-ignore lint/suspicious/noExplicitAny: pre-biome code
|
|
217
224
|
;(window as any).joggingStore = this
|
|
218
225
|
}
|
|
219
226
|
|
|
@@ -329,7 +336,6 @@ export class JoggingStore {
|
|
|
329
336
|
return tempTabs
|
|
330
337
|
}
|
|
331
338
|
|
|
332
|
-
|
|
333
339
|
get incrementOptions() {
|
|
334
340
|
return incrementOptions
|
|
335
341
|
}
|
|
@@ -347,6 +353,7 @@ export class JoggingStore {
|
|
|
347
353
|
}
|
|
348
354
|
|
|
349
355
|
get currentTab() {
|
|
356
|
+
// biome-ignore lint/style/noNonNullAssertion: pre-biome code
|
|
350
357
|
return this.tabsById[this.selectedTabId] || this.tabs[0]!
|
|
351
358
|
}
|
|
352
359
|
|
|
@@ -391,7 +398,6 @@ export class JoggingStore {
|
|
|
391
398
|
: this.translationVelocityMmPerSec
|
|
392
399
|
}
|
|
393
400
|
|
|
394
|
-
|
|
395
401
|
/** Minimum selectable velocity in mm/sec or deg/sec */
|
|
396
402
|
minVelocityInDisplayUnits(useDegree: boolean) {
|
|
397
403
|
return useDegree
|
|
@@ -399,7 +405,6 @@ export class JoggingStore {
|
|
|
399
405
|
: this.minTranslationVelocityMmPerSec
|
|
400
406
|
}
|
|
401
407
|
|
|
402
|
-
|
|
403
408
|
/** Maximum selectable velocity in mm/sec or deg/sec */
|
|
404
409
|
maxVelocityInDisplayUnits(useDegree: boolean) {
|
|
405
410
|
return useDegree
|
|
@@ -408,6 +413,7 @@ export class JoggingStore {
|
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
onTabChange(_event: React.SyntheticEvent, newValue: number) {
|
|
416
|
+
// biome-ignore lint/style/noNonNullAssertion: pre-biome code
|
|
411
417
|
const tab = this.tabs[newValue] || this.tabs[0]!
|
|
412
418
|
this.selectedTabId = tab.id
|
|
413
419
|
}
|
|
@@ -440,7 +446,6 @@ export class JoggingStore {
|
|
|
440
446
|
}
|
|
441
447
|
}
|
|
442
448
|
|
|
443
|
-
|
|
444
449
|
setSelectedCartesianMotionType(type: CartesianMotionType) {
|
|
445
450
|
this.selectedCartesianMotionType = type
|
|
446
451
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ToggleButtonGroupProps } from "@mui/material"
|
|
2
|
-
import { styled
|
|
3
|
-
|
|
1
|
+
import type { ToggleButtonGroupProps } from "@mui/material/ToggleButtonGroup"
|
|
2
|
+
import { styled } from "@mui/material/styles"
|
|
3
|
+
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup"
|
|
4
4
|
export const JoggingToggleButtonGroup: React.ComponentType<ToggleButtonGroupProps> =
|
|
5
5
|
styled(ToggleButtonGroup)(({ theme }) => ({
|
|
6
6
|
"&.MuiToggleButtonGroup-root": {
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { observer} from "mobx-react-lite"
|
|
1
|
+
import { observer } from "mobx-react-lite"
|
|
2
2
|
import { useTranslation } from "react-i18next"
|
|
3
3
|
import { VelocitySlider, VelocitySliderLabel } from "../VelocitySlider"
|
|
4
4
|
import type { JoggingStore } from "./JoggingStore"
|
|
5
5
|
|
|
6
6
|
export const JoggingVelocitySlider = observer(
|
|
7
|
-
({
|
|
8
|
-
store,
|
|
9
|
-
useDegree,
|
|
10
|
-
}: {
|
|
11
|
-
store: JoggingStore
|
|
12
|
-
useDegree: boolean
|
|
13
|
-
}) => {
|
|
14
|
-
|
|
7
|
+
({ store, useDegree }: { store: JoggingStore; useDegree: boolean }) => {
|
|
15
8
|
const { t } = useTranslation()
|
|
16
9
|
|
|
17
10
|
function valueLabelFormat(value: number, useDegree: boolean): string {
|
|
@@ -20,7 +13,6 @@ export const JoggingVelocitySlider = observer(
|
|
|
20
13
|
: `v = ${t("Jogging.Cartesian.Translation.velocityMmPerSec.lb", { amount: value })}`
|
|
21
14
|
}
|
|
22
15
|
|
|
23
|
-
|
|
24
16
|
return (
|
|
25
17
|
<VelocitySlider
|
|
26
18
|
store={store}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Button from "@mui/material/Button"
|
|
2
|
+
import Stack from "@mui/material/Stack"
|
|
2
3
|
import { poseToWandelscriptString, type Pose } from "@wandelbots/nova-js/v2"
|
|
3
4
|
import { observer } from "mobx-react-lite"
|
|
4
5
|
import { useState } from "react"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Button from "@mui/material/Button"
|
|
2
|
+
import Stack from "@mui/material/Stack"
|
|
2
3
|
import { observer } from "mobx-react-lite"
|
|
3
4
|
import { useState } from "react"
|
|
4
5
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Typography,
|
|
9
|
-
} from "@mui/material"
|
|
10
|
-
|
|
1
|
+
import Button from "@mui/material/Button"
|
|
2
|
+
import Dialog from "@mui/material/Dialog"
|
|
3
|
+
import DialogActions from "@mui/material/DialogActions"
|
|
4
|
+
import DialogContent from "@mui/material/DialogContent"
|
|
5
|
+
import DialogTitle from "@mui/material/DialogTitle"
|
|
6
|
+
import Stack from "@mui/material/Stack"
|
|
7
|
+
import Typography from "@mui/material/Typography"
|
|
11
8
|
function getBaseUrl(): string {
|
|
12
9
|
const currentUrl = window.location.href
|
|
13
10
|
return currentUrl.substring(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/* biome-ignore-all lint/style/noNonNullAssertion: pre-biome code */
|
|
2
|
+
/* biome-ignore-all lint/suspicious/noExplicitAny: pre-biome code */
|
|
3
|
+
|
|
1
4
|
import { Line } from "@react-three/drei"
|
|
2
|
-
import
|
|
3
|
-
import React, { useRef } from "react"
|
|
5
|
+
import { useRef } from "react"
|
|
4
6
|
import type * as THREE from "three"
|
|
5
7
|
import { Matrix4, Quaternion, Vector3 } from "three"
|
|
6
8
|
import LinearAxisAnimator from "./LinearAxisAnimator"
|
|
@@ -20,25 +22,27 @@ export function DHLinearAxis({
|
|
|
20
22
|
// Calculate initial TCP position
|
|
21
23
|
function calculateTcpPosition(jointValues: number[]): Vector3 {
|
|
22
24
|
const tempMatrix = new Matrix4()
|
|
23
|
-
|
|
25
|
+
|
|
24
26
|
for (let i = 0; i < dhParameters.length; i++) {
|
|
25
27
|
const param = dhParameters[i]
|
|
26
28
|
const jointValue = jointValues[i] ?? 0
|
|
27
|
-
|
|
29
|
+
|
|
28
30
|
const matrix = new Matrix4()
|
|
29
31
|
.makeRotationY(param.theta!) // Base rotation (if any)
|
|
30
32
|
.multiply(
|
|
31
33
|
new Matrix4().makeTranslation(
|
|
32
34
|
param.a! / 1000,
|
|
33
|
-
(param.d! +
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
(param.d! +
|
|
36
|
+
jointValue * (param.reverse_rotation_direction ? -1 : 1)) /
|
|
37
|
+
1000,
|
|
38
|
+
0,
|
|
39
|
+
),
|
|
36
40
|
) // Translate along X by a, and Y by d + joint_position
|
|
37
41
|
.multiply(new Matrix4().makeRotationX(param.alpha!)) // Rotate around X
|
|
38
|
-
|
|
42
|
+
|
|
39
43
|
tempMatrix.multiply(matrix)
|
|
40
44
|
}
|
|
41
|
-
|
|
45
|
+
|
|
42
46
|
const position = new Vector3()
|
|
43
47
|
const quaternion = new Quaternion()
|
|
44
48
|
const scale = new Vector3()
|
|
@@ -47,7 +51,9 @@ export function DHLinearAxis({
|
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
// Calculate initial TCP position for rendering
|
|
50
|
-
const initialTcpPosition = calculateTcpPosition(
|
|
54
|
+
const initialTcpPosition = calculateTcpPosition(
|
|
55
|
+
rapidlyChangingMotionState.joint_position,
|
|
56
|
+
)
|
|
51
57
|
|
|
52
58
|
function setTranslation(joints: THREE.Object3D[], jointValues: number[]) {
|
|
53
59
|
accumulatedMatrix.identity()
|
|
@@ -59,19 +65,21 @@ export function DHLinearAxis({
|
|
|
59
65
|
for (let jointIndex = 0; jointIndex < dhParameters.length; jointIndex++) {
|
|
60
66
|
const jointValue = jointValues[jointIndex] ?? 0
|
|
61
67
|
const param = dhParameters[jointIndex]
|
|
62
|
-
|
|
68
|
+
|
|
63
69
|
// Calculate and accumulate transformation
|
|
64
70
|
const matrix = new Matrix4()
|
|
65
71
|
.makeRotationY(param.theta!) // Base rotation (if any)
|
|
66
72
|
.multiply(
|
|
67
73
|
new Matrix4().makeTranslation(
|
|
68
74
|
param.a! / 1000,
|
|
69
|
-
(param.d! +
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
(param.d! +
|
|
76
|
+
jointValue * (param.reverse_rotation_direction ? -1 : 1)) /
|
|
77
|
+
1000,
|
|
78
|
+
0,
|
|
79
|
+
),
|
|
72
80
|
)
|
|
73
81
|
.multiply(new Matrix4().makeRotationX(param.alpha!))
|
|
74
|
-
|
|
82
|
+
|
|
75
83
|
accumulatedMatrix.multiply(matrix)
|
|
76
84
|
}
|
|
77
85
|
|
|
@@ -84,45 +92,54 @@ export function DHLinearAxis({
|
|
|
84
92
|
|
|
85
93
|
// Update TCP marker
|
|
86
94
|
if (tcpMeshRef.current) {
|
|
87
|
-
tcpMeshRef.current.position.set(
|
|
95
|
+
tcpMeshRef.current.position.set(
|
|
96
|
+
tcpPosition.x,
|
|
97
|
+
tcpPosition.y,
|
|
98
|
+
tcpPosition.z,
|
|
99
|
+
)
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
// Update TCP line
|
|
91
103
|
if (tcpLineRef.current) {
|
|
92
104
|
const lineGeometry = tcpLineRef.current.geometry
|
|
93
|
-
if (lineGeometry
|
|
94
|
-
lineGeometry.setPositions([
|
|
105
|
+
if (lineGeometry?.setPositions) {
|
|
106
|
+
lineGeometry.setPositions([
|
|
107
|
+
0,
|
|
108
|
+
0,
|
|
109
|
+
0,
|
|
110
|
+
tcpPosition.x,
|
|
111
|
+
tcpPosition.y,
|
|
112
|
+
tcpPosition.z,
|
|
113
|
+
])
|
|
95
114
|
}
|
|
96
115
|
}
|
|
97
116
|
}
|
|
98
117
|
|
|
99
118
|
return (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</LinearAxisAnimator>
|
|
126
|
-
</>
|
|
119
|
+
<LinearAxisAnimator
|
|
120
|
+
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
121
|
+
dhParameters={dhParameters}
|
|
122
|
+
onTranslationChanged={setTranslation}
|
|
123
|
+
>
|
|
124
|
+
<group {...props} name="Scene">
|
|
125
|
+
{/* Base (origin) - Green sphere representing initial previous position */}
|
|
126
|
+
<mesh name="Base" position={[0, 0, 0]}>
|
|
127
|
+
<sphereGeometry args={[0.02, 32, 32]} />
|
|
128
|
+
<meshStandardMaterial color={"green"} depthTest={true} />
|
|
129
|
+
</mesh>
|
|
130
|
+
{/* Line from Base to TCP */}
|
|
131
|
+
<Line
|
|
132
|
+
ref={tcpLineRef}
|
|
133
|
+
points={[new Vector3(0, 0, 0), initialTcpPosition]}
|
|
134
|
+
color={"White"}
|
|
135
|
+
lineWidth={5}
|
|
136
|
+
/>
|
|
137
|
+
{/* TCP (Tool Center Point) - Red sphere that shows final position */}
|
|
138
|
+
<mesh ref={tcpMeshRef} name="TCP" position={initialTcpPosition}>
|
|
139
|
+
<sphereGeometry args={[0.025, 32, 32]} />
|
|
140
|
+
<meshStandardMaterial color={"red"} depthTest={true} />
|
|
141
|
+
</mesh>
|
|
142
|
+
</group>
|
|
143
|
+
</LinearAxisAnimator>
|
|
127
144
|
)
|
|
128
145
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* biome-ignore-all lint/style/noNonNullAssertion: pre-biome code */
|
|
2
|
+
/* biome-ignore-all lint/suspicious/noExplicitAny: pre-biome code */
|
|
3
|
+
|
|
1
4
|
import { Line } from "@react-three/drei"
|
|
2
5
|
import type { DHParameter } from "@wandelbots/nova-js/v2"
|
|
3
6
|
import React, { useRef } from "react"
|
|
@@ -99,50 +102,49 @@ export function DHRobot({
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
return (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
>
|
|
108
|
-
<
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
</>
|
|
105
|
+
<RobotAnimator
|
|
106
|
+
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
107
|
+
dhParameters={dhParameters}
|
|
108
|
+
onRotationChanged={setRotation}
|
|
109
|
+
>
|
|
110
|
+
<group {...props} name="Scene">
|
|
111
|
+
<mesh>
|
|
112
|
+
<sphereGeometry args={[0.01, 32, 32]} />
|
|
113
|
+
<meshStandardMaterial color={"black"} depthTest={true} />
|
|
114
|
+
</mesh>
|
|
115
|
+
{dhParameters?.map((param, index) => {
|
|
116
|
+
const { a, b } = getLinePoints(
|
|
117
|
+
param,
|
|
118
|
+
rapidlyChangingMotionState.joint_position[index] ?? 0,
|
|
119
|
+
)
|
|
120
|
+
const jointName = `dhrobot_J0${index}`
|
|
121
|
+
return (
|
|
122
|
+
<group name={jointName} key={jointName}>
|
|
123
|
+
<Line
|
|
124
|
+
ref={(ref) => {
|
|
125
|
+
lineRefs.current[index] = ref
|
|
126
|
+
}}
|
|
127
|
+
name={CHILD_LINE}
|
|
128
|
+
points={[a, b]}
|
|
129
|
+
color={"white"}
|
|
130
|
+
lineWidth={5}
|
|
131
|
+
/>
|
|
132
|
+
<mesh
|
|
133
|
+
ref={(ref) => {
|
|
134
|
+
meshRefs.current[index] = ref
|
|
135
|
+
}}
|
|
136
|
+
name={CHILD_MESH}
|
|
137
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: pre-biome code
|
|
138
|
+
key={`mesh_${index}`}
|
|
139
|
+
position={b}
|
|
140
|
+
>
|
|
141
|
+
<sphereGeometry args={[0.01, 32, 32]} />
|
|
142
|
+
<meshStandardMaterial color={"black"} depthTest={true} />
|
|
143
|
+
</mesh>
|
|
144
|
+
</group>
|
|
145
|
+
)
|
|
146
|
+
})}
|
|
147
|
+
</group>
|
|
148
|
+
</RobotAnimator>
|
|
147
149
|
)
|
|
148
150
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useGLTF } from "@react-three/drei"
|
|
2
2
|
import type { ThreeElements } from "@react-three/fiber"
|
|
3
|
-
import React
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import type React from "react"
|
|
4
|
+
import { useCallback, useEffect, useState } from "react"
|
|
5
|
+
import type { Group, Mesh, Object3D } from "three"
|
|
6
6
|
import { isFlange, parseRobotModel } from "./robotModelLogic"
|
|
7
7
|
|
|
8
8
|
export type RobotModelProps = {
|
|
@@ -20,24 +20,19 @@ function isMesh(node: Object3D): node is Mesh {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// Separate component that only renders when we have a valid URL
|
|
23
|
-
function LoadedRobotModel({
|
|
24
|
-
url,
|
|
25
|
-
flangeRef,
|
|
26
|
-
postModelRender,
|
|
27
|
-
...props
|
|
28
|
-
}: {
|
|
23
|
+
function LoadedRobotModel({
|
|
24
|
+
url,
|
|
25
|
+
flangeRef,
|
|
26
|
+
postModelRender,
|
|
27
|
+
...props
|
|
28
|
+
}: {
|
|
29
29
|
url: string
|
|
30
30
|
flangeRef?: React.Ref<Group>
|
|
31
31
|
postModelRender?: () => void
|
|
32
32
|
} & ThreeElements["group"]) {
|
|
33
33
|
const gltfResult = useGLTF(url)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const parsed = parseRobotModel(gltfResult, 'robot.glb')
|
|
37
|
-
gltf = parsed.gltf
|
|
38
|
-
} catch (err) {
|
|
39
|
-
throw err;
|
|
40
|
-
}
|
|
34
|
+
const parsed = parseRobotModel(gltfResult, "robot.glb")
|
|
35
|
+
const gltf = parsed.gltf
|
|
41
36
|
|
|
42
37
|
const groupRef: React.RefCallback<Group> = useCallback(
|
|
43
38
|
(group) => {
|
|
@@ -66,7 +61,12 @@ function LoadedRobotModel({
|
|
|
66
61
|
}
|
|
67
62
|
// Fallback to empty group if geometry is missing
|
|
68
63
|
return (
|
|
69
|
-
<group
|
|
64
|
+
<group
|
|
65
|
+
name={node.name}
|
|
66
|
+
key={node.uuid}
|
|
67
|
+
position={node.position}
|
|
68
|
+
rotation={node.rotation}
|
|
69
|
+
/>
|
|
70
70
|
)
|
|
71
71
|
} else {
|
|
72
72
|
return (
|
|
@@ -82,7 +82,7 @@ function LoadedRobotModel({
|
|
|
82
82
|
)
|
|
83
83
|
}
|
|
84
84
|
} catch (e) {
|
|
85
|
-
console.warn(
|
|
85
|
+
console.warn("Error rendering node", node.name, e)
|
|
86
86
|
return null
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -101,21 +101,21 @@ export function GenericRobot({
|
|
|
101
101
|
...props
|
|
102
102
|
}: RobotModelProps) {
|
|
103
103
|
const [resolvedURL, setResolvedURL] = useState<string | null>(null)
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
useEffect(() => {
|
|
106
106
|
const resolveURL = async () => {
|
|
107
107
|
try {
|
|
108
|
-
if (typeof modelURL ===
|
|
108
|
+
if (typeof modelURL === "string") {
|
|
109
109
|
setResolvedURL(modelURL)
|
|
110
110
|
} else {
|
|
111
111
|
const url = await modelURL
|
|
112
112
|
setResolvedURL(url)
|
|
113
113
|
}
|
|
114
114
|
} catch (error) {
|
|
115
|
-
console.error(
|
|
115
|
+
console.error("Failed to resolve model URL:", error)
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
resolveURL()
|
|
120
120
|
}, [modelURL])
|
|
121
121
|
|
|
@@ -123,9 +123,9 @@ export function GenericRobot({
|
|
|
123
123
|
if (!resolvedURL) {
|
|
124
124
|
return null // Loading state
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
return (
|
|
128
|
-
<LoadedRobotModel
|
|
128
|
+
<LoadedRobotModel
|
|
129
129
|
url={resolvedURL}
|
|
130
130
|
flangeRef={flangeRef}
|
|
131
131
|
postModelRender={postModelRender}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useFrame, useThree } from "@react-three/fiber"
|
|
2
2
|
import type { DHParameter, MotionGroupState } from "@wandelbots/nova-js/v2"
|
|
3
|
-
import React
|
|
3
|
+
import type React from "react"
|
|
4
|
+
import { useCallback, useEffect, useRef } from "react"
|
|
4
5
|
import type { Group, Object3D } from "three"
|
|
5
6
|
import { useAutorun } from "../utils/hooks"
|
|
6
7
|
import { ValueInterpolator } from "../utils/interpolation"
|
|
@@ -25,6 +26,7 @@ export default function LinearAxisAnimator({
|
|
|
25
26
|
const { invalidate } = useThree()
|
|
26
27
|
|
|
27
28
|
// Initialize interpolator
|
|
29
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: pre-biome code
|
|
28
30
|
useEffect(() => {
|
|
29
31
|
const initialJointValues = rapidlyChangingMotionState.joint_position.filter(
|
|
30
32
|
(item) => item !== undefined,
|
|
@@ -98,6 +100,7 @@ export default function LinearAxisAnimator({
|
|
|
98
100
|
* Fire an update joints call on every motion state change.
|
|
99
101
|
* requestAnimationFrame used to avoid blocking main thread
|
|
100
102
|
*/
|
|
103
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: pre-biome code
|
|
101
104
|
useEffect(() => {
|
|
102
105
|
updateJoints()
|
|
103
106
|
}, [rapidlyChangingMotionState, updateJoints])
|