@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.
Files changed (56) hide show
  1. package/README.md +56 -5
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +1 -0
  4. package/dist/3d.js +16 -15
  5. package/dist/CurrentPoseBar/index.cjs +1 -1
  6. package/dist/CurrentPoseBar/index.js +1 -1
  7. package/dist/RobotControlPanel/index.cjs +1 -1
  8. package/dist/RobotControlPanel/index.js +1 -1
  9. package/dist/RobotHeader/index.js +1 -1
  10. package/dist/SafetyBar/index.js +1 -1
  11. package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-DENCilvf.js} +1 -1
  12. package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-DrXTcV-I.cjs} +1 -1
  13. package/dist/chunks/{RobotControlPanel-BXtBHEe9.cjs → RobotControlPanel-DTE8-v2j.cjs} +1 -1
  14. package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-E-hUzMIL.js} +1 -1
  15. package/dist/chunks/{RobotHeader-DDmDkUoV.js → RobotHeader-BvIzk8Fw.js} +1 -1
  16. package/dist/chunks/{SafetyBar-RkN0I1Cb.js → SafetyBar-eYzCHOFD.js} +1 -1
  17. package/dist/chunks/{converters-DAr6IQbG.js → converters-D9KpJ2HD.js} +2 -2
  18. package/dist/chunks/loadRobotSession-DlRzFjYE.cjs +3 -0
  19. package/dist/chunks/loadRobotSession-kKQ96rWu.js +4721 -0
  20. package/dist/chunks/robotModelSource-Bv1Z_miZ.cjs +1 -0
  21. package/dist/chunks/robotModelSource-CKuBOeQ-.js +1295 -0
  22. package/dist/chunks/useEveryFrame-B8t_yz-G.js +155 -0
  23. package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
  24. package/dist/components/robotControl/poseText.d.ts +21 -5
  25. package/dist/components/robots/LinearAxis.d.ts +12 -11
  26. package/dist/components/robots/Robot.d.ts +26 -9
  27. package/dist/components/robots/robotModelSource.d.ts +38 -0
  28. package/dist/core.cjs +1 -1
  29. package/dist/core.d.ts +10 -0
  30. package/dist/core.js +58 -39
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.js +86 -66
  33. package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
  34. package/dist/lib/controllerStateSource.d.ts +6 -4
  35. package/dist/lib/motionGroupModelResources.d.ts +1 -0
  36. package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
  37. package/dist/lib/robotSession/RobotActivation.d.ts +48 -0
  38. package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
  39. package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
  40. package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
  41. package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
  42. package/dist/lib/robotSession/RobotSession.d.ts +78 -0
  43. package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
  44. package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
  45. package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
  46. package/dist/lib/robotSession/robotPose.d.ts +28 -0
  47. package/dist/nats.cjs +1 -0
  48. package/dist/nats.d.ts +4 -0
  49. package/dist/nats.js +131 -0
  50. package/package.json +11 -1
  51. package/dist/chunks/Robot-B3vKEVXP.cjs +0 -1
  52. package/dist/chunks/Robot-DXhaz1tq.js +0 -1272
  53. package/dist/chunks/TrajectoryExecutionStore-CKfEoKo8.cjs +0 -3
  54. package/dist/chunks/TrajectoryExecutionStore-DYVukgCz.js +0 -3613
  55. package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
  56. package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +0 -1
package/dist/index.js CHANGED
@@ -1,72 +1,92 @@
1
- import { C as r, J as t, L as s, M as n, a as i, P as l, R as p, S as g, b as u, c as d, d as m, e as S, T as c, f as x } from "./chunks/Robot-DXhaz1tq.js";
2
- import { J } from "./chunks/JoggingGizmo-SuS9MmL7.js";
3
- import { J as R } from "./chunks/JoggingGizmoOrientation-x_crT_64.js";
4
- import { R as M } from "./chunks/RobotControlPanel-BiLexAWI.js";
5
- import { P as V, V as L, p as b, q as y, u as P, a as G } from "./chunks/Pose3-pocKPrHN.js";
1
+ import { C as t, J as s, L as r, M as n, a as i, P as p, R as l, S as d, b as g, c as S, d as u, e as R, T as m, f as x, r as c } from "./chunks/robotModelSource-CKuBOeQ-.js";
2
+ import { J as f } from "./chunks/JoggingGizmo-SuS9MmL7.js";
3
+ import { J } from "./chunks/JoggingGizmoOrientation-x_crT_64.js";
4
+ import { R as C } from "./chunks/RobotControlPanel-E-hUzMIL.js";
5
+ import { P as M, V as P, p as y, q as V, u as O, a as A } from "./chunks/Pose3-pocKPrHN.js";
6
6
  import "@wandelbots/mui";
7
- import { A, C as j, a as z, J as O, b as v, c as H, d as I, e as h, L as B, f as N, M as k, g as D, N as W, T as _, V as w, h as K, i as Q, j as U, k as Z, l as F, p as X, m as Y, r as $, n as oo, o as ao, t as eo, q as ro, u as to } from "./chunks/TrajectoryExecutionStore-DYVukgCz.js";
8
- import { C as no } from "./chunks/CurrentPoseBar-zTZi68tY.js";
9
- import { J as lo } from "./chunks/JoggingButtons-CXaozFVz.js";
10
- import { J as go } from "./chunks/JoggingJointSlider-CZ-k6XCa.js";
11
- import { R as mo } from "./chunks/RobotHeader-DDmDkUoV.js";
12
- import { i as co } from "./chunks/externalizeComponent-_w2d1_pz.js";
13
- import { S as fo } from "./chunks/SafetyBar-RkN0I1Cb.js";
7
+ import { A as j, C as q, a as v, J as z, b as D, c as I, d as B, e as H, L as _, f as h, M as N, g as k, N as w, R as W, h as F, i as K, j as Q, k as U, l as Z, m as X, n as Y, o as $, p as oo, q as ao, T as eo, V as to, r as so, s as ro, t as no, u as io, v as po, w as lo, x as go, y as So, z as uo, B as Ro, D as mo, E as xo, F as co, G as bo, H as fo, I as To } from "./chunks/loadRobotSession-kKQ96rWu.js";
8
+ import { C as Eo } from "./chunks/CurrentPoseBar-DENCilvf.js";
9
+ import { J as Lo } from "./chunks/JoggingButtons-CXaozFVz.js";
10
+ import { J as Po } from "./chunks/JoggingJointSlider-CZ-k6XCa.js";
11
+ import { R as Vo } from "./chunks/RobotHeader-BvIzk8Fw.js";
12
+ import { i as Ao } from "./chunks/externalizeComponent-_w2d1_pz.js";
13
+ import { j as jo, p as qo, a as vo, b as zo } from "./chunks/useEveryFrame-B8t_yz-G.js";
14
+ import { S as Io } from "./chunks/SafetyBar-eYzCHOFD.js";
14
15
  export {
15
- A as AppHeader,
16
- r as CollisionSceneRenderer,
17
- j as ConnectedMotionGroup,
18
- z as ControllerStateStream,
19
- no as CurrentPoseBar,
20
- O as JoggerConnection,
21
- lo as JoggingButtons,
22
- v as JoggingCartesianAxisControl,
23
- J as JoggingGizmo,
24
- R as JoggingGizmoOrientation,
25
- go as JoggingJointSlider,
26
- H as JoggingJointValueControl,
27
- I as JoggingPanel,
28
- h as JoggingStore,
29
- t as JointLimitGizmo,
30
- s as LinearAxis,
31
- B as LoadingCover,
32
- N as LoadingErrorMessage,
33
- k as MOTION_DELTA_THRESHOLD,
16
+ j as AppHeader,
17
+ t as CollisionSceneRenderer,
18
+ q as ConnectedMotionGroup,
19
+ v as ControllerStateStream,
20
+ Eo as CurrentPoseBar,
21
+ z as JoggerConnection,
22
+ Lo as JoggingButtons,
23
+ D as JoggingCartesianAxisControl,
24
+ f as JoggingGizmo,
25
+ J as JoggingGizmoOrientation,
26
+ Po as JoggingJointSlider,
27
+ I as JoggingJointValueControl,
28
+ B as JoggingPanel,
29
+ H as JoggingStore,
30
+ s as JointLimitGizmo,
31
+ r as LinearAxis,
32
+ _ as LoadingCover,
33
+ h as LoadingErrorMessage,
34
+ N as MOTION_DELTA_THRESHOLD,
34
35
  n as MotionGroupVisualizer,
35
36
  i as MotionGroupVisualizerExact,
36
- D as MotionStreamConnection,
37
- W as NoMotionGroupModal,
38
- V as Pose3,
39
- l as PresetEnvironment,
40
- p as Robot,
41
- M as RobotControlPanel,
42
- mo as RobotHeader,
43
- fo as SafetyBar,
44
- g as SafetyZonesRenderer,
45
- u as SupportedLinearAxis,
46
- d as SupportedLinearAxisExact,
47
- m as SupportedRobot,
48
- S as SupportedRobotExact,
49
- _ as TrajectoryExecutionStore,
50
- c as TrajectoryRenderer,
51
- L as ValueInterpolator,
52
- w as VelocitySlider,
53
- K as VelocitySliderLabel,
54
- Q as controllerStateWebsocket,
37
+ k as MotionStreamConnection,
38
+ w as NoMotionGroupModal,
39
+ M as Pose3,
40
+ p as PresetEnvironment,
41
+ W as ROBOT_LOAD_STEP_IDS,
42
+ l as Robot,
43
+ F as RobotActivation,
44
+ C as RobotControlPanel,
45
+ K as RobotDescription,
46
+ Vo as RobotHeader,
47
+ Q as RobotLiveState,
48
+ U as RobotLoadProgress,
49
+ Z as RobotLoadStepError,
50
+ X as RobotModeChangeError,
51
+ Y as RobotSafety,
52
+ $ as RobotSession,
53
+ oo as RobotSessionLoad,
54
+ ao as RobotTargetPose,
55
+ Io as SafetyBar,
56
+ d as SafetyZonesRenderer,
57
+ g as SupportedLinearAxis,
58
+ S as SupportedLinearAxisExact,
59
+ u as SupportedRobot,
60
+ R as SupportedRobotExact,
61
+ eo as TrajectoryExecutionStore,
62
+ m as TrajectoryRenderer,
63
+ P as ValueInterpolator,
64
+ to as VelocitySlider,
65
+ so as VelocitySliderLabel,
66
+ ro as controllerStateWebsocket,
55
67
  x as defaultGetModel,
56
- U as deriveSelectedTcpPose,
57
- co as i18n,
58
- Z as jointValuesEqual,
59
- F as jointValuesUnchanged,
60
- b as parseRotationToQuaternion,
61
- X as planErrorTranslationKey,
62
- Y as poseEqual,
63
- y as quaternionToRotationVector,
64
- $ as readoutOf,
65
- oo as readoutsEqual,
66
- ao as resolveCoordinateSystemInWorld,
67
- eo as tcpMotionEqual,
68
- ro as transformPoseToCoordinateSystem,
69
- to as unwrapRotationVector,
70
- P as useInterpolation,
71
- G as useSmoothedMotionState
68
+ no as deriveSelectedTcpPose,
69
+ Ao as i18n,
70
+ io as isRobotLoadStepError,
71
+ po as jointValuesEqual,
72
+ lo as jointValuesUnchanged,
73
+ jo as jointsToText,
74
+ go as loadRobotSession,
75
+ qo as parseJointsText,
76
+ vo as parsePoseText,
77
+ y as parseRotationToQuaternion,
78
+ So as planErrorTranslationKey,
79
+ uo as poseEqual,
80
+ zo as poseToText,
81
+ V as quaternionToRotationVector,
82
+ Ro as readoutOf,
83
+ mo as readoutsEqual,
84
+ xo as resolveCoordinateSystemInWorld,
85
+ c as robotModelOf,
86
+ co as tcpMotionEqual,
87
+ bo as trajectoryTargetOf,
88
+ fo as transformPoseToCoordinateSystem,
89
+ To as unwrapRotationVector,
90
+ O as useInterpolation,
91
+ A as useSmoothedMotionState
72
92
  };
@@ -18,7 +18,11 @@ export type ConnectedMotionGroupOptions = {
18
18
  };
19
19
  /**
20
20
  * Store representing the current state of a connected motion group.
21
- * API v2 version, not used yet in the components.
21
+ *
22
+ * @deprecated Use `loadRobotSession`: its `RobotSession` has the same robot
23
+ * with its jogging and Move to. `Robot` and `LinearAxis` take
24
+ * `robotModelOf(session)`. The README's "From ConnectedMotionGroup to
25
+ * RobotSession" maps each member.
22
26
  */
23
27
  export declare class ConnectedMotionGroup {
24
28
  readonly controller: RobotControllerState;
@@ -2,10 +2,10 @@ import type { RobotControllerState } from "@wandelbots/nova-js/v2";
2
2
  import { type NovaConnection } from "./novaConnection";
3
3
  /**
4
4
  * Where a robot's live controller state comes from: NOVA's websocket
5
- * ({@link controllerStateWebsocket}), NATS (the `/nats` entry point), or a
6
- * source of the app's own. It works like a WebSocket that reconnects itself:
7
- * a {@link ControllerStateStream} listens to its messages and asks it to
8
- * reconnect when they stop coming.
5
+ * (`controllerStateWebsocket` of `/core`), NATS (`natsControllerStateSource`
6
+ * of `/nats`), or a source of the app's own. It works like a WebSocket that
7
+ * reconnects itself: a `ControllerStateStream` listens to its messages and
8
+ * asks it to reconnect when they stop coming.
9
9
  */
10
10
  export type ControllerStateSource = {
11
11
  /** Where it connects, for error reports */
@@ -14,6 +14,8 @@ export type ControllerStateSource = {
14
14
  readonly readyState: number;
15
15
  addEventListener(type: "message", listener: (event: MessageEvent) => void): void;
16
16
  removeEventListener(type: "message", listener: (event: MessageEvent) => void): void;
17
+ /** Resolves with the first message, also when it came already */
18
+ firstMessage(): Promise<MessageEvent>;
17
19
  /** Resolves with the next message */
18
20
  nextMessage(): Promise<MessageEvent>;
19
21
  reconnect(): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { ConnectionLogger } from "../connectionLogger";
2
+ import type { ControllerStateSource } from "../controllerStateSource";
3
+ import type { NovaConnection } from "../novaConnection";
4
+ /** What {@link natsControllerStateSource} connects to */
5
+ export type NatsControllerStateSourceOptions = {
6
+ /** The websocket URL of the NATS server, e.g. from {@link natsUrlOf} */
7
+ url: string;
8
+ /** The NOVA cell; defaults to "cell" */
9
+ cellId?: string;
10
+ controllerId: string;
11
+ /** Where the connection logs. Defaults to the console. */
12
+ logger?: ConnectionLogger;
13
+ };
14
+ /**
15
+ * The live state of a controller from NOVA's NATS server, on the subject
16
+ * `nova.v2.cells.{cell}.controllers.{controller}.state`. NATS sends the state
17
+ * as it changes, without the response rate of the websocket.
18
+ *
19
+ * Needs the optional peer dependency `nats.ws`.
20
+ */
21
+ export declare function natsControllerStateSource(options: NatsControllerStateSourceOptions): ControllerStateSource;
22
+ /**
23
+ * The websocket URL of a NOVA instance's NATS server: `/api/nats` on its
24
+ * host, over wss for https and ws for http. A relative instance URL is read
25
+ * against the page's origin.
26
+ */
27
+ export declare function natsUrlOf(connection: NovaConnection): string;
@@ -0,0 +1,48 @@
1
+ import type { Nova } from "@wandelbots/nova-js/v2";
2
+ import type { ConnectionLogger } from "../connectionLogger";
3
+ import type { RobotLiveState } from "./RobotLiveState";
4
+ import type { RobotSafety } from "./RobotSafety";
5
+ /**
6
+ * Whether the robot is activated, i.e. its controller is in control mode
7
+ * (MODE_CONTROL) rather than monitor mode
8
+ */
9
+ export type RobotActivationState = "inactive" | "activating" | "deactivating" | "active";
10
+ /** A mode change that NOVA refused or that failed; `url` is the request's */
11
+ export declare class RobotModeChangeError extends Error {
12
+ readonly url: string;
13
+ readonly cause: unknown;
14
+ }
15
+ /**
16
+ * The robot's activation: it follows the mode that the controller reports,
17
+ * and switches the mode on request
18
+ */
19
+ export declare class RobotActivation {
20
+ private readonly nova;
21
+ private readonly ids;
22
+ private readonly live;
23
+ private readonly safety;
24
+ private readonly logger;
25
+ /** What the controller reports, or the mode change in progress */
26
+ state: RobotActivationState;
27
+ private readonly disposers;
28
+ constructor(nova: Nova, ids: {
29
+ cellId: string;
30
+ controllerId: string;
31
+ }, live: RobotLiveState, safety: () => RobotSafety, logger: ConnectionLogger);
32
+ /**
33
+ * Switches the controller to control mode. Does nothing while a mode change
34
+ * is in progress, or when the safety state or operation mode would make
35
+ * NOVA refuse it (see {@link RobotSafety.activationBlockedReason}). Rejects
36
+ * with a {@link RobotModeChangeError} when NOVA refuses it.
37
+ */
38
+ activate(): Promise<void>;
39
+ /**
40
+ * Switches the controller to monitor mode. Rejects with a
41
+ * {@link RobotModeChangeError} when NOVA refuses it.
42
+ */
43
+ deactivate(): Promise<void>;
44
+ /** Activates an inactive robot, deactivates an active one */
45
+ toggle(): Promise<void>;
46
+ dispose(): void;
47
+ private setMode;
48
+ }
@@ -0,0 +1,84 @@
1
+ import { type CoordinateSystem, type DHParameter, JointTypeEnum, type KinematicModel, type MotionGroupDescription, type RobotControllerConfiguration } from "@wandelbots/nova-js/v2";
2
+ /**
3
+ * What NOVA describes about a robot: its model, kinematics, limits, safety
4
+ * zones, TCPs and the coordinate systems of its controller
5
+ */
6
+ export declare class RobotDescription {
7
+ /** The motion group's description as NOVA gives it */
8
+ readonly motionGroupDescription: MotionGroupDescription;
9
+ readonly controllerConfiguration: RobotControllerConfiguration;
10
+ /** The model's kinematics: its inverse solver, chain and flange offsets */
11
+ readonly kinematicModel: KinematicModel;
12
+ /**
13
+ * The model that holds this robot's data: the custom copy registered for
14
+ * its serial number, or {@link RobotDescription.motionGroupModel} otherwise. Planner
15
+ * requests carry only a model name, so they must send this one.
16
+ */
17
+ readonly resolvedMotionGroupModel: string;
18
+ /**
19
+ * The coordinate systems of the robot's controller. Not a cell-wide list:
20
+ * an id that exists on several controllers would resolve to another
21
+ * robot's frame.
22
+ */
23
+ readonly coordinateSystems: CoordinateSystem[];
24
+ /**
25
+ * The DH parameters of the joints, with the values that NOVA leaves out
26
+ * because they are 0 filled in; empty for a motion group without them
27
+ */
28
+ readonly dhParameters: DHParameter[];
29
+ /** A virtual robot of NOVA's simulation, not a physical one */
30
+ get isVirtual(): boolean;
31
+ /** The model the controller reports */
32
+ get motionGroupModel(): string;
33
+ get serialNumber(): string | undefined;
34
+ /**
35
+ * The inverse solver of the model; null for a model without one, such as a
36
+ * linear axis or a turntable, which jogs its joints only
37
+ */
38
+ get inverseSolver(): string | undefined;
39
+ /** Revolute, or prismatic for a linear axis */
40
+ get jointType(): JointTypeEnum;
41
+ /** The joints' limits in automatic mode, one per joint */
42
+ get jointLimits(): import("@wandelbots/nova-js/v2").JointLimits[];
43
+ get safetyZones(): {
44
+ [key: string]: import("@wandelbots/nova-js/v2").Collider;
45
+ } | undefined;
46
+ /**
47
+ * Per-link safety colliders (`safety_link_colliders`): entry k is in the
48
+ * frame after k DH transforms (entry 0 = the static base). Not every
49
+ * controller gives them.
50
+ */
51
+ get safetyLinkColliders(): {
52
+ [key: string]: import("@wandelbots/nova-js/v2").Collider;
53
+ }[] | undefined;
54
+ /** The collision shapes of each tool (TCP), at the flange */
55
+ get safetyToolColliders(): {
56
+ [key: string]: {
57
+ [key: string]: import("@wandelbots/nova-js/v2").Collider;
58
+ };
59
+ } | undefined;
60
+ /**
61
+ * Constant transformation between the motion group base frame and the start
62
+ * of the DH chain. From the kinematic model, which always reflects the
63
+ * current robot data; the motion group description is only the fallback, as
64
+ * controllers snapshot the offset when they are created. Null means
65
+ * identity.
66
+ */
67
+ get kinematicChainOffset(): import("@wandelbots/nova-js/v2").Pose | null;
68
+ /**
69
+ * Constant transformation between the end of the DH chain and the flange
70
+ * frame, sourced as {@link RobotDescription.kinematicChainOffset}
71
+ */
72
+ get flangeOffset(): import("@wandelbots/nova-js/v2").Pose | null;
73
+ /** Where the robot is mounted in the cell (mm, rotation vector), if set */
74
+ get mounting(): import("@wandelbots/nova-js/v2").Pose | null;
75
+ /** The robot's TCPs, by id and name */
76
+ get tcps(): {
77
+ id: string;
78
+ name: string;
79
+ }[];
80
+ /** The TCPs' offsets from the flange, by TCP id */
81
+ get tcpOffsetsById(): {
82
+ [key: string]: import("@wandelbots/nova-js/v2").TcpOffset;
83
+ };
84
+ }
@@ -0,0 +1,56 @@
1
+ import { type ControllerStateStream } from "../ControllerStateStream";
2
+ import { type MotionStateReadout } from "../motionStateUpdate";
3
+ import { type TcpReferencedPose } from "../PoseTransformer";
4
+ import type { RobotPose } from "./robotPose";
5
+ /**
6
+ * A robot's live state: its controller's state and its motion state as they
7
+ * come, and its TCP pose in the TCP and coordinate system that the jogging
8
+ * store has selected
9
+ */
10
+ export declare class RobotLiveState {
11
+ /** The stream the state comes from */
12
+ readonly stream: ControllerStateStream;
13
+ private readonly description;
14
+ private readonly jogging;
15
+ /** Safety state, operation mode and mode of the controller */
16
+ get controllerState(): import("@wandelbots/nova-js/v2").RobotControllerState;
17
+ /**
18
+ * The motion state as the last message had it: one object for the whole
19
+ * session, updated in place (see {@link ControllerStateStream})
20
+ */
21
+ get rapidlyChangingMotionState(): import("@wandelbots/nova-js/v2").MotionGroupState;
22
+ /** What readouts show: it holds while the joints only jitter */
23
+ get readoutState(): MotionStateReadout;
24
+ /** The joints readouts show, from {@link RobotLiveState.readoutState} */
25
+ get jointPose(): number[];
26
+ get connectionQuality(): "good" | "struggling" | "critical";
27
+ get lastValidStateMessage(): {
28
+ receivedAt: number;
29
+ data: import("@wandelbots/nova-js/v2").RobotControllerState;
30
+ };
31
+ get lastInvalidStateMessage(): {
32
+ receivedAt: number;
33
+ data: unknown;
34
+ } | null;
35
+ /** The TCP pose as NOVA reports it, in its own TCP and coordinate system */
36
+ get measuredTcpPoseReference(): TcpReferencedPose;
37
+ /**
38
+ * The measured TCP pose in the TCP and coordinate system that the jogging
39
+ * store has selected: what a stored or typed pose uses
40
+ */
41
+ get displayedTcpPoseReference(): TcpReferencedPose;
42
+ /** The pose readouts show, from {@link RobotLiveState.readoutState}, in the selected frame */
43
+ get displayedTcpPose(): Required<import("@wandelbots/nova-js/v2").Pose>;
44
+ /**
45
+ * Whether the robot stands at a pose: its joints within 0.001, or its TCP
46
+ * within 0.5 mm and 0.01 rad of the pose in the pose's TCP and coordinate
47
+ * system. Not at a pose of a TCP or coordinate system it does not know.
48
+ */
49
+ isAt(pose: RobotPose): boolean;
50
+ /** The motion state in the stream's next message */
51
+ nextMotionState(): Promise<import("@wandelbots/nova-js/v2").MotionGroupState>;
52
+ /** Resolves once two messages in a row show the joints standing still */
53
+ waitUntilStopped(): Promise<void>;
54
+ private tcpPoseReferenceOf;
55
+ private inSelectedFrame;
56
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Delays before each automatic retry of a failed robot load. A robot that was
3
+ * just powered up or a controller that is still initializing usually recovers
4
+ * within a few seconds, so we retry quietly before bothering the user.
5
+ */
6
+ export declare const AUTO_RETRY_DELAYS_MS: number[];
7
+ /**
8
+ * The distinct pieces of data an app needs before it can show and control a
9
+ * robot, in the order they are loaded. Kept explicit (rather than implicit in
10
+ * the await chain of the load) so the UI can tell the user
11
+ * how far the load got and which piece failed.
12
+ */
13
+ export declare const ROBOT_LOAD_STEP_IDS: readonly ["motionGroupDescription", "controllerConfiguration", "kinematicModel", "motionGroupModel", "coordinateSystems", "controllerState", "motionStateStream", "controllerStateStream"];
14
+ export type RobotLoadStepId = (typeof ROBOT_LOAD_STEP_IDS)[number];
15
+ export type RobotLoadStepStatus = "pending" | "running" | "succeeded" | "failed";
16
+ export type RobotLoadStep = {
17
+ id: RobotLoadStepId;
18
+ status: RobotLoadStepStatus;
19
+ /** Endpoint the step talks to; shown to the user and included in support details */
20
+ url: string | null;
21
+ error: unknown;
22
+ };
23
+ /**
24
+ * Error thrown by a load step, carrying the step it belongs to so the caller
25
+ * can tell a transient connection problem (worth retrying) apart from a
26
+ * programming error.
27
+ */
28
+ export declare class RobotLoadStepError extends Error {
29
+ readonly stepId: RobotLoadStepId;
30
+ readonly cause: unknown;
31
+ constructor(stepId: RobotLoadStepId, cause: unknown, message: string);
32
+ }
33
+ export declare function isRobotLoadStepError(err: unknown): err is RobotLoadStepError;
34
+ /**
35
+ * Observable progress of loading a single robot: which steps have completed,
36
+ * which one is currently running, and which one failed. Drives both the
37
+ * loading screen and the failure screen.
38
+ */
39
+ export declare class RobotLoadProgress {
40
+ /** The robot this progress refers to; null before any load has started */
41
+ motionGroupId: string | null;
42
+ controllerId: string | null;
43
+ steps: RobotLoadStep[];
44
+ /** 0 while on the first try, 1.. while auto-retrying */
45
+ retryAttempt: number;
46
+ /** Set when the load gave up; failure is also implied by a failed step */
47
+ fatalError: unknown;
48
+ /** When the currently running step started, for the "still waiting" hint */
49
+ currentStepStartedAt: number | null;
50
+ /**
51
+ * One instance tracks one load. Concurrent loads must not share one — a load
52
+ * that has been superseded keeps reporting for a step or two before it
53
+ * notices, and those reports would otherwise overwrite the state of the load
54
+ * that replaced it (clearing a recorded failure, for instance).
55
+ */
56
+ constructor(motionGroupId?: string | null, controllerId?: string | null);
57
+ /** Reset the step states for another attempt at the same robot */
58
+ beginRetry(attempt: number): void;
59
+ private stepById;
60
+ startStep(id: RobotLoadStepId, url: string | null): void;
61
+ updateStepUrl(id: RobotLoadStepId, url: string): void;
62
+ succeedStep(id: RobotLoadStepId): void;
63
+ failStep(id: RobotLoadStepId, error: unknown): void;
64
+ /** A failure that is not tied to a specific step (e.g. an invalid selection) */
65
+ failWith(error: unknown): void;
66
+ get totalCount(): number;
67
+ get succeededCount(): number;
68
+ get runningStep(): RobotLoadStep | undefined;
69
+ get failedStep(): RobotLoadStep | undefined;
70
+ get isFailed(): boolean;
71
+ get isComplete(): boolean;
72
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Why a robot cannot move now, as a code an app can translate. `value` is the
3
+ * controller's state behind it.
4
+ */
5
+ export type RobotNotMoveableReason =
6
+ /** The live state stopped coming */
7
+ {
8
+ code: "disconnected";
9
+ }
10
+ /** The safety state does not allow movement, e.g. an emergency stop */
11
+ | {
12
+ code: "safety_state";
13
+ value: string;
14
+ }
15
+ /** The operation mode does not allow movement */
16
+ | {
17
+ code: "operation_mode";
18
+ value: string;
19
+ }
20
+ /** The robot is not activated (the controller is not in control mode) */
21
+ | {
22
+ code: "deactivated";
23
+ };
24
+ /**
25
+ * Whether a robot may be activated and moved, from its controller's safety
26
+ * state and operation mode, its activation and its connection
27
+ */
28
+ export declare class RobotSafety {
29
+ private readonly state;
30
+ private readonly activationState;
31
+ private get safetyState();
32
+ private get operationMode();
33
+ /** Whether an emergency stop is active */
34
+ get isEstopActive(): boolean;
35
+ /** Whether the safety state allows movement */
36
+ get isMoveableSafetyState(): boolean;
37
+ /** Whether the operation mode allows movement */
38
+ get isMoveableOperationMode(): boolean;
39
+ /**
40
+ * Whether the safety state allows switching to control mode: the moveable
41
+ * ones and the stop states (RPS-1296)
42
+ */
43
+ get isActivatableSafetyState(): boolean;
44
+ /**
45
+ * Why the controller cannot be switched to control mode now, or null. NOVA
46
+ * refuses the mode change then (an emergency stop needs a hand on the
47
+ * physical controller), so it is not even requested.
48
+ */
49
+ get activationBlockedReason(): string | null;
50
+ /** Whether the robot may be activated now */
51
+ get canBeActive(): boolean;
52
+ /** Why the robot cannot move now, or null when it can */
53
+ get notMoveableReason(): RobotNotMoveableReason | null;
54
+ /**
55
+ * Whether the robot can move now: a moveable safety state and operation
56
+ * mode, activated, and its live state coming
57
+ */
58
+ get canBeMoved(): boolean;
59
+ }
@@ -0,0 +1,78 @@
1
+ import { JoggingStore, type JoggingStoreStorage } from "../../components/jogging/JoggingStore";
2
+ import type { ConnectionLogger } from "../connectionLogger";
3
+ import { type JoggerMode } from "../JoggerConnection";
4
+ import { TrajectoryExecutionStore } from "../TrajectoryExecutionStore";
5
+ import { RobotActivation } from "./RobotActivation";
6
+ import { RobotDescription } from "./RobotDescription";
7
+ import { RobotLiveState } from "./RobotLiveState";
8
+ import { RobotSafety } from "./RobotSafety";
9
+ import { RobotTargetPose } from "./RobotTargetPose";
10
+ /** Something that went wrong in a robot session, for the app to show */
11
+ export type RobotSessionError = {
12
+ /**
13
+ * What failed: a mode change, a jog, a message of the live state, or an
14
+ * automatic activation
15
+ */
16
+ kind: "mode" | "jog" | "stream";
17
+ message: string;
18
+ /** The request or stream it came from */
19
+ url?: string;
20
+ cause?: unknown;
21
+ };
22
+ /** What an app can give a robot session */
23
+ export type RobotSessionOptions = {
24
+ /** The app's lock: a locked app plans and starts no trajectory */
25
+ isLocked?: () => boolean;
26
+ /**
27
+ * Gets what goes wrong in the background: a jog error, a message of the
28
+ * live state the session could not use, a failed automatic activation.
29
+ * What an app calls itself (e.g. `activation.activate()`) rejects instead.
30
+ */
31
+ onError?: (error: RobotSessionError) => void;
32
+ /**
33
+ * Where to keep the user's jogging settings, e.g. `localStorage`. Without
34
+ * it nothing is kept.
35
+ */
36
+ storage?: JoggingStoreStorage;
37
+ /** Where the session's connections log. Defaults to the console. */
38
+ logger?: ConnectionLogger;
39
+ /** Activate a virtual robot once it is loaded. Defaults to false. */
40
+ autoActivateVirtual?: boolean;
41
+ };
42
+ /**
43
+ * One robot of a NOVA cell, loaded and connected: what NOVA describes about
44
+ * it, its live state, its safety and activation, its jogging and its moves to
45
+ * a pose. Made by {@link loadRobotSession}; {@link RobotSession.dispose}
46
+ * closes its connections.
47
+ */
48
+ export declare class RobotSession {
49
+ readonly motionGroupId: string;
50
+ readonly controllerId: string;
51
+ readonly cellId: string;
52
+ /** What NOVA describes about the robot; does not change */
53
+ readonly description: RobotDescription;
54
+ /** The live state of the robot and its controller, and its TCP pose */
55
+ readonly state: RobotLiveState;
56
+ /** Whether the robot may be activated and moved, and why not */
57
+ readonly safety: RobotSafety;
58
+ /** The robot's activation (control mode) */
59
+ readonly activation: RobotActivation;
60
+ /** Jogging the robot, with the user's jogging settings */
61
+ readonly jogging: JoggingStore;
62
+ /** Moving the robot to a pose along a planned trajectory (Move to) */
63
+ readonly trajectory: TrajectoryExecutionStore;
64
+ /** A pose the user types in, planned so Move to can drive there */
65
+ readonly targetPose: RobotTargetPose;
66
+ private readonly stateSource;
67
+ private readonly motionStateSocket;
68
+ private readonly onError;
69
+ /** Which motion owns the robot: jogging, a trajectory, or none ("off") */
70
+ get movementOwner(): JoggerMode;
71
+ /**
72
+ * Hands the robot to jogging or to a trajectory: the controller runs only
73
+ * one of them at a time
74
+ */
75
+ ensureMovementOwnership(target: Exclude<JoggerMode, "off">): Promise<void>;
76
+ /** Closes the session's connections and stops following the robot */
77
+ dispose(): void;
78
+ }