@kuriousdesign/machine-sdk 1.0.0 → 1.0.1

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 (91) hide show
  1. package/dist/custom-types/AppState.d.ts +92 -0
  2. package/dist/custom-types/AppState.js +70 -0
  3. package/dist/custom-types/Com.d.ts +16 -0
  4. package/dist/custom-types/Com.js +2 -0
  5. package/dist/custom-types/Devices/BaseDevice.d.ts +34 -0
  6. package/dist/custom-types/Devices/BaseDevice.js +2 -0
  7. package/dist/custom-types/GlobalConstants.d.ts +4 -0
  8. package/dist/custom-types/GlobalConstants.js +2 -0
  9. package/dist/custom-types/HMI.d.ts +46 -0
  10. package/dist/custom-types/HMI.js +2 -0
  11. package/dist/custom-types/Machine.d.ts +14 -0
  12. package/dist/custom-types/Machine.js +7 -0
  13. package/dist/custom-types/PartData.d.ts +11 -0
  14. package/dist/custom-types/PartData.js +2 -0
  15. package/dist/custom-types/RackData.d.ts +18 -0
  16. package/dist/custom-types/RackData.js +2 -0
  17. package/dist/custom-types/RecipeData.d.ts +7 -0
  18. package/dist/custom-types/RecipeData.js +2 -0
  19. package/dist/custom-types/RecipeManagerFB.d.ts +10 -0
  20. package/dist/custom-types/RecipeManagerFB.js +2 -0
  21. package/dist/custom-types/RobData.d.ts +24 -0
  22. package/dist/custom-types/RobData.js +2 -0
  23. package/dist/custom-types/TaskQueue.d.ts +24 -0
  24. package/dist/custom-types/TaskQueue.js +2 -0
  25. package/dist/custom-types/UserManagerFB.d.ts +7 -0
  26. package/dist/custom-types/UserManagerFB.js +2 -0
  27. package/dist/custom-types/index.d.ts +12 -0
  28. package/dist/custom-types/index.js +28 -0
  29. package/dist/enums/Colors.d.ts +62 -0
  30. package/dist/enums/Colors.js +76 -0
  31. package/dist/enums/DeviceId.d.ts +10 -0
  32. package/dist/enums/DeviceId.js +14 -0
  33. package/dist/enums/Errors.d.ts +6 -0
  34. package/dist/enums/Errors.js +28 -0
  35. package/dist/enums/ExtrusionType.d.ts +4 -0
  36. package/dist/enums/ExtrusionType.js +9 -0
  37. package/dist/enums/OpcuaDatatype.d.ts +28 -0
  38. package/dist/enums/OpcuaDatatype.js +32 -0
  39. package/dist/enums/Pages.d.ts +18 -0
  40. package/dist/enums/Pages.js +22 -0
  41. package/dist/enums/Priorities.d.ts +18 -0
  42. package/dist/enums/Priorities.js +24 -0
  43. package/dist/enums/RobPositions.d.ts +12 -0
  44. package/dist/enums/RobPositions.js +16 -0
  45. package/dist/enums/States.d.ts +54 -0
  46. package/dist/enums/States.js +63 -0
  47. package/dist/enums/TaskId.d.ts +35 -0
  48. package/dist/enums/TaskId.js +40 -0
  49. package/dist/enums/Warnings.d.ts +6 -0
  50. package/dist/enums/Warnings.js +18 -0
  51. package/dist/enums/index.d.ts +11 -0
  52. package/dist/enums/index.js +27 -0
  53. package/dist/functions/colorMapping.d.ts +4 -0
  54. package/dist/functions/colorMapping.js +42 -0
  55. package/dist/functions/index.d.ts +2 -0
  56. package/dist/functions/index.js +18 -0
  57. package/dist/functions/topicMapping.d.ts +1 -0
  58. package/dist/functions/topicMapping.js +9 -0
  59. package/dist/index.d.ts +3 -16
  60. package/dist/index.js +17 -21
  61. package/package.json +8 -3
  62. package/src/custom-types/AppState.ts +116 -0
  63. package/src/custom-types/Com.ts +19 -0
  64. package/src/custom-types/Devices/BaseDevice.ts +41 -0
  65. package/src/custom-types/GlobalConstants.ts +4 -0
  66. package/src/custom-types/HMI.ts +52 -0
  67. package/src/custom-types/Machine.ts +23 -0
  68. package/src/custom-types/PartData.ts +11 -0
  69. package/src/custom-types/RackData.ts +21 -0
  70. package/src/custom-types/RecipeData.ts +7 -0
  71. package/src/custom-types/RecipeManagerFB.ts +11 -0
  72. package/src/custom-types/RobData.ts +27 -0
  73. package/src/custom-types/TaskQueue.ts +31 -0
  74. package/src/custom-types/UserManagerFB.ts +8 -0
  75. package/src/custom-types/index.ts +12 -0
  76. package/src/enums/Colors.ts +79 -0
  77. package/src/enums/DeviceId.ts +10 -0
  78. package/src/enums/Errors.ts +30 -0
  79. package/src/enums/ExtrusionType.ts +5 -0
  80. package/src/enums/OpcuaDatatype.ts +28 -0
  81. package/src/enums/Pages.ts +21 -0
  82. package/src/enums/Priorities.ts +21 -0
  83. package/src/enums/RobPositions.ts +12 -0
  84. package/src/enums/States.ts +59 -0
  85. package/src/enums/TaskId.ts +37 -0
  86. package/src/enums/Warnings.ts +20 -0
  87. package/src/enums/index.ts +11 -0
  88. package/src/functions/colorMapping.ts +42 -0
  89. package/src/functions/index.ts +2 -0
  90. package/src/functions/topicMapping.ts +6 -0
  91. package/src/index.ts +3 -34
@@ -0,0 +1,59 @@
1
+ export enum VisibilityState {
2
+ Invisible = 0,
3
+ Visible = 1,
4
+ FlashingFast = 2,
5
+ FlashingMed = 3,
6
+ FlashingSlow = 4,
7
+ StrobingFast = 5,
8
+ StrobingSlow = 6,
9
+ GrowingSlow = 7,
10
+ }
11
+
12
+ export enum DeviceState {
13
+ Faulted = -2,
14
+ Killed = -1,
15
+ Inactive = 0,
16
+ Resetting = 50,
17
+ Idle = 100,
18
+ Running = 500,
19
+ Stopping = 900,
20
+ Aborting = 911,
21
+ Paused = 999,
22
+ Done = 1000,
23
+ Manual = 2000,
24
+ }
25
+
26
+ export enum PartState {
27
+ Empty = 0, //no part present
28
+ Raw = 10,
29
+ DeburrBottomStarted = 11,
30
+ DeburrBottomFinished = 12,
31
+ DeburrTopStarted = 15,
32
+ Deburred = 20, //completely deburred, both bottom and top
33
+ MachiningStarted = 45,
34
+ Machined = 50,
35
+ WashStarted = 55,
36
+ Washed = 60,
37
+ DryStarted = 65,
38
+ Dryed = 70,
39
+ Finished = 100,
40
+ Scrapped = 911,
41
+ Error = 999,
42
+ }
43
+
44
+ export enum TaskItemState {
45
+ TaskDone = 48,
46
+ TaskActive = 49,
47
+ TaskFuture = 50,
48
+ }
49
+
50
+ export enum StatusMsg {
51
+ Running = 0,
52
+ Faulted = 2,
53
+ }
54
+
55
+ export enum BannerMode {
56
+ Good = 0,
57
+ Warning = 1,
58
+ Faulted = 2,
59
+ }
@@ -0,0 +1,37 @@
1
+ export enum TaskId {
2
+ NoTask = 0,
3
+ WayPointMove = 1, //use endPositionId as the destination to communicate to robot, all other parameters are useless.
4
+ PickRawShelf_R = 2, //pick raw shelf with Right Gripper, left gripper must be empty
5
+ DeburrBottom_R = 3, //Right Gripper Side Only, params(top/bottom/both
6
+ DeburrTop_R = 4, //Right Gripper Side Only, params(top/bottom/both
7
+ LoadPreOp2_L = 5, //rarely used (only be used if robot were ready to load cnc but had to abandon that to go wash parts or something like that), position 2 on pre op is on the right, left gripper must be empty
8
+ LoadPreOp2_R = 6, //position 2 on pre op is on the right, left gripper must be empty
9
+ LoadPreOp1_R = 7, //position 1 on pre op is on the left
10
+ PickPreOp1_R = 8, //position 1 on pre op is on the left
11
+ PickPreOp2_L = 9, //position 2 on pre op is on the right
12
+ LoadCnc2_L = 10,
13
+ LoadCnc1_R = 11,
14
+ PickCnc1_R = 12,
15
+ PickCnc2_L = 13,
16
+ LoadPostOp2_L = 14,
17
+ LoadPostOp1_R = 15,
18
+ PickPostOp1_R = 16,
19
+ PickPostOp2_L = 17,
20
+ PickPostOp2_R = 18, //left gripper must be empty
21
+ WashAndDry = 19,
22
+ LoadDoneShelf_R = 20, //uses a PLC PR offset for done shelf user frame
23
+ RejectPart_L = 21, //start and end at rack perch
24
+ RejectPart_R = 22, //start and end at rack perch
25
+ WaitToUnload = 23, //MARTIN WE WILL USE WayPointMove FOR THIS,
26
+ WaitToLoad = 24, //MARTIN WE WILL USE WayPointMove FOR THIS, wait in front of cnc with deburred parts in both robot gripppers, only used when cnc is empty and waiting to be filled, REPLACE WITH WAYPOINT MOVE?
27
+ ExitCnc = 25, //MARTIN WE WILL USE WayPointMove FOR THIS, move from cnc hover position to cnc perch position, REPLACE WITH WAYPOINT MOVE?
28
+ EnterCnc = 26, //MARTIN WE WILL USE WayPointMove FOR THIS, move to cnc hover position, MARTIN WE WILL USE WayPointMove FOR THIS
29
+
30
+ //non-robot tasks
31
+ ChangeCncProgram = 27,
32
+ StartCnc = 28,
33
+ StopCnc = 29,
34
+ ResetCnc = 30,
35
+ OpenCncDoor = 31,
36
+ CloseCncDoor = 32,
37
+ }
@@ -0,0 +1,20 @@
1
+ import { DeviceId } from "./DeviceId";
2
+
3
+ export const WarningsMap: {
4
+ [key in DeviceId]: {
5
+ [key: number]: string;
6
+ };
7
+ } = {
8
+ [DeviceId.SYS]: {
9
+ //refer to SysWarnings enum in CoDeSys for mapping
10
+ },
11
+ [DeviceId.RACK]: {
12
+ //refer to RackWarnings enum in CoDeSys for mapping
13
+ },
14
+ [DeviceId.CNC]: {},
15
+ [DeviceId.CON]: {},
16
+ [DeviceId.DBRR]: {},
17
+ [DeviceId.ROB]: {},
18
+ [DeviceId.SFTY]: {},
19
+ [DeviceId.WASH]: {},
20
+ };
@@ -0,0 +1,11 @@
1
+ export * from "./Colors";
2
+ export * from "./States";
3
+ export * from "./OpcuaDatatype";
4
+ export * from "./ExtrusionType";
5
+ export * from "./Warnings";
6
+ export * from "./Errors";
7
+ export * from "./DeviceId";
8
+ export * from "./TaskId";
9
+ export * from "./Priorities";
10
+ export * from "./Pages";
11
+ export * from "./RobPositions";
@@ -0,0 +1,42 @@
1
+ import { Color } from "../enums/Colors";
2
+ import { DeviceState, PartState } from "../enums/States";
3
+
4
+ export function deviceStateToColorMap(state: DeviceState): Color {
5
+ const colorMap: { [key in DeviceState]: Color } = {
6
+ [DeviceState.Killed]: Color.Black,
7
+ [DeviceState.Inactive]: Color.Inactive,
8
+ [DeviceState.Resetting]: Color.Resetting,
9
+ [DeviceState.Idle]: Color.Idle,
10
+ [DeviceState.Running]: Color.Running,
11
+ [DeviceState.Stopping]: Color.Processing,
12
+ [DeviceState.Done]: Color.Done,
13
+ [DeviceState.Aborting]: Color.Error,
14
+ [DeviceState.Manual]: Color.Manual,
15
+ [DeviceState.Paused]: Color.Processing,
16
+ [DeviceState.Faulted]: Color.Error,
17
+ };
18
+
19
+ return colorMap[state];
20
+ }
21
+
22
+ export function partStateToColorMap(state: PartState): Color {
23
+ const colorMap: { [key in PartState]: Color } = {
24
+ [PartState.Empty]: Color.Empty,
25
+ [PartState.Raw]: Color.Raw,
26
+ [PartState.DeburrBottomStarted]: Color.Processing,
27
+ [PartState.DeburrBottomFinished]: Color.DeburrBottomFinished,
28
+ [PartState.DeburrTopStarted]: Color.Processing,
29
+ [PartState.Deburred]: Color.Deburred,
30
+ [PartState.MachiningStarted]: Color.Processing,
31
+ [PartState.Machined]: Color.Machined,
32
+ [PartState.WashStarted]: Color.Processing,
33
+ [PartState.Washed]: Color.Processing,
34
+ [PartState.DryStarted]: Color.Processing,
35
+ [PartState.Dryed]: Color.Dryed,
36
+ [PartState.Finished]: Color.Finished,
37
+ [PartState.Scrapped]: Color.Scrapped,
38
+ [PartState.Error]: Color.Error,
39
+ };
40
+
41
+ return colorMap[state];
42
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./colorMapping";
2
+ export * from "./topicMapping";
@@ -0,0 +1,6 @@
1
+ export function machineIdToTopicMap(id: string): string {
2
+ const topicMap: { [key in string]: string } = {
3
+ "BendPro G2 Demo": "BendProG2/2286/198C/#",
4
+ };
5
+ return topicMap[id];
6
+ }
package/src/index.ts CHANGED
@@ -1,34 +1,3 @@
1
- // Data Types
2
- export interface Machine {
3
- id: string;
4
- name: string;
5
- status: 'idle' | 'running' | 'stopped' | 'error';
6
- lastUpdated: Date;
7
- }
8
-
9
- export interface SensorData {
10
- machineId: string;
11
- temperature: number;
12
- pressure: number;
13
- timestamp: Date;
14
- }
15
-
16
- // Helper Functions
17
- export function formatTimestamp(timestamp: Date): string {
18
- return timestamp.toISOString();
19
- }
20
-
21
- export function isMachineActive(machine: Machine): boolean {
22
- return machine.status === 'running';
23
- }
24
-
25
- export function calculateAverageTemperature(data: SensorData[]): number {
26
- if (data.length === 0) return 0;
27
- const total = data.reduce((sum, reading) => sum + reading.temperature, 0);
28
- return Number((total / data.length).toFixed(2));
29
- }
30
-
31
- export function validateMachineId(id: string): boolean {
32
- const idRegex = /^[A-Za-z0-9-_]{1,36}$/;
33
- return idRegex.test(id);
34
- }
1
+ export * from "./custom-types";
2
+ export * from "./enums";
3
+ export * from "./functions";