@kuriousdesign/machine-sdk 1.0.1 → 1.0.3

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.
@@ -1,7 +1,7 @@
1
1
  import { Page } from "../enums";
2
2
  import { ButtonBar, StatusBar } from "./HMI";
3
3
  import { PartData } from "./PartData";
4
- import { Device } from "./Devices/BaseDevice";
4
+ import { Device } from "./Devices/Device";
5
5
  import { GlobalConstants } from "./GlobalConstants";
6
6
  import { RackData, RackHmiPbs, RecipeData, RecipeManagerPbs, SystemFaultData, TaskQueue, UserData, UserManagerFB, RobData } from ".";
7
7
  export declare enum NodeId {
@@ -0,0 +1,104 @@
1
+ export declare enum AxisDriveTypes {
2
+ STINGRAY = 0,
3
+ BOSCH_FSOE = 1
4
+ }
5
+ export interface AxisCfg {
6
+ DriveType: AxisDriveTypes;
7
+ DriveId: number;
8
+ Unit: string;
9
+ AtPosTol: number;
10
+ IgnoreSoftwareLimits: boolean;
11
+ IgnoreLimitSwitches: boolean;
12
+ Ignores: boolean[];
13
+ SoftwareLimitPositive: number;
14
+ SoftwareLimitNegative: number;
15
+ OperationalPositionMin: number;
16
+ OperationalPositionMax: number;
17
+ HardStopPositive: number;
18
+ HardStopNegative: number;
19
+ SensorPositions: number[];
20
+ AxisType: number;
21
+ VerificationSensorOffsetFromZero: number;
22
+ SearchDistance: number;
23
+ hasRailBrakes: boolean;
24
+ AutoPositionVerifyDuringReset: boolean;
25
+ hasDynamicPositiveLimit: boolean;
26
+ hasDynamicNegativeLimit: boolean;
27
+ HomingToHardstopDir: number;
28
+ MaxCurrentWhileHomingToHardstop: number;
29
+ MaxCurrentNormalOperation: number;
30
+ updateScalingIsNeeded: boolean;
31
+ GearingPositionTolerance: number;
32
+ AxesPositionToleranceForSkew: number;
33
+ ShippingPosition: number;
34
+ KeepMasteredStatusAtStartup: boolean;
35
+ }
36
+ export interface AxisMotionProfileData {
37
+ speed: number;
38
+ acceleration: number;
39
+ jerk: number;
40
+ }
41
+ export interface AxisSts {
42
+ Cfg: AxisCfg;
43
+ actualPosition: number;
44
+ actualVelocity: number;
45
+ actualAcceleration: number;
46
+ ActualTorque: number;
47
+ ActualCurrent: number;
48
+ ActiveStreamType: number;
49
+ AxisRefState: number;
50
+ targetPosition: number;
51
+ targetSetpoint: number;
52
+ targetVelocity: number;
53
+ targetDir: number;
54
+ targetMaxCurrent: number;
55
+ targetTorque: number;
56
+ targetMotionProfileId: number;
57
+ targetMotionProfileData: AxisMotionProfileData;
58
+ TargetControllerMode: number;
59
+ setPosition: number;
60
+ setVelocity: number;
61
+ setAccel: number;
62
+ setTorque: number;
63
+ setJerk: number;
64
+ isEnabled: boolean;
65
+ isHoming: boolean;
66
+ isHomed: boolean;
67
+ isMastered: boolean;
68
+ mutingSwAndHwLimitsWhileHoming: boolean;
69
+ isStandstill: boolean;
70
+ isAtPosAndStandstill: boolean;
71
+ isJogging: boolean;
72
+ isMoving: boolean;
73
+ isGeared: boolean;
74
+ isTorquing: boolean;
75
+ DriveStatusMsg: string;
76
+ DriveHasError: boolean;
77
+ DriveIsStoppingMotor: boolean;
78
+ DriveStoppedMotor: boolean;
79
+ SoftMotionHasError: boolean;
80
+ SoftMotionErrorId: number;
81
+ ConfiguredSoftLimitTravelRange: number;
82
+ HomeOffsetFromZero: number;
83
+ CalculatedStoppingPosition: number;
84
+ TravelLimitNegative: number;
85
+ TravelLimitPositive: number;
86
+ RestrictedToSlow: boolean;
87
+ Sensors: boolean[];
88
+ targetEncoderSetpoint: number;
89
+ targetMasterAxisDevId: number;
90
+ targetMasterAxisRefPointer: any;
91
+ actualMasterAxisDevId: number;
92
+ actualMasterAxisRefPointer: any;
93
+ RecordedPosition: number;
94
+ ignoringRailBrakes: boolean;
95
+ EtherCatComms_OK: boolean;
96
+ RcHomingState: number;
97
+ RcControlMode: number;
98
+ isStreaming: boolean;
99
+ PositionDifference: number;
100
+ AxesPositionDifference_OK: boolean;
101
+ AxesPositionDifference_CORRECTABLE: boolean;
102
+ SkippingPositionCorrectionBeforeGearing: boolean;
103
+ DualAxisStopType: number;
104
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AxisDriveTypes = void 0;
4
+ var AxisDriveTypes;
5
+ (function (AxisDriveTypes) {
6
+ AxisDriveTypes[AxisDriveTypes["STINGRAY"] = 0] = "STINGRAY";
7
+ AxisDriveTypes[AxisDriveTypes["BOSCH_FSOE"] = 1] = "BOSCH_FSOE";
8
+ })(AxisDriveTypes || (exports.AxisDriveTypes = AxisDriveTypes = {}));
@@ -0,0 +1,74 @@
1
+ import { DeviceTypes } from './DeviceTypes';
2
+ export interface DeviceRegistration {
3
+ mnemonic: string;
4
+ id: number;
5
+ childIdArray: number[];
6
+ parentId: number;
7
+ deviceType: DeviceTypes;
8
+ }
9
+ export declare const initialDeviceRegistration: DeviceRegistration;
10
+ export interface DeviceCfg {
11
+ safetyZoneId: number;
12
+ controllableByHmi: boolean;
13
+ autoReset: boolean;
14
+ ignore: boolean;
15
+ }
16
+ export declare const initialDeviceCfg: DeviceCfg;
17
+ export interface FaultData {
18
+ DeviceId: number;
19
+ Code: number;
20
+ Msg: string;
21
+ AutoReset: boolean;
22
+ ResetFlag: boolean;
23
+ LogFlag: boolean;
24
+ TimeStamp: Date;
25
+ StepNum: number;
26
+ ParentStepNum: number;
27
+ }
28
+ export declare const initialFaultData: FaultData;
29
+ export interface DeviceFaultData {
30
+ List: FaultData[];
31
+ Present: boolean;
32
+ ChildrenPresent: boolean;
33
+ }
34
+ export declare const initialDeviceFaultData: DeviceFaultData;
35
+ export interface DeviceStatus {
36
+ state: number;
37
+ stepNum: number;
38
+ stepDescription: string;
39
+ colorCode: number;
40
+ statusMsg: string;
41
+ error: boolean;
42
+ killed: boolean;
43
+ inactive: boolean;
44
+ resetting: boolean;
45
+ idle: boolean;
46
+ running: boolean;
47
+ stopping: boolean;
48
+ paused: boolean;
49
+ aborting: boolean;
50
+ done: boolean;
51
+ manual: boolean;
52
+ idleOrError: boolean;
53
+ iifkm: boolean;
54
+ rri: boolean;
55
+ ipr: boolean;
56
+ kei: boolean;
57
+ runningOrStopping: boolean;
58
+ allChildrenIdle: boolean;
59
+ allChildrenKilled: boolean;
60
+ allChildrenInactive: boolean;
61
+ allChildrenIdleOrError: boolean;
62
+ commanderId: number;
63
+ recordingLogs: boolean;
64
+ }
65
+ export declare const initialDeviceStatus: DeviceStatus;
66
+ export interface Device {
67
+ is: DeviceStatus;
68
+ errors: DeviceFaultData;
69
+ warnings: DeviceFaultData;
70
+ registration: DeviceRegistration;
71
+ cfg: DeviceCfg;
72
+ connectionStatus: boolean;
73
+ }
74
+ export declare const initialDevice: Device;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initialDevice = exports.initialDeviceStatus = exports.initialDeviceFaultData = exports.initialFaultData = exports.initialDeviceCfg = exports.initialDeviceRegistration = void 0;
4
+ const DeviceTypes_1 = require("./DeviceTypes");
5
+ exports.initialDeviceRegistration = {
6
+ mnemonic: '',
7
+ id: 0,
8
+ childIdArray: [],
9
+ parentId: 0,
10
+ deviceType: DeviceTypes_1.DeviceTypes.Base // Assuming Unknown exists in DeviceTypes enum
11
+ };
12
+ exports.initialDeviceCfg = {
13
+ safetyZoneId: 0,
14
+ controllableByHmi: false,
15
+ autoReset: false,
16
+ ignore: false
17
+ };
18
+ exports.initialFaultData = {
19
+ DeviceId: 0,
20
+ Code: 0,
21
+ Msg: '',
22
+ AutoReset: false,
23
+ ResetFlag: false,
24
+ LogFlag: false,
25
+ TimeStamp: new Date(),
26
+ StepNum: 0,
27
+ ParentStepNum: 0
28
+ };
29
+ exports.initialDeviceFaultData = {
30
+ List: [],
31
+ Present: false,
32
+ ChildrenPresent: false
33
+ };
34
+ exports.initialDeviceStatus = {
35
+ state: 0,
36
+ stepNum: 0,
37
+ stepDescription: '',
38
+ colorCode: 0,
39
+ statusMsg: '',
40
+ error: false,
41
+ killed: false,
42
+ inactive: false,
43
+ resetting: false,
44
+ idle: false,
45
+ running: false,
46
+ stopping: false,
47
+ paused: false,
48
+ aborting: false,
49
+ done: false,
50
+ manual: false,
51
+ idleOrError: false,
52
+ iifkm: false,
53
+ rri: false,
54
+ ipr: false,
55
+ kei: false,
56
+ runningOrStopping: false,
57
+ allChildrenIdle: false,
58
+ allChildrenKilled: false,
59
+ allChildrenInactive: false,
60
+ allChildrenIdleOrError: false,
61
+ commanderId: 0,
62
+ recordingLogs: false
63
+ };
64
+ exports.initialDevice = {
65
+ is: exports.initialDeviceStatus,
66
+ errors: exports.initialDeviceFaultData,
67
+ warnings: exports.initialDeviceFaultData,
68
+ registration: exports.initialDeviceRegistration,
69
+ cfg: exports.initialDeviceCfg,
70
+ connectionStatus: false
71
+ };
@@ -0,0 +1,7 @@
1
+ export declare enum DeviceTypes {
2
+ Base = 0,
3
+ Axis = 1,
4
+ BoschAxis = 2,//need to deprecate this soon
5
+ DualAxis = 3,
6
+ Gantry = 4
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceTypes = void 0;
4
+ var DeviceTypes;
5
+ (function (DeviceTypes) {
6
+ DeviceTypes[DeviceTypes["Base"] = 0] = "Base";
7
+ DeviceTypes[DeviceTypes["Axis"] = 1] = "Axis";
8
+ DeviceTypes[DeviceTypes["BoschAxis"] = 2] = "BoschAxis";
9
+ DeviceTypes[DeviceTypes["DualAxis"] = 3] = "DualAxis";
10
+ DeviceTypes[DeviceTypes["Gantry"] = 4] = "Gantry";
11
+ })(DeviceTypes || (exports.DeviceTypes = DeviceTypes = {}));
@@ -0,0 +1,2 @@
1
+ export * from "./Device";
2
+ export * from "./Axis";
@@ -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("./Device"), exports);
18
+ __exportStar(require("./Axis"), exports);
@@ -1,7 +1,7 @@
1
1
  export * from "./Com";
2
2
  export * from "./AppState";
3
3
  export * from "./HMI";
4
- export * from "./Devices/BaseDevice";
4
+ export * from "./Devices/Device";
5
5
  export * from "./Machine";
6
6
  export * from "./RackData";
7
7
  export * from "./GlobalConstants";
@@ -10,3 +10,4 @@ export * from "./RecipeManagerFB";
10
10
  export * from "./UserManagerFB";
11
11
  export * from "./TaskQueue";
12
12
  export * from "./RobData";
13
+ export * from "./Devices";
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Com"), exports);
18
18
  __exportStar(require("./AppState"), exports);
19
19
  __exportStar(require("./HMI"), exports);
20
- __exportStar(require("./Devices/BaseDevice"), exports);
20
+ __exportStar(require("./Devices/Device"), exports);
21
21
  __exportStar(require("./Machine"), exports);
22
22
  __exportStar(require("./RackData"), exports);
23
23
  __exportStar(require("./GlobalConstants"), exports);
@@ -26,3 +26,4 @@ __exportStar(require("./RecipeManagerFB"), exports);
26
26
  __exportStar(require("./UserManagerFB"), exports);
27
27
  __exportStar(require("./TaskQueue"), exports);
28
28
  __exportStar(require("./RobData"), exports);
29
+ __exportStar(require("./Devices"), exports);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./custom-types";
2
2
  export * from "./enums";
3
3
  export * from "./functions";
4
+ export * from "./plc-tags";
package/dist/index.js CHANGED
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./custom-types"), exports);
18
18
  __exportStar(require("./enums"), exports);
19
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);
@@ -0,0 +1,13 @@
1
+ export interface TopicData {
2
+ timestamp: number;
3
+ payload: unknown;
4
+ }
5
+ export declare const MqttTopics: {
6
+ readonly BRIDGE_STATUS: "bridge/status";
7
+ readonly BRIDGE_CMD: "bridge/cmd";
8
+ readonly DEVICE_MAP: "deviceMap";
9
+ };
10
+ export declare const BridgeCmds: {
11
+ readonly CONNECT: "connect";
12
+ readonly DISCONNECT: "disconnect";
13
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BridgeCmds = exports.MqttTopics = void 0;
4
+ exports.MqttTopics = {
5
+ BRIDGE_STATUS: 'bridge/status',
6
+ BRIDGE_CMD: 'bridge/cmd',
7
+ DEVICE_MAP: 'deviceMap',
8
+ };
9
+ exports.BridgeCmds = {
10
+ CONNECT: 'connect',
11
+ DISCONNECT: 'disconnect'
12
+ };
@@ -0,0 +1,2 @@
1
+ export declare const nodeListString = "ns=4;s=|var|";
2
+ export declare const nodeTypeString = "ns=4;s=|type|";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeTypeString = exports.nodeListString = void 0;
4
+ exports.nodeListString = "ns=4;s=|var|";
5
+ exports.nodeTypeString = "ns=4;s=|type|";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuriousdesign/machine-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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",
@@ -1,7 +1,7 @@
1
1
  import { PartState, Page } from "../enums";
2
2
  import { ButtonBar, StatusBar } from "./HMI";
3
3
  import { PartData } from "./PartData";
4
- import { Device } from "./Devices/BaseDevice";
4
+ import { Device } from "./Devices/Device";
5
5
  import { GlobalConstants } from "./GlobalConstants";
6
6
  import {
7
7
  RackData,
@@ -0,0 +1,159 @@
1
+ export enum AxisDriveTypes {
2
+ STINGRAY = 0,
3
+ BOSCH_FSOE = 1
4
+ }
5
+
6
+ //ignored-
7
+ export interface AxisCfg {
8
+ DriveType: AxisDriveTypes;
9
+ DriveId: number; // use either the BoschDrives enum or the Nautilus Drives enum
10
+ Unit: string;
11
+ AtPosTol: number; // note: this may already be defined in the drive (if using bosch fsoe) difference between data.actualPosition and data.targetPosition below threshold and used during validation to determine if checked position matches the stored mastering position
12
+
13
+
14
+ IgnoreSoftwareLimits: boolean;
15
+ IgnoreLimitSwitches: boolean;
16
+
17
+ Ignores: boolean[]; // use AxisPermissives ENUM
18
+
19
+ SoftwareLimitPositive: number; // this is the limit that will produce an error if exceeded
20
+ SoftwareLimitNegative: number;
21
+ OperationalPositionMin: number; // this is the nominal operation minimum
22
+ OperationalPositionMax: number;
23
+ HardStopPositive: number;
24
+ HardStopNegative: number;
25
+ SensorPositions: number[];
26
+ //ignored-MotionProfiles: AxisMotionProfileData[]; // normal use case motion profiles, not e-stopping or error related
27
+ AxisType: number;
28
+
29
+ //ignored-ValidationSensor: AxisSensors; // used for homing or position verification
30
+ //ignored-PositionReferencingMethod: PositionReferencingMethods; // homing or position verification
31
+ VerificationSensorOffsetFromZero: number;
32
+ SearchDistance: number; // allowed distance to search beyond operation limit to find the validation sensor
33
+ hasRailBrakes: boolean;
34
+ AutoPositionVerifyDuringReset: boolean; // set to true if you want the axis to automatically try to position verify during reset
35
+ hasDynamicPositiveLimit: boolean;
36
+ hasDynamicNegativeLimit: boolean;
37
+
38
+ HomingToHardstopDir: number; // use -1.0 for negative and 1.0 for positive
39
+ MaxCurrentWhileHomingToHardstop: number; // if homing in neg direction, then use a negative value only used if using home_to_hardstop_<dir> as the position verification method.
40
+ MaxCurrentNormalOperation: number; // max current allowed during normal operation, ignore unless using homing to hardstop
41
+
42
+ updateScalingIsNeeded: boolean; // set this to TRUE to enforce scaling changes
43
+ //ignored-SoftMotionScalingParams: SoftMotionScalingParams;
44
+
45
+ // DUAL AXIS ONLY
46
+ GearingPositionTolerance: number; // mm, (dual Axis only) used for checking differences between geared axes while synced
47
+ AxesPositionToleranceForSkew: number; // mm, (dual Axis only) used for checking if axes have gone beyond their mechanical limit for position differences before ruining the machine
48
+
49
+ ShippingPosition: number; // mm, this should be something that is between the hardstop positions
50
+ KeepMasteredStatusAtStartup: boolean; // if TRUE, this will maintain the mastered status/homed status of the axis after a power cycle
51
+ }
52
+
53
+ export interface AxisMotionProfileData {
54
+ speed: number; // this must be greater than zero
55
+ acceleration: number; // used for accel and decel
56
+ jerk: number;
57
+ }
58
+
59
+
60
+
61
+ export interface AxisSts {
62
+ Cfg: AxisCfg; // read-only
63
+
64
+ actualPosition: number;
65
+ // actualSetpoint: number; // use the enum associated with setpoints
66
+ actualVelocity: number;
67
+ actualAcceleration: number;
68
+ ActualTorque: number;
69
+ ActualCurrent: number;
70
+ //ignored-ActualControllerMode: SMC_CONTROLLER_MODE;
71
+
72
+ ActiveStreamType: number;
73
+
74
+ AxisRefState: number; // uses SMC_AXIS_STATE;
75
+
76
+ targetPosition: number; // used for MoveAbs or MoveRel, change value before issuing your mc cmd, result should be echoed in setPosition after corresponding MC Cmd
77
+ targetSetpoint: number;
78
+ targetVelocity: number; // used for jogging, change value before issuing your mc cmd, result should be echoed in setVelocity after corresponding MC Cmd
79
+
80
+ targetDir: number; // used for jogging and moving, 1.0 for fwd and -1.0 for bckwd
81
+ // targetAccel: number;
82
+ targetMaxCurrent: number; // only used for homing to hardstop of swing arms
83
+ targetTorque: number; // not used
84
+ targetMotionProfileId: number;
85
+ targetMotionProfileData: AxisMotionProfileData; // used for moving and jogging, change value before issuing your mc cmd, result should be echoed in setVelocity/setAcceleration after corresponding MC Cmd
86
+ TargetControllerMode: number; // uses SMC_CONTROLLER_MODE;
87
+
88
+ setPosition: number; // this value is updated by the drive
89
+ setVelocity: number; // this value is updated by the drive
90
+ setAccel: number; // this value is updated by the drive
91
+ setTorque: number; // this value is updated by the drive
92
+ setJerk: number; // this value is updated by the drive
93
+
94
+ // STATUS BITS
95
+ isEnabled: boolean;
96
+ isHoming: boolean; // used to indicate that axis in the process of homing or used to indicate that axis is in the process of verifying its position
97
+ isHomed: boolean; // used to indicate that axis has homed to a sensor and updated its position accordingly or used to indicate that position has been verified, useful when using absolute encoders that don't require homing (overwriting of known zero position)
98
+ isMastered: boolean; // used to indicate that axis has been mastered, useful for axes that require position verification as their position referencing method
99
+
100
+ mutingSwAndHwLimitsWhileHoming: boolean;
101
+ //ignored-DriveHwLimitsEnforcement: AxisLimitEnforcements; // this status is set after calling the set software limits
102
+ //ignored-DriveSwLimitsEnforcement: AxisLimitEnforcements;
103
+
104
+ // MOTION STATES - these are all mutually exclusive
105
+ isStandstill: boolean; // axis is not moving (within zero velocity threshold)
106
+ isAtPosAndStandstill: boolean; // axis is at the target position and at standstill
107
+ isJogging: boolean; // axis is rotating with velocity cmd
108
+ isMoving: boolean; // axis is moving to a position
109
+ isGeared: boolean; // axis is moving synchronously with another axis
110
+ isTorquing: boolean; // axis is in torque mode and actively applying torque
111
+
112
+ // DRIVE RELATED
113
+ DriveStatusMsg: string;
114
+ DriveHasError: boolean;
115
+ DriveIsStoppingMotor: boolean; // is True when motor faults and starts stopping itself
116
+ DriveStoppedMotor: boolean; // True after motor finishes stopping itself. clears when you reset the motor
117
+
118
+ SoftMotionHasError: boolean;
119
+ SoftMotionErrorId: number; // uses SMC_ERROR;
120
+
121
+ ConfiguredSoftLimitTravelRange: number; // determined by the sw limits;
122
+ HomeOffsetFromZero: number; // units, this is a read-only value, the retain var HomeOffsetFromZero is used (this might be deprecated)
123
+
124
+ CalculatedStoppingPosition: number;
125
+ TravelLimitNegative: number;
126
+ TravelLimitPositive: number;
127
+
128
+ //ignored-Permissives: AxisPermissiveStsData[]; // Array of NUM_PERMISSIVES length
129
+ RestrictedToSlow: boolean; // (TODO: replace this with NOT Permissives.FullSpeed_OK) used to speed limit the axis when it is not homed or has software and hardware limits disabled
130
+
131
+ //ignored-RailBrakes: RailBrakeInputs;
132
+ Sensors: boolean[]; // Array of MAX_NUM_SENSORS length
133
+
134
+ targetEncoderSetpoint: number;
135
+
136
+ targetMasterAxisDevId: number;
137
+ targetMasterAxisRefPointer: any; // TypeScript doesn't have direct pointer equivalents
138
+ actualMasterAxisDevId: number;
139
+ actualMasterAxisRefPointer: any; // TypeScript doesn't have direct pointer equivalents
140
+
141
+ RecordedPosition: number; // use this to save position information, useful for mastering and position verification processes
142
+ //ignored-Interlocks: AxisInterlocks;
143
+
144
+ ignoringRailBrakes: boolean;
145
+ EtherCatComms_OK: boolean;
146
+
147
+ // ROBOT CONTROLLER STATE
148
+ RcHomingState: number; // uses enumRcAxisHomingState;
149
+ RcControlMode: number; // uses enumRcAxisMode;
150
+
151
+ isStreaming: boolean;
152
+
153
+ // DUAL AXIS ONLY
154
+ PositionDifference: number; // (Dual Axis Only) difference between the axes: axis1 - axis2
155
+ AxesPositionDifference_OK: boolean; // (Dual Axis Only)status stating difference in position between two axes while moving or idle is acceptable, based on cfg.GearingPositionTolerance
156
+ AxesPositionDifference_CORRECTABLE: boolean; // (Dual Axis Only)status stating difference in position between two axes able to be automatically corrected, based on cfg.AxesPositionToleranceForSkew
157
+ SkippingPositionCorrectionBeforeGearing: boolean; // (Dual Axis Only)this is usually TRUE if the axes are first being setup
158
+ DualAxisStopType: number; // uses DualAxisStopTypes; // (Dual Axis Only)
159
+ }
@@ -0,0 +1,168 @@
1
+ import { DeviceTypes } from './DeviceTypes'
2
+
3
+ export interface DeviceRegistration {
4
+ mnemonic: string; // short hand notation for the device, e.g. IB for Bufferwall, IBG for gantry
5
+ id: number; // this device id
6
+ childIdArray: number[]; // array of child device ids
7
+ parentId: number; // this is the parent id
8
+ deviceType: DeviceTypes; // type of the device
9
+ }
10
+
11
+ export const initialDeviceRegistration: DeviceRegistration = {
12
+ mnemonic: '',
13
+ id: 0,
14
+ childIdArray: [],
15
+ parentId: 0,
16
+ deviceType: DeviceTypes.Base // Assuming Unknown exists in DeviceTypes enum
17
+ };
18
+
19
+ export interface DeviceCfg {
20
+ safetyZoneId: number;
21
+ controllableByHmi: boolean;
22
+ autoReset: boolean;
23
+ ignore: boolean;
24
+ //ignore--OutboundAxisInterlocks: AxisInterlockCfgData[];
25
+ }
26
+
27
+ export const initialDeviceCfg: DeviceCfg = {
28
+ safetyZoneId: 0,
29
+ controllableByHmi: false,
30
+ autoReset: false,
31
+ ignore: false
32
+ };
33
+
34
+ export interface FaultData {
35
+ DeviceId: number;
36
+ Code: number; // this is deprecated
37
+ Msg: string;
38
+ AutoReset: boolean; // if this is true, the code will be reset by the fault monitor
39
+ ResetFlag: boolean; // used by the fault monitor to know whether to clear an fault or not
40
+ LogFlag: boolean; // when true, this fault hasn't been logged yet
41
+ TimeStamp: Date;
42
+ StepNum: number; // of this device
43
+ ParentStepNum: number;
44
+ }
45
+
46
+ export const initialFaultData: FaultData = {
47
+ DeviceId: 0,
48
+ Code: 0,
49
+ Msg: '',
50
+ AutoReset: false,
51
+ ResetFlag: false,
52
+ LogFlag: false,
53
+ TimeStamp: new Date(),
54
+ StepNum: 0,
55
+ ParentStepNum: 0
56
+ };
57
+
58
+ export interface DeviceFaultData {
59
+ List: FaultData[]; // Array of fault data
60
+ Present: boolean; // status
61
+ ChildrenPresent: boolean; // status that children have errors
62
+ }
63
+
64
+ export const initialDeviceFaultData: DeviceFaultData = {
65
+ List: [],
66
+ Present: false,
67
+ ChildrenPresent: false
68
+ };
69
+
70
+ export interface DeviceStatus {
71
+ state: number; // enum for States enum, same as the boolean states in the data structure
72
+ stepNum: number;
73
+ stepDescription: string;
74
+
75
+ colorCode: number; // color to indicate the current status for HMI purposes
76
+ statusMsg: string; // status string
77
+
78
+ error: boolean; // state, device or child has an error
79
+ killed: boolean; // device is de-energized
80
+ inactive: boolean; // waiting to be reset
81
+ resetting: boolean; // taking action to be idle
82
+ idle: boolean; // ready for auto tasks
83
+ running: boolean; // performing an active task (excludes tasks that just involve data exchange like recipe changing)
84
+ stopping: boolean;
85
+ paused: boolean; // action paused mid-task, able to be resumed (finish the task) or stopped (abandon task and back to idle or inactive)
86
+ aborting: boolean; // Aborting (Reacting TO E-Stop)
87
+ done: boolean; // finished with task, waiting for parent to drop the request
88
+ manual: boolean;
89
+
90
+ idleOrError: boolean; // useful to check for stopping
91
+ iifkm: boolean; // IdleOrInactiveOrFaultedOrKilledOrManual
92
+ rri: boolean; // ResettingOrRunningOrIdle
93
+ ipr: boolean; // IdleOrPausedOrRunning
94
+ kei: boolean; // KilledErrorOrInactive
95
+ runningOrStopping: boolean;
96
+
97
+ // Children Status
98
+ allChildrenIdle: boolean;
99
+ allChildrenKilled: boolean;
100
+ allChildrenInactive: boolean;
101
+ allChildrenIdleOrError: boolean;
102
+
103
+ commanderId: number; // used for external control
104
+
105
+ recordingLogs: boolean;
106
+ }
107
+
108
+ export const initialDeviceStatus: DeviceStatus = {
109
+ state: 0,
110
+ stepNum: 0,
111
+ stepDescription: '',
112
+ colorCode: 0,
113
+ statusMsg: '',
114
+ error: false,
115
+ killed: false,
116
+ inactive: false,
117
+ resetting: false,
118
+ idle: false,
119
+ running: false,
120
+ stopping: false,
121
+ paused: false,
122
+ aborting: false,
123
+ done: false,
124
+ manual: false,
125
+ idleOrError: false,
126
+ iifkm: false,
127
+ rri: false,
128
+ ipr: false,
129
+ kei: false,
130
+ runningOrStopping: false,
131
+ allChildrenIdle: false,
132
+ allChildrenKilled: false,
133
+ allChildrenInactive: false,
134
+ allChildrenIdleOrError: false,
135
+ commanderId: 0,
136
+ recordingLogs: false
137
+ };
138
+
139
+ export interface Device {
140
+ is: DeviceStatus;
141
+ errors: DeviceFaultData;
142
+ warnings: DeviceFaultData;
143
+ registration: DeviceRegistration;
144
+ cfg: DeviceCfg;
145
+ //ignore--instants: DeviceInstants;
146
+
147
+ //ignore--instantsexecMethod: ProcessData;
148
+ //ignore--instantstask: ProcessData;
149
+ //ignore--instantsprocess: ProcessData; //read-only
150
+ //ignore--instantsscript: ProcessData; //read-only
151
+
152
+ //ignore--instantsmission: ProcessData;
153
+ //ignore--instantssettings: DeviceSettings;
154
+ connectionStatus: boolean;
155
+
156
+ //ignore--instantsrequests: Array<DeviceActionRequestData>; //this can be written to outside of the device fb;
157
+ //ignore--instantsapiOpcua: ApiOpcuaData;
158
+ //ignore--instantsudp: UdpData;
159
+ }
160
+
161
+ export const initialDevice: Device = {
162
+ is: initialDeviceStatus,
163
+ errors: initialDeviceFaultData,
164
+ warnings: initialDeviceFaultData,
165
+ registration: initialDeviceRegistration,
166
+ cfg: initialDeviceCfg,
167
+ connectionStatus: false
168
+ };
@@ -0,0 +1,7 @@
1
+ export enum DeviceTypes {
2
+ Base = 0,
3
+ Axis = 1,
4
+ BoschAxis = 2, //need to deprecate this soon
5
+ DualAxis = 3,
6
+ Gantry = 4
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Device";
2
+ export * from "./Axis";
@@ -1,7 +1,7 @@
1
1
  export * from "./Com";
2
2
  export * from "./AppState";
3
3
  export * from "./HMI";
4
- export * from "./Devices/BaseDevice";
4
+ export * from "./Devices/Device";
5
5
  export * from "./Machine";
6
6
  export * from "./RackData";
7
7
  export * from "./GlobalConstants";
@@ -10,3 +10,4 @@ export * from "./RecipeManagerFB";
10
10
  export * from "./UserManagerFB";
11
11
  export * from "./TaskQueue";
12
12
  export * from "./RobData";
13
+ export * from "./Devices";
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./custom-types";
2
2
  export * from "./enums";
3
3
  export * from "./functions";
4
+ export * from "./plc-tags";
@@ -0,0 +1,24 @@
1
+ export const PlcNamespaces = {
2
+ Machine: 'Machine',
3
+ MachineHw: 'MachineHw',
4
+ Main: 'Main'
5
+ }
6
+
7
+ export const MachineTags = {
8
+ deviceStore: 'Devices',
9
+ //deviceTypeStore: 'DeviceTypes',
10
+ registeredDevices: 'RegisteredDevices',
11
+ axisStsArray: 'AxisStsArray',
12
+ HeartbeatPLC: 'HeartbeatPLC',
13
+ HeartbeatHMI: 'HeartbeatHMI'
14
+ }
15
+
16
+ export const DeviceTags = {
17
+ Cfg: 'Cfg',
18
+ Is: 'Is',
19
+ Registration: 'Registration',
20
+ }
21
+
22
+
23
+ export * from "./opcua";
24
+ export * from "./mqtt";
@@ -0,0 +1,16 @@
1
+ export interface TopicData {
2
+ timestamp: number;
3
+ payload: unknown; // Placeholder until cfg, status, data schemas provided
4
+ }
5
+
6
+ export const MqttTopics = {
7
+ BRIDGE_STATUS: 'bridge/status',
8
+ BRIDGE_CMD: 'bridge/cmd',
9
+ DEVICE_MAP: 'deviceMap',
10
+ } as const;
11
+
12
+
13
+ export const BridgeCmds = {
14
+ CONNECT: 'connect',
15
+ DISCONNECT: 'disconnect'
16
+ } as const;
@@ -0,0 +1,3 @@
1
+ export const nodeListString = "ns=4;s=|var|";
2
+ export const nodeTypeString = "ns=4;s=|type|";
3
+
@@ -1,41 +0,0 @@
1
- export interface DeviceCfg {
2
- mnemonic: string; //short hand notation for the device, e.g. ROB for Robot
3
- id: number; //calculation using ChildId and Parent Id, where Id = (100*ParentId + LocalId)
4
- childId: number;
5
- parentId: number;
6
- }
7
-
8
- export interface DeviceFaultData {
9
- list: number[];
10
- present: boolean; //status
11
- }
12
-
13
- export interface DeviceInputs {
14
- instantKill_ON: boolean
15
- }
16
-
17
- export interface DeviceParentCmds {
18
- reset: boolean;
19
- stop: boolean;
20
- clearFlts: boolean;
21
- start: boolean;
22
- abort: boolean;
23
- kill: boolean;
24
- }
25
-
26
- export interface DeviceStatus {
27
- state: number;
28
- //Faulted: BOOL;
29
- //HasWarnings: BOOL;
30
- stepNum: number;
31
- colorCode: number; //color to indicate the current status
32
- }
33
-
34
- export interface Device {
35
- cfg: DeviceCfg;
36
- is: DeviceStatus;
37
- cmds: DeviceParentCmds;
38
- errors: DeviceFaultData;
39
- warnings: DeviceFaultData;
40
- i: DeviceInputs;
41
- }