motion-master-client 0.0.77 → 0.0.86

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 (85) hide show
  1. package/README.md +227 -138
  2. package/package.json +1 -1
  3. package/src/cli.d.ts +1 -1
  4. package/src/cli.js +160 -160
  5. package/src/index.d.ts +30 -28
  6. package/src/index.js +33 -31
  7. package/src/index.js.map +1 -1
  8. package/src/lib/cia402.d.ts +184 -182
  9. package/src/lib/cia402.js +393 -391
  10. package/src/lib/cia402.js.map +1 -1
  11. package/src/lib/config-file.d.ts +13 -13
  12. package/src/lib/config-file.js +49 -49
  13. package/src/lib/data-monitoring.d.ts +12 -12
  14. package/src/lib/data-monitoring.js +33 -33
  15. package/src/lib/device-log-line.d.ts +5 -5
  16. package/src/lib/device-log-line.js +2 -2
  17. package/src/lib/device-parameter.d.ts +56 -56
  18. package/src/lib/device-parameter.js +38 -38
  19. package/src/lib/device.d.ts +46 -9
  20. package/src/lib/device.js +166 -2
  21. package/src/lib/device.js.map +1 -1
  22. package/src/lib/encoder-register.d.ts +16 -16
  23. package/src/lib/encoder-register.js +116 -116
  24. package/src/lib/hardware-description.d.ts +46 -46
  25. package/src/lib/hardware-description.js +109 -109
  26. package/src/lib/integro-encoder-calibration.d.ts +31 -0
  27. package/src/lib/integro-encoder-calibration.js +196 -0
  28. package/src/lib/integro-encoder-calibration.js.map +1 -0
  29. package/src/lib/logger.d.ts +1 -1
  30. package/src/lib/logger.js +7 -7
  31. package/src/lib/monitoring-config.d.ts +31 -31
  32. package/src/lib/monitoring-config.js +2 -2
  33. package/src/lib/monitoring-entry.d.ts +9 -9
  34. package/src/lib/monitoring-entry.js +2 -2
  35. package/src/lib/motion-master-client.d.ts +77 -77
  36. package/src/lib/motion-master-client.js +196 -196
  37. package/src/lib/motion-master-pub-sub-client.d.ts +17 -17
  38. package/src/lib/motion-master-pub-sub-client.js +72 -72
  39. package/src/lib/motion-master-pub-sub-client.js.map +1 -1
  40. package/src/lib/motion-master-pub-sub-socket.d.ts +42 -42
  41. package/src/lib/motion-master-pub-sub-socket.js +2 -2
  42. package/src/lib/motion-master-pub-sub-web-socket.d.ts +18 -18
  43. package/src/lib/motion-master-pub-sub-web-socket.js +65 -65
  44. package/src/lib/motion-master-pub-sub-worker-socket.d.ts +18 -18
  45. package/src/lib/motion-master-pub-sub-worker-socket.js +47 -47
  46. package/src/lib/motion-master-req-res-client.d.ts +1104 -1062
  47. package/src/lib/motion-master-req-res-client.js +2137 -1997
  48. package/src/lib/motion-master-req-res-client.js.map +1 -1
  49. package/src/lib/motion-master-req-res-socket.d.ts +60 -60
  50. package/src/lib/motion-master-req-res-socket.js +2 -2
  51. package/src/lib/motion-master-req-res-web-socket.d.ts +28 -28
  52. package/src/lib/motion-master-req-res-web-socket.js +97 -97
  53. package/src/lib/motion-master-req-res-worker-socket.d.ts +24 -24
  54. package/src/lib/motion-master-req-res-worker-socket.js +71 -71
  55. package/src/lib/motion-master.proto.d.ts +5183 -5183
  56. package/src/lib/motion-master.proto.js +53218 -53218
  57. package/src/lib/operators.d.ts +20 -20
  58. package/src/lib/operators.js +82 -83
  59. package/src/lib/operators.js.map +1 -1
  60. package/src/lib/options.d.ts +10 -10
  61. package/src/lib/options.js +13 -13
  62. package/src/lib/os-command.d.ts +387 -173
  63. package/src/lib/os-command.js +555 -269
  64. package/src/lib/os-command.js.map +1 -1
  65. package/src/lib/parameter.d.ts +156 -138
  66. package/src/lib/parameter.js +377 -152
  67. package/src/lib/parameter.js.map +1 -1
  68. package/src/lib/product-id-range.d.ts +7 -7
  69. package/src/lib/product-id-range.js +11 -11
  70. package/src/lib/request-status-resolver.d.ts +4 -4
  71. package/src/lib/request-status-resolver.js +344 -344
  72. package/src/lib/somanet-product.d.ts +37 -0
  73. package/src/lib/somanet-product.js +126 -0
  74. package/src/lib/somanet-product.js.map +1 -0
  75. package/src/lib/system-log-line.d.ts +9 -9
  76. package/src/lib/system-log-line.js +2 -2
  77. package/src/lib/types.d.ts +141 -141
  78. package/src/lib/types.js +28 -28
  79. package/src/lib/urls.d.ts +3 -3
  80. package/src/lib/urls.js +9 -9
  81. package/src/lib/util.d.ts +21 -45
  82. package/src/lib/util.js +113 -379
  83. package/src/lib/util.js.map +1 -1
  84. package/src/lib/web-socket-connection-close-codes.d.ts +8 -8
  85. package/src/lib/web-socket-connection-close-codes.js +88 -88
@@ -1,270 +1,556 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPhaseInductanceMeasurementOsCommand = exports.createPhaseResistanceMeasurementOsCommand = exports.createPolePairDetectionOsCommand = exports.openPhaseDetectionErrors = exports.createOpenPhaseDetectionOsCommand = exports.createCommutationOffsetMeasurementOsCommand = exports.createMotorPhaseOrderDetectionOsCommand = exports.createEncoderRegisterCommunicationOsCommand = exports.createOsCommandTypedArray = exports.osCommandErrorCode = exports.OsCommandId = exports.OsCommandMode = exports.parseOsCommandResponse = void 0;
4
- ;
5
- function parseOsCommandResponse(response) {
6
- const status = response.at(0);
7
- if (status === undefined) {
8
- throw new Error(`No status is available in the typed array response ${JSON.stringify(response)}`);
9
- }
10
- let data;
11
- let errorCode;
12
- let errorName;
13
- let errorDescription;
14
- let progress;
15
- let request = 'started';
16
- // Determine the status of the OS command.
17
- if (status === 0 || status === 1) {
18
- request = 'succeeded';
19
- }
20
- else if (status === 2 || status === 3) {
21
- request = 'failed';
22
- }
23
- else if ((status >= 100 && status <= 200) || status === 255) {
24
- request = 'running';
25
- }
26
- else {
27
- throw new Error(`Unknown OS command response status: ${status}`);
28
- }
29
- // Command in progress with percentage.
30
- if (status >= 100 && status <= 200) {
31
- progress = status - 100;
32
- }
33
- // Command completed with error and with response.
34
- if (status === 3) {
35
- errorCode = response.at(2);
36
- if (errorCode !== undefined) {
37
- errorName = exports.osCommandErrorCode[errorCode];
38
- }
39
- }
40
- if (status === 1) {
41
- // 6 bytes for data when last command completed, no errors, response data available
42
- data = Array.from(response.slice(2));
43
- }
44
- else if (status === 3) {
45
- // 5 bytes for data when last command completed, error, response data available
46
- data = Array.from(response.slice(3));
47
- }
48
- return { data, errorCode, errorName, errorDescription, progress, request, response };
49
- }
50
- exports.parseOsCommandResponse = parseOsCommandResponse;
51
- var OsCommandMode;
52
- (function (OsCommandMode) {
53
- OsCommandMode[OsCommandMode["EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY"] = 0] = "EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY";
54
- OsCommandMode[OsCommandMode["ABORT_THE_CURRENT_COMMAND_AND_ALL_COMMANDS_IN_THE_BUFFER"] = 3] = "ABORT_THE_CURRENT_COMMAND_AND_ALL_COMMANDS_IN_THE_BUFFER";
55
- })(OsCommandMode = exports.OsCommandMode || (exports.OsCommandMode = {}));
56
- ;
57
- var OsCommandId;
58
- (function (OsCommandId) {
59
- OsCommandId[OsCommandId["ENCODER_REGISTER_COMMUNICATION"] = 0] = "ENCODER_REGISTER_COMMUNICATION";
60
- OsCommandId[OsCommandId["ICMU_CALIBRATION_MODE"] = 1] = "ICMU_CALIBRATION_MODE";
61
- OsCommandId[OsCommandId["OPEN_LOOP_FIELD_MODE"] = 2] = "OPEN_LOOP_FIELD_MODE";
62
- OsCommandId[OsCommandId["HRD_STREAMING"] = 3] = "HRD_STREAMING";
63
- OsCommandId[OsCommandId["MOTOR_PHASE_ORDER_DETECTION"] = 4] = "MOTOR_PHASE_ORDER_DETECTION";
64
- OsCommandId[OsCommandId["COMMUTATION_OFFSET_MEASUREMENT"] = 5] = "COMMUTATION_OFFSET_MEASUREMENT";
65
- OsCommandId[OsCommandId["OPEN_PHASE_DETECTION"] = 6] = "OPEN_PHASE_DETECTION";
66
- OsCommandId[OsCommandId["POLE_PAIR_DETECTION"] = 7] = "POLE_PAIR_DETECTION";
67
- OsCommandId[OsCommandId["PHASE_RESISTANCE_MEASUREMENT"] = 8] = "PHASE_RESISTANCE_MEASUREMENT";
68
- OsCommandId[OsCommandId["PHASE_INDUCTANCE_MEASUREMENT"] = 9] = "PHASE_INDUCTANCE_MEASUREMENT";
69
- OsCommandId[OsCommandId["TORQUE_CONSTANT_MEASUREMENT"] = 10] = "TORQUE_CONSTANT_MEASUREMENT";
70
- OsCommandId[OsCommandId["SMM"] = 11] = "SMM";
71
- })(OsCommandId = exports.OsCommandId || (exports.OsCommandId = {}));
72
- ;
73
- exports.osCommandErrorCode = {
74
- 251: 'Command not allowed',
75
- 252: 'Command aborted',
76
- 253: 'Command timeout',
77
- 254: 'Command unsupported',
78
- };
79
- function createOsCommandTypedArray(elements) {
80
- return new Uint8Array(elements.concat(new Array(8 - elements.length).fill(0)));
81
- }
82
- exports.createOsCommandTypedArray = createOsCommandTypedArray;
83
- /**
84
- * OS command 0: Encoder register communication
85
- *
86
- * This OS command is utilized for reading or writing registers from an encoder service.
87
- * Presently, the only service supporting this functionality is BiSS, but it can be easily extended to other encoder services.
88
- * For more information on how BiSS register communication operates, please consult the official BiSS C Interface Protocol Description.
89
- *
90
- * | | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
91
- * |--------|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
92
- * | Byte 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
93
- * | Byte 1 | - | - | - | - | - | A | A | A |
94
- * | Byte 2 | B | B | B | B | B | B | B | C |
95
- * | Byte 3 | D | D | D | D | D | D | D | D |
96
- * | Byte 4 | E | E | E | E | E | E | E | E |
97
- * | Byte 5 | - | - | - | - | - | - | - | - |
98
- * | Byte 6 | - | - | - | - | - | - | - | - |
99
- * | Byte 7 | - | - | - | - | - | - | - | - |
100
- *
101
- * @param encoderOrdinal (A) 2^3=8 encoder ordinals. Counting starts from 1, so '1' refers to Encoder 1 configured in 0x2110.
102
- * @param slaveAddress (B) 2^7=128 slave addresses. Select the address of the slave to read (BiSS protocol level). Since our BiSS service doesn't support multiple slaves in the same device, this value should always be 0.
103
- * @param rw (C) Read or write the encoder register. Select the direction of the command: 0 for reading a register, and 1 for writing it.
104
- * @param registerAddress (D) Register to be read/written.
105
- * @param registerWriteValue (E) The value to write to the register. This value is ignored when reading a register (when rw is set to 0).
106
- */
107
- function createEncoderRegisterCommunicationOsCommand(encoderOrdinal = 1, slaveAddress = 0, rw = 0, registerAddress = 0, registerWriteValue = 0) {
108
- const byte2 = (slaveAddress << 1) | rw;
109
- const elements = [OsCommandId.ENCODER_REGISTER_COMMUNICATION, encoderOrdinal, byte2, registerAddress, registerWriteValue];
110
- return createOsCommandTypedArray(elements);
111
- }
112
- exports.createEncoderRegisterCommunicationOsCommand = createEncoderRegisterCommunicationOsCommand;
113
- ;
114
- /**
115
- * Command 4: Motor phase order detection
116
- *
117
- * This command is used to detect the order of the motor phases.
118
- * When this command finishes successfully, the found value is automatically written to the object 0x2003:5 Motor phases inverted.
119
- * This command rotates the motor.
120
- *
121
- * This OS command has no arguments.
122
- *
123
- * When the command finishes successfully, it will return a value of 0 for normal and 1 for inverted motor phases.
124
- *
125
- * This command doesn't have any command-specific OS error code, so this status will only happen when a general OS error code occurs.
126
- *
127
- * This command will report its progress without indicating a percentage.
128
- *
129
- * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled, there is no active limit switch,
130
- * and the brake status is disengaged (in case there is a configured brake). If any of these conditions is not true during the execution of the command,
131
- * the execution will stop, and it will return the OS error code 251 (command not allowed).
132
- */
133
- function createMotorPhaseOrderDetectionOsCommand() {
134
- const elements = [OsCommandId.MOTOR_PHASE_ORDER_DETECTION];
135
- return createOsCommandTypedArray(elements);
136
- }
137
- exports.createMotorPhaseOrderDetectionOsCommand = createMotorPhaseOrderDetectionOsCommand;
138
- ;
139
- /**
140
- * Command 5: Commutation offset measurement
141
- *
142
- * This command is used to measure the commutation angle offset.
143
- * The configuration of the procedure is derived from the pre-existing and previously used commutation offset objects in the object dictionary.
144
- * Upon successful completion of this command, the determined value is automatically written to:
145
- * - 0x2001:00 Commutation angle offset
146
- * - 0x2009:01 State is set to OFFSET_VALID
147
- *
148
- * In version 5.0, three different methods can be selected for command 5. These methods are named:
149
- * - Commutation offset measurement - method 0
150
- * - Commutation offset measurement - method 1
151
- * - Commutation offset measurement - method 2
152
- * Among these three methods, "method 0" and "method 1" involve rotating the rotor.
153
- *
154
- * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS) and the CIA402 state is Operation enabled.
155
- * Additionally, if the commutation offset measurement method (0x2009:3) is set to 0 or 1,
156
- * the command is permissible only when there are no active limit switches, and the brake status is disengaged (in case a brake is configured).
157
- * If any of these conditions is not met during the execution of the command, the execution will be halted,
158
- * and it will return the OS error code 251 (Command not allowed).
159
- */
160
- function createCommutationOffsetMeasurementOsCommand() {
161
- const elements = [OsCommandId.COMMUTATION_OFFSET_MEASUREMENT];
162
- return createOsCommandTypedArray(elements);
163
- }
164
- exports.createCommutationOffsetMeasurementOsCommand = createCommutationOffsetMeasurementOsCommand;
165
- ;
166
- /**
167
- * Command 6: Open phase detection
168
- *
169
- * This command is used to detect whether one of the phases is open.
170
- * It might rotate the motor if there is no brake or if it is disengaged.
171
- *
172
- * If this command finishes successfully, it indicates that all motor phases seem to be fine.
173
- *
174
- * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
175
- * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
176
- * the execution will stop, and it will return the OS error code 251 (Command not allowed).
177
- */
178
- function createOpenPhaseDetectionOsCommand() {
179
- const elements = [OsCommandId.OPEN_PHASE_DETECTION];
180
- return createOsCommandTypedArray(elements);
181
- }
182
- exports.createOpenPhaseDetectionOsCommand = createOpenPhaseDetectionOsCommand;
183
- ;
184
- exports.openPhaseDetectionErrors = {
185
- 0: {
186
- errorName: 'Open terminal A',
187
- errorDescription: 'Terminal A of the Drive is not connected',
188
- },
189
- 1: {
190
- errorName: 'Open terminal B',
191
- errorDescription: 'Terminal B of the Drive is not connected',
192
- },
193
- 2: {
194
- errorName: 'Open terminal C',
195
- errorDescription: 'Terminal C of the Drive is not connected',
196
- },
197
- 3: {
198
- errorName: 'Open FET A high',
199
- errorDescription: 'Upper FET in leg A of the Drive is not conducting (open circuit fault)',
200
- },
201
- 4: {
202
- errorName: 'Open FET A low',
203
- errorDescription: 'Lower FET in leg A of the Drive is not conducting (open circuit fault)',
204
- },
205
- 5: {
206
- errorName: 'Open FET B high',
207
- errorDescription: 'Upper FET in leg B of the Drive is not conducting (open circuit fault)',
208
- },
209
- 6: {
210
- errorName: 'Open FET B low',
211
- errorDescription: 'Lower FET in leg B of the Drive is not conducting (open circuit fault)',
212
- },
213
- 7: {
214
- errorName: 'Open FET C high',
215
- errorDescription: 'Upper FET in leg C of the Drive is not conducting (open circuit fault)',
216
- },
217
- 8: {
218
- errorName: 'Open FET C low',
219
- errorDescription: 'Lower FET in leg C of the Drive is not conducting (open circuit fault)',
220
- },
221
- };
222
- /**
223
- * Command 7: Pole pair detection
224
- *
225
- * This command is used to detect the number of pole pairs that the connected motor has.
226
- * It requires the rotation of the rotor.
227
- *
228
- * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
229
- * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
230
- * the execution will stop, and it will return the OS error code 251 (Command not allowed).
231
- */
232
- function createPolePairDetectionOsCommand() {
233
- const elements = [OsCommandId.POLE_PAIR_DETECTION];
234
- return createOsCommandTypedArray(elements);
235
- }
236
- exports.createPolePairDetectionOsCommand = createPolePairDetectionOsCommand;
237
- ;
238
- /**
239
- * Command 8: Phase resistance measurement
240
- *
241
- * This command is used to measure the phase resistance of the motor in milliohms (mΩ).
242
- * It might rotate the motor if there is no brake or if it is disengaged.
243
- *
244
- * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
245
- * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
246
- * the execution will stop, and it will return the OS error code 251 (Command not allowed).
247
- */
248
- function createPhaseResistanceMeasurementOsCommand() {
249
- const elements = [OsCommandId.PHASE_RESISTANCE_MEASUREMENT];
250
- return createOsCommandTypedArray(elements);
251
- }
252
- exports.createPhaseResistanceMeasurementOsCommand = createPhaseResistanceMeasurementOsCommand;
253
- ;
254
- /**
255
- * Command 9: Phase inductance measurement
256
- *
257
- * This command is used to measure the phase inductance of the motor in microhenries (μH).
258
- * It might rotate the motor if there is no brake or if it is disengaged.
259
- *
260
- * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
261
- * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
262
- * the execution will stop, and it will return the OS error code 251 (Command not allowed).
263
- */
264
- function createPhaseInductanceMeasurementOsCommand() {
265
- const elements = [OsCommandId.PHASE_INDUCTANCE_MEASUREMENT];
266
- return createOsCommandTypedArray(elements);
267
- }
268
- exports.createPhaseInductanceMeasurementOsCommand = createPhaseInductanceMeasurementOsCommand;
269
- ;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.osCommands = exports.kublerEncoderRegisterValueMeaning = exports.kublerEncoderRegisterCommunicationWriteOsCommandErrors = exports.kublerEncoderRegisterCommunicationReadOsCommandErrors = exports.createKublerEncoderRegisterCommunicationOsCommand = exports.createUseInternalEncoderVelocityOsCommand = exports.kublerEncoderCommandSendScpiCommandOsCommandErrors = exports.kublerEncoderCommandWriteCorrectionTableOsCommandErrors = exports.createKublerEncoderCommand = exports.triggerErrorTypes = exports.createTriggerErrorOsCommand = exports.systemIdentificationParameters = exports.createSystemIdentificationOsCommand = exports.createIgnoreBissStatusBitsOsCommand = exports.createSkippedCyclesCounterOsCommand = exports.createTorqueConstantMeasurementOsCommand = exports.createPhaseInductanceMeasurementOsCommand = exports.createPhaseResistanceMeasurementOsCommand = exports.createPolePairDetectionOsCommand = exports.openPhaseDetectionErrors = exports.createOpenPhaseDetectionOsCommand = exports.createCommutationOffsetMeasurementOsCommand = exports.createMotorPhaseOrderDetectionOsCommand = exports.hrdStreamingOsCommandErrors = exports.createHrdStreamingOsCommand = exports.openLoopFieldModeParameters = exports.createOpenLoopFieldModeOsCommand = exports.createIcMuCalibrationModeOsCommand = exports.createEncoderRegisterCommunicationOsCommand = exports.createOsCommandTypedArray = exports.osCommandErrorCode = exports.OsCommandId = exports.OsCommandMode = exports.parseOsCommandResponse = void 0;
4
+ ;
5
+ function parseOsCommandResponse(response, command) {
6
+ const status = response.at(0);
7
+ if (status === undefined) {
8
+ throw new Error(`No status is available in the typed array response ${JSON.stringify(response)}`);
9
+ }
10
+ let data;
11
+ let errorCode;
12
+ let errorName;
13
+ let errorDescription;
14
+ let progress;
15
+ let request = 'started';
16
+ // Determine the status of the OS command.
17
+ if (status === 0 || status === 1) {
18
+ request = 'succeeded';
19
+ }
20
+ else if (status === 2 || status === 3) {
21
+ request = 'failed';
22
+ }
23
+ else if ((status >= 100 && status <= 200) || status === 255) {
24
+ request = 'running';
25
+ }
26
+ else {
27
+ throw new Error(`Unknown OS command response status: ${status}`);
28
+ }
29
+ // Command in progress with percentage.
30
+ if (status >= 100 && status <= 200) {
31
+ progress = status - 100;
32
+ }
33
+ // Command completed with error and with response.
34
+ if (status === 3) {
35
+ errorCode = response.at(2);
36
+ if (errorCode !== undefined) {
37
+ errorName = exports.osCommandErrorCode[errorCode];
38
+ }
39
+ }
40
+ if (status === 1) {
41
+ // 6 bytes for data when last command completed, no errors, response data available
42
+ data = Array.from(response.slice(2));
43
+ }
44
+ else if (status === 3) {
45
+ // 5 bytes for data when last command completed, error, response data available
46
+ data = Array.from(response.slice(3));
47
+ }
48
+ return { command, data, errorCode, errorName, errorDescription, progress, request, response };
49
+ }
50
+ exports.parseOsCommandResponse = parseOsCommandResponse;
51
+ var OsCommandMode;
52
+ (function (OsCommandMode) {
53
+ OsCommandMode[OsCommandMode["EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY"] = 0] = "EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY";
54
+ OsCommandMode[OsCommandMode["ABORT_THE_CURRENT_COMMAND_AND_ALL_COMMANDS_IN_THE_BUFFER"] = 3] = "ABORT_THE_CURRENT_COMMAND_AND_ALL_COMMANDS_IN_THE_BUFFER";
55
+ })(OsCommandMode = exports.OsCommandMode || (exports.OsCommandMode = {}));
56
+ ;
57
+ var OsCommandId;
58
+ (function (OsCommandId) {
59
+ OsCommandId[OsCommandId["CUSTOM_OS_COMMAND"] = -1] = "CUSTOM_OS_COMMAND";
60
+ OsCommandId[OsCommandId["ENCODER_REGISTER_COMMUNICATION"] = 0] = "ENCODER_REGISTER_COMMUNICATION";
61
+ OsCommandId[OsCommandId["ICMU_CALIBRATION_MODE"] = 1] = "ICMU_CALIBRATION_MODE";
62
+ OsCommandId[OsCommandId["OPEN_LOOP_FIELD_MODE"] = 2] = "OPEN_LOOP_FIELD_MODE";
63
+ OsCommandId[OsCommandId["HRD_STREAMING"] = 3] = "HRD_STREAMING";
64
+ OsCommandId[OsCommandId["MOTOR_PHASE_ORDER_DETECTION"] = 4] = "MOTOR_PHASE_ORDER_DETECTION";
65
+ OsCommandId[OsCommandId["COMMUTATION_OFFSET_MEASUREMENT"] = 5] = "COMMUTATION_OFFSET_MEASUREMENT";
66
+ OsCommandId[OsCommandId["OPEN_PHASE_DETECTION"] = 6] = "OPEN_PHASE_DETECTION";
67
+ OsCommandId[OsCommandId["POLE_PAIR_DETECTION"] = 7] = "POLE_PAIR_DETECTION";
68
+ OsCommandId[OsCommandId["PHASE_RESISTANCE_MEASUREMENT"] = 8] = "PHASE_RESISTANCE_MEASUREMENT";
69
+ OsCommandId[OsCommandId["PHASE_INDUCTANCE_MEASUREMENT"] = 9] = "PHASE_INDUCTANCE_MEASUREMENT";
70
+ OsCommandId[OsCommandId["TORQUE_CONSTANT_MEASUREMENT"] = 10] = "TORQUE_CONSTANT_MEASUREMENT";
71
+ OsCommandId[OsCommandId["SMM"] = 11] = "SMM";
72
+ OsCommandId[OsCommandId["SKIPPED_CYCLED_COUNTER"] = 13] = "SKIPPED_CYCLED_COUNTER";
73
+ OsCommandId[OsCommandId["IGNORE_BISS_STATUS_BITS"] = 14] = "IGNORE_BISS_STATUS_BITS";
74
+ OsCommandId[OsCommandId["SYSTEM_IDENTIFICATION"] = 15] = "SYSTEM_IDENTIFICATION";
75
+ OsCommandId[OsCommandId["TRIGGER_ERROR"] = 16] = "TRIGGER_ERROR";
76
+ OsCommandId[OsCommandId["KUBLER_ENCODER_COMMAND"] = 17] = "KUBLER_ENCODER_COMMAND";
77
+ OsCommandId[OsCommandId["USE_INTERNAL_ENCODER_VELOCITY"] = 18] = "USE_INTERNAL_ENCODER_VELOCITY";
78
+ OsCommandId[OsCommandId["KUBLER_ENCODER_REGISTER_COMMUNICATION"] = 19] = "KUBLER_ENCODER_REGISTER_COMMUNICATION";
79
+ })(OsCommandId = exports.OsCommandId || (exports.OsCommandId = {}));
80
+ ;
81
+ exports.osCommandErrorCode = {
82
+ 251: 'Command not allowed',
83
+ 252: 'Command aborted',
84
+ 253: 'Command timeout',
85
+ 254: 'Command unsupported',
86
+ };
87
+ function createOsCommandTypedArray(elements) {
88
+ return new Uint8Array(elements.concat(new Array(8 - elements.length).fill(0)));
89
+ }
90
+ exports.createOsCommandTypedArray = createOsCommandTypedArray;
91
+ /**
92
+ * OS command 0: Encoder register communication
93
+ *
94
+ * This OS command is utilized for reading or writing registers from an encoder service.
95
+ * Presently, the only service supporting this functionality is BiSS, but it can be easily extended to other encoder services.
96
+ * For more information on how BiSS register communication operates, please consult the official BiSS C Interface Protocol Description.
97
+ *
98
+ * | | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
99
+ * |--------|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
100
+ * | Byte 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
101
+ * | Byte 1 | - | - | - | - | - | A | A | A |
102
+ * | Byte 2 | B | B | B | B | B | B | B | C |
103
+ * | Byte 3 | D | D | D | D | D | D | D | D |
104
+ * | Byte 4 | E | E | E | E | E | E | E | E |
105
+ * | Byte 5 | - | - | - | - | - | - | - | - |
106
+ * | Byte 6 | - | - | - | - | - | - | - | - |
107
+ * | Byte 7 | - | - | - | - | - | - | - | - |
108
+ *
109
+ * @param encoderOrdinal (A) 2^3=8 encoder ordinals. Counting starts from 1, so '1' refers to Encoder 1 configured in 0x2110.
110
+ * @param slaveAddress (B) 2^7=128 slave addresses. Select the address of the slave to read (BiSS protocol level). Since our BiSS service doesn't support multiple slaves in the same device, this value should always be 0.
111
+ * @param rw (C) Read or write the encoder register. Select the direction of the command: 0 for reading a register, and 1 for writing it.
112
+ * @param registerAddress (D) Register to be read/written.
113
+ * @param registerWriteValue (E) The value to write to the register. This value is ignored when reading a register (when rw is set to 0).
114
+ */
115
+ function createEncoderRegisterCommunicationOsCommand(encoderOrdinal = 1, slaveAddress = 0, rw = 0, registerAddress = 0, registerWriteValue = 0) {
116
+ const byte2 = (slaveAddress << 1) | rw;
117
+ const elements = [OsCommandId.ENCODER_REGISTER_COMMUNICATION, encoderOrdinal, byte2, registerAddress, registerWriteValue];
118
+ return createOsCommandTypedArray(elements);
119
+ }
120
+ exports.createEncoderRegisterCommunicationOsCommand = createEncoderRegisterCommunicationOsCommand;
121
+ ;
122
+ /**
123
+ * OS command 1: iC-MU calibration mode
124
+ *
125
+ * This command is used to set a particular BiSS mode when using an iC-MU encoder, which is primarily employed for iC-MU calibration.
126
+ *
127
+ * The supported modes are explained below:
128
+ *
129
+ * **Configuration mode**: The BiSS service clocks the encoder normally, but it only utilizes the bits for register communication and discards the rest,
130
+ * thereby not updating the encoder data.
131
+ * This also implies that the BisCrc error is not triggered while in this mode.
132
+ * This mode is intended to allow the user to change the configuration in the encoder BiSS registers without encountering a BisCrc error.
133
+ *
134
+ * **Raw mode**: The BiSS service clocks the encoder assuming it was correctly configured for raw mode.
135
+ * It continues to calculate all the encoder data, but additionally, it averages the raw data and makes it available in 0x2704 User MISO, as follows:
136
+ *
137
+ * <table border="1">
138
+ * <tr>
139
+ * <td>31</td>
140
+ * <td>30</td>
141
+ * <td>29</td>
142
+ * <td>28</td>
143
+ * <td>27</td>
144
+ * <td>26</td>
145
+ * <td>25</td>
146
+ * <td>24</td>
147
+ * <td>23</td>
148
+ * <td>22</td>
149
+ * <td>21</td>
150
+ * <td>20</td>
151
+ * <td>19</td>
152
+ * <td>18</td>
153
+ * <td>17</td>
154
+ * <td>16</td>
155
+ * <td>15</td>
156
+ * <td>14</td>
157
+ * <td>13</td>
158
+ * <td>12</td>
159
+ * <td>11</td>
160
+ * <td>10</td>
161
+ * <td>9</td>
162
+ * <td>8</td>
163
+ * <td>7</td>
164
+ * <td>6</td>
165
+ * <td>5</td>
166
+ * <td>4</td>
167
+ * <td>3</td>
168
+ * <td>2</td>
169
+ * <td>1</td>
170
+ * <td>0</td>
171
+ * </tr>
172
+ * <tr>
173
+ * <td colspan="4" style="text-align: center;">0</td>
174
+ * <td colspan="14" style="text-align: center;">Nonius count</td>
175
+ * <td colspan="14" style="text-align: center;">Master count</td>
176
+ * </tr>
177
+ * </table>
178
+ *
179
+ * This data can also be read by using OS command 3.
180
+ *
181
+ * **Standard mode**: The BiSS service clocks the encoder normally.
182
+ *
183
+ * When transitioning from any mode to Configuration mode, the current position is saved.
184
+ * If we subsequently switch to Raw mode, this saved position serves as the starting point for position calculation because the raw data is relative.
185
+ * Therefore, the motor should not be moved while in Configuration mode if there are plans to switch to Raw mode afterward.
186
+ *
187
+ * @param encoderOrdinal (A) 2^3=8 encoder ordinals. Counting starts from 1, so '1' refers to Encoder 1 configured in 0x2110.
188
+ * @param modeEnable: Select the iC-MU calibration mode. Configuration mode is 0, raw mode is 1, and standard mode is 2.
189
+ */
190
+ function createIcMuCalibrationModeOsCommand(encoderOrdinal = 1, modeEnable = 0) {
191
+ const byte2 = (modeEnable << 3) | encoderOrdinal;
192
+ const elements = [OsCommandId.ICMU_CALIBRATION_MODE, byte2];
193
+ return createOsCommandTypedArray(elements);
194
+ }
195
+ exports.createIcMuCalibrationModeOsCommand = createIcMuCalibrationModeOsCommand;
196
+ ;
197
+ function createOpenLoopFieldModeOsCommand(parameterIndex = 0, parameterValue = 0) {
198
+ let msb = (parameterValue >> 24) & 0xFF;
199
+ let msb1 = (parameterValue >> 16) & 0xFF;
200
+ let msb2 = (parameterValue >> 8) & 0xFF;
201
+ let lsb = parameterValue & 0xFF;
202
+ const elements = [OsCommandId.OPEN_LOOP_FIELD_MODE, parameterIndex, msb, msb1, msb2, lsb];
203
+ return createOsCommandTypedArray(elements);
204
+ }
205
+ exports.createOpenLoopFieldModeOsCommand = createOpenLoopFieldModeOsCommand;
206
+ exports.openLoopFieldModeParameters = [
207
+ { parameterIndex: 0, parameterName: 'Starting electrical angle [mrad]' },
208
+ { parameterIndex: 1, parameterName: 'Ending electrical angle [mrad]' },
209
+ { parameterIndex: 2, parameterName: 'Maximum electrical rotational speed [rad / s]' },
210
+ { parameterIndex: 3, parameterName: 'Electrical rotational acceleration [rad / s²]' },
211
+ { parameterIndex: 4, parameterName: 'Starting length [per thousand rated current]' },
212
+ { parameterIndex: 5, parameterName: 'Ending length [per thousand rated current]' },
213
+ { parameterIndex: 6, parameterName: 'Increasing length rate [per thousand rated current / s]' },
214
+ ];
215
+ ;
216
+ function createHrdStreamingOsCommand(action = 0, dataIndex = 0, duration = 10000) {
217
+ let msb = (duration >> 8) & 0xFF;
218
+ let lsb = duration & 0xFF;
219
+ const elements = [OsCommandId.HRD_STREAMING, action, dataIndex, msb, lsb];
220
+ return createOsCommandTypedArray(elements);
221
+ }
222
+ exports.createHrdStreamingOsCommand = createHrdStreamingOsCommand;
223
+ exports.hrdStreamingOsCommandErrors = {
224
+ 0: {
225
+ errorName: 'Initialization error',
226
+ errorDescription: 'The command failed to initialize',
227
+ },
228
+ 1: {
229
+ errorName: 'Streaming error',
230
+ errorDescription: 'Something failed while streaming was in progress',
231
+ },
232
+ 2: {
233
+ errorName: 'Duration value',
234
+ errorDescription: 'The selected Duration value is larger than 10000ms',
235
+ },
236
+ 3: {
237
+ errorName: 'Data index value',
238
+ errorDescription: 'The selected Data index is unknown',
239
+ },
240
+ 4: {
241
+ errorName: 'Action value',
242
+ errorDescription: 'The selected Action is unknown',
243
+ },
244
+ };
245
+ /**
246
+ * Command 4: Motor phase order detection
247
+ *
248
+ * This command is used to detect the order of the motor phases.
249
+ * When this command finishes successfully, the found value is automatically written to the object 0x2003:5 Motor phases inverted.
250
+ * This command rotates the motor.
251
+ *
252
+ * This OS command has no arguments.
253
+ *
254
+ * When the command finishes successfully, it will return a value of 0 for normal and 1 for inverted motor phases.
255
+ *
256
+ * This command doesn't have any command-specific OS error code, so this status will only happen when a general OS error code occurs.
257
+ *
258
+ * This command will report its progress without indicating a percentage.
259
+ *
260
+ * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled, there is no active limit switch,
261
+ * and the brake status is disengaged (in case there is a configured brake). If any of these conditions is not true during the execution of the command,
262
+ * the execution will stop, and it will return the OS error code 251 (command not allowed).
263
+ */
264
+ function createMotorPhaseOrderDetectionOsCommand() {
265
+ const elements = [OsCommandId.MOTOR_PHASE_ORDER_DETECTION];
266
+ return createOsCommandTypedArray(elements);
267
+ }
268
+ exports.createMotorPhaseOrderDetectionOsCommand = createMotorPhaseOrderDetectionOsCommand;
269
+ ;
270
+ /**
271
+ * Command 5: Commutation offset measurement
272
+ *
273
+ * This command is used to measure the commutation angle offset.
274
+ * The configuration of the procedure is derived from the pre-existing and previously used commutation offset objects in the object dictionary.
275
+ * Upon successful completion of this command, the determined value is automatically written to:
276
+ * - 0x2001:00 Commutation angle offset
277
+ * - 0x2009:01 State is set to OFFSET_VALID
278
+ *
279
+ * In version 5.0, three different methods can be selected for command 5. These methods are named:
280
+ * - Commutation offset measurement - method 0
281
+ * - Commutation offset measurement - method 1
282
+ * - Commutation offset measurement - method 2
283
+ * Among these three methods, "method 0" and "method 1" involve rotating the rotor.
284
+ *
285
+ * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS) and the CIA402 state is Operation enabled.
286
+ * Additionally, if the commutation offset measurement method (0x2009:3) is set to 0 or 1,
287
+ * the command is permissible only when there are no active limit switches, and the brake status is disengaged (in case a brake is configured).
288
+ * If any of these conditions is not met during the execution of the command, the execution will be halted,
289
+ * and it will return the OS error code 251 (Command not allowed).
290
+ */
291
+ function createCommutationOffsetMeasurementOsCommand() {
292
+ const elements = [OsCommandId.COMMUTATION_OFFSET_MEASUREMENT];
293
+ return createOsCommandTypedArray(elements);
294
+ }
295
+ exports.createCommutationOffsetMeasurementOsCommand = createCommutationOffsetMeasurementOsCommand;
296
+ ;
297
+ /**
298
+ * Command 6: Open phase detection
299
+ *
300
+ * This command is used to detect whether one of the phases is open.
301
+ * It might rotate the motor if there is no brake or if it is disengaged.
302
+ *
303
+ * If this command finishes successfully, it indicates that all motor phases seem to be fine.
304
+ *
305
+ * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
306
+ * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
307
+ * the execution will stop, and it will return the OS error code 251 (Command not allowed).
308
+ */
309
+ function createOpenPhaseDetectionOsCommand() {
310
+ const elements = [OsCommandId.OPEN_PHASE_DETECTION];
311
+ return createOsCommandTypedArray(elements);
312
+ }
313
+ exports.createOpenPhaseDetectionOsCommand = createOpenPhaseDetectionOsCommand;
314
+ ;
315
+ exports.openPhaseDetectionErrors = {
316
+ 0: {
317
+ errorName: 'Open terminal A',
318
+ errorDescription: 'Terminal A of the Drive is not connected',
319
+ },
320
+ 1: {
321
+ errorName: 'Open terminal B',
322
+ errorDescription: 'Terminal B of the Drive is not connected',
323
+ },
324
+ 2: {
325
+ errorName: 'Open terminal C',
326
+ errorDescription: 'Terminal C of the Drive is not connected',
327
+ },
328
+ 3: {
329
+ errorName: 'Open FET A high',
330
+ errorDescription: 'Upper FET in leg A of the Drive is not conducting (open circuit fault)',
331
+ },
332
+ 4: {
333
+ errorName: 'Open FET A low',
334
+ errorDescription: 'Lower FET in leg A of the Drive is not conducting (open circuit fault)',
335
+ },
336
+ 5: {
337
+ errorName: 'Open FET B high',
338
+ errorDescription: 'Upper FET in leg B of the Drive is not conducting (open circuit fault)',
339
+ },
340
+ 6: {
341
+ errorName: 'Open FET B low',
342
+ errorDescription: 'Lower FET in leg B of the Drive is not conducting (open circuit fault)',
343
+ },
344
+ 7: {
345
+ errorName: 'Open FET C high',
346
+ errorDescription: 'Upper FET in leg C of the Drive is not conducting (open circuit fault)',
347
+ },
348
+ 8: {
349
+ errorName: 'Open FET C low',
350
+ errorDescription: 'Lower FET in leg C of the Drive is not conducting (open circuit fault)',
351
+ },
352
+ };
353
+ /**
354
+ * Command 7: Pole pair detection
355
+ *
356
+ * This command is used to detect the number of pole pairs that the connected motor has.
357
+ * It requires the rotation of the rotor.
358
+ *
359
+ * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
360
+ * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
361
+ * the execution will stop, and it will return the OS error code 251 (Command not allowed).
362
+ */
363
+ function createPolePairDetectionOsCommand() {
364
+ const elements = [OsCommandId.POLE_PAIR_DETECTION];
365
+ return createOsCommandTypedArray(elements);
366
+ }
367
+ exports.createPolePairDetectionOsCommand = createPolePairDetectionOsCommand;
368
+ ;
369
+ /**
370
+ * Command 8: Phase resistance measurement
371
+ *
372
+ * This command is used to measure the phase resistance of the motor in milliohms (mΩ).
373
+ * It might rotate the motor if there is no brake or if it is disengaged.
374
+ *
375
+ * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
376
+ * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
377
+ * the execution will stop, and it will return the OS error code 251 (Command not allowed).
378
+ */
379
+ function createPhaseResistanceMeasurementOsCommand() {
380
+ const elements = [OsCommandId.PHASE_RESISTANCE_MEASUREMENT];
381
+ return createOsCommandTypedArray(elements);
382
+ }
383
+ exports.createPhaseResistanceMeasurementOsCommand = createPhaseResistanceMeasurementOsCommand;
384
+ ;
385
+ /**
386
+ * Command 9: Phase inductance measurement
387
+ *
388
+ * This command is used to measure the phase inductance of the motor in microhenries (μH).
389
+ * It might rotate the motor if there is no brake or if it is disengaged.
390
+ *
391
+ * This command can only be run when the opmode is -2 (OPMODE_DIAGNOSTICS), the CIA402 state is Operation enabled,
392
+ * and there is no limit switch active. If any of these conditions is not true during the execution of the command,
393
+ * the execution will stop, and it will return the OS error code 251 (Command not allowed).
394
+ */
395
+ function createPhaseInductanceMeasurementOsCommand() {
396
+ const elements = [OsCommandId.PHASE_INDUCTANCE_MEASUREMENT];
397
+ return createOsCommandTypedArray(elements);
398
+ }
399
+ exports.createPhaseInductanceMeasurementOsCommand = createPhaseInductanceMeasurementOsCommand;
400
+ ;
401
+ function createTorqueConstantMeasurementOsCommand() {
402
+ const elements = [OsCommandId.TORQUE_CONSTANT_MEASUREMENT];
403
+ return createOsCommandTypedArray(elements);
404
+ }
405
+ exports.createTorqueConstantMeasurementOsCommand = createTorqueConstantMeasurementOsCommand;
406
+ function createSkippedCyclesCounterOsCommand(firmwareService = 0) {
407
+ const elements = [OsCommandId.SKIPPED_CYCLED_COUNTER, firmwareService];
408
+ return createOsCommandTypedArray(elements);
409
+ }
410
+ exports.createSkippedCyclesCounterOsCommand = createSkippedCyclesCounterOsCommand;
411
+ function createIgnoreBissStatusBitsOsCommand(trigger = 1, encoderOrdinal = 1) {
412
+ const byte2 = (encoderOrdinal << 1) | trigger;
413
+ const elements = [OsCommandId.IGNORE_BISS_STATUS_BITS, byte2];
414
+ return createOsCommandTypedArray(elements);
415
+ }
416
+ exports.createIgnoreBissStatusBitsOsCommand = createIgnoreBissStatusBitsOsCommand;
417
+ function createSystemIdentificationOsCommand(parameterIndex = 0, parameterValue = 0) {
418
+ let msb = (parameterValue >> 24) & 0xFF;
419
+ let msb1 = (parameterValue >> 16) & 0xFF;
420
+ let msb2 = (parameterValue >> 8) & 0xFF;
421
+ let lsb = parameterValue & 0xFF;
422
+ const elements = [OsCommandId.SYSTEM_IDENTIFICATION, parameterIndex, msb, msb1, msb2, lsb];
423
+ return createOsCommandTypedArray(elements);
424
+ }
425
+ exports.createSystemIdentificationOsCommand = createSystemIdentificationOsCommand;
426
+ exports.systemIdentificationParameters = [
427
+ { parameterIndex: 0, parameterName: 'Starting frequency [mHz]' },
428
+ { parameterIndex: 1, parameterName: 'Target frequency [mHz]' },
429
+ { parameterIndex: 2, parameterName: 'Target amplitude [permils of rated torque]' },
430
+ { parameterIndex: 3, parameterName: 'Transition time [milliseconds]' },
431
+ ];
432
+ function createTriggerErrorOsCommand(firmwareService = 0, errorType = 11) {
433
+ const elements = [OsCommandId.TRIGGER_ERROR, firmwareService, errorType];
434
+ return createOsCommandTypedArray(elements);
435
+ }
436
+ exports.createTriggerErrorOsCommand = createTriggerErrorOsCommand;
437
+ exports.triggerErrorTypes = [
438
+ { value: 4, name: 'RAISE ET_LOAD_STORE EXCEPTION' },
439
+ { value: 6, name: 'RAISE ET_ARITHMETIC EXCEPTION' },
440
+ { value: 7, name: 'RAISE ET_ECALL EXCEPTION' },
441
+ { value: 10, name: 'HANG IN AN ENDLESS LOOP' },
442
+ { value: 11, name: 'RAISE RESETTABLE FIRMWARE ERROR `DiagErr`' },
443
+ ];
444
+ function createKublerEncoderCommand(command = 0) {
445
+ const elements = [OsCommandId.KUBLER_ENCODER_COMMAND, command];
446
+ return createOsCommandTypedArray(elements);
447
+ }
448
+ exports.createKublerEncoderCommand = createKublerEncoderCommand;
449
+ exports.kublerEncoderCommandWriteCorrectionTableOsCommandErrors = {
450
+ 0: {
451
+ errorName: 'Async communication in progress',
452
+ errorDescription: 'The command is currently not allowed because another asynchronous encoder communication is already being executed.',
453
+ },
454
+ 1: {
455
+ errorName: 'Buffer timeout error',
456
+ errorDescription: 'The FOE buffer was empty for more than 10 seconds.',
457
+ },
458
+ 2: {
459
+ errorName: 'Unknown command',
460
+ errorDescription: 'The received command is not known.',
461
+ },
462
+ 3: {
463
+ errorName: 'Wrong data length',
464
+ errorDescription: 'The provided correction table is too short or too long. In any case, the firmware will ensure to write 1024 bytes to the encoder so that the correction table writing is finished.',
465
+ },
466
+ };
467
+ exports.kublerEncoderCommandSendScpiCommandOsCommandErrors = {
468
+ 0: {
469
+ errorName: 'Async communication in progress',
470
+ errorDescription: 'The command is currently not allowed because another asynchronous encoder communication is already being executed.',
471
+ },
472
+ 1: {
473
+ errorName: 'Buffer timeout error',
474
+ errorDescription: 'The FOE buffer was empty for more than 10 seconds.',
475
+ },
476
+ 2: {
477
+ errorName: 'Unknown command',
478
+ errorDescription: 'The received command is not known.',
479
+ },
480
+ 3: {
481
+ errorName: 'Wrong data length',
482
+ errorDescription: 'The SCPI command string in the FOE buffer is longer than 256 bytes.',
483
+ },
484
+ };
485
+ function createUseInternalEncoderVelocityOsCommand(trigger = 0) {
486
+ const elements = [OsCommandId.USE_INTERNAL_ENCODER_VELOCITY, trigger];
487
+ return createOsCommandTypedArray(elements);
488
+ }
489
+ exports.createUseInternalEncoderVelocityOsCommand = createUseInternalEncoderVelocityOsCommand;
490
+ function createKublerEncoderRegisterCommunicationOsCommand(rw = 0, registerAddress = 0, registerLength = 0, registerWriteValue = 0) {
491
+ let msb = (registerWriteValue >> 24) & 0xFF;
492
+ let msb1 = (registerWriteValue >> 16) & 0xFF;
493
+ let msb2 = (registerWriteValue >> 8) & 0xFF;
494
+ let lsb = registerWriteValue & 0xFF;
495
+ const elements = [OsCommandId.KUBLER_ENCODER_REGISTER_COMMUNICATION, rw, registerAddress, registerLength, lsb, msb2, msb1, msb];
496
+ return createOsCommandTypedArray(elements);
497
+ }
498
+ exports.createKublerEncoderRegisterCommunicationOsCommand = createKublerEncoderRegisterCommunicationOsCommand;
499
+ exports.kublerEncoderRegisterCommunicationReadOsCommandErrors = {
500
+ 0: {
501
+ errorName: 'Async communication in progress',
502
+ errorDescription: 'The command is currently not allowed because another asynchronous encoder communication is already being executed.',
503
+ },
504
+ 1: {
505
+ errorName: 'Invalid register length',
506
+ errorDescription: 'The register length selected is lower than 1 or higher than 4.',
507
+ },
508
+ 2: {
509
+ errorName: 'Encoder Timeout',
510
+ errorDescription: "The encoder didn't return a register value after 10ms.",
511
+ },
512
+ 3: {
513
+ errorName: 'Wrong byte count',
514
+ errorDescription: "The register value returned by the encoder doesn't have the same size as the register length specified.",
515
+ },
516
+ };
517
+ exports.kublerEncoderRegisterCommunicationWriteOsCommandErrors = {
518
+ 0: {
519
+ errorName: 'Async communication in progress',
520
+ errorDescription: 'The command is currently not allowed because another asynchronous encoder communication is already being executed.',
521
+ },
522
+ 1: {
523
+ errorName: 'Invalid register length',
524
+ errorDescription: 'The register length selected is lower than 1 or higher than 4.',
525
+ },
526
+ };
527
+ exports.kublerEncoderRegisterValueMeaning = {
528
+ 36: {
529
+ 1: 'POA auto-calibration is not running.',
530
+ 25: 'POA auto-calibration reached good results but is still running at the moment.',
531
+ 17: 'POA auto-calibration reached good results and is finished, obtained values are saved automatically.',
532
+ 9: 'POA auto-calibration did not reach good results yet and is still running.',
533
+ }
534
+ };
535
+ exports.osCommands = [
536
+ { id: OsCommandId.CUSTOM_OS_COMMAND, name: 'Custom OS command' },
537
+ { id: OsCommandId.ENCODER_REGISTER_COMMUNICATION, name: 'Encoder register communication' },
538
+ { id: OsCommandId.ICMU_CALIBRATION_MODE, name: 'iC-MU calibration mode' },
539
+ { id: OsCommandId.OPEN_LOOP_FIELD_MODE, name: 'Open Loop Field Mode (OLFM)' },
540
+ { id: OsCommandId.HRD_STREAMING, name: 'HRD streaming' },
541
+ { id: OsCommandId.MOTOR_PHASE_ORDER_DETECTION, name: 'Motor phase order detection' },
542
+ { id: OsCommandId.COMMUTATION_OFFSET_MEASUREMENT, name: 'Commutation offset detection' },
543
+ { id: OsCommandId.OPEN_PHASE_DETECTION, name: 'Open phase detection' },
544
+ { id: OsCommandId.POLE_PAIR_DETECTION, name: 'Pole pair detection' },
545
+ { id: OsCommandId.PHASE_RESISTANCE_MEASUREMENT, name: 'Phase resistance measurement' },
546
+ { id: OsCommandId.PHASE_INDUCTANCE_MEASUREMENT, name: 'Phase inductance measurement' },
547
+ { id: OsCommandId.TORQUE_CONSTANT_MEASUREMENT, name: 'Torque constant measurement' },
548
+ { id: OsCommandId.SKIPPED_CYCLED_COUNTER, name: 'Skipped cycles counter' },
549
+ { id: OsCommandId.IGNORE_BISS_STATUS_BITS, name: 'Ignore BISS status bits' },
550
+ { id: OsCommandId.SYSTEM_IDENTIFICATION, name: 'System identification' },
551
+ { id: OsCommandId.TRIGGER_ERROR, name: 'Trigger error' },
552
+ { id: OsCommandId.KUBLER_ENCODER_COMMAND, name: 'Kübler Encoder Command' },
553
+ { id: OsCommandId.USE_INTERNAL_ENCODER_VELOCITY, name: 'Use Internal Encoder Velocity' },
554
+ { id: OsCommandId.KUBLER_ENCODER_REGISTER_COMMUNICATION, name: 'Kübler Encoder Register Communication' },
555
+ ];
270
556
  //# sourceMappingURL=os-command.js.map