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

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "5.2.0-pr.fix-RB-3135-dhparam-type-check.571.ea4bdbb",
3
+ "version": "5.2.0",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -3,9 +3,8 @@ 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 } from "./JoggingStore"
6
+ import { type JoggingStore, JointCategory } from "./JoggingStore"
7
7
  import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
8
- import { JointTypeEnum } from "@wandelbots/nova-js/v2"
9
8
 
10
9
  export const JoggingJointTab = observer(
11
10
  ({ store, children }: { store: JoggingStore; children: ReactNode }) => {
@@ -20,11 +19,11 @@ export const JoggingJointTab = observer(
20
19
  joint: opts.joint,
21
20
  direction: opts.direction,
22
21
  velocityUnit:
23
- store.jointType === JointTypeEnum.PrismaticJoint
22
+ store.jointCategory === JointCategory.PRISMATIC
24
23
  ? "mm/s"
25
24
  : "rad/s",
26
25
  velocityValue:
27
- store.jointType === JointTypeEnum.PrismaticJoint
26
+ store.jointCategory === JointCategory.PRISMATIC
28
27
  ? store.translationVelocityMmPerSec
29
28
  : store.rotationVelocityRadsPerSec,
30
29
 
@@ -47,7 +46,7 @@ export const JoggingJointTab = observer(
47
46
  <JoggingVelocitySlider
48
47
  store={store}
49
48
  useDegree={
50
- store.jointType === JointTypeEnum.RevoluteJoint
49
+ store.jointCategory === JointCategory.REVOLUTE
51
50
  }
52
51
  />
53
52
 
@@ -97,7 +96,7 @@ export const JoggingJointTab = observer(
97
96
  lowerLimit={jointLimits?.lower_limit}
98
97
  upperLimit={jointLimits?.upper_limit}
99
98
  useDegree={
100
- store.jointType === JointTypeEnum.RevoluteJoint
99
+ store.jointCategory === JointCategory.REVOLUTE
101
100
  }
102
101
 
103
102
  getValue={() => {
@@ -1,11 +1,8 @@
1
1
  import { tryParseJson } from "@wandelbots/nova-js"
2
- import {
3
- type CoordinateSystem,
4
- type DHParameter,
5
- type MotionGroupDescription,
6
- type RobotTcp,
7
- type KinematicModel,
8
- JointTypeEnum,
2
+ import type {
3
+ CoordinateSystem,
4
+ MotionGroupDescription,
5
+ RobotTcp,
9
6
  } from "@wandelbots/nova-js/v2"
10
7
  import { countBy } from "lodash-es"
11
8
  import keyBy from "lodash-es/keyBy"
@@ -43,12 +40,30 @@ export type IncrementJogInProgress = {
43
40
  axis: JoggingAxis
44
41
  }
45
42
 
43
+ export enum JointCategory {
44
+ REVOLUTE = "REVOLUTE",
45
+ PRISMATIC = "PRISMATIC",
46
+ }
47
+
46
48
  type TabType = "cartesian" | "joint" | "debug";
47
49
  export type CartesianMotionType = "translate" | "rotate"
48
50
 
49
51
  export class JoggingStore {
50
52
  selectedTabId: TabType = "cartesian";
51
53
 
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
+
52
67
  /** Locks to prevent UI interactions during certain operations */
53
68
  locks = new Set<string>()
54
69
 
@@ -130,17 +145,6 @@ export class JoggingStore {
130
145
 
131
146
  disposers: IReactionDisposer[] = []
132
147
 
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
-
144
148
  /**
145
149
  * Load a jogging store with the relevant data it needs
146
150
  * from the backend
@@ -163,10 +167,6 @@ export class JoggingStore {
163
167
  ),
164
168
  ])
165
169
 
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, kinematicModel.inverse_solver)
177
+ return new JoggingStore(jogger, coordinatesystems || [], description, tcps)
178
178
  }
179
179
 
180
180
  constructor(
@@ -182,7 +182,6 @@ export class JoggingStore {
182
182
  readonly coordSystems: CoordinateSystem[],
183
183
  readonly motionGroupDescription: MotionGroupDescription,
184
184
  readonly tcps: RobotTcp[],
185
- readonly inverseSolverValue: string | null | undefined,
186
185
  ) {
187
186
  // TODO workaround for default coord system on backend having a canonical id
188
187
  // of empty string. Can remove when fixed on API side
@@ -194,10 +193,6 @@ export class JoggingStore {
194
193
  }
195
194
  this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || "world"
196
195
  this.selectedTcpId = tcps[0]?.id || ""
197
- this.inverseSolver = inverseSolverValue
198
- this.jointType =
199
- motionGroupDescription?.dh_parameters?.[0]?.type ??
200
- JointTypeEnum.RevoluteJoint
201
196
 
202
197
  // Make all properties observable and actions auto-bound
203
198
  makeAutoObservable(this, {}, { autoBind: true })
@@ -311,22 +306,17 @@ export class JoggingStore {
311
306
  }
312
307
 
313
308
  get tabs() {
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) {
309
+ const tempTabs : {id: TabType, label: string}[] = [{
310
+ id: "joint",
311
+ label: "Joints",
312
+ }] ;
313
+ if(this.isTcpCartesianMoveable){
323
314
  tempTabs.unshift({
324
315
  id: "cartesian",
325
316
  label: "Cartesian",
326
- })
327
- }
317
+ })}
328
318
 
329
- return tempTabs
319
+ return tempTabs;
330
320
  }
331
321
 
332
322
 
@@ -358,6 +348,10 @@ export class JoggingStore {
358
348
  return keyBy(this.coordSystems, (cs) => cs.coordinate_system)
359
349
  }
360
350
 
351
+ get selectedCoordSystem() {
352
+ return this.coordSystemsById[this.selectedCoordSystemId]
353
+ }
354
+
361
355
  /**
362
356
  * The id of the coordinate system to use for jogging.
363
357
  * If in tool orientation, this is set to "tool", not the
@@ -407,6 +401,24 @@ export class JoggingStore {
407
401
  : this.maxTranslationVelocityMmPerSec
408
402
  }
409
403
 
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
+
410
422
  onTabChange(_event: React.SyntheticEvent, newValue: number) {
411
423
  const tab = this.tabs[newValue] || this.tabs[0]!
412
424
  this.selectedTabId = tab.id
@@ -432,7 +444,7 @@ export class JoggingStore {
432
444
  this.incrementJogInProgress = incrementJog
433
445
  }
434
446
 
435
- setVelocityFromSlider(velocity: number, useDegree: boolean) {
447
+ setVelocityFromSlider(velocity: number,useDegree : boolean ) {
436
448
  if (useDegree) {
437
449
  this.rotationVelocityDegPerSec = velocity
438
450
  } else {
@@ -25,6 +25,10 @@ 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.
28
32
  */
29
33
  useEffect(() => {
30
34
  if (dhParameters.length) {