@wandelbots/wandelbots-js-react-components 5.1.0 → 5.1.1-pr.fix-RB-3135-dhparam-type-check.571.707bea2

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 (29) 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 +2 -1
  4. package/dist/components/VelocitySlider.d.ts.map +1 -1
  5. package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
  6. package/dist/components/jogging/JoggingJointTab.d.ts.map +1 -1
  7. package/dist/components/jogging/JoggingOptions.d.ts +2 -1
  8. package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
  9. package/dist/components/jogging/JoggingStore.d.ts +21 -31
  10. package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
  11. package/dist/components/jogging/JoggingVelocitySlider.d.ts +2 -1
  12. package/dist/components/jogging/JoggingVelocitySlider.d.ts.map +1 -1
  13. package/dist/components/robots/MotionGroupVisualizer.d.ts.map +1 -1
  14. package/dist/core.cjs.js +1 -1
  15. package/dist/core.es.js +1 -1
  16. package/dist/index.cjs.js +1 -1
  17. package/dist/index.es.js +1 -1
  18. package/dist/{theming-Bt0cspr6.js → theming-CmwvXiqz.js} +597 -593
  19. package/dist/{theming-Bt0cspr6.js.map → theming-CmwvXiqz.js.map} +1 -1
  20. package/dist/{theming-B5Q8EK1c.cjs → theming-tB9mdiHF.cjs} +35 -35
  21. package/dist/{theming-B5Q8EK1c.cjs.map → theming-tB9mdiHF.cjs.map} +1 -1
  22. package/package.json +1 -1
  23. package/src/components/VelocitySlider.tsx +3 -2
  24. package/src/components/jogging/JoggingCartesianTab.tsx +10 -2
  25. package/src/components/jogging/JoggingJointTab.tsx +15 -5
  26. package/src/components/jogging/JoggingOptions.tsx +4 -4
  27. package/src/components/jogging/JoggingStore.ts +67 -88
  28. package/src/components/jogging/JoggingVelocitySlider.tsx +20 -17
  29. 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.0",
3
+ "version": "5.1.1-pr.fix-RB-3135-dhparam-type-check.571.707bea2",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -10,9 +10,10 @@ type VelocitySliderProps = {
10
10
  min: number
11
11
  max: number
12
12
  velocity: number
13
- onVelocityChange: (newVelocity: number) => void
13
+ onVelocityChange: (newVelocity: number, useDegree: boolean) => void
14
14
  disabled?: boolean
15
15
  renderValue?: (value: number) => ReactNode
16
+ useDegree: boolean
16
17
  store: JoggingStore
17
18
  }
18
19
 
@@ -25,7 +26,7 @@ export const VelocitySlider = observer((props: VelocitySliderProps) => {
25
26
  function onSliderChange(_event: Event, newVelocity: number | number[]) {
26
27
  if (newVelocity === props.velocity || !isNumber(newVelocity)) return
27
28
 
28
- props.onVelocityChange(newVelocity)
29
+ props.onVelocityChange(newVelocity, props.useDegree)
29
30
  }
30
31
 
31
32
  return (
@@ -194,8 +194,16 @@ export const JoggingCartesianTab = observer(
194
194
  return (
195
195
  <Stack flexGrow={1} gap={2} sx={{ padding: "18px 24px" }}>
196
196
  <Stack gap={2}>
197
- <JoggingOptions store={store} />
198
- <JoggingVelocitySlider store={store} />
197
+ <JoggingOptions
198
+ store={store}
199
+ useDegree={store.selectedCartesianMotionType === "rotate"}
200
+ />
201
+
202
+ <JoggingVelocitySlider
203
+ store={store}
204
+ useDegree={store.selectedCartesianMotionType === "rotate"}
205
+ />
206
+
199
207
  <Divider />
200
208
  </Stack>
201
209
 
@@ -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
 
@@ -37,7 +38,13 @@ export const JoggingJointTab = observer(
37
38
 
38
39
  return (
39
40
  <Stack flexGrow={1} gap={2} sx={{ padding: "18px 24px" }}>
40
- <JoggingVelocitySlider store={store} />
41
+ <JoggingVelocitySlider
42
+ store={store}
43
+ useDegree={
44
+ store.jointType === JointTypeEnum.RevoluteJoint
45
+ }
46
+ />
47
+
41
48
  <Divider />
42
49
 
43
50
  <Stack
@@ -76,7 +83,10 @@ export const JoggingJointTab = observer(
76
83
  disabled={store.isLocked}
77
84
  lowerLimit={jointLimits?.lower_limit}
78
85
  upperLimit={jointLimits?.upper_limit}
79
- useDegree={store.currentMotionType === "rotate"}
86
+ useDegree={
87
+ store.jointType === JointTypeEnum.RevoluteJoint
88
+ }
89
+
80
90
  getValue={() => {
81
91
  const value =
82
92
  store.jogger.motionStream.rapidlyChangingMotionState
@@ -10,7 +10,7 @@ import {
10
10
  type OrientationId,
11
11
  } from "./JoggingStore"
12
12
 
13
- export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
13
+ export const JoggingOptions = observer(({ store, useDegree }: { store: JoggingStore, useDegree: boolean }) => {
14
14
  const { t } = useTranslation()
15
15
  const componentId = useId()
16
16
  const joggingOptions: React.ReactElement[] = []
@@ -118,9 +118,9 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
118
118
  ? null
119
119
  : store.discreteIncrementOptions.map((inc) => (
120
120
  <MenuItem key={inc.id} value={inc.id}>
121
- {store.currentMotionType === "translate"
122
- ? `${inc.mm}mm`
123
- : `${inc.degrees}°`}
121
+ {useDegree
122
+ ? `${inc.degrees}°`
123
+ : `${inc.mm}mm`}
124
124
  </MenuItem>
125
125
  ))}
126
126
  </AdornedSelect>,
@@ -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
 
@@ -96,7 +81,7 @@ export class JoggingStore {
96
81
  * When on the cartesian tab, jogging can be either translating or rotating
97
82
  * around the TCP.
98
83
  */
99
- selectedCartesianMotionType: "translate" | "rotate" = "translate"
84
+ selectedCartesianMotionType: CartesianMotionType = "translate"
100
85
 
101
86
  /**
102
87
  * If the jogger is busy running an incremental jog, this will be set
@@ -145,6 +130,19 @@ export class JoggingStore {
145
130
 
146
131
  disposers: IReactionDisposer[] = []
147
132
 
133
+ dhParameters: DHParameter[] = []
134
+
135
+ /**
136
+ * Inverse solver from the kinematic model of the motion group to determine, which tabs should be rendered
137
+ */
138
+ inverseSolver: string | null | undefined = undefined
139
+
140
+ /**
141
+ * Joint type to determine, whether the active robot should be displayed as Robot or Linear Axis and what tabs
142
+ * should be rendered by the JoggingPanel component.
143
+ */
144
+ jointType: JointTypeEnum = JointTypeEnum.RevoluteJoint
145
+
148
146
  /**
149
147
  * Load a jogging store with the relevant data it needs
150
148
  * from the backend
@@ -167,6 +165,10 @@ export class JoggingStore {
167
165
  ),
168
166
  ])
169
167
 
168
+ const kinematicModel: KinematicModel = await nova.api.motionGroupModels.getMotionGroupKinematicModel(
169
+ description.motion_group_model,
170
+ )
171
+
170
172
  const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({
171
173
  id,
172
174
  readable_name: tcp.name,
@@ -174,7 +176,7 @@ export class JoggingStore {
174
176
  orientation: tcp.pose.orientation as Vector3Simple,
175
177
  }))
176
178
 
177
- return new JoggingStore(jogger, coordinatesystems || [], description, tcps)
179
+ return new JoggingStore(jogger, coordinatesystems || [], description, tcps, kinematicModel)
178
180
  }
179
181
 
180
182
  constructor(
@@ -182,6 +184,7 @@ export class JoggingStore {
182
184
  readonly coordSystems: CoordinateSystem[],
183
185
  readonly motionGroupDescription: MotionGroupDescription,
184
186
  readonly tcps: RobotTcp[],
187
+ readonly kinematicModel: KinematicModel,
185
188
  ) {
186
189
  // TODO workaround for default coord system on backend having a canonical id
187
190
  // of empty string. Can remove when fixed on API side
@@ -193,6 +196,10 @@ export class JoggingStore {
193
196
  }
194
197
  this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || "world"
195
198
  this.selectedTcpId = tcps[0]?.id || ""
199
+ this.inverseSolver = this.kinematicModel.inverse_solver
200
+ this.jointType =
201
+ motionGroupDescription?.dh_parameters?.[0]?.type ??
202
+ JointTypeEnum.RevoluteJoint
196
203
 
197
204
  // Make all properties observable and actions auto-bound
198
205
  makeAutoObservable(this, {}, { autoBind: true })
@@ -306,17 +313,25 @@ export class JoggingStore {
306
313
  }
307
314
 
308
315
  get tabs() {
309
- const tempTabs : {id: TabType, label: string}[] = [{
310
- id: "joint",
311
- label: "Joints",
312
- }] ;
313
- if(this.isTcpCartesianMoveable){
316
+ const tempTabs: { id: TabType; label: string }[] = [
317
+ {
318
+ id: "joint",
319
+ label: "Joints",
320
+ },
321
+ ]
322
+ // show the cartesian tab only : 1. when there is a solver or 2. when no solver could be loaded ( as a default )
323
+ // do not show the cartesia tab when the solver is null this means, it cannot get jogged cartesian
324
+ if (
325
+ this.inverseSolver === undefined ||
326
+ this.inverseSolver !== null
327
+ ) {
314
328
  tempTabs.unshift({
315
329
  id: "cartesian",
316
330
  label: "Cartesian",
317
- })}
331
+ })
332
+ }
318
333
 
319
- return tempTabs;
334
+ return tempTabs
320
335
  }
321
336
 
322
337
 
@@ -348,10 +363,6 @@ export class JoggingStore {
348
363
  return keyBy(this.coordSystems, (cs) => cs.coordinate_system)
349
364
  }
350
365
 
351
- get selectedCoordSystem() {
352
- return this.coordSystemsById[this.selectedCoordSystemId]
353
- }
354
-
355
366
  /**
356
367
  * The id of the coordinate system to use for jogging.
357
368
  * If in tool orientation, this is set to "tool", not the
@@ -379,59 +390,26 @@ export class JoggingStore {
379
390
  }
380
391
 
381
392
  /** Selected velocity in mm/sec or deg/sec */
382
- get velocityInDisplayUnits() {
383
- return this.currentMotionType === "translate"
384
- ? this.translationVelocityMmPerSec
385
- : this.rotationVelocityDegPerSec
386
- }
387
-
388
- /** Minimum selectable velocity in mm/sec or deg/sec */
389
- get minVelocityInDisplayUnits() {
390
- return this.currentMotionType === "translate"
391
- ? this.minTranslationVelocityMmPerSec
392
- : this.minRotationVelocityDegPerSec
393
+ velocityInDisplayUnits(useDegree: boolean) {
394
+ return useDegree
395
+ ? this.rotationVelocityDegPerSec
396
+ : this.translationVelocityMmPerSec
393
397
  }
394
398
 
395
- /** Maximum selectable velocity in mm/sec or deg/sec */
396
- get maxVelocityInDisplayUnits() {
397
- return this.currentMotionType === "translate"
398
- ? this.maxTranslationVelocityMmPerSec
399
- : this.maxRotationVelocityDegPerSec
400
- }
401
399
 
402
- /**
403
- * For velocity unit purposes, joint and cartesian rotation
404
- * are treated as the same type of motion
405
- */
406
- get currentMotionType() {
407
- if (
408
- (
409
- this.selectedTabId === "cartesian" &&
410
- this.selectedCartesianMotionType === "translate"
411
- ) || this.jointCategory === JointCategory.PRISMATIC
412
- ) {
413
- return "translate"
414
- } else {
415
- return "rotate"
416
- }
400
+ /** Minimum selectable velocity in mm/sec or deg/sec */
401
+ minVelocityInDisplayUnits(useDegree: boolean) {
402
+ return useDegree
403
+ ? this.minRotationVelocityDegPerSec
404
+ : this.minTranslationVelocityMmPerSec
417
405
  }
418
406
 
419
407
 
420
- /*
421
- * ToDo replace Hardcoded Models with an api request that delivers the type (will become part of DH-Parameters)
422
- * Ticket already created
423
- * */
424
- get jointCategory(): JointCategory {
425
- return this.motionGroupDescription.motion_group_model === "ABB_IRT710"
426
- ? JointCategory.PRISMATIC
427
- : JointCategory.REVOLUTE
428
- }
429
-
430
- get isTcpCartesianMoveable(): boolean{
431
- if(this.motionGroupDescription.motion_group_model === "ABB_IRT710"){
432
- return false;
433
- }
434
- return true;
408
+ /** Maximum selectable velocity in mm/sec or deg/sec */
409
+ maxVelocityInDisplayUnits(useDegree: boolean) {
410
+ return useDegree
411
+ ? this.maxRotationVelocityDegPerSec
412
+ : this.maxTranslationVelocityMmPerSec
435
413
  }
436
414
 
437
415
  onTabChange(_event: React.SyntheticEvent, newValue: number) {
@@ -459,15 +437,16 @@ export class JoggingStore {
459
437
  this.incrementJogInProgress = incrementJog
460
438
  }
461
439
 
462
- setVelocityFromSlider(velocity: number) {
463
- if (this.currentMotionType === "translate") {
464
- this.translationVelocityMmPerSec = velocity
465
- } else {
440
+ setVelocityFromSlider(velocity: number, useDegree: boolean) {
441
+ if (useDegree) {
466
442
  this.rotationVelocityDegPerSec = velocity
443
+ } else {
444
+ this.translationVelocityMmPerSec = velocity
467
445
  }
468
446
  }
469
447
 
470
- setSelectedCartesianMotionType(type: "translate" | "rotate") {
448
+
449
+ setSelectedCartesianMotionType(type: CartesianMotionType) {
471
450
  this.selectedCartesianMotionType = type
472
451
  }
473
452
 
@@ -1,35 +1,38 @@
1
- import { observer, useLocalObservable } from "mobx-react-lite"
1
+ import { observer} from "mobx-react-lite"
2
2
  import { useTranslation } from "react-i18next"
3
3
  import { VelocitySlider, VelocitySliderLabel } from "../VelocitySlider"
4
4
  import type { JoggingStore } from "./JoggingStore"
5
5
 
6
6
  export const JoggingVelocitySlider = observer(
7
- ({ store }: { store: JoggingStore }) => {
7
+ ({
8
+ store,
9
+ useDegree,
10
+ }: {
11
+ store: JoggingStore
12
+ useDegree: boolean
13
+ }) => {
14
+
8
15
  const { t } = useTranslation()
9
16
 
10
- const state = useLocalObservable(() => ({
11
- get valueLabelFormat() {
12
- if (store.currentMotionType === "translate") {
13
- return (value: number) =>
14
- `v = ${t("Jogging.Cartesian.Translation.velocityMmPerSec.lb", { amount: value })}`
15
- } else {
16
- return (value: number) =>
17
- `ω = ${t("Jogging.Cartesian.Rotation.velocityDegPerSec.lb", { amount: value })}`
18
- }
19
- },
20
- }))
17
+ function valueLabelFormat(value: number, useDegree: boolean): string {
18
+ return useDegree
19
+ ? = ${t("Jogging.Cartesian.Rotation.velocityDegPerSec.lb", { amount: value })}`
20
+ : `v = ${t("Jogging.Cartesian.Translation.velocityMmPerSec.lb", { amount: value })}`
21
+ }
22
+
21
23
 
22
24
  return (
23
25
  <VelocitySlider
24
26
  store={store}
25
- velocity={store.velocityInDisplayUnits}
26
- min={store.minVelocityInDisplayUnits}
27
- max={store.maxVelocityInDisplayUnits}
27
+ velocity={store.velocityInDisplayUnits(useDegree)}
28
+ min={store.minVelocityInDisplayUnits(useDegree)}
29
+ max={store.maxVelocityInDisplayUnits(useDegree)}
28
30
  onVelocityChange={store.setVelocityFromSlider}
31
+ useDegree={useDegree}
29
32
  disabled={store.isLocked}
30
33
  renderValue={(value) => (
31
34
  <VelocitySliderLabel
32
- value={state.valueLabelFormat(value)}
35
+ value={valueLabelFormat(value, useDegree)}
33
36
  sx={{
34
37
  minWidth: "111px",
35
38
  span: {
@@ -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) {