@wandelbots/wandelbots-js-react-components 5.1.1 → 5.2.0-pr.fix-RB-3135-dhparam-type-check.571.ea4bdbb

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 (33) hide show
  1. package/dist/MotionGroupVisualizer-C6MgXjCN.cjs.map +1 -1
  2. package/dist/MotionGroupVisualizer-Cm-XYEZe.js.map +1 -1
  3. package/dist/components/VelocitySlider.d.ts.map +1 -1
  4. package/dist/components/jogging/JoggingBlocked.d.ts.map +1 -1
  5. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts.map +1 -1
  6. package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
  7. package/dist/components/jogging/JoggingJointLimitDetector.d.ts +4 -2
  8. package/dist/components/jogging/JoggingJointLimitDetector.d.ts.map +1 -1
  9. package/dist/components/jogging/JoggingJointTab.d.ts.map +1 -1
  10. package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
  11. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  12. package/dist/components/jogging/JoggingStore.d.ts +12 -19
  13. package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
  14. package/dist/components/robots/MotionGroupVisualizer.d.ts.map +1 -1
  15. package/dist/core.cjs.js +1 -1
  16. package/dist/core.es.js +1 -1
  17. package/dist/index.cjs.js +1 -1
  18. package/dist/index.es.js +1 -1
  19. package/dist/{theming-BgAu1ds7.cjs → theming-DkMwng7o.cjs} +36 -36
  20. package/dist/{theming-BgAu1ds7.cjs.map → theming-DkMwng7o.cjs.map} +1 -1
  21. package/dist/{theming-DouElHKD.js → theming-HOZn0p_s.js} +1123 -1067
  22. package/dist/{theming-DouElHKD.js.map → theming-HOZn0p_s.js.map} +1 -1
  23. package/package.json +1 -1
  24. package/src/components/VelocitySlider.tsx +7 -1
  25. package/src/components/jogging/JoggingBlocked.tsx +2 -0
  26. package/src/components/jogging/JoggingCartesianAxisControl.tsx +6 -1
  27. package/src/components/jogging/JoggingCartesianTab.tsx +11 -1
  28. package/src/components/jogging/JoggingJointLimitDetector.tsx +5 -2
  29. package/src/components/jogging/JoggingJointTab.tsx +21 -7
  30. package/src/components/jogging/JoggingOptions.tsx +2 -0
  31. package/src/components/jogging/JoggingPanel.tsx +6 -0
  32. package/src/components/jogging/JoggingStore.ts +41 -53
  33. package/src/components/robots/MotionGroupVisualizer.tsx +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "5.1.1",
3
+ "version": "5.2.0-pr.fix-RB-3135-dhparam-type-check.571.ea4bdbb",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -30,7 +30,13 @@ export const VelocitySlider = observer((props: VelocitySliderProps) => {
30
30
  }
31
31
 
32
32
  return (
33
- <Stack direction="row" gap={2} alignItems="center">
33
+ <Stack
34
+ direction="row"
35
+ gap={2}
36
+ alignItems="center"
37
+ data-testid="velocity-slider"
38
+ aria-label="velocity-slider"
39
+ >
34
40
  {store.showVelocityLegend && (
35
41
  <Typography
36
42
  sx={{
@@ -8,6 +8,8 @@ export const JoggingBlocked = observer(({ store }: { store: JoggingStore }) => {
8
8
 
9
9
  return (
10
10
  <Backdrop
11
+ data-testid="jogging-blocked"
12
+ aria-label="jogging-blocked"
11
13
  open={true}
12
14
  sx={{
13
15
  position: "absolute",
@@ -137,7 +137,12 @@ export const JoggingCartesianAxisControl = externalizeComponent(
137
137
  }
138
138
 
139
139
  return (
140
- <Stack height="64px" direction="row" justifyContent="center" {...rest}>
140
+ <Stack
141
+ height="64px"
142
+ direction="row"
143
+ justifyContent="center"
144
+ {...rest}
145
+ >
141
146
  <IconButton
142
147
  disabled={disabled}
143
148
  disableRipple
@@ -192,7 +192,13 @@ export const JoggingCartesianTab = observer(
192
192
  }
193
193
 
194
194
  return (
195
- <Stack flexGrow={1} gap={2} sx={{ padding: "18px 24px" }}>
195
+ <Stack
196
+ data-testid="jogging-cartesian-tab"
197
+ aria-label="jogging-cartesian-tab"
198
+ flexGrow={1}
199
+ gap={2}
200
+ sx={{ padding: "18px 24px" }}
201
+ >
196
202
  <Stack gap={2}>
197
203
  <JoggingOptions
198
204
  store={store}
@@ -242,6 +248,8 @@ export const JoggingCartesianTab = observer(
242
248
  axisList.map((axis) => (
243
249
  <JoggingCartesianAxisControl
244
250
  key={axis.id}
251
+ data-testid={`jogging-cartesian-axis-control-${axis.id}`}
252
+ aria-label={`jogging-cartesian-axis-control-${axis.id}`}
245
253
  colors={axis.colors}
246
254
  disabled={store.isLocked}
247
255
  activeJoggingDirection={
@@ -286,6 +294,8 @@ export const JoggingCartesianTab = observer(
286
294
  axisList.map((axis) => (
287
295
  <JoggingCartesianAxisControl
288
296
  key={axis.id}
297
+ data-testid={`jogging-cartesian-axis-control-${axis.id}`}
298
+ aria-label={`jogging-cartesian-axis-control-${axis.id}`}
289
299
  colors={axis.colors}
290
300
  disabled={store.isLocked}
291
301
  activeJoggingDirection={
@@ -1,4 +1,5 @@
1
1
  import { Typography } from "@mui/material"
2
+ import { observer } from "mobx-react-lite"
2
3
  import isEqual from "lodash-es/isEqual"
3
4
  import { useRef, useState } from "react"
4
5
  import { useTranslation } from "react-i18next"
@@ -9,7 +10,7 @@ import type { JoggingStore } from "./JoggingStore"
9
10
  * Monitors the active robot motion state and displays a message if
10
11
  * any joint limits are reached.
11
12
  */
12
- export const JoggingJointLimitDetector = ({
13
+ export const JoggingJointLimitDetector = observer(({
13
14
  store,
14
15
  }: {
15
16
  store: JoggingStore
@@ -40,6 +41,8 @@ export const JoggingJointLimitDetector = ({
40
41
 
41
42
  return (
42
43
  <Typography
44
+ data-testid="jogging-joint-limit-detector"
45
+ aria-label="jogging-joint-limit-detector"
43
46
  color="error"
44
47
  sx={{
45
48
  margin: "0.5rem 1rem",
@@ -53,4 +56,4 @@ export const JoggingJointLimitDetector = ({
53
56
  })}
54
57
  </Typography>
55
58
  )
56
- }
59
+ })
@@ -3,8 +3,9 @@ import { observer } from "mobx-react-lite"
3
3
  import type { ReactNode } from "react"
4
4
  import { JoggingJointLimitDetector } from "./JoggingJointLimitDetector"
5
5
  import { JoggingJointValueControl } from "./JoggingJointValueControl"
6
- import { type JoggingStore, JointCategory } from "./JoggingStore"
6
+ import { type JoggingStore } from "./JoggingStore"
7
7
  import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
8
+ import { JointTypeEnum } from "@wandelbots/nova-js/v2"
8
9
 
9
10
  export const JoggingJointTab = observer(
10
11
  ({ store, children }: { store: JoggingStore; children: ReactNode }) => {
@@ -19,11 +20,11 @@ export const JoggingJointTab = observer(
19
20
  joint: opts.joint,
20
21
  direction: opts.direction,
21
22
  velocityUnit:
22
- store.jointCategory === JointCategory.PRISMATIC
23
+ store.jointType === JointTypeEnum.PrismaticJoint
23
24
  ? "mm/s"
24
25
  : "rad/s",
25
26
  velocityValue:
26
- store.jointCategory === JointCategory.PRISMATIC
27
+ store.jointType === JointTypeEnum.PrismaticJoint
27
28
  ? store.translationVelocityMmPerSec
28
29
  : store.rotationVelocityRadsPerSec,
29
30
 
@@ -36,11 +37,17 @@ export const JoggingJointTab = observer(
36
37
  }
37
38
 
38
39
  return (
39
- <Stack flexGrow={1} gap={2} sx={{ padding: "18px 24px" }}>
40
+ <Stack
41
+ data-testid="jogging-joint-tab"
42
+ aria-label="jogging-joint-tab"
43
+ flexGrow={1}
44
+ gap={2}
45
+ sx={{ padding: "18px 24px" }}
46
+ >
40
47
  <JoggingVelocitySlider
41
48
  store={store}
42
49
  useDegree={
43
- store.jointCategory === JointCategory.REVOLUTE
50
+ store.jointType === JointTypeEnum.RevoluteJoint
44
51
  }
45
52
  />
46
53
 
@@ -51,7 +58,12 @@ export const JoggingJointTab = observer(
51
58
  alignItems="stretch"
52
59
  sx={{ flexGrow: "1" }}
53
60
  >
54
- <Stack alignItems="center" gap="24px">
61
+ <Stack
62
+ data-testid="jogging-joint-value-controls-wrapper"
63
+ aria-label="jogging-joint-value-controls-wrapper"
64
+ alignItems="center"
65
+ gap="24px"
66
+ >
55
67
  {store.jogger.motionStream.joints.map((joint) => {
56
68
  const jointLimits =
57
69
  store.motionGroupDescription.operation_limits.auto_limits
@@ -60,6 +72,8 @@ export const JoggingJointTab = observer(
60
72
  return (
61
73
  <Stack
62
74
  key={`joint-${joint.index}`}
75
+ data-testid={`jogging-joint-value-control-${joint.index}`}
76
+ aria-label={`jogging-joint-value-control-${joint.index}`}
63
77
  direction="row"
64
78
  alignItems="center"
65
79
  justifyContent={"center"}
@@ -83,7 +97,7 @@ export const JoggingJointTab = observer(
83
97
  lowerLimit={jointLimits?.lower_limit}
84
98
  upperLimit={jointLimits?.upper_limit}
85
99
  useDegree={
86
- store.jointCategory === JointCategory.REVOLUTE
100
+ store.jointType === JointTypeEnum.RevoluteJoint
87
101
  }
88
102
 
89
103
  getValue={() => {
@@ -130,6 +130,8 @@ export const JoggingOptions = observer(({ store, useDegree }: { store: JoggingSt
130
130
  return (
131
131
  <Box
132
132
  component="div"
133
+ data-testid="jogging-options"
134
+ aria-label="jogging-options"
133
135
  sx={{
134
136
  display: "grid",
135
137
  gap: "16px",
@@ -96,6 +96,8 @@ export const JoggingPanel = externalizeComponent(
96
96
 
97
97
  return (
98
98
  <Stack
99
+ data-testid="jogging-panel"
100
+ aria-label="jogging-panel"
99
101
  sx={{
100
102
  maxWidth: "460px",
101
103
  minWidth: "320px",
@@ -147,6 +149,8 @@ const JoggingPanelInner = observer(
147
149
  <Stack flexGrow={1} sx={{ overflow: "hidden" }}>
148
150
  {/* Tab selection */}
149
151
  <Tabs
152
+ data-testid="jogging-tabs"
153
+ aria-label="jogging-tabs"
150
154
  value={store.tabIndex}
151
155
  onChange={store.onTabChange}
152
156
  variant="fullWidth"
@@ -167,6 +171,8 @@ const JoggingPanelInner = observer(
167
171
  return (
168
172
  <Tab
169
173
  key={tab.id}
174
+ data-testid={`jogging-tab-${tab.id}`}
175
+ aria-label={`jogging-tab-${tab.id}`}
170
176
  label={
171
177
  store.showTabIcons ? (
172
178
  <Stack direction="row" alignItems="center">
@@ -1,8 +1,11 @@
1
1
  import { tryParseJson } from "@wandelbots/nova-js"
2
- import type {
3
- CoordinateSystem,
4
- MotionGroupDescription,
5
- RobotTcp,
2
+ import {
3
+ type CoordinateSystem,
4
+ type DHParameter,
5
+ type MotionGroupDescription,
6
+ type RobotTcp,
7
+ type KinematicModel,
8
+ JointTypeEnum,
6
9
  } from "@wandelbots/nova-js/v2"
7
10
  import { countBy } from "lodash-es"
8
11
  import keyBy from "lodash-es/keyBy"
@@ -40,30 +43,12 @@ export type IncrementJogInProgress = {
40
43
  axis: JoggingAxis
41
44
  }
42
45
 
43
- export enum JointCategory {
44
- REVOLUTE = "REVOLUTE",
45
- PRISMATIC = "PRISMATIC",
46
- }
47
-
48
46
  type TabType = "cartesian" | "joint" | "debug";
49
47
  export type CartesianMotionType = "translate" | "rotate"
50
48
 
51
49
  export class JoggingStore {
52
50
  selectedTabId: TabType = "cartesian";
53
51
 
54
- /**
55
- * State of the jogging panel. Starts as "inactive"
56
- */
57
- activationState: "inactive" | "loading" | "active" = "inactive"
58
-
59
- /**
60
- * If an error occurred connecting to the jogging websocket
61
- */
62
- activationError: unknown | null = null
63
-
64
- /** To avoid activation race conditions */
65
- activationCounter: number = 0
66
-
67
52
  /** Locks to prevent UI interactions during certain operations */
68
53
  locks = new Set<string>()
69
54
 
@@ -145,6 +130,17 @@ export class JoggingStore {
145
130
 
146
131
  disposers: IReactionDisposer[] = []
147
132
 
133
+ /**
134
+ * Inverse solver from the kinematic model of the motion group to determine, which tabs should be rendered
135
+ */
136
+ inverseSolver: string | null | undefined = undefined
137
+
138
+ /**
139
+ * Joint type to determine, whether the active robot should be displayed as Robot or Linear Axis and what tabs
140
+ * should be rendered by the JoggingPanel component.
141
+ */
142
+ jointType: JointTypeEnum = JointTypeEnum.RevoluteJoint
143
+
148
144
  /**
149
145
  * Load a jogging store with the relevant data it needs
150
146
  * from the backend
@@ -167,6 +163,10 @@ export class JoggingStore {
167
163
  ),
168
164
  ])
169
165
 
166
+ const kinematicModel: KinematicModel = await nova.api.motionGroupModels.getMotionGroupKinematicModel(
167
+ description.motion_group_model,
168
+ )
169
+
170
170
  const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({
171
171
  id,
172
172
  readable_name: tcp.name,
@@ -174,7 +174,7 @@ export class JoggingStore {
174
174
  orientation: tcp.pose.orientation as Vector3Simple,
175
175
  }))
176
176
 
177
- return new JoggingStore(jogger, coordinatesystems || [], description, tcps)
177
+ return new JoggingStore(jogger, coordinatesystems || [], description, tcps, kinematicModel.inverse_solver)
178
178
  }
179
179
 
180
180
  constructor(
@@ -182,6 +182,7 @@ export class JoggingStore {
182
182
  readonly coordSystems: CoordinateSystem[],
183
183
  readonly motionGroupDescription: MotionGroupDescription,
184
184
  readonly tcps: RobotTcp[],
185
+ readonly inverseSolverValue: string | null | undefined,
185
186
  ) {
186
187
  // TODO workaround for default coord system on backend having a canonical id
187
188
  // of empty string. Can remove when fixed on API side
@@ -193,6 +194,10 @@ export class JoggingStore {
193
194
  }
194
195
  this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || "world"
195
196
  this.selectedTcpId = tcps[0]?.id || ""
197
+ this.inverseSolver = inverseSolverValue
198
+ this.jointType =
199
+ motionGroupDescription?.dh_parameters?.[0]?.type ??
200
+ JointTypeEnum.RevoluteJoint
196
201
 
197
202
  // Make all properties observable and actions auto-bound
198
203
  makeAutoObservable(this, {}, { autoBind: true })
@@ -306,17 +311,22 @@ export class JoggingStore {
306
311
  }
307
312
 
308
313
  get tabs() {
309
- const tempTabs : {id: TabType, label: string}[] = [{
310
- id: "joint",
311
- label: "Joints",
312
- }] ;
313
- if(this.isTcpCartesianMoveable){
314
+ const tempTabs: { id: TabType; label: string }[] = [
315
+ {
316
+ id: "joint",
317
+ label: "Joints",
318
+ },
319
+ ]
320
+ // show the cartesian tab only : 1. when there is a solver or 2. when no solver could be loaded ( as a default )
321
+ // do not show the cartesian tab when the solver is null this means, it cannot get jogged cartesian
322
+ if (this.inverseSolver !== null) {
314
323
  tempTabs.unshift({
315
324
  id: "cartesian",
316
325
  label: "Cartesian",
317
- })}
326
+ })
327
+ }
318
328
 
319
- return tempTabs;
329
+ return tempTabs
320
330
  }
321
331
 
322
332
 
@@ -348,10 +358,6 @@ export class JoggingStore {
348
358
  return keyBy(this.coordSystems, (cs) => cs.coordinate_system)
349
359
  }
350
360
 
351
- get selectedCoordSystem() {
352
- return this.coordSystemsById[this.selectedCoordSystemId]
353
- }
354
-
355
361
  /**
356
362
  * The id of the coordinate system to use for jogging.
357
363
  * If in tool orientation, this is set to "tool", not the
@@ -401,24 +407,6 @@ export class JoggingStore {
401
407
  : this.maxTranslationVelocityMmPerSec
402
408
  }
403
409
 
404
-
405
- /*
406
- * ToDo replace Hardcoded Models with an api request that delivers the type (will become part of DH-Parameters)
407
- * Ticket already created
408
- * */
409
- get jointCategory(): JointCategory {
410
- return this.motionGroupDescription.motion_group_model === "ABB_IRT710"
411
- ? JointCategory.PRISMATIC
412
- : JointCategory.REVOLUTE
413
- }
414
-
415
- get isTcpCartesianMoveable(): boolean{
416
- if(this.motionGroupDescription.motion_group_model === "ABB_IRT710"){
417
- return false;
418
- }
419
- return true;
420
- }
421
-
422
410
  onTabChange(_event: React.SyntheticEvent, newValue: number) {
423
411
  const tab = this.tabs[newValue] || this.tabs[0]!
424
412
  this.selectedTabId = tab.id
@@ -444,7 +432,7 @@ export class JoggingStore {
444
432
  this.incrementJogInProgress = incrementJog
445
433
  }
446
434
 
447
- setVelocityFromSlider(velocity: number,useDegree : boolean ) {
435
+ setVelocityFromSlider(velocity: number, useDegree: boolean) {
448
436
  if (useDegree) {
449
437
  this.rotationVelocityDegPerSec = velocity
450
438
  } else {
@@ -25,10 +25,6 @@ export const MotionGroupVisualizer: React.FC<MotionGroupVisualizerProps> = exter
25
25
 
26
26
  /**
27
27
  * Sets the joint type according to delivered dh parameter type
28
- *
29
- * TODO as soon as V2 api migration is done, the setting of the default RevoluteJoint value should be
30
- * deleted, cause the type property is expected to be always delivered. It is not the case in the V1 at the
31
- * moment.
32
28
  */
33
29
  useEffect(() => {
34
30
  if (dhParameters.length) {