@wandelbots/wandelbots-js-react-components 5.2.0-pr.fix-RB-3135-dhparam-type-check.571.bb107d7 → 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.bb107d7",
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,19 +145,6 @@ export class JoggingStore {
130
145
 
131
146
  disposers: IReactionDisposer[] = []
132
147
 
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
-
146
148
  /**
147
149
  * Load a jogging store with the relevant data it needs
148
150
  * from the backend
@@ -165,10 +167,6 @@ export class JoggingStore {
165
167
  ),
166
168
  ])
167
169
 
168
- const kinematicModel: KinematicModel = await nova.api.motionGroupModels.getMotionGroupKinematicModel(
169
- description.motion_group_model,
170
- )
171
-
172
170
  const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({
173
171
  id,
174
172
  readable_name: tcp.name,
@@ -176,7 +174,7 @@ export class JoggingStore {
176
174
  orientation: tcp.pose.orientation as Vector3Simple,
177
175
  }))
178
176
 
179
- return new JoggingStore(jogger, coordinatesystems || [], description, tcps, kinematicModel)
177
+ return new JoggingStore(jogger, coordinatesystems || [], description, tcps)
180
178
  }
181
179
 
182
180
  constructor(
@@ -184,7 +182,6 @@ export class JoggingStore {
184
182
  readonly coordSystems: CoordinateSystem[],
185
183
  readonly motionGroupDescription: MotionGroupDescription,
186
184
  readonly tcps: RobotTcp[],
187
- readonly kinematicModel: KinematicModel,
188
185
  ) {
189
186
  // TODO workaround for default coord system on backend having a canonical id
190
187
  // of empty string. Can remove when fixed on API side
@@ -196,10 +193,6 @@ export class JoggingStore {
196
193
  }
197
194
  this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || "world"
198
195
  this.selectedTcpId = tcps[0]?.id || ""
199
- this.inverseSolver = this.kinematicModel.inverse_solver
200
- this.jointType =
201
- motionGroupDescription?.dh_parameters?.[0]?.type ??
202
- JointTypeEnum.RevoluteJoint
203
196
 
204
197
  // Make all properties observable and actions auto-bound
205
198
  makeAutoObservable(this, {}, { autoBind: true })
@@ -313,25 +306,17 @@ export class JoggingStore {
313
306
  }
314
307
 
315
308
  get tabs() {
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
- ) {
309
+ const tempTabs : {id: TabType, label: string}[] = [{
310
+ id: "joint",
311
+ label: "Joints",
312
+ }] ;
313
+ if(this.isTcpCartesianMoveable){
328
314
  tempTabs.unshift({
329
315
  id: "cartesian",
330
316
  label: "Cartesian",
331
- })
332
- }
317
+ })}
333
318
 
334
- return tempTabs
319
+ return tempTabs;
335
320
  }
336
321
 
337
322
 
@@ -363,6 +348,10 @@ export class JoggingStore {
363
348
  return keyBy(this.coordSystems, (cs) => cs.coordinate_system)
364
349
  }
365
350
 
351
+ get selectedCoordSystem() {
352
+ return this.coordSystemsById[this.selectedCoordSystemId]
353
+ }
354
+
366
355
  /**
367
356
  * The id of the coordinate system to use for jogging.
368
357
  * If in tool orientation, this is set to "tool", not the
@@ -412,6 +401,24 @@ export class JoggingStore {
412
401
  : this.maxTranslationVelocityMmPerSec
413
402
  }
414
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
+
415
422
  onTabChange(_event: React.SyntheticEvent, newValue: number) {
416
423
  const tab = this.tabs[newValue] || this.tabs[0]!
417
424
  this.selectedTabId = tab.id
@@ -437,7 +444,7 @@ export class JoggingStore {
437
444
  this.incrementJogInProgress = incrementJog
438
445
  }
439
446
 
440
- setVelocityFromSlider(velocity: number, useDegree: boolean) {
447
+ setVelocityFromSlider(velocity: number,useDegree : boolean ) {
441
448
  if (useDegree) {
442
449
  this.rotationVelocityDegPerSec = velocity
443
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) {