@kuriousdesign/machine-sdk 1.0.0 → 1.0.2
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/dist/custom-types/AppState.d.ts +92 -0
- package/dist/custom-types/AppState.js +70 -0
- package/dist/custom-types/Com.d.ts +16 -0
- package/dist/custom-types/Com.js +2 -0
- package/dist/custom-types/Devices/Axis.d.ts +104 -0
- package/dist/custom-types/Devices/Axis.js +8 -0
- package/dist/custom-types/Devices/BaseDevice.d.ts +34 -0
- package/dist/custom-types/Devices/BaseDevice.js +2 -0
- package/dist/custom-types/Devices/Device.d.ts +74 -0
- package/dist/custom-types/Devices/Device.js +71 -0
- package/dist/custom-types/Devices/deviceTypes.d.ts +7 -0
- package/dist/custom-types/Devices/deviceTypes.js +11 -0
- package/dist/custom-types/Devices/index.d.ts +2 -0
- package/dist/custom-types/Devices/index.js +18 -0
- package/dist/custom-types/GlobalConstants.d.ts +4 -0
- package/dist/custom-types/GlobalConstants.js +2 -0
- package/dist/custom-types/HMI.d.ts +46 -0
- package/dist/custom-types/HMI.js +2 -0
- package/dist/custom-types/Machine.d.ts +14 -0
- package/dist/custom-types/Machine.js +7 -0
- package/dist/custom-types/PartData.d.ts +11 -0
- package/dist/custom-types/PartData.js +2 -0
- package/dist/custom-types/RackData.d.ts +18 -0
- package/dist/custom-types/RackData.js +2 -0
- package/dist/custom-types/RecipeData.d.ts +7 -0
- package/dist/custom-types/RecipeData.js +2 -0
- package/dist/custom-types/RecipeManagerFB.d.ts +10 -0
- package/dist/custom-types/RecipeManagerFB.js +2 -0
- package/dist/custom-types/RobData.d.ts +24 -0
- package/dist/custom-types/RobData.js +2 -0
- package/dist/custom-types/TaskQueue.d.ts +24 -0
- package/dist/custom-types/TaskQueue.js +2 -0
- package/dist/custom-types/UserManagerFB.d.ts +7 -0
- package/dist/custom-types/UserManagerFB.js +2 -0
- package/dist/custom-types/index.d.ts +13 -0
- package/dist/custom-types/index.js +29 -0
- package/dist/enums/Colors.d.ts +62 -0
- package/dist/enums/Colors.js +76 -0
- package/dist/enums/DeviceId.d.ts +10 -0
- package/dist/enums/DeviceId.js +14 -0
- package/dist/enums/Errors.d.ts +6 -0
- package/dist/enums/Errors.js +28 -0
- package/dist/enums/ExtrusionType.d.ts +4 -0
- package/dist/enums/ExtrusionType.js +9 -0
- package/dist/enums/OpcuaDatatype.d.ts +28 -0
- package/dist/enums/OpcuaDatatype.js +32 -0
- package/dist/enums/Pages.d.ts +18 -0
- package/dist/enums/Pages.js +22 -0
- package/dist/enums/Priorities.d.ts +18 -0
- package/dist/enums/Priorities.js +24 -0
- package/dist/enums/RobPositions.d.ts +12 -0
- package/dist/enums/RobPositions.js +16 -0
- package/dist/enums/States.d.ts +54 -0
- package/dist/enums/States.js +63 -0
- package/dist/enums/TaskId.d.ts +35 -0
- package/dist/enums/TaskId.js +40 -0
- package/dist/enums/Warnings.d.ts +6 -0
- package/dist/enums/Warnings.js +18 -0
- package/dist/enums/index.d.ts +11 -0
- package/dist/enums/index.js +27 -0
- package/dist/functions/colorMapping.d.ts +4 -0
- package/dist/functions/colorMapping.js +42 -0
- package/dist/functions/index.d.ts +2 -0
- package/dist/functions/index.js +18 -0
- package/dist/functions/topicMapping.d.ts +1 -0
- package/dist/functions/topicMapping.js +9 -0
- package/dist/index.d.ts +4 -16
- package/dist/index.js +18 -21
- package/dist/plc-tags/index.d.ts +19 -0
- package/dist/plc-tags/index.js +37 -0
- package/dist/plc-tags/mqtt.d.ts +7 -0
- package/dist/plc-tags/mqtt.js +6 -0
- package/dist/plc-tags/opcua.d.ts +2 -0
- package/dist/plc-tags/opcua.js +5 -0
- package/package.json +8 -3
- package/src/custom-types/AppState.ts +116 -0
- package/src/custom-types/Com.ts +19 -0
- package/src/custom-types/Devices/Axis.ts +159 -0
- package/src/custom-types/Devices/Device.ts +168 -0
- package/src/custom-types/Devices/DeviceTypes.ts +7 -0
- package/src/custom-types/Devices/index.ts +2 -0
- package/src/custom-types/GlobalConstants.ts +4 -0
- package/src/custom-types/HMI.ts +52 -0
- package/src/custom-types/Machine.ts +23 -0
- package/src/custom-types/PartData.ts +11 -0
- package/src/custom-types/RackData.ts +21 -0
- package/src/custom-types/RecipeData.ts +7 -0
- package/src/custom-types/RecipeManagerFB.ts +11 -0
- package/src/custom-types/RobData.ts +27 -0
- package/src/custom-types/TaskQueue.ts +31 -0
- package/src/custom-types/UserManagerFB.ts +8 -0
- package/src/custom-types/index.ts +13 -0
- package/src/enums/Colors.ts +79 -0
- package/src/enums/DeviceId.ts +10 -0
- package/src/enums/Errors.ts +30 -0
- package/src/enums/ExtrusionType.ts +5 -0
- package/src/enums/OpcuaDatatype.ts +28 -0
- package/src/enums/Pages.ts +21 -0
- package/src/enums/Priorities.ts +21 -0
- package/src/enums/RobPositions.ts +12 -0
- package/src/enums/States.ts +59 -0
- package/src/enums/TaskId.ts +37 -0
- package/src/enums/Warnings.ts +20 -0
- package/src/enums/index.ts +11 -0
- package/src/functions/colorMapping.ts +42 -0
- package/src/functions/index.ts +2 -0
- package/src/functions/topicMapping.ts +6 -0
- package/src/index.ts +4 -34
- package/src/plc-tags/index.ts +24 -0
- package/src/plc-tags/mqtt.ts +8 -0
- package/src/plc-tags/opcua.ts +3 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare 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
|
+
ChangeCncProgram = 27,
|
|
30
|
+
StartCnc = 28,
|
|
31
|
+
StopCnc = 29,
|
|
32
|
+
ResetCnc = 30,
|
|
33
|
+
OpenCncDoor = 31,
|
|
34
|
+
CloseCncDoor = 32
|
|
35
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskId = void 0;
|
|
4
|
+
var TaskId;
|
|
5
|
+
(function (TaskId) {
|
|
6
|
+
TaskId[TaskId["NoTask"] = 0] = "NoTask";
|
|
7
|
+
TaskId[TaskId["WayPointMove"] = 1] = "WayPointMove";
|
|
8
|
+
TaskId[TaskId["PickRawShelf_R"] = 2] = "PickRawShelf_R";
|
|
9
|
+
TaskId[TaskId["DeburrBottom_R"] = 3] = "DeburrBottom_R";
|
|
10
|
+
TaskId[TaskId["DeburrTop_R"] = 4] = "DeburrTop_R";
|
|
11
|
+
TaskId[TaskId["LoadPreOp2_L"] = 5] = "LoadPreOp2_L";
|
|
12
|
+
TaskId[TaskId["LoadPreOp2_R"] = 6] = "LoadPreOp2_R";
|
|
13
|
+
TaskId[TaskId["LoadPreOp1_R"] = 7] = "LoadPreOp1_R";
|
|
14
|
+
TaskId[TaskId["PickPreOp1_R"] = 8] = "PickPreOp1_R";
|
|
15
|
+
TaskId[TaskId["PickPreOp2_L"] = 9] = "PickPreOp2_L";
|
|
16
|
+
TaskId[TaskId["LoadCnc2_L"] = 10] = "LoadCnc2_L";
|
|
17
|
+
TaskId[TaskId["LoadCnc1_R"] = 11] = "LoadCnc1_R";
|
|
18
|
+
TaskId[TaskId["PickCnc1_R"] = 12] = "PickCnc1_R";
|
|
19
|
+
TaskId[TaskId["PickCnc2_L"] = 13] = "PickCnc2_L";
|
|
20
|
+
TaskId[TaskId["LoadPostOp2_L"] = 14] = "LoadPostOp2_L";
|
|
21
|
+
TaskId[TaskId["LoadPostOp1_R"] = 15] = "LoadPostOp1_R";
|
|
22
|
+
TaskId[TaskId["PickPostOp1_R"] = 16] = "PickPostOp1_R";
|
|
23
|
+
TaskId[TaskId["PickPostOp2_L"] = 17] = "PickPostOp2_L";
|
|
24
|
+
TaskId[TaskId["PickPostOp2_R"] = 18] = "PickPostOp2_R";
|
|
25
|
+
TaskId[TaskId["WashAndDry"] = 19] = "WashAndDry";
|
|
26
|
+
TaskId[TaskId["LoadDoneShelf_R"] = 20] = "LoadDoneShelf_R";
|
|
27
|
+
TaskId[TaskId["RejectPart_L"] = 21] = "RejectPart_L";
|
|
28
|
+
TaskId[TaskId["RejectPart_R"] = 22] = "RejectPart_R";
|
|
29
|
+
TaskId[TaskId["WaitToUnload"] = 23] = "WaitToUnload";
|
|
30
|
+
TaskId[TaskId["WaitToLoad"] = 24] = "WaitToLoad";
|
|
31
|
+
TaskId[TaskId["ExitCnc"] = 25] = "ExitCnc";
|
|
32
|
+
TaskId[TaskId["EnterCnc"] = 26] = "EnterCnc";
|
|
33
|
+
//non-robot tasks
|
|
34
|
+
TaskId[TaskId["ChangeCncProgram"] = 27] = "ChangeCncProgram";
|
|
35
|
+
TaskId[TaskId["StartCnc"] = 28] = "StartCnc";
|
|
36
|
+
TaskId[TaskId["StopCnc"] = 29] = "StopCnc";
|
|
37
|
+
TaskId[TaskId["ResetCnc"] = 30] = "ResetCnc";
|
|
38
|
+
TaskId[TaskId["OpenCncDoor"] = 31] = "OpenCncDoor";
|
|
39
|
+
TaskId[TaskId["CloseCncDoor"] = 32] = "CloseCncDoor";
|
|
40
|
+
})(TaskId || (exports.TaskId = TaskId = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarningsMap = void 0;
|
|
4
|
+
const DeviceId_1 = require("./DeviceId");
|
|
5
|
+
exports.WarningsMap = {
|
|
6
|
+
[DeviceId_1.DeviceId.SYS]: {
|
|
7
|
+
//refer to SysWarnings enum in CoDeSys for mapping
|
|
8
|
+
},
|
|
9
|
+
[DeviceId_1.DeviceId.RACK]: {
|
|
10
|
+
//refer to RackWarnings enum in CoDeSys for mapping
|
|
11
|
+
},
|
|
12
|
+
[DeviceId_1.DeviceId.CNC]: {},
|
|
13
|
+
[DeviceId_1.DeviceId.CON]: {},
|
|
14
|
+
[DeviceId_1.DeviceId.DBRR]: {},
|
|
15
|
+
[DeviceId_1.DeviceId.ROB]: {},
|
|
16
|
+
[DeviceId_1.DeviceId.SFTY]: {},
|
|
17
|
+
[DeviceId_1.DeviceId.WASH]: {},
|
|
18
|
+
};
|
|
@@ -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,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Colors"), exports);
|
|
18
|
+
__exportStar(require("./States"), exports);
|
|
19
|
+
__exportStar(require("./OpcuaDatatype"), exports);
|
|
20
|
+
__exportStar(require("./ExtrusionType"), exports);
|
|
21
|
+
__exportStar(require("./Warnings"), exports);
|
|
22
|
+
__exportStar(require("./Errors"), exports);
|
|
23
|
+
__exportStar(require("./DeviceId"), exports);
|
|
24
|
+
__exportStar(require("./TaskId"), exports);
|
|
25
|
+
__exportStar(require("./Priorities"), exports);
|
|
26
|
+
__exportStar(require("./Pages"), exports);
|
|
27
|
+
__exportStar(require("./RobPositions"), exports);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deviceStateToColorMap = deviceStateToColorMap;
|
|
4
|
+
exports.partStateToColorMap = partStateToColorMap;
|
|
5
|
+
const Colors_1 = require("../enums/Colors");
|
|
6
|
+
const States_1 = require("../enums/States");
|
|
7
|
+
function deviceStateToColorMap(state) {
|
|
8
|
+
const colorMap = {
|
|
9
|
+
[States_1.DeviceState.Killed]: Colors_1.Color.Black,
|
|
10
|
+
[States_1.DeviceState.Inactive]: Colors_1.Color.Inactive,
|
|
11
|
+
[States_1.DeviceState.Resetting]: Colors_1.Color.Resetting,
|
|
12
|
+
[States_1.DeviceState.Idle]: Colors_1.Color.Idle,
|
|
13
|
+
[States_1.DeviceState.Running]: Colors_1.Color.Running,
|
|
14
|
+
[States_1.DeviceState.Stopping]: Colors_1.Color.Processing,
|
|
15
|
+
[States_1.DeviceState.Done]: Colors_1.Color.Done,
|
|
16
|
+
[States_1.DeviceState.Aborting]: Colors_1.Color.Error,
|
|
17
|
+
[States_1.DeviceState.Manual]: Colors_1.Color.Manual,
|
|
18
|
+
[States_1.DeviceState.Paused]: Colors_1.Color.Processing,
|
|
19
|
+
[States_1.DeviceState.Faulted]: Colors_1.Color.Error,
|
|
20
|
+
};
|
|
21
|
+
return colorMap[state];
|
|
22
|
+
}
|
|
23
|
+
function partStateToColorMap(state) {
|
|
24
|
+
const colorMap = {
|
|
25
|
+
[States_1.PartState.Empty]: Colors_1.Color.Empty,
|
|
26
|
+
[States_1.PartState.Raw]: Colors_1.Color.Raw,
|
|
27
|
+
[States_1.PartState.DeburrBottomStarted]: Colors_1.Color.Processing,
|
|
28
|
+
[States_1.PartState.DeburrBottomFinished]: Colors_1.Color.DeburrBottomFinished,
|
|
29
|
+
[States_1.PartState.DeburrTopStarted]: Colors_1.Color.Processing,
|
|
30
|
+
[States_1.PartState.Deburred]: Colors_1.Color.Deburred,
|
|
31
|
+
[States_1.PartState.MachiningStarted]: Colors_1.Color.Processing,
|
|
32
|
+
[States_1.PartState.Machined]: Colors_1.Color.Machined,
|
|
33
|
+
[States_1.PartState.WashStarted]: Colors_1.Color.Processing,
|
|
34
|
+
[States_1.PartState.Washed]: Colors_1.Color.Processing,
|
|
35
|
+
[States_1.PartState.DryStarted]: Colors_1.Color.Processing,
|
|
36
|
+
[States_1.PartState.Dryed]: Colors_1.Color.Dryed,
|
|
37
|
+
[States_1.PartState.Finished]: Colors_1.Color.Finished,
|
|
38
|
+
[States_1.PartState.Scrapped]: Colors_1.Color.Scrapped,
|
|
39
|
+
[States_1.PartState.Error]: Colors_1.Color.Error,
|
|
40
|
+
};
|
|
41
|
+
return colorMap[state];
|
|
42
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./colorMapping"), exports);
|
|
18
|
+
__exportStar(require("./topicMapping"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function machineIdToTopicMap(id: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.machineIdToTopicMap = machineIdToTopicMap;
|
|
4
|
+
function machineIdToTopicMap(id) {
|
|
5
|
+
const topicMap = {
|
|
6
|
+
"BendPro G2 Demo": "BendProG2/2286/198C/#",
|
|
7
|
+
};
|
|
8
|
+
return topicMap[id];
|
|
9
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
lastUpdated: Date;
|
|
6
|
-
}
|
|
7
|
-
export interface SensorData {
|
|
8
|
-
machineId: string;
|
|
9
|
-
temperature: number;
|
|
10
|
-
pressure: number;
|
|
11
|
-
timestamp: Date;
|
|
12
|
-
}
|
|
13
|
-
export declare function formatTimestamp(timestamp: Date): string;
|
|
14
|
-
export declare function isMachineActive(machine: Machine): boolean;
|
|
15
|
-
export declare function calculateAverageTemperature(data: SensorData[]): number;
|
|
16
|
-
export declare function validateMachineId(id: string): boolean;
|
|
1
|
+
export * from "./custom-types";
|
|
2
|
+
export * from "./enums";
|
|
3
|
+
export * from "./functions";
|
|
4
|
+
export * from "./plc-tags";
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
exports
|
|
5
|
-
exports
|
|
6
|
-
exports
|
|
7
|
-
// Helper Functions
|
|
8
|
-
function formatTimestamp(timestamp) {
|
|
9
|
-
return timestamp.toISOString();
|
|
10
|
-
}
|
|
11
|
-
function isMachineActive(machine) {
|
|
12
|
-
return machine.status === 'running';
|
|
13
|
-
}
|
|
14
|
-
function calculateAverageTemperature(data) {
|
|
15
|
-
if (data.length === 0)
|
|
16
|
-
return 0;
|
|
17
|
-
const total = data.reduce((sum, reading) => sum + reading.temperature, 0);
|
|
18
|
-
return Number((total / data.length).toFixed(2));
|
|
19
|
-
}
|
|
20
|
-
function validateMachineId(id) {
|
|
21
|
-
const idRegex = /^[A-Za-z0-9-_]{1,36}$/;
|
|
22
|
-
return idRegex.test(id);
|
|
23
|
-
}
|
|
17
|
+
__exportStar(require("./custom-types"), exports);
|
|
18
|
+
__exportStar(require("./enums"), exports);
|
|
19
|
+
__exportStar(require("./functions"), exports);
|
|
20
|
+
__exportStar(require("./plc-tags"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const PlcNamespaces: {
|
|
2
|
+
Machine: string;
|
|
3
|
+
MachineHw: string;
|
|
4
|
+
Main: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const MachineTags: {
|
|
7
|
+
deviceStore: string;
|
|
8
|
+
registeredDevices: string;
|
|
9
|
+
axisStsArray: string;
|
|
10
|
+
HeartbeatPLC: string;
|
|
11
|
+
HeartbeatHMI: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const DeviceTags: {
|
|
14
|
+
Cfg: string;
|
|
15
|
+
Is: string;
|
|
16
|
+
Registration: string;
|
|
17
|
+
};
|
|
18
|
+
export * from "./opcua";
|
|
19
|
+
export * from "./mqtt";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.DeviceTags = exports.MachineTags = exports.PlcNamespaces = void 0;
|
|
18
|
+
exports.PlcNamespaces = {
|
|
19
|
+
Machine: 'Machine',
|
|
20
|
+
MachineHw: 'MachineHw',
|
|
21
|
+
Main: 'Main'
|
|
22
|
+
};
|
|
23
|
+
exports.MachineTags = {
|
|
24
|
+
deviceStore: 'Devices',
|
|
25
|
+
//deviceTypeStore: 'DeviceTypes',
|
|
26
|
+
registeredDevices: 'RegisteredDevices',
|
|
27
|
+
axisStsArray: 'AxisStsArray',
|
|
28
|
+
HeartbeatPLC: 'HeartbeatPLC',
|
|
29
|
+
HeartbeatHMI: 'HeartbeatHMI'
|
|
30
|
+
};
|
|
31
|
+
exports.DeviceTags = {
|
|
32
|
+
Cfg: 'Cfg',
|
|
33
|
+
Is: 'Is',
|
|
34
|
+
Registration: 'Registration',
|
|
35
|
+
};
|
|
36
|
+
__exportStar(require("./opcua"), exports);
|
|
37
|
+
__exportStar(require("./mqtt"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kuriousdesign/machine-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Shared data types and helpers for machine-related repositories",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
11
|
-
"keywords": [
|
|
11
|
+
"keywords": [
|
|
12
|
+
"machine",
|
|
13
|
+
"sdk",
|
|
14
|
+
"data-types",
|
|
15
|
+
"helpers"
|
|
16
|
+
],
|
|
12
17
|
"author": "kuriousdesign (https://github.com/kuriousDesign)",
|
|
13
18
|
"license": "MIT",
|
|
14
19
|
"devDependencies": {
|
|
@@ -22,4 +27,4 @@
|
|
|
22
27
|
"url": "https://github.com/kuriousDesign/machine-sdk/issues"
|
|
23
28
|
},
|
|
24
29
|
"homepage": "https://github.com/kuriousDesign/machine-sdk#readme"
|
|
25
|
-
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { PartState, Page } from "../enums";
|
|
2
|
+
import { ButtonBar, StatusBar } from "./HMI";
|
|
3
|
+
import { PartData } from "./PartData";
|
|
4
|
+
import { Device } from "./Devices/Device";
|
|
5
|
+
import { GlobalConstants } from "./GlobalConstants";
|
|
6
|
+
import {
|
|
7
|
+
RackData,
|
|
8
|
+
RackHmiPbs,
|
|
9
|
+
RecipeData,
|
|
10
|
+
RecipeManagerPbs,
|
|
11
|
+
RobPositionData,
|
|
12
|
+
SystemFaultData,
|
|
13
|
+
TaskQueue,
|
|
14
|
+
UserData,
|
|
15
|
+
UserManagerFB,
|
|
16
|
+
RobData,
|
|
17
|
+
} from ".";
|
|
18
|
+
|
|
19
|
+
export enum NodeId {
|
|
20
|
+
// new node ids
|
|
21
|
+
ButtonBar = "Main.HMI.ButtonBar",
|
|
22
|
+
StatusBar = "Main.HMI.StatusBar",
|
|
23
|
+
RackPbs = "Main.HMI.RackPbs",
|
|
24
|
+
ROB = "Main.ROB",
|
|
25
|
+
CNC = "Main.CNC",
|
|
26
|
+
DBRR = "Main.DBRR",
|
|
27
|
+
WASH = "Main.WASH",
|
|
28
|
+
PartData = "Main.PartData",
|
|
29
|
+
TaskQueue = "Main.TaskQueue",
|
|
30
|
+
GlobalConstants = "GlobalConstants", // TODO: add this to monitored items
|
|
31
|
+
MachineUser = "Machine.User",
|
|
32
|
+
MachineErrors = "Machine.Errors",
|
|
33
|
+
MachineWarnings = "Machine.Warnings",
|
|
34
|
+
RackData = "Main.RackData",
|
|
35
|
+
RecipeData = "Main.RecipeData",
|
|
36
|
+
ActiveJobRecipe = "Main.Job.ActiveRecipe",
|
|
37
|
+
RecipeManagerState = "Main.RecipeManagerFB.State",
|
|
38
|
+
RecipeManagerPbs = "Main.RecipeManagerFB.Pbs",
|
|
39
|
+
RemoteControlPage = "Main.HMI.RemoteControlPage",
|
|
40
|
+
RobData = "Main.RobData",
|
|
41
|
+
|
|
42
|
+
// TODO: add following to montored items, correctly
|
|
43
|
+
UserManagerFB = "Main.UserManagerFB",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface AppState {
|
|
47
|
+
[NodeId.StatusBar]: StatusBar;
|
|
48
|
+
[NodeId.ButtonBar]: ButtonBar;
|
|
49
|
+
[NodeId.RackPbs]: RackHmiPbs;
|
|
50
|
+
[NodeId.ROB]: Device;
|
|
51
|
+
[NodeId.CNC]: Device;
|
|
52
|
+
[NodeId.DBRR]: Device;
|
|
53
|
+
[NodeId.WASH]: Device;
|
|
54
|
+
[NodeId.PartData]: PartData;
|
|
55
|
+
[NodeId.TaskQueue]: TaskQueue;
|
|
56
|
+
[NodeId.GlobalConstants]: GlobalConstants;
|
|
57
|
+
[NodeId.MachineUser]: UserData;
|
|
58
|
+
[NodeId.MachineErrors]: SystemFaultData;
|
|
59
|
+
[NodeId.MachineWarnings]: SystemFaultData;
|
|
60
|
+
[NodeId.RackData]: RackData;
|
|
61
|
+
[NodeId.RecipeData]: RecipeData[];
|
|
62
|
+
[NodeId.ActiveJobRecipe]: RecipeData;
|
|
63
|
+
[NodeId.RecipeManagerState]: number;
|
|
64
|
+
[NodeId.RecipeManagerPbs]: RecipeManagerPbs;
|
|
65
|
+
[NodeId.UserManagerFB]: UserManagerFB;
|
|
66
|
+
[NodeId.RemoteControlPage]: Page;
|
|
67
|
+
[NodeId.RobData]: RobData;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export enum InputNodeId {
|
|
71
|
+
ButtonBarStopBtnClick = "Main.HMI.ButtonBar.StopBtn.wasClicked",
|
|
72
|
+
ButtonBarUnloadbtnClick = "Main.HMI.ButtonBar.UnloadBtn.wasClicked",
|
|
73
|
+
ButtonBarUnlockbtnClick = "Main.HMI.ButtonBar.UnlockBtn.wasClicked",
|
|
74
|
+
ButtonBarEnergizebtnClick = "Main.HMI.ButtonBar.EnergizeBtn.wasClicked",
|
|
75
|
+
ButtonBarStartbtnClick = "Main.HMI.ButtonBar.StartBtn.wasClicked",
|
|
76
|
+
ButtonBarLockbtnClick = "Main.HMI.ButtonBar.LockBtn.wasClicked",
|
|
77
|
+
ButtonBarResetbtnClick = "Main.HMI.ButtonBar.ResetBtn.wasClicked",
|
|
78
|
+
ButtonBarJobchangeBtnClick = "Main.HMI.ButtonBar.JobChangeBtn.wasClicked",
|
|
79
|
+
ButtonBarClearFaultsBtnClick = "Main.HMI.ButtonBar.ClearFaultsBtn.wasClicked",
|
|
80
|
+
|
|
81
|
+
PartDataDoneShelf = "Main.PartData.DoneShelf",
|
|
82
|
+
PartDataRawShelf = "Main.PartData.RawShelf",
|
|
83
|
+
|
|
84
|
+
Username = "Machine.User.Username",
|
|
85
|
+
Password = "Machine.User.Password",
|
|
86
|
+
LoginBtnBlick = "Machine.User.HmiLoginBtn.wasClicked",
|
|
87
|
+
LogoutBtnBlick = "Machine.User.HmiLogoutBtn.wasClicked",
|
|
88
|
+
|
|
89
|
+
EditRawShelfBtnClick = "Main.HMI.RackPbs.EditRawShelfBtn.wasClicked",
|
|
90
|
+
EditDoneShelfBtnClick = "Main.HMI.RackPbs.EditDoneShelfBtn.wasClicked",
|
|
91
|
+
ShelfCancelBtnClick = "Main.HMI.RackPbs.CancelBtn.wasClicked",
|
|
92
|
+
ShelfSaveBtnClick = "Main.HMI.RackPbs.SaveBtn.wasClicked",
|
|
93
|
+
|
|
94
|
+
RecipeManagerEditBtnClick = "Main.recipeManagerFB.pbs.EditBtn.wasClicked",
|
|
95
|
+
RecipeManagerChangeBtnClick = "Main.recipeManagerFB.pbs.ChangeBtn.wasClicked",
|
|
96
|
+
RecipeManagerJobSetupBtnClick = "Main.recipeManagerFB.pbs.JobSetupBtn.wasClicked",
|
|
97
|
+
RecipeManagerActivateBtnClick = "Main.recipeManagerFB.pbs.ActivateBtn",
|
|
98
|
+
RecipeManagerCancelBtnClick = "Main.recipeManagerFB.pbs.CancelBtn",
|
|
99
|
+
RecipeManagerStartSetupBtnClick = "Main.recipeManagerFB.pbs.StartSetupBtn",
|
|
100
|
+
RecipeManagerFinishSetupBtnClick = "Main.recipeManagerFB.pbs.FinishSetupBtn",
|
|
101
|
+
|
|
102
|
+
RecipeData = "Main.RecipeData",
|
|
103
|
+
ActiveJobRecipe = "Machine.Job.ActiveRecipe",
|
|
104
|
+
JobBatchQuantity = "Machine.Job.BatchQty",
|
|
105
|
+
|
|
106
|
+
ActivePage = "Main.HMI.ActivePage",
|
|
107
|
+
|
|
108
|
+
CncPart1 = "Main.PartData.Cnc[0]",
|
|
109
|
+
CncPart2 = "Main.PartData.Cnc[1]",
|
|
110
|
+
PreOpPart1 = "Main.PartData.CncPreOp[0]",
|
|
111
|
+
PreOpPart2 = "Main.PartData.CncPreOp[1]",
|
|
112
|
+
PostOpPart1 = "Main.PartData.CncPostOp[0]",
|
|
113
|
+
PostOpPart2 = "Main.PartData.CncPostOp[1]",
|
|
114
|
+
RobotPart1 = "Main.PartData.Robot[0]",
|
|
115
|
+
RobotPart2 = "Main.PartData.Robot[1]",
|
|
116
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface NewValue {
|
|
2
|
+
nodeId: string;
|
|
3
|
+
value: any
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface UserInput {
|
|
7
|
+
nodeId: string;
|
|
8
|
+
nodeDataType: any;
|
|
9
|
+
value: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface LoginInput {
|
|
13
|
+
username: string,
|
|
14
|
+
password: string,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface RecipeDeleteInput {
|
|
18
|
+
index: number,
|
|
19
|
+
}
|