@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.5d2eede → 6.4.0-pr.revamp.667.d7cab79
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/README.md +56 -5
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +1 -0
- package/dist/3d.js +16 -15
- package/dist/CurrentPoseBar/index.cjs +1 -1
- package/dist/CurrentPoseBar/index.js +1 -1
- package/dist/RobotControlPanel/index.cjs +1 -1
- package/dist/RobotControlPanel/index.js +1 -1
- package/dist/RobotHeader/index.js +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-DENCilvf.js} +1 -1
- package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-DrXTcV-I.cjs} +1 -1
- package/dist/chunks/{RobotControlPanel-BXtBHEe9.cjs → RobotControlPanel-DTE8-v2j.cjs} +1 -1
- package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-E-hUzMIL.js} +1 -1
- package/dist/chunks/{RobotHeader-DDmDkUoV.js → RobotHeader-BvIzk8Fw.js} +1 -1
- package/dist/chunks/{SafetyBar-RkN0I1Cb.js → SafetyBar-eYzCHOFD.js} +1 -1
- package/dist/chunks/{converters-DAr6IQbG.js → converters-D9KpJ2HD.js} +2 -2
- package/dist/chunks/loadRobotSession-DlRzFjYE.cjs +3 -0
- package/dist/chunks/loadRobotSession-kKQ96rWu.js +4721 -0
- package/dist/chunks/robotModelSource-Bv1Z_miZ.cjs +1 -0
- package/dist/chunks/robotModelSource-CKuBOeQ-.js +1295 -0
- package/dist/chunks/useEveryFrame-B8t_yz-G.js +155 -0
- package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
- package/dist/components/robotControl/poseText.d.ts +21 -5
- package/dist/components/robots/LinearAxis.d.ts +12 -11
- package/dist/components/robots/Robot.d.ts +26 -9
- package/dist/components/robots/robotModelSource.d.ts +38 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +10 -0
- package/dist/core.js +58 -39
- package/dist/index.cjs +1 -1
- package/dist/index.js +86 -66
- package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
- package/dist/lib/controllerStateSource.d.ts +6 -4
- package/dist/lib/motionGroupModelResources.d.ts +1 -0
- package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
- package/dist/lib/robotSession/RobotActivation.d.ts +48 -0
- package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
- package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
- package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
- package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
- package/dist/lib/robotSession/RobotSession.d.ts +78 -0
- package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
- package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
- package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
- package/dist/lib/robotSession/robotPose.d.ts +28 -0
- package/dist/nats.cjs +1 -0
- package/dist/nats.d.ts +4 -0
- package/dist/nats.js +131 -0
- package/package.json +11 -1
- package/dist/chunks/Robot-B3vKEVXP.cjs +0 -1
- package/dist/chunks/Robot-DXhaz1tq.js +0 -1272
- package/dist/chunks/TrajectoryExecutionStore-CKfEoKo8.cjs +0 -3
- package/dist/chunks/TrajectoryExecutionStore-DYVukgCz.js +0 -3613
- package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
- package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +0 -1
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ Browse the full icon set at https://wandelbotsgmbh.github.io/nova-design-system/
|
|
|
68
68
|
- **`.`** (Main) — All components. Requires the peer dependencies of `/core` and `/3d`.
|
|
69
69
|
- **`/core`** — The parts without 3D (jogging, `SafetyBar`, `AppHeader`, `LoadingCover`, `NoMotionGroupModal`), the NOVA connections and `JoggingStore`, the motion state helpers and `i18n`.
|
|
70
70
|
- **`/3d`** — The 3D parts (`Robot`, `MotionGroupVisualizer`, `SafetyZonesRenderer`, …). Requires in addition three, three-stdlib, @react-three/fiber and @react-three/drei.
|
|
71
|
+
- **`/nats`** — A robot's live controller state over NOVA's NATS server (`natsControllerStateSource`, `natsUrlOf`), a source for `ControllerStateStream` of `/core` instead of its websocket (`controllerStateWebsocket`). Requires in addition nats.ws; no other entry point loads it.
|
|
71
72
|
- **`/SafetyBar`** — Only `SafetyBar` (also as the default export).
|
|
72
73
|
- **`/JoggingGizmo`** — Only `JoggingGizmo` (also as the default export) and `JoggingGizmoOrientation`. Requires in addition three and @react-three/fiber.
|
|
73
74
|
- **`/JoggingButtons`** — Only `JoggingButtons` (also as the default export). No 3D packages needed.
|
|
@@ -94,6 +95,7 @@ import JoggingJointSlider from "@wandelbots/wandelbots-js-react-components/Joggi
|
|
|
94
95
|
| `three-stdlib` (only `/3d`) | >=2 |
|
|
95
96
|
| `@react-three/fiber` (only `/3d`, `/JoggingGizmo`, `/RobotControlPanel`) | ^9 |
|
|
96
97
|
| `@react-three/drei` (only `/3d`) | ^10 |
|
|
98
|
+
| `nats.ws` (only `/nats`) | ^1.30.3 |
|
|
97
99
|
|
|
98
100
|
These packages are peer dependencies because the app and the library must use the same copy: React, the MUI theme of the app, the MobX stores that the app reads with its own `observer`, and the `<Canvas>` of React Three Fiber.
|
|
99
101
|
|
|
@@ -130,6 +132,53 @@ These packages are peer dependencies because the app and the library must use th
|
|
|
130
132
|
- **Look:** `AppHeader` and `LoadingCover` use the styles of the design system, so they look a little different.
|
|
131
133
|
- **Release asset:** `no-draco-models.zip` is gone. The models come from the NOVA API (since 4.0.0).
|
|
132
134
|
|
|
135
|
+
### From ConnectedMotionGroup to RobotSession
|
|
136
|
+
|
|
137
|
+
`ConnectedMotionGroup` is deprecated. `RobotSession` replaces it: one robot of a cell, loaded and connected, with its description, live state, safety, activation, jogging and Move to. `ConnectedMotionGroup` keeps working until a later major version removes it, and `Robot` and `LinearAxis` still take it.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
// Before
|
|
141
|
+
const motionGroup = await ConnectedMotionGroup.connect(nova, "0@ur5e", { cellId })
|
|
142
|
+
<Robot connectedMotionGroup={motionGroup} />
|
|
143
|
+
motionGroup.dispose()
|
|
144
|
+
|
|
145
|
+
// After
|
|
146
|
+
const load = loadRobotSession(nova, "0@ur5e", { cellId })
|
|
147
|
+
const session = await load.ready
|
|
148
|
+
<Robot motionGroup={robotModelOf(session)} />
|
|
149
|
+
load.dispose()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
What changes besides the names:
|
|
153
|
+
|
|
154
|
+
- **Loading:** `loadRobotSession` returns at once. `load.state` ("loading", "ready", "failed") and `load.progress` tell how far it is, `load.retry()` loads again after a failure, `await load.ready` gives the session. A failed step is retried on its own, after 1 and 2 seconds unless `retryDelaysMs` says otherwise.
|
|
155
|
+
- **Jogging comes with it:** `session.jogging` is the robot's `JoggingStore`. An app no longer opens it with `JoggerConnection.open` and `JoggingStore.loadFor`.
|
|
156
|
+
- **Nothing happens unasked:** without `storage` the jogging settings are not kept (pass `localStorage` to keep them), and a virtual robot is activated only with `autoActivateVirtual: true`.
|
|
157
|
+
- **Errors:** what the app calls rejects (`session.activation.activate()` with a `RobotModeChangeError`); what fails in the background (a jog, a message of the live state) goes to `onError`.
|
|
158
|
+
- **Several robots:** load one session per robot instead of `ConnectedMotionGroup.connectMultiple`.
|
|
159
|
+
|
|
160
|
+
| `ConnectedMotionGroup` | `RobotSession` |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| `motionGroupId`, `controllerId` | `motionGroupId`, `controllerId` (and `cellId`) |
|
|
163
|
+
| `modelFromController` | `description.motionGroupModel` |
|
|
164
|
+
| `dhParameters` | `description.dhParameters` |
|
|
165
|
+
| `safetyZones` | `description.safetyZones` |
|
|
166
|
+
| `description` | `description.motionGroupDescription` |
|
|
167
|
+
| `isVirtual` | `description.isVirtual` |
|
|
168
|
+
| `tcps` | `description.tcps` (id and name), `description.tcpOffsetsById` (position and orientation) |
|
|
169
|
+
| `joints` | One per joint: `description.dhParameters`, or the joint limits in `description.jointLimits` |
|
|
170
|
+
| `mountingPosition`, `mountingQuaternion` | `robotModelOf(session)` of `/3d` (metres and a quaternion), or `description.mounting` (mm and a rotation vector) |
|
|
171
|
+
| `rapidlyChangingMotionState` | `state.rapidlyChangingMotionState` |
|
|
172
|
+
| `controllerState` | `state.controllerState` |
|
|
173
|
+
| `initialMotionState`, `controller`, `motionGroup`, `motionStateSocket` | No replacement: the session keeps its connections. Read `state` instead. |
|
|
174
|
+
| `activationState` | `activation.state` |
|
|
175
|
+
| `activate()`, `deactivate()`, `toggleActivation()` | `activation.activate()`, `activation.deactivate()`, `activation.toggle()` |
|
|
176
|
+
| `isEstopActive`, `isMoveableSafetyState`, `isMoveableOperationMode`, `canBeMoved` | `safety.isEstopActive`, `safety.isMoveableSafetyState`, `safety.isMoveableOperationMode`, `safety.canBeMoved`; why the robot may not move: `safety.notMoveableReason` |
|
|
177
|
+
| `joggingVelocity`, `joggingVelocityRads`, `setJoggingVelocity()` | The velocities of `jogging`: `rotationVelocityDegPerSec`, `rotationVelocityRadsPerSec`, `translationVelocityMmPerSec`, `setVelocityFromSlider()` |
|
|
178
|
+
| `connectedJoggingSocket`, `planData` | No replacement (unused) |
|
|
179
|
+
| `dispose()` | `load.dispose()`, or `session.dispose()` |
|
|
180
|
+
| `<Robot connectedMotionGroup={…}>`, `<LinearAxis connectedMotionGroup={…}>` | `<Robot motionGroup={robotModelOf(session)}>`, the same for `LinearAxis`. `motionGroup` also takes a `ConnectedMotionGroup`, or the app's own data (see `RobotModelSource`). |
|
|
181
|
+
|
|
133
182
|
### 4.x Core Changes
|
|
134
183
|
|
|
135
184
|
Robot data is now fetched from a running nova instance. This eliminates the need of shipping every react application with the robot data attached.
|
|
@@ -313,12 +362,13 @@ const orientation = useRef<Quaternion | null>(null)
|
|
|
313
362
|
|
|
314
363
|
**Robot** - Real-time 3D robot rendering
|
|
315
364
|
|
|
316
|
-
-
|
|
365
|
+
- Takes the robot as plain data (`RobotModelSource`): `robotModelOf(session)` of a `RobotSession`, a `ConnectedMotionGroup`, or the app's own data
|
|
366
|
+
- Live pose updates from its motion state, at its mounting
|
|
317
367
|
- The model of the motion group from the NOVA instance (`defaultGetModel`)
|
|
318
368
|
|
|
319
369
|
**LinearAxis** - The same for a linear axis
|
|
320
370
|
|
|
321
|
-
**SupportedRobot**, **SupportedLinearAxis** and **MotionGroupVisualizer** - The same
|
|
371
|
+
**SupportedRobot**, **SupportedLinearAxis** and **MotionGroupVisualizer** - The same with single props: they take a motion state, the model name and the DH parameters. `MotionGroupVisualizer` picks the robot or the linear axis. The `…Exact` variants show the pose without smoothing.
|
|
322
372
|
|
|
323
373
|
**SafetyZonesRenderer** - 3D safety visualization
|
|
324
374
|
|
|
@@ -353,7 +403,8 @@ Safety components for production environments.
|
|
|
353
403
|
|
|
354
404
|
### Logic
|
|
355
405
|
|
|
356
|
-
- **
|
|
406
|
+
- **loadRobotSession** and **RobotSession** - A robot of a cell, loaded and connected: its description, live state, safety, activation, jogging and Move to
|
|
407
|
+
- **ConnectedMotionGroup** (deprecated, see [From ConnectedMotionGroup to RobotSession](#from-connectedmotiongroup-to-robotsession)) - A motion group with its live motion state, safety state and operation mode
|
|
357
408
|
- **MotionStreamConnection** and **JoggerConnection** - The motion state stream and the jogging connection of a motion group
|
|
358
409
|
- **jointValuesEqual**, **poseEqual**, **tcpMotionEqual**, **unwrapRotationVector** - Helpers for the motion state
|
|
359
410
|
- **ValueInterpolator**, **useInterpolation**, **useSmoothedMotionState** - Smooth joint values for the 3D view
|
|
@@ -365,9 +416,9 @@ Safety components for production environments.
|
|
|
365
416
|
|
|
366
417
|
Components integrate with the Wandelbots Nova ecosystem:
|
|
367
418
|
|
|
368
|
-
- **NovaConnection** - Where the library connects to NOVA (`nova` of `JoggingPanel`, `ConnectedMotionGroup.connect`, `MotionStreamConnection.open`, `JoggerConnection.open`, `defaultGetModel`), it takes a `NovaConnection`: the URL of the instance, or the NOVA client of the app (`Nova` of `@wandelbots/nova-js`, of any version). The library reads only the URL and the access token of the client, and connects with its own client (nova-js 4.13.0). So the app configures the connection in one place.
|
|
419
|
+
- **NovaConnection** - Where the library connects to NOVA (`nova` of `JoggingPanel`, `loadRobotSession`, `ConnectedMotionGroup.connect`, `MotionStreamConnection.open`, `JoggerConnection.open`, `defaultGetModel`), it takes a `NovaConnection`: the URL of the instance, or the NOVA client of the app (`Nova` of `@wandelbots/nova-js`, of any version). The library reads only the URL and the access token of the client, and connects with its own client (nova-js 4.13.0). So the app configures the connection in one place.
|
|
369
420
|
- **Real-time Updates** - WebSocket connections for live robot state updates
|
|
370
|
-
- **Motion Group Management** -
|
|
421
|
+
- **Motion Group Management** - One `RobotSession` per robot (`ConnectedMotionGroup` in earlier versions)
|
|
371
422
|
- **State Synchronization** - Automatic state management with MobX reactivity
|
|
372
423
|
|
|
373
424
|
### Technical Foundation
|
package/dist/3d.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/robotModelSource-Bv1Z_miZ.cjs"),t=require("./chunks/JoggingGizmo-DGbFLWgT.cjs"),r=require("./chunks/JoggingGizmoOrientation-dzned4f4.cjs"),i=require("./chunks/RobotControlPanel-DTE8-v2j.cjs"),e=require("./chunks/Pose3-DIyg-aZA.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.JointLimitGizmo=o.JointLimitGizmo;exports.LinearAxis=o.LinearAxis;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultGetModel=o.defaultGetModel;exports.robotModelOf=o.robotModelOf;exports.JoggingGizmo=t.JoggingGizmo;exports.JoggingGizmoOrientation=r.JoggingGizmoOrientation;exports.RobotControlPanel=i.RobotControlPanel;exports.Pose3=e.Pose3;exports.ValueInterpolator=e.ValueInterpolator;exports.parseRotationToQuaternion=e.parseRotationToQuaternion;exports.quaternionToRotationVector=e.quaternionToRotationVector;exports.useSmoothedMotionState=e.useSmoothedMotionState;
|
package/dist/3d.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./components/robots/LinearAxis";
|
|
|
12
12
|
export * from "./components/robots/MotionGroupVisualizer";
|
|
13
13
|
export * from "./components/robots/Robot";
|
|
14
14
|
export { defaultGetModel } from "./components/robots/robotModelLogic";
|
|
15
|
+
export { type RobotModelSource, robotModelOf, } from "./components/robots/robotModelSource";
|
|
15
16
|
export * from "./components/robots/SupportedLinearAxis";
|
|
16
17
|
export * from "./components/robots/SupportedRobot";
|
|
17
18
|
export { ValueInterpolator, type InterpolationOptions, } from "./components/utils/interpolation";
|
package/dist/3d.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as a, J as t, L as r, M as s, a as i, P as n, R as p, S as u, b as d, c as
|
|
2
|
-
import { J as
|
|
1
|
+
import { C as a, J as t, L as r, M as s, a as i, P as n, R as p, S as u, b as d, c as l, d as m, e as x, T as R, f, r as S } from "./chunks/robotModelSource-CKuBOeQ-.js";
|
|
2
|
+
import { J as b } from "./chunks/JoggingGizmo-SuS9MmL7.js";
|
|
3
3
|
import { J as G } from "./chunks/JoggingGizmoOrientation-x_crT_64.js";
|
|
4
|
-
import { R as
|
|
5
|
-
import { P as L, V as
|
|
4
|
+
import { R as M } from "./chunks/RobotControlPanel-E-hUzMIL.js";
|
|
5
|
+
import { P as L, V as P, p as V, q as E, a as T } from "./chunks/Pose3-pocKPrHN.js";
|
|
6
6
|
export {
|
|
7
7
|
a as CollisionSceneRenderer,
|
|
8
|
-
|
|
8
|
+
b as JoggingGizmo,
|
|
9
9
|
G as JoggingGizmoOrientation,
|
|
10
10
|
t as JointLimitGizmo,
|
|
11
11
|
r as LinearAxis,
|
|
@@ -14,16 +14,17 @@ export {
|
|
|
14
14
|
L as Pose3,
|
|
15
15
|
n as PresetEnvironment,
|
|
16
16
|
p as Robot,
|
|
17
|
-
|
|
17
|
+
M as RobotControlPanel,
|
|
18
18
|
u as SafetyZonesRenderer,
|
|
19
19
|
d as SupportedLinearAxis,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
l as SupportedLinearAxisExact,
|
|
21
|
+
m as SupportedRobot,
|
|
22
|
+
x as SupportedRobotExact,
|
|
23
|
+
R as TrajectoryRenderer,
|
|
24
|
+
P as ValueInterpolator,
|
|
25
|
+
f as defaultGetModel,
|
|
26
|
+
V as parseRotationToQuaternion,
|
|
27
|
+
E as quaternionToRotationVector,
|
|
28
|
+
S as robotModelOf,
|
|
29
|
+
T as useSmoothedMotionState
|
|
29
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-DrXTcV-I.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-DTE8-v2j.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
|
package/dist/SafetyBar/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Settings as on } from "@wandelbots/icons/Settings";
|
|
|
9
9
|
import { memo as rn, useId as K, useRef as $, useState as j, useCallback as T } from "react";
|
|
10
10
|
import { useTranslation as U } from "react-i18next";
|
|
11
11
|
import { e as an } from "./externalizeComponent-_w2d1_pz.js";
|
|
12
|
-
import { P as B, u as sn,
|
|
12
|
+
import { P as B, u as sn, c as ln, b as cn } from "./useEveryFrame-B8t_yz-G.js";
|
|
13
13
|
import { S as un } from "./SmallSelect-BdD9uLKK.js";
|
|
14
14
|
import pn from "@mui/material/ListSubheader";
|
|
15
15
|
import dn from "@mui/material/MenuItem";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),y=require("./useEveryFrame-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),y=require("./useEveryFrame-CHxg25f4.cjs"),ee=require("./SmallSelect-Dcsd7_6_.cjs"),ne=require("@mui/material/ListSubheader"),te=require("@mui/material/MenuItem"),re=require("@mui/material/Popover"),oe=require("@wandelbots/mui"),ie=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function N(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function se(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function le(e,n){const{intrinsic:r,axes:o}=N(n),c=r?[...o].reverse():o,i=U[c[0]],s=U[c[1]],p=c[0]===c[2],a=p?3-i-s:U[c[2]],x=(i-s)*(s-a)*(a-i)/2,q=Math.hypot(...e)||1,[L,A,I,m]=e.map(V=>V/q),S=[L,A,I],j=S[i]??0,f=S[s]??0,v=(S[a]??0)*x,[T,g,O,_]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(O,_),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(_,O);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(se)}function X({children:e}){return t.jsx(ne,{children:e})}X.muiSkipListHighlight=!0;function ce({value:e,onChange:n}){const{t:r}=F.useTranslation(),o=d.useId(),c=s=>{const{intrinsic:p,axes:a}=N(s);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:a.join("")})},i=s=>ae.filter(p=>N(p).intrinsic===s).map(p=>t.jsx(te,{value:p,children:N(p).axes.join("")},p));return t.jsxs(oe.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:s=>c(s),onChange:s=>n(s.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const ue=d.memo(pe,(e,n)=>e.anchor===n.anchor&&e.open===n.open&&e.onClose===n.onClose&&e.onChange===n.onChange&&e.format.type===n.format.type&&e.format.angleUnit===n.format.angleUnit&&e.format.eulerConvention===n.format.eulerConvention);function pe({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=F.useTranslation(),s=i("CurrentPose.OrientationFormat.ti"),p=a=>c({...o,...a});return t.jsxs(re,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":s,sx:a=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${a.palette.divider}`,background:(x=a.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:a.shadows[16]}}}},children:[t.jsx(R,{variant:"subtitle2",color:"text.primary",children:s}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(y.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:a=>p({type:a}),disabled:!1}),o.type!=="quaternion"&&t.jsx(y.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:a=>p({angleUnit:a}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ce,{value:o.eulerConvention,onChange:a=>p({eulerConvention:a})})]})]})}const de={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function xe(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return N(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function he(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return le(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function ge(e,n){const r=["x","y","z"].map((i,s)=>({label:i.toUpperCase(),value:e?w(e.position[s]??0,1):"–",kind:i})),o=e?he(e.orientation,n):null,c=xe(n).map((i,s)=>({label:i,value:(o==null?void 0:o[s])??"–",kind:"orientation"}));return[...r,...c]}const Ce={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function be({state:e,error:n}){const{t:r}=F.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":Ce[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(ie,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},me={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(R,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ee.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),ve=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:s,sx:p})=>{const{t:a}=F.useTranslation(),x=d.useRef(null),[q,L]=d.useState(de),A=i??q,[I,m]=d.useState(null),{copied:S,copy:j}=y.useCopyText(),f=y.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=ge(v,A),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:s});g.current={tcp:n,frame:r,onOrientationFormatChange:s};const O=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),_=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(y.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:a("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":a("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:O})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:_})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(R,{variant:"caption",sx:{...k,color:me[h]},children:l}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:a("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":a("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(be,{state:o,error:c}),t.jsx(ue,{anchor:I,open:I!==null,onClose:E,format:A,onChange:C})]})});exports.CurrentPoseBar=ve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),$=require("@mui/material/IconButton"),v=require("@mui/material/Stack"),z=require("@mui/material/Tab"),W=require("@mui/material/Tabs"),F=require("@mui/material/Typography"),D=require("@wandelbots/icons/CloseFilled"),b=require("react"),w=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),V=require("@mui/material/Divider"),P=require("@mui/material/Tooltip"),Q=require("@wandelbots/icons/Jog"),U=require("@wandelbots/icons/ViewModuleFilled"),Y=require("./JoggingGizmo-DGbFLWgT.cjs"),Z=require("./JoggingButtons-CbL-5LMK.cjs"),tt=require("@mui/material/styles"),X=require("@mui/material/ToggleButton"),et=require("@mui/material/ToggleButtonGroup"),T=require("./useEveryFrame-dmPPTKtT.cjs"),ot=require("@mui/material/Slider"),nt=require("./JoggingJointSlider-R3_A9Ppj.cjs"),rt=require("@wandelbots/icons/Undo"),I=require("@wandelbots/mui"),lt=require("@wandelbots/icons/NorthEastFilled"),st=require("./joggingColors-ZDc_2UCp.cjs"),_=require("@wandelbots/icons/CheckFilled"),at=require("@wandelbots/icons/ContentCopyFilled"),it=require("@wandelbots/icons/EditFilled");function ct({view:t,onViewChange:o,mode:n,controls:s,gizmoOrientation:a,gizmoFrameQuaternion:d}){const{t:l}=w.useTranslation(),r=t==="gizmo"&&a!==void 0,i=l(r?n==="increment"?"RobotControl.JogArea.Hint.ClickHandle.lb":"RobotControl.JogArea.Hint.HoldHandle.lb":n==="increment"?"RobotControl.JogArea.Hint.ClickButton.lb":"RobotControl.JogArea.Hint.HoldButton.lb"),x=l(r?"RobotControl.JogArea.ShowButtons.bt":"RobotControl.JogArea.ShowGizmo.bt");return e.jsxs(v,{"data-testid":"jog-area",sx:{position:"relative",alignItems:"center",gap:"16px"},children:[a&&e.jsx(P,{title:x,placement:"left",children:e.jsx($,{"aria-label":x,onClick:()=>o(r?"buttons":"gizmo"),size:"small",sx:c=>{var g;return{position:"absolute",top:0,right:0,zIndex:1,borderRadius:"8px",border:`1px solid ${c.palette.divider}`,background:(g=c.palette.backgroundPaperElevation)==null?void 0:g[11]}},children:r?e.jsx(U.ViewModuleFilled,{}):e.jsx(Q.Jog,{})})}),r?e.jsx(Y.JoggingGizmo,{...s,orientation:a,frameQuaternion:d,size:180}):e.jsx(Z.JoggingButtons,{...s}),e.jsx(F,{variant:"body2",color:"text.secondary",textAlign:"center",children:i})]})}const ut=tt.styled(et)(({theme:t})=>{var o;return{gap:"4px","& .MuiToggleButton-root":{border:"none",borderRadius:"8px",padding:"6px 16px",textTransform:"none",fontSize:"14px",color:t.palette.text.secondary},"& .MuiToggleButton-root.Mui-selected":{color:t.palette.text.primary,background:(o=t.palette.backgroundPaperElevation)==null?void 0:o[11]}}});function dt({value:t,onChange:o,disabled:n}){const{t:s}=w.useTranslation();return e.jsxs(ut,{exclusive:!0,value:t,disabled:n,"aria-label":s("RobotControl.JogMode.lb"),onChange:(a,d)=>{d!==null&&o(d)},children:[e.jsx(X,{value:"continuous",children:s("RobotControl.JogMode.Continuous.bt")}),e.jsx(X,{value:"increment",children:s("RobotControl.JogMode.Increment.bt")})]})}function J({children:t}){return e.jsx(v,{sx:{padding:"16px 20px",gap:"16px"},children:t})}function xt(t){return t*180/Math.PI}function pt(t){return t*Math.PI/180}function H(t,o){return t==="rotate"?xt(o):o}function gt(t,o){return t==="rotate"?pt(o):o}function bt(t,o){const n=String(Number(H(t,o).toFixed(2)));return t==="rotate"?`${n}°`:`${n} mm`}function ft(t,o){const n=Math.round(H(t,o));return t==="rotate"?`${n}°/s`:`${n} mm/s`}function L({motion:t,velocity:o,onChange:n,disabled:s}){const{t:a}=w.useTranslation(),d=b.useId(),l=r=>H(t,r);return e.jsxs(v,{gap:"4px",children:[e.jsxs(v,{direction:"row",sx:{justifyContent:"space-between"},children:[e.jsx(F,{id:d,variant:"body2",color:"text.secondary",children:a("RobotControl.Velocity.lb")}),e.jsx(F,{variant:"body2",color:"text.primary",sx:{fontVariantNumeric:"tabular-nums"},children:ft(t,o.value)})]}),e.jsx(ot,{"aria-labelledby":d,size:"small",value:Math.round(l(o.value)),min:Math.ceil(l(o.min)),max:Math.floor(l(o.max)),disabled:s,onChange:(r,i)=>{typeof i=="number"&&n(gt(t,i))},sx:r=>{var i;return{height:4,"& .MuiSlider-rail":{opacity:.38},"& .MuiSlider-thumb":{width:16,height:16,border:`3px solid ${r.palette.primary.main}`,backgroundColor:(i=r.palette.backgroundPaperElevation)==null?void 0:i[5]}}}})]})}function ht({motion:t,settings:o,onSettingsChange:n,disabled:s=!1,tcp:a,jogFrame:d,velocity:l,onVelocityChange:r,onJogStart:i,onJogStop:x,increments:c,gizmoOrientation:g,gizmoFrameQuaternion:j}){const{t:h}=w.useTranslation(),u=c?o.mode:"continuous",R=(c==null?void 0:c.steps[t])??[],m=Math.min(o.step[t],R.length-1),C=R[m],M=b.useRef(!1);function S(f,y){if(u==="increment"){c&&C!==void 0&&c.onStep(t,f,y,C);return}M.current=!0,i(t,f,y)}function E(){M.current&&(M.current=!1,x())}return e.jsxs(e.Fragment,{children:[(a||d)&&e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsxs(v,{direction:"row",sx:{gap:"12px"},children:[a&&e.jsx(T.PanelSelect,{label:h("RobotControl.Tcp.lb"),...a,disabled:s}),d&&e.jsx(T.PanelSelect,{label:h("RobotControl.JogFrame.lb"),...d,disabled:s})]})}),e.jsx(V,{sx:{marginX:"20px"}})]}),e.jsxs(J,{children:[c&&e.jsx(dt,{value:u,onChange:f=>n({...o,mode:f}),disabled:s}),e.jsx(L,{motion:t,velocity:l[t],onChange:f=>r(t,f),disabled:s}),u==="increment"&&C!==void 0&&e.jsx(T.InlineSelect,{label:h("RobotControl.StepSize.lb"),value:String(m),options:R.map((f,y)=>({id:String(y),label:bt(t,f)})),onChange:f=>n({...o,step:{...o.step,[t]:Number(f)}}),disabled:s})]}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(ct,{view:o.view,onViewChange:f=>n({...o,view:f}),mode:u,controls:{motion:t,onJogStart:S,onJogStop:E,activeHandle:u==="increment"?c==null?void 0:c.running:null,disabled:s},gizmoOrientation:g,gizmoFrameQuaternion:j},u)})]})}function Ct({joints:t,disabled:o}){const n=b.useRef(null),[s,a]=b.useState(null);function d(r,i){n.current!==null&&n.current!==r||(n.current=r,a(r),t.onJogStart(r,i))}function l(r){n.current===r&&(n.current=null,a(null),t.onJogStop())}return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsx(v,{sx:{gap:"8px",paddingX:"4px"},children:t.joints.map((r,i)=>e.jsx(nt.JoggingJointSlider,{label:`J${i+1}`,name:r.name,value:r.value,min:r.min,max:r.max,linear:t.linear,onJogStart:x=>d(i,x),onJogStop:()=>l(i),disabled:o||s!==null&&s!==i},i))})}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(L,{motion:t.linear?"translate":"rotate",velocity:t.velocity,onChange:t.onVelocityChange,disabled:o})})]})}const jt=.5,vt=.01;function Rt(t,o){return t?Math.hypot(t.position[0]-o.position[0],t.position[1]-o.position[1],t.position[2]-o.position[2])<=jt&&mt(t.orientation,o.orientation)<=vt:!1}function G(t){const o=Math.hypot(...t);if(o<1e-12)return[1,0,0,0];const n=Math.sin(o/2)/o;return[Math.cos(o/2),t[0]*n,t[1]*n,t[2]*n]}function mt(t,o){const n=G(t),s=G(o),a=Math.abs(n[0]*s[0]+n[1]*s[1]+n[2]*s[2]+n[3]*s[3]);return 2*Math.acos(Math.min(1,a))}const Tt="move",Mt=200;function St({state:t,ready:o,atPose:n,disabled:s,onMoveStart:a,onMoveStop:d,stopRef:l}){const{t:r}=w.useTranslation(),[i,x]=b.useState(!1),c=b.useRef(void 0),g=b.useRef(!1),j=b.useRef({onMoveStart:a,onMoveStop:d});j.current={onMoveStart:a,onMoveStop:d};const h=t==="planned",u=h||t==="moving",{handlersFor:R,stop:m}=st.useHold({onStart:()=>{x(!0),c.current=setTimeout(()=>{c.current=void 0,g.current=!0,j.current.onMoveStart()},Mt)},onStop:()=>{x(!1),clearTimeout(c.current),c.current=void 0,g.current&&(g.current=!1,j.current.onMoveStop())},disabled:i?s||!o||!u:s||!o||n||!h,isSame:()=>!0});l&&(l.current=m),b.useEffect(()=>()=>clearTimeout(c.current),[]);const C=r(t==="moving"?"RobotControl.MoveTo.Moving.bt":t==="stopping"?"RobotControl.MoveTo.Stopping.bt":"RobotControl.MoveTo.MoveTo.bt");return e.jsx(P,{title:r(n?"RobotControl.MoveTo.AtPose.lb":"RobotControl.MoveTo.HoldToMove.lb"),placement:"top",children:e.jsx("span",{...R(Tt),style:{display:"block",flexGrow:1,touchAction:"none",userSelect:"none"},children:e.jsx(I.PrimaryButton,{fullWidth:!0,disabled:s||!o||n||!u,loading:t==="planning"||t==="stopping",loadingPosition:"start",startIcon:e.jsx(lt.NorthEastFilled,{}),"aria-pressed":i,children:C})})})}function yt({text:t,editing:o,onEdit:n,onDraftChange:s,onCancel:a,onConfirm:d,canConfirm:l,error:r,disabled:i}){const{t:x}=w.useTranslation(),c=b.useRef(null),{copied:g,copy:j}=T.useCopyText();b.useEffect(()=>{const u=c.current;u&&(o?(u.focus(),u.setSelectionRange(u.value.length,u.value.length)):document.activeElement===u&&(u.blur(),u.scrollLeft=0))},[o]);function h(){return j(t,()=>{var u;return(u=c.current)==null?void 0:u.select()})}return e.jsxs(v,{direction:"row",sx:{gap:"8px",alignItems:"flex-start"},children:[e.jsx(I.AdornedTextField,{label:x("RobotControl.MoveTo.Coordinates.lb"),value:t,inputRef:c,onChange:u=>s(u.target.value),onClick:()=>{!o&&!i&&n()},onKeyDown:u=>{o&&(u.key==="Enter"&&l?d():u.key==="Escape"&&a())},error:!!r,helperText:r??void 0,fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{readOnly:!o,spellCheck:!1}},sx:{"& input":{fontVariantNumeric:"tabular-nums",cursor:o||i?void 0:"text"}}}),e.jsx(v,{direction:"row",sx:{gap:"8px",height:"56px",alignItems:"center"},children:o?e.jsxs(e.Fragment,{children:[e.jsx(I.RoundedIconButton,{icon:e.jsx(D.CloseFilled,{}),ariaLabel:x("RobotControl.MoveTo.Cancel.bt"),onClick:a}),e.jsx(P,{title:x("RobotControl.MoveTo.ConfirmEdit.lb"),placement:"left",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(_.CheckFilled,{}),ariaLabel:x("RobotControl.MoveTo.ConfirmEdit.lb"),onClick:d,disabled:!l,sx:{color:"primary.main"}})})})]}):e.jsxs(e.Fragment,{children:[e.jsx(P,{title:x("RobotControl.MoveTo.Copied.lb"),open:g,disableHoverListener:!0,placement:"left",children:e.jsx(I.RoundedIconButton,{icon:g?e.jsx(_.CheckFilled,{}):e.jsx(at.ContentCopyFilled,{}),ariaLabel:x("RobotControl.MoveTo.Copy.bt"),onClick:()=>void h()})}),e.jsx(I.RoundedIconButton,{icon:e.jsx(it.EditFilled,{}),ariaLabel:x("RobotControl.MoveTo.Edit.bt"),onClick:n,disabled:i})]})})]})}function wt({moveTo:t,tcp:o,velocity:n,onVelocityChange:s,disabled:a}){var B;const{t:d}=w.useTranslation(),[l,r]=b.useState(null),[i,x]=b.useState(null),c=T.useEveryFrame(()=>{const p=t.getCurrentPose();return p?T.poseToText(p):""},l===null&&i===null),g=(l==null?void 0:l.text)??c,j=i!==null,h=i===null?null:T.parsePoseText(i),u=l!==null&&!t.error&&!j,R=T.useEveryFrame(()=>l!==null&&Rt(t.getCurrentPose(),l.pose),u)&&u,m=b.useRef(!1),C=b.useRef(null);function M(){var p;(p=C.current)==null||p.call(C),m.current=!1,r(null),x(null),t.onTargetChange(null)}function S(){h===null||a||(m.current=!1,r({pose:h,text:T.poseToText(h)}),x(null),t.onTargetChange(h))}b.useEffect(()=>{if(u){if(t.state==="moving"){m.current=!0;return}m.current&&R&&t.state!=="stopping"&&M()}},[u,t.state,R]);const E=[o==null?void 0:o.value,(B=t.frame)==null?void 0:B.value].join("\0");b.useEffect(()=>{l&&M()},[E]);const f=b.useRef({target:l,onTargetChange:t.onTargetChange});f.current={target:l,onTargetChange:t.onTargetChange},b.useEffect(()=>()=>{var p;(p=C.current)==null||p.call(C),f.current.target&&f.current.onTargetChange(null)},[]);const y=i!==null?h===null?d("RobotControl.MoveTo.InvalidPose.lb"):null:l?t.error??null:null;return e.jsxs(J,{children:[o&&e.jsx(T.PanelSelect,{label:d("RobotControl.Tcp.lb"),...o,disabled:a}),e.jsx(F,{variant:"body1",color:"text.primary",children:d("RobotControl.MoveTo.TargetPose.lb")}),e.jsxs(v,{sx:{gap:"8px"},children:[t.frame&&e.jsx(T.PanelSelect,{label:d("RobotControl.MoveTo.RelativeTo.lb"),...t.frame,disabled:a}),e.jsx(yt,{text:i??g,editing:j,onEdit:()=>{a||x(g)},onDraftChange:x,onCancel:()=>x(null),onConfirm:S,canConfirm:h!==null&&!a&&t.state!=="planning",error:y,disabled:a})]}),e.jsx(L,{motion:"translate",velocity:n,onChange:s,disabled:a}),e.jsxs(v,{direction:"row",sx:{gap:"12px",alignItems:"center"},children:[l&&!j&&e.jsx(P,{title:d("RobotControl.MoveTo.Reset.lb"),placement:"top",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(rt.Undo,{}),ariaLabel:d("RobotControl.MoveTo.Reset.lb"),onClick:M})})}),e.jsx(St,{state:l?t.state:"idle",ready:u,atPose:R,disabled:a,onMoveStart:()=>{l&&t.onMoveStart(l.pose)},onMoveStop:t.onMoveStop,stopRef:C})]})]})}const Et=K.externalizeComponent(({onClose:t,sx:o,joints:n,moveTo:s,jogDisabled:a=!1,cartesian:d=!0,tab:l,onTabChange:r,jogMode:i,onJogModeChange:x,...c})=>{const{t:g}=w.useTranslation(),j=c.disabled??!1,[h,u]=b.useState("translate"),[R,m]=b.useState({mode:"continuous",view:"gizmo",step:{translate:0,rotate:0}}),C=[...d?["translate","rotate"]:[],...n?["joint"]:[],...s?["moveTo"]:[]],M=l??h,S=C.includes(M)?M:C[0],E=qt(R,i,c.increments),f=g("RobotControl.Title.ti");function y(p){u(p),r==null||r(p)}function B(p){var q,A,N;m(p),p.mode!==E.mode&&(x==null||x(p.mode));for(const k of["translate","rotate"]){const O=(q=c.increments)==null?void 0:q.steps[k][p.step[k]];p.step[k]!==E.step[k]&&O!==void 0&&((N=(A=c.increments)==null?void 0:A.onStepChange)==null||N.call(A,k,O))}}return e.jsxs(v,{"data-testid":"robot-control-panel",sx:[p=>{var q;return{minHeight:0,overflow:"hidden",borderRadius:"16px",background:(q=p.palette.backgroundPaperElevation)==null?void 0:q[5]}},...Array.isArray(o)?o:[o]],children:[e.jsxs(v,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",padding:"20px 20px 8px"},children:[e.jsx(F,{component:"h2",color:"text.primary",sx:{fontSize:"20px"},children:f}),t&&e.jsx($,{"aria-label":g("RobotControl.Close.bt"),onClick:t,size:"small",children:e.jsx(D.CloseFilled,{})})]}),e.jsxs(W,{value:S??!1,onChange:(p,q)=>y(q),"aria-label":f,variant:"scrollable",scrollButtons:!1,sx:{marginX:"20px",borderBottom:1,borderColor:"divider",background:"transparent"},children:[d&&e.jsx(z,{value:"translate",label:g("RobotControl.Tab.Translate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),d&&e.jsx(z,{value:"rotate",label:g("RobotControl.Tab.Rotate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),n&&e.jsx(z,{value:"joint",label:g("RobotControl.Tab.Joint.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),s&&e.jsx(z,{value:"moveTo",label:g("RobotControl.Tab.MoveTo.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}})]}),e.jsx(v,{sx:{flexGrow:1,overflowY:"auto",overflowX:"hidden"},children:S==="joint"&&n?e.jsx(Ct,{joints:n,disabled:j||a}):S==="moveTo"&&s?e.jsx(wt,{moveTo:s,tcp:c.tcp,velocity:c.velocity.translate,onVelocityChange:p=>c.onVelocityChange("translate",p),disabled:j}):S==="translate"||S==="rotate"?e.jsx(ht,{...c,disabled:j||a,motion:S,settings:E,onSettingsChange:B}):null})]})});function qt(t,o,n){const s=a=>{var r;const d=(r=n==null?void 0:n.step)==null?void 0:r[a];if(d===void 0)return t.step[a];const l=n==null?void 0:n.steps[a].findIndex(i=>Math.abs(i-d)<=1e-9*Math.max(1,Math.abs(i)));return l===void 0||l<0?t.step[a]:l};return{...t,mode:o??t.mode,step:{translate:s("translate"),rotate:s("rotate")}}}exports.RobotControlPanel=Et;
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),$=require("@mui/material/IconButton"),v=require("@mui/material/Stack"),z=require("@mui/material/Tab"),W=require("@mui/material/Tabs"),F=require("@mui/material/Typography"),D=require("@wandelbots/icons/CloseFilled"),b=require("react"),w=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),V=require("@mui/material/Divider"),P=require("@mui/material/Tooltip"),Q=require("@wandelbots/icons/Jog"),U=require("@wandelbots/icons/ViewModuleFilled"),Y=require("./JoggingGizmo-DGbFLWgT.cjs"),Z=require("./JoggingButtons-CbL-5LMK.cjs"),tt=require("@mui/material/styles"),X=require("@mui/material/ToggleButton"),et=require("@mui/material/ToggleButtonGroup"),T=require("./useEveryFrame-CHxg25f4.cjs"),ot=require("@mui/material/Slider"),nt=require("./JoggingJointSlider-R3_A9Ppj.cjs"),rt=require("@wandelbots/icons/Undo"),I=require("@wandelbots/mui"),lt=require("@wandelbots/icons/NorthEastFilled"),st=require("./joggingColors-ZDc_2UCp.cjs"),_=require("@wandelbots/icons/CheckFilled"),at=require("@wandelbots/icons/ContentCopyFilled"),it=require("@wandelbots/icons/EditFilled");function ct({view:t,onViewChange:o,mode:n,controls:s,gizmoOrientation:a,gizmoFrameQuaternion:d}){const{t:l}=w.useTranslation(),r=t==="gizmo"&&a!==void 0,i=l(r?n==="increment"?"RobotControl.JogArea.Hint.ClickHandle.lb":"RobotControl.JogArea.Hint.HoldHandle.lb":n==="increment"?"RobotControl.JogArea.Hint.ClickButton.lb":"RobotControl.JogArea.Hint.HoldButton.lb"),x=l(r?"RobotControl.JogArea.ShowButtons.bt":"RobotControl.JogArea.ShowGizmo.bt");return e.jsxs(v,{"data-testid":"jog-area",sx:{position:"relative",alignItems:"center",gap:"16px"},children:[a&&e.jsx(P,{title:x,placement:"left",children:e.jsx($,{"aria-label":x,onClick:()=>o(r?"buttons":"gizmo"),size:"small",sx:c=>{var g;return{position:"absolute",top:0,right:0,zIndex:1,borderRadius:"8px",border:`1px solid ${c.palette.divider}`,background:(g=c.palette.backgroundPaperElevation)==null?void 0:g[11]}},children:r?e.jsx(U.ViewModuleFilled,{}):e.jsx(Q.Jog,{})})}),r?e.jsx(Y.JoggingGizmo,{...s,orientation:a,frameQuaternion:d,size:180}):e.jsx(Z.JoggingButtons,{...s}),e.jsx(F,{variant:"body2",color:"text.secondary",textAlign:"center",children:i})]})}const ut=tt.styled(et)(({theme:t})=>{var o;return{gap:"4px","& .MuiToggleButton-root":{border:"none",borderRadius:"8px",padding:"6px 16px",textTransform:"none",fontSize:"14px",color:t.palette.text.secondary},"& .MuiToggleButton-root.Mui-selected":{color:t.palette.text.primary,background:(o=t.palette.backgroundPaperElevation)==null?void 0:o[11]}}});function dt({value:t,onChange:o,disabled:n}){const{t:s}=w.useTranslation();return e.jsxs(ut,{exclusive:!0,value:t,disabled:n,"aria-label":s("RobotControl.JogMode.lb"),onChange:(a,d)=>{d!==null&&o(d)},children:[e.jsx(X,{value:"continuous",children:s("RobotControl.JogMode.Continuous.bt")}),e.jsx(X,{value:"increment",children:s("RobotControl.JogMode.Increment.bt")})]})}function J({children:t}){return e.jsx(v,{sx:{padding:"16px 20px",gap:"16px"},children:t})}function xt(t){return t*180/Math.PI}function pt(t){return t*Math.PI/180}function H(t,o){return t==="rotate"?xt(o):o}function gt(t,o){return t==="rotate"?pt(o):o}function bt(t,o){const n=String(Number(H(t,o).toFixed(2)));return t==="rotate"?`${n}°`:`${n} mm`}function ft(t,o){const n=Math.round(H(t,o));return t==="rotate"?`${n}°/s`:`${n} mm/s`}function L({motion:t,velocity:o,onChange:n,disabled:s}){const{t:a}=w.useTranslation(),d=b.useId(),l=r=>H(t,r);return e.jsxs(v,{gap:"4px",children:[e.jsxs(v,{direction:"row",sx:{justifyContent:"space-between"},children:[e.jsx(F,{id:d,variant:"body2",color:"text.secondary",children:a("RobotControl.Velocity.lb")}),e.jsx(F,{variant:"body2",color:"text.primary",sx:{fontVariantNumeric:"tabular-nums"},children:ft(t,o.value)})]}),e.jsx(ot,{"aria-labelledby":d,size:"small",value:Math.round(l(o.value)),min:Math.ceil(l(o.min)),max:Math.floor(l(o.max)),disabled:s,onChange:(r,i)=>{typeof i=="number"&&n(gt(t,i))},sx:r=>{var i;return{height:4,"& .MuiSlider-rail":{opacity:.38},"& .MuiSlider-thumb":{width:16,height:16,border:`3px solid ${r.palette.primary.main}`,backgroundColor:(i=r.palette.backgroundPaperElevation)==null?void 0:i[5]}}}})]})}function ht({motion:t,settings:o,onSettingsChange:n,disabled:s=!1,tcp:a,jogFrame:d,velocity:l,onVelocityChange:r,onJogStart:i,onJogStop:x,increments:c,gizmoOrientation:g,gizmoFrameQuaternion:j}){const{t:h}=w.useTranslation(),u=c?o.mode:"continuous",R=(c==null?void 0:c.steps[t])??[],m=Math.min(o.step[t],R.length-1),C=R[m],M=b.useRef(!1);function S(f,y){if(u==="increment"){c&&C!==void 0&&c.onStep(t,f,y,C);return}M.current=!0,i(t,f,y)}function E(){M.current&&(M.current=!1,x())}return e.jsxs(e.Fragment,{children:[(a||d)&&e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsxs(v,{direction:"row",sx:{gap:"12px"},children:[a&&e.jsx(T.PanelSelect,{label:h("RobotControl.Tcp.lb"),...a,disabled:s}),d&&e.jsx(T.PanelSelect,{label:h("RobotControl.JogFrame.lb"),...d,disabled:s})]})}),e.jsx(V,{sx:{marginX:"20px"}})]}),e.jsxs(J,{children:[c&&e.jsx(dt,{value:u,onChange:f=>n({...o,mode:f}),disabled:s}),e.jsx(L,{motion:t,velocity:l[t],onChange:f=>r(t,f),disabled:s}),u==="increment"&&C!==void 0&&e.jsx(T.InlineSelect,{label:h("RobotControl.StepSize.lb"),value:String(m),options:R.map((f,y)=>({id:String(y),label:bt(t,f)})),onChange:f=>n({...o,step:{...o.step,[t]:Number(f)}}),disabled:s})]}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(ct,{view:o.view,onViewChange:f=>n({...o,view:f}),mode:u,controls:{motion:t,onJogStart:S,onJogStop:E,activeHandle:u==="increment"?c==null?void 0:c.running:null,disabled:s},gizmoOrientation:g,gizmoFrameQuaternion:j},u)})]})}function Ct({joints:t,disabled:o}){const n=b.useRef(null),[s,a]=b.useState(null);function d(r,i){n.current!==null&&n.current!==r||(n.current=r,a(r),t.onJogStart(r,i))}function l(r){n.current===r&&(n.current=null,a(null),t.onJogStop())}return e.jsxs(e.Fragment,{children:[e.jsx(J,{children:e.jsx(v,{sx:{gap:"8px",paddingX:"4px"},children:t.joints.map((r,i)=>e.jsx(nt.JoggingJointSlider,{label:`J${i+1}`,name:r.name,value:r.value,min:r.min,max:r.max,linear:t.linear,onJogStart:x=>d(i,x),onJogStop:()=>l(i),disabled:o||s!==null&&s!==i},i))})}),e.jsx(V,{sx:{marginX:"20px"}}),e.jsx(J,{children:e.jsx(L,{motion:t.linear?"translate":"rotate",velocity:t.velocity,onChange:t.onVelocityChange,disabled:o})})]})}const jt=.5,vt=.01;function Rt(t,o){return t?Math.hypot(t.position[0]-o.position[0],t.position[1]-o.position[1],t.position[2]-o.position[2])<=jt&&mt(t.orientation,o.orientation)<=vt:!1}function G(t){const o=Math.hypot(...t);if(o<1e-12)return[1,0,0,0];const n=Math.sin(o/2)/o;return[Math.cos(o/2),t[0]*n,t[1]*n,t[2]*n]}function mt(t,o){const n=G(t),s=G(o),a=Math.abs(n[0]*s[0]+n[1]*s[1]+n[2]*s[2]+n[3]*s[3]);return 2*Math.acos(Math.min(1,a))}const Tt="move",Mt=200;function St({state:t,ready:o,atPose:n,disabled:s,onMoveStart:a,onMoveStop:d,stopRef:l}){const{t:r}=w.useTranslation(),[i,x]=b.useState(!1),c=b.useRef(void 0),g=b.useRef(!1),j=b.useRef({onMoveStart:a,onMoveStop:d});j.current={onMoveStart:a,onMoveStop:d};const h=t==="planned",u=h||t==="moving",{handlersFor:R,stop:m}=st.useHold({onStart:()=>{x(!0),c.current=setTimeout(()=>{c.current=void 0,g.current=!0,j.current.onMoveStart()},Mt)},onStop:()=>{x(!1),clearTimeout(c.current),c.current=void 0,g.current&&(g.current=!1,j.current.onMoveStop())},disabled:i?s||!o||!u:s||!o||n||!h,isSame:()=>!0});l&&(l.current=m),b.useEffect(()=>()=>clearTimeout(c.current),[]);const C=r(t==="moving"?"RobotControl.MoveTo.Moving.bt":t==="stopping"?"RobotControl.MoveTo.Stopping.bt":"RobotControl.MoveTo.MoveTo.bt");return e.jsx(P,{title:r(n?"RobotControl.MoveTo.AtPose.lb":"RobotControl.MoveTo.HoldToMove.lb"),placement:"top",children:e.jsx("span",{...R(Tt),style:{display:"block",flexGrow:1,touchAction:"none",userSelect:"none"},children:e.jsx(I.PrimaryButton,{fullWidth:!0,disabled:s||!o||n||!u,loading:t==="planning"||t==="stopping",loadingPosition:"start",startIcon:e.jsx(lt.NorthEastFilled,{}),"aria-pressed":i,children:C})})})}function yt({text:t,editing:o,onEdit:n,onDraftChange:s,onCancel:a,onConfirm:d,canConfirm:l,error:r,disabled:i}){const{t:x}=w.useTranslation(),c=b.useRef(null),{copied:g,copy:j}=T.useCopyText();b.useEffect(()=>{const u=c.current;u&&(o?(u.focus(),u.setSelectionRange(u.value.length,u.value.length)):document.activeElement===u&&(u.blur(),u.scrollLeft=0))},[o]);function h(){return j(t,()=>{var u;return(u=c.current)==null?void 0:u.select()})}return e.jsxs(v,{direction:"row",sx:{gap:"8px",alignItems:"flex-start"},children:[e.jsx(I.AdornedTextField,{label:x("RobotControl.MoveTo.Coordinates.lb"),value:t,inputRef:c,onChange:u=>s(u.target.value),onClick:()=>{!o&&!i&&n()},onKeyDown:u=>{o&&(u.key==="Enter"&&l?d():u.key==="Escape"&&a())},error:!!r,helperText:r??void 0,fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{readOnly:!o,spellCheck:!1}},sx:{"& input":{fontVariantNumeric:"tabular-nums",cursor:o||i?void 0:"text"}}}),e.jsx(v,{direction:"row",sx:{gap:"8px",height:"56px",alignItems:"center"},children:o?e.jsxs(e.Fragment,{children:[e.jsx(I.RoundedIconButton,{icon:e.jsx(D.CloseFilled,{}),ariaLabel:x("RobotControl.MoveTo.Cancel.bt"),onClick:a}),e.jsx(P,{title:x("RobotControl.MoveTo.ConfirmEdit.lb"),placement:"left",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(_.CheckFilled,{}),ariaLabel:x("RobotControl.MoveTo.ConfirmEdit.lb"),onClick:d,disabled:!l,sx:{color:"primary.main"}})})})]}):e.jsxs(e.Fragment,{children:[e.jsx(P,{title:x("RobotControl.MoveTo.Copied.lb"),open:g,disableHoverListener:!0,placement:"left",children:e.jsx(I.RoundedIconButton,{icon:g?e.jsx(_.CheckFilled,{}):e.jsx(at.ContentCopyFilled,{}),ariaLabel:x("RobotControl.MoveTo.Copy.bt"),onClick:()=>void h()})}),e.jsx(I.RoundedIconButton,{icon:e.jsx(it.EditFilled,{}),ariaLabel:x("RobotControl.MoveTo.Edit.bt"),onClick:n,disabled:i})]})})]})}function wt({moveTo:t,tcp:o,velocity:n,onVelocityChange:s,disabled:a}){var B;const{t:d}=w.useTranslation(),[l,r]=b.useState(null),[i,x]=b.useState(null),c=T.useEveryFrame(()=>{const p=t.getCurrentPose();return p?T.poseToText(p):""},l===null&&i===null),g=(l==null?void 0:l.text)??c,j=i!==null,h=i===null?null:T.parsePoseText(i),u=l!==null&&!t.error&&!j,R=T.useEveryFrame(()=>l!==null&&Rt(t.getCurrentPose(),l.pose),u)&&u,m=b.useRef(!1),C=b.useRef(null);function M(){var p;(p=C.current)==null||p.call(C),m.current=!1,r(null),x(null),t.onTargetChange(null)}function S(){h===null||a||(m.current=!1,r({pose:h,text:T.poseToText(h)}),x(null),t.onTargetChange(h))}b.useEffect(()=>{if(u){if(t.state==="moving"){m.current=!0;return}m.current&&R&&t.state!=="stopping"&&M()}},[u,t.state,R]);const E=[o==null?void 0:o.value,(B=t.frame)==null?void 0:B.value].join("\0");b.useEffect(()=>{l&&M()},[E]);const f=b.useRef({target:l,onTargetChange:t.onTargetChange});f.current={target:l,onTargetChange:t.onTargetChange},b.useEffect(()=>()=>{var p;(p=C.current)==null||p.call(C),f.current.target&&f.current.onTargetChange(null)},[]);const y=i!==null?h===null?d("RobotControl.MoveTo.InvalidPose.lb"):null:l?t.error??null:null;return e.jsxs(J,{children:[o&&e.jsx(T.PanelSelect,{label:d("RobotControl.Tcp.lb"),...o,disabled:a}),e.jsx(F,{variant:"body1",color:"text.primary",children:d("RobotControl.MoveTo.TargetPose.lb")}),e.jsxs(v,{sx:{gap:"8px"},children:[t.frame&&e.jsx(T.PanelSelect,{label:d("RobotControl.MoveTo.RelativeTo.lb"),...t.frame,disabled:a}),e.jsx(yt,{text:i??g,editing:j,onEdit:()=>{a||x(g)},onDraftChange:x,onCancel:()=>x(null),onConfirm:S,canConfirm:h!==null&&!a&&t.state!=="planning",error:y,disabled:a})]}),e.jsx(L,{motion:"translate",velocity:n,onChange:s,disabled:a}),e.jsxs(v,{direction:"row",sx:{gap:"12px",alignItems:"center"},children:[l&&!j&&e.jsx(P,{title:d("RobotControl.MoveTo.Reset.lb"),placement:"top",children:e.jsx("span",{children:e.jsx(I.RoundedIconButton,{icon:e.jsx(rt.Undo,{}),ariaLabel:d("RobotControl.MoveTo.Reset.lb"),onClick:M})})}),e.jsx(St,{state:l?t.state:"idle",ready:u,atPose:R,disabled:a,onMoveStart:()=>{l&&t.onMoveStart(l.pose)},onMoveStop:t.onMoveStop,stopRef:C})]})]})}const Et=K.externalizeComponent(({onClose:t,sx:o,joints:n,moveTo:s,jogDisabled:a=!1,cartesian:d=!0,tab:l,onTabChange:r,jogMode:i,onJogModeChange:x,...c})=>{const{t:g}=w.useTranslation(),j=c.disabled??!1,[h,u]=b.useState("translate"),[R,m]=b.useState({mode:"continuous",view:"gizmo",step:{translate:0,rotate:0}}),C=[...d?["translate","rotate"]:[],...n?["joint"]:[],...s?["moveTo"]:[]],M=l??h,S=C.includes(M)?M:C[0],E=qt(R,i,c.increments),f=g("RobotControl.Title.ti");function y(p){u(p),r==null||r(p)}function B(p){var q,A,N;m(p),p.mode!==E.mode&&(x==null||x(p.mode));for(const k of["translate","rotate"]){const O=(q=c.increments)==null?void 0:q.steps[k][p.step[k]];p.step[k]!==E.step[k]&&O!==void 0&&((N=(A=c.increments)==null?void 0:A.onStepChange)==null||N.call(A,k,O))}}return e.jsxs(v,{"data-testid":"robot-control-panel",sx:[p=>{var q;return{minHeight:0,overflow:"hidden",borderRadius:"16px",background:(q=p.palette.backgroundPaperElevation)==null?void 0:q[5]}},...Array.isArray(o)?o:[o]],children:[e.jsxs(v,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",padding:"20px 20px 8px"},children:[e.jsx(F,{component:"h2",color:"text.primary",sx:{fontSize:"20px"},children:f}),t&&e.jsx($,{"aria-label":g("RobotControl.Close.bt"),onClick:t,size:"small",children:e.jsx(D.CloseFilled,{})})]}),e.jsxs(W,{value:S??!1,onChange:(p,q)=>y(q),"aria-label":f,variant:"scrollable",scrollButtons:!1,sx:{marginX:"20px",borderBottom:1,borderColor:"divider",background:"transparent"},children:[d&&e.jsx(z,{value:"translate",label:g("RobotControl.Tab.Translate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),d&&e.jsx(z,{value:"rotate",label:g("RobotControl.Tab.Rotate.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),n&&e.jsx(z,{value:"joint",label:g("RobotControl.Tab.Joint.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}}),s&&e.jsx(z,{value:"moveTo",label:g("RobotControl.Tab.MoveTo.bt"),sx:{minWidth:0,paddingX:"12px",textTransform:"none"}})]}),e.jsx(v,{sx:{flexGrow:1,overflowY:"auto",overflowX:"hidden"},children:S==="joint"&&n?e.jsx(Ct,{joints:n,disabled:j||a}):S==="moveTo"&&s?e.jsx(wt,{moveTo:s,tcp:c.tcp,velocity:c.velocity.translate,onVelocityChange:p=>c.onVelocityChange("translate",p),disabled:j}):S==="translate"||S==="rotate"?e.jsx(ht,{...c,disabled:j||a,motion:S,settings:E,onSettingsChange:B}):null})]})});function qt(t,o,n){const s=a=>{var r;const d=(r=n==null?void 0:n.step)==null?void 0:r[a];if(d===void 0)return t.step[a];const l=n==null?void 0:n.steps[a].findIndex(i=>Math.abs(i-d)<=1e-9*Math.max(1,Math.abs(i)));return l===void 0||l<0?t.step[a]:l};return{...t,mode:o??t.mode,step:{translate:s("translate"),rotate:s("rotate")}}}exports.RobotControlPanel=Et;
|
|
@@ -17,7 +17,7 @@ import { J as at } from "./JoggingButtons-CXaozFVz.js";
|
|
|
17
17
|
import { styled as it } from "@mui/material/styles";
|
|
18
18
|
import K from "@mui/material/ToggleButton";
|
|
19
19
|
import ct from "@mui/material/ToggleButtonGroup";
|
|
20
|
-
import { P as X, I as st, u as ut,
|
|
20
|
+
import { P as X, I as st, u as ut, c as Q, a as pt, b as q } from "./useEveryFrame-B8t_yz-G.js";
|
|
21
21
|
import dt from "@mui/material/Slider";
|
|
22
22
|
import { J as ft } from "./JoggingJointSlider-CZ-k6XCa.js";
|
|
23
23
|
import { Undo as bt } from "@wandelbots/icons/Undo";
|
|
@@ -4,7 +4,7 @@ import s from "@mui/material/Stack";
|
|
|
4
4
|
import { useId as v, useState as A } from "react";
|
|
5
5
|
import { useTranslation as h } from "react-i18next";
|
|
6
6
|
import { e as B } from "./externalizeComponent-_w2d1_pz.js";
|
|
7
|
-
import { S as C } from "./SafetyBar-
|
|
7
|
+
import { S as C } from "./SafetyBar-eYzCHOFD.js";
|
|
8
8
|
import { S as k } from "./SmallSelect-BdD9uLKK.js";
|
|
9
9
|
import T from "@mui/material/CircularProgress";
|
|
10
10
|
import R from "@mui/material/Switch";
|
|
@@ -11,7 +11,7 @@ import O from "@mui/material/Popover";
|
|
|
11
11
|
import B from "@mui/material/SvgIcon";
|
|
12
12
|
import E from "@mui/material/Typography";
|
|
13
13
|
import { AxiosError as w } from "axios";
|
|
14
|
-
import {
|
|
14
|
+
import { a as F } from "./converters-D9KpJ2HD.js";
|
|
15
15
|
function Z(e, t) {
|
|
16
16
|
throw new Error(`${t} ${JSON.stringify(e)}`);
|
|
17
17
|
}
|