@wandelbots/wandelbots-js-react-components 2.54.5-pr.feat-upgrade-jogging-to-v2.404.50fa670 → 2.54.5-pr.feat-upgrade-robot-motions-to-v2.407.56c347d

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 (42) hide show
  1. package/dist/components/ProgramStateIndicator.d.ts +3 -3
  2. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  3. package/dist/components/RobotCard.d.ts +4 -3
  4. package/dist/components/RobotCard.d.ts.map +1 -1
  5. package/dist/components/robots/DHRobot.d.ts.map +1 -1
  6. package/dist/components/robots/Robot.d.ts +1 -1
  7. package/dist/components/robots/Robot.d.ts.map +1 -1
  8. package/dist/components/robots/RobotAnimator.d.ts +2 -2
  9. package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
  10. package/dist/components/robots/SupportedRobot.d.ts +3 -3
  11. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  12. package/dist/components/robots/manufacturerHomePositions.d.ts +1 -1
  13. package/dist/components/safetyBar/OperationModeIndicator.d.ts +2 -2
  14. package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
  15. package/dist/components/safetyBar/SafetyBar.d.ts +3 -3
  16. package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
  17. package/dist/components/safetyBar/SafetyStateIndicator.d.ts +2 -2
  18. package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
  19. package/dist/index.cjs +2 -2
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.js +12 -12
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/ConnectedMotionGroup.d.ts +7 -1
  24. package/dist/lib/ConnectedMotionGroup.d.ts.map +1 -1
  25. package/dist/lib/MotionStreamConnection.d.ts.map +1 -1
  26. package/dist/lib/motionStateUpdate.d.ts +2 -0
  27. package/dist/lib/motionStateUpdate.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/ProgramStateIndicator.tsx +3 -6
  30. package/src/components/RobotCard.tsx +4 -7
  31. package/src/components/robots/DHRobot.tsx +2 -3
  32. package/src/components/robots/Robot.tsx +1 -1
  33. package/src/components/robots/RobotAnimator.test.tsx +7 -22
  34. package/src/components/robots/RobotAnimator.tsx +8 -13
  35. package/src/components/robots/SupportedRobot.tsx +3 -6
  36. package/src/components/robots/manufacturerHomePositions.ts +1 -1
  37. package/src/components/safetyBar/OperationModeIndicator.tsx +2 -2
  38. package/src/components/safetyBar/SafetyBar.tsx +3 -6
  39. package/src/components/safetyBar/SafetyStateIndicator.tsx +2 -2
  40. package/src/lib/ConnectedMotionGroup.ts +22 -4
  41. package/src/lib/MotionStreamConnection.ts +7 -42
  42. package/src/lib/motionStateUpdate.ts +41 -0
@@ -48,7 +48,13 @@ export declare class ConnectedMotionGroup {
48
48
  get joints(): {
49
49
  index: number;
50
50
  }[];
51
- get dhParameters(): import("@wandelbots/nova-api/v2").DHParameter[] | undefined;
51
+ get dhParameters(): {
52
+ alpha?: number;
53
+ theta?: number;
54
+ a?: number;
55
+ d?: number;
56
+ reverse_rotation_direction?: boolean;
57
+ }[] | undefined;
52
58
  get safetyZones(): {
53
59
  [key: string]: import("@wandelbots/nova-api/v2").Collider;
54
60
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectedMotionGroup.d.ts","sourceRoot":"","sources":["../../src/lib/ConnectedMotionGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,EAEV,oBAAoB,EAErB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAKvD,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,MAAM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W,EAAE,gBAAgB,EAC7B,WAAW,EAAE,sBAAsB,EACnC,kBAAkB,EAAE,gBAAgB,EACpC,iBAAiB,EAAE,yBAAyB;IA4EvD,IAAI,aAAa,WAEhB;IAED,IAAI,YAAY,WAEf;IAED,IAAI,sBAAsB,WAGzB;IAED,IAAI,MAAM;;QAMT;IAED,OAAO;CAGR"}
1
+ {"version":3,"file":"MotionStreamConnection.d.ts","sourceRoot":"","sources":["../../src/lib/MotionStreamConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAgB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACrB,MAAM,wBAAwB,CAAA;AAW/B;;GAEG;AACH,qBAAa,sBAAsB;IA2D/B,QAAQ,CAAC,IAAI,EAAE,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,oBAAoB;IACzC,QAAQ,CAAC,WAAW,EAAE,gBAAgB;IACtC,QAAQ,CAAC,WAAW,EAAE,sBAAsB;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB;IAC7C,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB;WA/D1C,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM;IAuDzD,0BAA0B,EAAE,gBAAgB,CAAA;gBAGjC,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,oBAAoB,EAChC,WAAW,EAAE,gBAAgB,EAC7B,WAAW,EAAE,sBAAsB,EACnC,kBAAkB,EAAE,gBAAgB,EACpC,iBAAiB,EAAE,yBAAyB;IA6EvD,IAAI,aAAa,WAEhB;IAED,IAAI,YAAY,WAEf;IAED,IAAI,sBAAsB,WAGzB;IAED,IAAI,MAAM;;QAMT;IAED,OAAO;CAGR"}
@@ -1,5 +1,7 @@
1
1
  import type { MotionGroupState, Pose } from "@wandelbots/nova-js/v2";
2
+ import type { Vector3Simple } from "./JoggerConnection";
2
3
  export declare function jointValuesEqual(oldJointValues: number[], newJointValues: number[], changeDeltaThreshold: number): boolean;
3
4
  export declare function poseEqual(oldTcp: Pose | undefined, newTcp: Pose | undefined, changeDeltaThreshold: number): boolean;
4
5
  export declare function tcpMotionEqual(oldMotionState: MotionGroupState, newMotionState: MotionGroupState, changeDeltaThreshold: number): boolean;
6
+ export declare function unwrapRotationVector(newRotationVectorApi: Vector3Simple, currentRotationVectorApi: Vector3Simple): Vector3Simple;
5
7
  //# sourceMappingURL=motionStateUpdate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"motionStateUpdate.d.ts","sourceRoot":"","sources":["../../src/lib/motionStateUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAEpE,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EAAE,EACxB,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAgBT;AAED,wBAAgB,SAAS,CACvB,MAAM,EAAE,IAAI,GAAG,SAAS,EACxB,MAAM,EAAE,IAAI,GAAG,SAAS,EACxB,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CA8BT;AAGD,wBAAgB,cAAc,CAC5B,cAAc,EAAE,gBAAgB,EAChC,cAAc,EAAE,gBAAgB,EAChC,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAUT"}
1
+ {"version":3,"file":"motionStateUpdate.d.ts","sourceRoot":"","sources":["../../src/lib/motionStateUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EAAE,EACxB,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAgBT;AAED,wBAAgB,SAAS,CACvB,MAAM,EAAE,IAAI,GAAG,SAAS,EACxB,MAAM,EAAE,IAAI,GAAG,SAAS,EACxB,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CA8BT;AAGD,wBAAgB,cAAc,CAC5B,cAAc,EAAE,gBAAgB,EAChC,cAAc,EAAE,gBAAgB,EAChC,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAUT;AAED,wBAAgB,oBAAoB,CAClC,oBAAoB,EAAE,aAAa,EACnC,wBAAwB,EAAE,aAAa,GACtC,aAAa,CAkCf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "2.54.5-pr.feat-upgrade-jogging-to-v2.404.50fa670",
3
+ "version": "2.54.5-pr.feat-upgrade-robot-motions-to-v2.407.56c347d",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,8 +1,5 @@
1
1
  import { Chip, Typography, useTheme } from "@mui/material"
2
- import type {
3
- RobotControllerStateOperationModeEnum,
4
- RobotControllerStateSafetyStateEnum,
5
- } from "@wandelbots/nova-js/v1"
2
+ import type { OperationMode, SafetyStateType } from "@wandelbots/nova-js/v2"
6
3
  import { observer } from "mobx-react-lite"
7
4
  import { useTranslation } from "react-i18next"
8
5
  import { externalizeComponent } from "../externalizeComponent"
@@ -12,9 +9,9 @@ export interface ProgramStateIndicatorProps {
12
9
  /** The current state of the program */
13
10
  programState: ProgramState
14
11
  /** The current safety state of the robot controller */
15
- safetyState: RobotControllerStateSafetyStateEnum
12
+ safetyState: SafetyStateType
16
13
  /** The current operation mode of the robot controller */
17
- operationMode: RobotControllerStateOperationModeEnum
14
+ operationMode: OperationMode
18
15
  /** Additional CSS class name */
19
16
  className?: string
20
17
  }
@@ -1,16 +1,13 @@
1
1
  import { Box, Button, Card, Divider, Typography, useTheme } from "@mui/material"
2
2
  import { Bounds } from "@react-three/drei"
3
3
  import { Canvas } from "@react-three/fiber"
4
- import type {
5
- ConnectedMotionGroup,
6
- RobotControllerStateOperationModeEnum,
7
- RobotControllerStateSafetyStateEnum,
8
- } from "@wandelbots/nova-js/v1"
4
+ import type { OperationMode, SafetyStateType } from "@wandelbots/nova-js/v2"
9
5
  import { observer } from "mobx-react-lite"
10
6
  import { useCallback, useEffect, useRef, useState } from "react"
11
7
  import { useTranslation } from "react-i18next"
12
8
  import type { Group } from "three"
13
9
  import { externalizeComponent } from "../externalizeComponent"
10
+ import type { ConnectedMotionGroup } from "../lib/ConnectedMotionGroup"
14
11
  import { PresetEnvironment } from "./3d-viewport/PresetEnvironment"
15
12
  import type { ProgramState } from "./ProgramControl"
16
13
  import { ProgramStateIndicator } from "./ProgramStateIndicator"
@@ -22,9 +19,9 @@ export interface RobotCardProps {
22
19
  /** Current program state */
23
20
  programState: ProgramState
24
21
  /** Current safety state of the robot controller */
25
- safetyState: RobotControllerStateSafetyStateEnum
22
+ safetyState: SafetyStateType
26
23
  /** Current operation mode of the robot controller */
27
- operationMode: RobotControllerStateOperationModeEnum
24
+ operationMode: OperationMode
28
25
  /** Whether the "Drive to Home" button should be enabled */
29
26
  driveToHomeEnabled?: boolean
30
27
  /** Callback fired when "Drive to Home" button is pressed */
@@ -1,5 +1,5 @@
1
1
  import { Line } from "@react-three/drei"
2
- import type { DHParameter } from "@wandelbots/nova-js/v1"
2
+ import type { DHParameter } from "@wandelbots/nova-js/v2"
3
3
  import React, { useRef } from "react"
4
4
  import type * as THREE from "three"
5
5
  import { Matrix4, Quaternion, Vector3 } from "three"
@@ -113,8 +113,7 @@ export function DHRobot({
113
113
  {dhParameters!.map((param, index) => {
114
114
  const { a, b } = getLinePoints(
115
115
  param,
116
- rapidlyChangingMotionState.state.joint_position.joints[index] ??
117
- 0,
116
+ rapidlyChangingMotionState.joint_position[index] ?? 0,
118
117
  )
119
118
  const jointName = `dhrobot_J0${index}`
120
119
  return (
@@ -1,7 +1,7 @@
1
1
  import type { ThreeElements } from "@react-three/fiber"
2
2
 
3
- import type { ConnectedMotionGroup } from "@wandelbots/nova-js/v1"
4
3
  import type { Group } from "three"
4
+ import type { ConnectedMotionGroup } from "../../lib/ConnectedMotionGroup"
5
5
  import { defaultGetModel } from "./robotModelLogic"
6
6
  import { SupportedRobot } from "./SupportedRobot"
7
7
 
@@ -1,7 +1,4 @@
1
- import type {
2
- DHParameter,
3
- MotionGroupStateResponse,
4
- } from "@wandelbots/nova-api/v1"
1
+ import type { DHParameter, MotionGroupState } from "@wandelbots/nova-api/v2"
5
2
  import { describe, expect, it, vi } from "vitest"
6
3
  import RobotAnimator from "./RobotAnimator"
7
4
 
@@ -26,12 +23,8 @@ describe("RobotAnimator", () => {
26
23
 
27
24
  it("should handle props with different numbers of joints", () => {
28
25
  // Test that the component accepts different numbers of DH parameters
29
- const mockMotionState4Joints: MotionGroupStateResponse = {
30
- state: {
31
- joint_position: {
32
- joints: [0.1, 0.2, 0.3, 0.4],
33
- },
34
- },
26
+ const mockMotionState4Joints: MotionGroupState = {
27
+ joint_position: [0.1, 0.2, 0.3, 0.4],
35
28
  } as any
36
29
 
37
30
  const mockDHParameters4Joints: DHParameter[] = [
@@ -41,12 +34,8 @@ describe("RobotAnimator", () => {
41
34
  { theta: 0, reverse_rotation_direction: false },
42
35
  ]
43
36
 
44
- const mockMotionState7Joints: MotionGroupStateResponse = {
45
- state: {
46
- joint_position: {
47
- joints: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7],
48
- },
49
- },
37
+ const mockMotionState7Joints: MotionGroupState = {
38
+ joint_position: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7],
50
39
  } as any
51
40
 
52
41
  const mockDHParameters7Joints: DHParameter[] = Array(7).fill({
@@ -63,9 +52,7 @@ describe("RobotAnimator", () => {
63
52
  }
64
53
  // Verify props are correctly typed
65
54
  expect(props4.dhParameters).toHaveLength(4)
66
- expect(
67
- props4.rapidlyChangingMotionState.state.joint_position.joints,
68
- ).toHaveLength(4)
55
+ expect(props4.rapidlyChangingMotionState.joint_position).toHaveLength(4)
69
56
  }).not.toThrow()
70
57
 
71
58
  expect(() => {
@@ -75,9 +62,7 @@ describe("RobotAnimator", () => {
75
62
  children: null,
76
63
  }
77
64
  expect(props7.dhParameters).toHaveLength(7)
78
- expect(
79
- props7.rapidlyChangingMotionState.state.joint_position.joints,
80
- ).toHaveLength(7)
65
+ expect(props7.rapidlyChangingMotionState.joint_position).toHaveLength(7)
81
66
  }).not.toThrow()
82
67
  })
83
68
 
@@ -1,8 +1,5 @@
1
1
  import { useFrame, useThree } from "@react-three/fiber"
2
- import type {
3
- DHParameter,
4
- MotionGroupStateResponse,
5
- } from "@wandelbots/nova-js/v1"
2
+ import type { DHParameter, MotionGroupState } from "@wandelbots/nova-js/v2"
6
3
  import React, { useEffect, useRef } from "react"
7
4
  import type { Group, Object3D } from "three"
8
5
  import { useAutorun } from "../utils/hooks"
@@ -10,7 +7,7 @@ import { ValueInterpolator } from "../utils/interpolation"
10
7
  import { collectJoints } from "./robotModelLogic"
11
8
 
12
9
  type RobotAnimatorProps = {
13
- rapidlyChangingMotionState: MotionGroupStateResponse
10
+ rapidlyChangingMotionState: MotionGroupState
14
11
  dhParameters: DHParameter[]
15
12
  onRotationChanged?: (joints: Object3D[], jointValues: number[]) => void
16
13
  children: React.ReactNode
@@ -29,10 +26,9 @@ export default function RobotAnimator({
29
26
 
30
27
  // Initialize interpolator
31
28
  useEffect(() => {
32
- const initialJointValues =
33
- rapidlyChangingMotionState.state.joint_position.joints.filter(
34
- (item) => item !== undefined,
35
- )
29
+ const initialJointValues = rapidlyChangingMotionState.joint_position.filter(
30
+ (item) => item !== undefined,
31
+ )
36
32
 
37
33
  interpolatorRef.current = new ValueInterpolator(initialJointValues, {
38
34
  tension: 120, // Controls spring stiffness - higher values create faster, more responsive motion
@@ -91,10 +87,9 @@ export default function RobotAnimator({
91
87
  }
92
88
 
93
89
  useAutorun(() => {
94
- const newJointValues =
95
- rapidlyChangingMotionState.state.joint_position.joints.filter(
96
- (item) => item !== undefined,
97
- )
90
+ const newJointValues = rapidlyChangingMotionState.joint_position.filter(
91
+ (item) => item !== undefined,
92
+ )
98
93
 
99
94
  requestAnimationFrame(() => updateJoints(newJointValues))
100
95
  })
@@ -1,8 +1,5 @@
1
1
  import type { ThreeElements } from "@react-three/fiber"
2
- import type {
3
- DHParameter,
4
- MotionGroupStateResponse,
5
- } from "@wandelbots/nova-js/v1"
2
+ import type { DHParameter, MotionGroupState } from "@wandelbots/nova-js/v2"
6
3
  import { Suspense, useCallback, useEffect, useState } from "react"
7
4
  import { DHRobot } from "./DHRobot"
8
5
 
@@ -16,12 +13,12 @@ import { applyGhostStyle, removeGhostStyle } from "./ghostStyle"
16
13
  import { defaultGetModel } from "./robotModelLogic"
17
14
 
18
15
  export type DHRobotProps = {
19
- rapidlyChangingMotionState: MotionGroupStateResponse
16
+ rapidlyChangingMotionState: MotionGroupState
20
17
  dhParameters: Array<DHParameter>
21
18
  } & ThreeElements["group"]
22
19
 
23
20
  export type SupportedRobotProps = {
24
- rapidlyChangingMotionState: MotionGroupStateResponse
21
+ rapidlyChangingMotionState: MotionGroupState
25
22
  modelFromController: string
26
23
  dhParameters: DHParameter[]
27
24
  flangeRef?: React.Ref<THREE.Group>
@@ -1,4 +1,4 @@
1
- import { Manufacturer } from "@wandelbots/nova-js/v1"
1
+ import { Manufacturer } from "@wandelbots/nova-js/v2"
2
2
 
3
3
  /**
4
4
  * Default home configs for different robot manufacturers.
@@ -1,5 +1,5 @@
1
1
  import { useTheme, type PopoverOrigin } from "@mui/material"
2
- import type { RobotControllerStateOperationModeEnum } from "@wandelbots/nova-js/v1"
2
+ import type { OperationMode } from "@wandelbots/nova-js/v2"
3
3
  import { observer } from "mobx-react-lite"
4
4
  import { Trans, useTranslation } from "react-i18next"
5
5
  import OperationModeAutomaticIcon from "./icons/operation-mode-automatic.svg"
@@ -8,7 +8,7 @@ import OperationModeManualIcon from "./icons/operation-mode-manual.svg"
8
8
  import { IndicatorWithExplanation } from "./IndicatorWithExplanation"
9
9
 
10
10
  interface OperationModeIndicatorProps {
11
- operationMode: RobotControllerStateOperationModeEnum
11
+ operationMode: OperationMode
12
12
  anchorOrigin?: PopoverOrigin
13
13
  transformOrigin?: PopoverOrigin
14
14
  compact: boolean
@@ -1,8 +1,5 @@
1
1
  import { Divider, Stack, type PopoverOrigin } from "@mui/material"
2
- import type {
3
- RobotControllerStateOperationModeEnum,
4
- RobotControllerStateSafetyStateEnum,
5
- } from "@wandelbots/nova-js/v1"
2
+ import type { OperationMode, SafetyStateType } from "@wandelbots/nova-js/v2"
6
3
  import { observer } from "mobx-react-lite"
7
4
  import { externalizeComponent } from "../../externalizeComponent"
8
5
  import { ControllerTypeIndicator } from "./ControllerTypeIndicator"
@@ -12,8 +9,8 @@ import { SafetyStateIndicator } from "./SafetyStateIndicator"
12
9
  export interface SafetyBarProps {
13
10
  isVirtual: boolean
14
11
  motionGroupId: string
15
- operationMode: RobotControllerStateOperationModeEnum
16
- safetyState: RobotControllerStateSafetyStateEnum
12
+ operationMode: OperationMode
13
+ safetyState: SafetyStateType
17
14
  anchorOrigin?: PopoverOrigin
18
15
  transformOrigin?: PopoverOrigin
19
16
  compact?: boolean
@@ -1,5 +1,5 @@
1
1
  import { useTheme, type PopoverOrigin } from "@mui/material"
2
- import type { RobotControllerStateSafetyStateEnum } from "@wandelbots/nova-js/v1"
2
+ import type { SafetyStateType } from "@wandelbots/nova-js/v2"
3
3
  import { observer } from "mobx-react-lite"
4
4
  import { Trans, useTranslation } from "react-i18next"
5
5
  import { assertUnreachable } from "../utils/errorHandling"
@@ -11,7 +11,7 @@ import SafetyStateStopIcon from "./icons/safety-state-stop.svg"
11
11
  import { IndicatorWithExplanation } from "./IndicatorWithExplanation"
12
12
 
13
13
  interface SafetyStateIndicatorProps {
14
- safetyState: RobotControllerStateSafetyStateEnum
14
+ safetyState: SafetyStateType
15
15
  anchorOrigin?: PopoverOrigin
16
16
  transformOrigin?: PopoverOrigin
17
17
  compact: boolean
@@ -3,6 +3,7 @@ import {
3
3
  type AutoReconnectingWebsocket,
4
4
  } from "@wandelbots/nova-js"
5
5
  import type {
6
+ DHParameter,
6
7
  MotionGroupDescription,
7
8
  MotionGroupState,
8
9
  NovaClient,
@@ -28,6 +29,14 @@ export type MotionGroupOption = {
28
29
  selectionId: string
29
30
  }
30
31
 
32
+ const EMPTY_DH_PARAMETER: DHParameter = {
33
+ a: 0,
34
+ d: 0,
35
+ alpha: 0,
36
+ theta: 0,
37
+ reverse_rotation_direction: false,
38
+ }
39
+
31
40
  /**
32
41
  * Store representing the current state of a connected motion group.
33
42
  * API v2 version, not used yet in the components.
@@ -196,7 +205,7 @@ export class ConnectedMotionGroup {
196
205
  )
197
206
  }
198
207
 
199
- // handle motionState message
208
+ // handle joint position changes
200
209
  if (
201
210
  !jointValuesEqual(
202
211
  this.rapidlyChangingMotionState.joint_position,
@@ -205,11 +214,12 @@ export class ConnectedMotionGroup {
205
214
  )
206
215
  ) {
207
216
  runInAction(() => {
208
- this.rapidlyChangingMotionState = latestMotionState
217
+ this.rapidlyChangingMotionState.joint_position =
218
+ latestMotionState.joint_position
209
219
  })
210
220
  }
211
221
 
212
- // handle tcpPose message
222
+ // handle tcp pose changes
213
223
  if (
214
224
  !tcpMotionEqual(
215
225
  this.rapidlyChangingMotionState,
@@ -266,8 +276,16 @@ export class ConnectedMotionGroup {
266
276
  })
267
277
  }
268
278
 
279
+ // Please note that API v2 omits 0 values
269
280
  get dhParameters() {
270
- return this.description.dh_parameters
281
+ if (this.description.dh_parameters === undefined) {
282
+ return undefined
283
+ }
284
+
285
+ return this.description.dh_parameters.map((dh_param) => ({
286
+ ...EMPTY_DH_PARAMETER,
287
+ ...dh_param,
288
+ }))
271
289
  }
272
290
 
273
291
  get safetyZones() {
@@ -6,51 +6,15 @@ import type {
6
6
  RobotControllerState,
7
7
  } from "@wandelbots/nova-js/v2"
8
8
  import { makeAutoObservable, runInAction } from "mobx"
9
- import { Vector3 } from "three"
10
9
  import type { Vector3Simple } from "./JoggerConnection"
11
- import { jointValuesEqual, tcpMotionEqual } from "./motionStateUpdate"
10
+ import {
11
+ jointValuesEqual,
12
+ tcpMotionEqual,
13
+ unwrapRotationVector,
14
+ } from "./motionStateUpdate"
12
15
 
13
16
  const MOTION_DELTA_THRESHOLD = 0.0001
14
17
 
15
- function unwrapRotationVector(
16
- newRotationVectorApi: Vector3Simple,
17
- currentRotationVectorApi: Vector3Simple,
18
- ): Vector3Simple {
19
- const currentRotationVector = new Vector3(
20
- currentRotationVectorApi[0],
21
- currentRotationVectorApi[1],
22
- currentRotationVectorApi[2],
23
- )
24
-
25
- const newRotationVector = new Vector3(
26
- newRotationVectorApi[0],
27
- newRotationVectorApi[1],
28
- newRotationVectorApi[2],
29
- )
30
-
31
- const currentAngle = currentRotationVector.length()
32
- const currentAxis = currentRotationVector.normalize()
33
-
34
- let newAngle = newRotationVector.length()
35
- let newAxis = newRotationVector.normalize()
36
-
37
- // Align rotation axes
38
- if (newAxis.dot(currentAxis) < 0) {
39
- newAngle = -newAngle
40
- newAxis = newAxis.multiplyScalar(-1.0)
41
- }
42
-
43
- // Shift rotation angle close to previous one to extend domain of rotation angles beyond [0, pi]
44
- // - this simplifies interpolation and prevents abruptly changing signs of the rotation angles
45
- let angleDifference = newAngle - currentAngle
46
- angleDifference -=
47
- 2.0 * Math.PI * Math.floor((angleDifference + Math.PI) / (2.0 * Math.PI))
48
-
49
- newAngle = currentAngle + angleDifference
50
-
51
- return [...newAxis.multiplyScalar(newAngle)] as Vector3Simple
52
- }
53
-
54
18
  /**
55
19
  * Store representing the current state of a connected motion group.
56
20
  */
@@ -142,7 +106,8 @@ export class MotionStreamConnection {
142
106
  )
143
107
  ) {
144
108
  runInAction(() => {
145
- this.rapidlyChangingMotionState = latestMotionState
109
+ this.rapidlyChangingMotionState.joint_position =
110
+ latestMotionState.joint_position
146
111
  })
147
112
  }
148
113
 
@@ -1,4 +1,6 @@
1
1
  import type { MotionGroupState, Pose } from "@wandelbots/nova-js/v2"
2
+ import type { Vector3Simple } from "./JoggerConnection"
3
+ import { Vector3 } from "three"
2
4
 
3
5
  export function jointValuesEqual(
4
6
  oldJointValues: number[],
@@ -74,3 +76,42 @@ export function tcpMotionEqual(
74
76
  )
75
77
  )
76
78
  }
79
+
80
+ export function unwrapRotationVector(
81
+ newRotationVectorApi: Vector3Simple,
82
+ currentRotationVectorApi: Vector3Simple,
83
+ ): Vector3Simple {
84
+ const currentRotationVector = new Vector3(
85
+ currentRotationVectorApi[0],
86
+ currentRotationVectorApi[1],
87
+ currentRotationVectorApi[2],
88
+ )
89
+
90
+ const newRotationVector = new Vector3(
91
+ newRotationVectorApi[0],
92
+ newRotationVectorApi[1],
93
+ newRotationVectorApi[2],
94
+ )
95
+
96
+ const currentAngle = currentRotationVector.length()
97
+ const currentAxis = currentRotationVector.normalize()
98
+
99
+ let newAngle = newRotationVector.length()
100
+ let newAxis = newRotationVector.normalize()
101
+
102
+ // Align rotation axes
103
+ if (newAxis.dot(currentAxis) < 0) {
104
+ newAngle = -newAngle
105
+ newAxis = newAxis.multiplyScalar(-1.0)
106
+ }
107
+
108
+ // Shift rotation angle close to previous one to extend domain of rotation angles beyond [0, pi]
109
+ // - this simplifies interpolation and prevents abruptly changing signs of the rotation angles
110
+ let angleDifference = newAngle - currentAngle
111
+ angleDifference -=
112
+ 2.0 * Math.PI * Math.floor((angleDifference + Math.PI) / (2.0 * Math.PI))
113
+
114
+ newAngle = currentAngle + angleDifference
115
+
116
+ return [...newAxis.multiplyScalar(newAngle)] as Vector3Simple
117
+ }