motion-master-client 0.0.118 → 0.0.120

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-master-client",
3
- "version": "0.0.118",
3
+ "version": "0.0.120",
4
4
  "type": "commonjs",
5
5
  "description": "A library and CLI program used for communicating with Motion Master.",
6
6
  "dependencies": {
package/src/api.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const tslib_1 = require("tslib");
4
5
  const debug_1 = tslib_1.__importDefault(require("debug"));
@@ -9,18 +10,20 @@ const motion_master_client_1 = require("./lib/motion-master-client");
9
10
  Object.assign(globalThis, { WebSocket: require('ws') });
10
11
  const log = (0, debug_1.default)('mmapi');
11
12
  const app = (0, express_1.default)();
12
- const port = 63526;
13
+ const port = (_a = process.env['PORT']) !== null && _a !== void 0 ? _a : 63526;
13
14
  let client;
14
15
  function errmsg(err) {
15
16
  return err instanceof Error ? err.message : 'Unknown error';
16
17
  }
18
+ // Middleware to parse raw binary data
19
+ app.use(express_1.default.raw({ type: 'application/octet-stream', limit: '10mb' }));
17
20
  // Middleware to handle a non-existing instance of a client
18
21
  app.use((req, res, next) => {
19
22
  if (req.path.startsWith('/api/connect') || req.path === '/api/disconnect') {
20
23
  return next();
21
24
  }
22
25
  if (!client) {
23
- res.status(400).send('Client has not been created. Please connect using GET /api/connect/:hostname? before making requests to Motion Master.');
26
+ res.status(400).send({ error: 'Client has not been created. Please connect using GET /api/connect/:hostname? before making requests to Motion Master.' });
24
27
  return;
25
28
  }
26
29
  next();
@@ -39,12 +42,12 @@ const asyncHandler = (fn) => (req, res, next) => tslib_1.__awaiter(void 0, void
39
42
  }
40
43
  });
41
44
  app.get('/api/connect/:hostname?', (req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
42
- var _a;
45
+ var _b;
43
46
  if (client) {
44
- res.status(400).send('Client has already been created. Please disconnect (GET /api/disconnect) before creating a new client.');
47
+ res.status(409).send({ error: 'Client has already been created. Please disconnect (GET /api/disconnect) before creating a new client.' });
45
48
  return;
46
49
  }
47
- const hostname = (_a = req.params['hostname']) !== null && _a !== void 0 ? _a : '127.0.0.1';
50
+ const hostname = (_b = req.params['hostname']) !== null && _b !== void 0 ? _b : '127.0.0.1';
48
51
  log(`Creating an instance of Motion Master client and connecting to ${hostname}.`);
49
52
  client = (0, motion_master_client_1.createMotionMasterClient)(hostname);
50
53
  try {
@@ -62,23 +65,14 @@ app.get('/api/disconnect', (_req, res) => {
62
65
  client = undefined;
63
66
  res.status(204).send();
64
67
  });
65
- app.get('/api/get-system-version', asyncHandler((_req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
68
+ app.get('/api/system-version', asyncHandler((_req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
66
69
  const status = yield (0, rxjs_1.lastValueFrom)(client.request.getSystemVersion(5000));
67
- res.send(status);
68
- })));
69
- app.get('/api/get-device-info', asyncHandler((_req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
70
- const status = yield (0, rxjs_1.lastValueFrom)(client.request.getDeviceInfo(5000));
71
- res.send(status);
70
+ res.send({ version: status.version });
72
71
  })));
73
72
  app.get('/api/devices', asyncHandler((_req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
74
73
  const devices = yield (0, rxjs_1.lastValueFrom)(client.request.getDevices(10000));
75
74
  res.send(devices);
76
75
  })));
77
- app.get('/api/devices/:deviceRef/get-device-file-list', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
78
- const deviceRefObj = (0, device_1.makeDeviceRefObj)(req.params['deviceRef']);
79
- const status = yield (0, rxjs_1.lastValueFrom)(client.request.getDeviceFileList(deviceRefObj, 5000));
80
- res.send(status);
81
- })));
82
76
  app.get('/api/devices/:deviceRef/upload/:index/:subindex', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
83
77
  const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
84
78
  const index = parseInt(req.params['index'], 16);
@@ -94,6 +88,31 @@ app.get('/api/devices/:deviceRef/download/:index/:subindex/:value', asyncHandler
94
88
  yield client.request.download(deviceRef, index, subindex, value);
95
89
  res.status(204).send();
96
90
  })));
91
+ app.get('/api/devices/:deviceRef/files', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
92
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
93
+ const value = yield (0, rxjs_1.lastValueFrom)(client.request.getFiles(deviceRef));
94
+ res.send(value);
95
+ })));
96
+ app.get('/api/devices/:deviceRef/files/:filename', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
97
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
98
+ const filename = req.params['filename'];
99
+ const value = yield (0, rxjs_1.lastValueFrom)(client.request.getDecodedFile(deviceRef, filename));
100
+ res.send(value);
101
+ })));
102
+ app.post('/api/devices/:deviceRef/files/:filename', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
103
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
104
+ const filename = req.params['filename'];
105
+ const buffer = req.body;
106
+ const content = new Uint8Array(buffer);
107
+ yield (0, rxjs_1.lastValueFrom)(client.request.setFile(deviceRef, filename, content, true, 30000));
108
+ res.send();
109
+ })));
110
+ app.delete('/api/devices/:deviceRef/files/:filename', asyncHandler((req, res) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
111
+ const deviceRef = (0, device_1.ensureDeviceRef)(req.params['deviceRef']);
112
+ const filename = req.params['filename'];
113
+ yield (0, rxjs_1.lastValueFrom)(client.request.deleteFile(deviceRef, filename));
114
+ res.send();
115
+ })));
97
116
  app.listen(port, () => {
98
117
  log(`API server is now running on port ${port}.`);
99
118
  });
package/src/api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  export * from './lib/product';
27
27
  export * from './lib/request-status-resolver';
28
+ export * from './lib/sii';
28
29
  export * from './lib/system-log-line';
29
30
  export * from './lib/types';
30
31
  export * from './lib/urls';
package/src/index.js CHANGED
@@ -28,6 +28,7 @@ tslib_1.__exportStar(require("./lib/os-command"), exports);
28
28
  tslib_1.__exportStar(require("./lib/parameter"), exports);
29
29
  tslib_1.__exportStar(require("./lib/product"), exports);
30
30
  tslib_1.__exportStar(require("./lib/request-status-resolver"), exports);
31
+ tslib_1.__exportStar(require("./lib/sii"), exports);
31
32
  tslib_1.__exportStar(require("./lib/system-log-line"), exports);
32
33
  tslib_1.__exportStar(require("./lib/types"), exports);
33
34
  tslib_1.__exportStar(require("./lib/urls"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/motion-master-client/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,4DAAkC;AAClC,gEAAsC;AACtC,uDAA6B;AAC7B,gEAAsC;AACtC,iEAAuC;AACvC,wDAA8B;AAC9B,qEAA2C;AAC3C,gEAAsC;AACtC,4EAAkD;AAClD,kEAAwC;AACxC,iEAAuC;AACvC,qEAA2C;AAC3C,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,0DAAgC;AAChC,wDAA8B;AAC9B,2DAAiC;AACjC,0DAAgC;AAChC,wDAA8B;AAC9B,wEAA8C;AAC9C,gEAAsC;AACtC,sDAA4B;AAC5B,qDAA2B;AAC3B,qDAA2B;AAC3B,kFAAwD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/motion-master-client/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,4DAAkC;AAClC,gEAAsC;AACtC,uDAA6B;AAC7B,gEAAsC;AACtC,iEAAuC;AACvC,wDAA8B;AAC9B,qEAA2C;AAC3C,gEAAsC;AACtC,4EAAkD;AAClD,kEAAwC;AACxC,iEAAuC;AACvC,qEAA2C;AAC3C,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,0DAAgC;AAChC,wDAA8B;AAC9B,2DAAiC;AACjC,0DAAgC;AAChC,wDAA8B;AAC9B,wEAA8C;AAC9C,oDAA0B;AAC1B,gEAAsC;AACtC,sDAA4B;AAC5B,qDAA2B;AAC3B,qDAA2B;AAC3B,kFAAwD"}
@@ -19,7 +19,7 @@ export interface CirculoEncoderBatteryMode {
19
19
  maxCurrent: number;
20
20
  value: number;
21
21
  }
22
- export declare const circuloEncoderBatteryModeMap: Map<"Node 400" | "Node 1000" | "Node 2000" | "Circulo 7" | "Circulo 9" | "Integro 60" | "Integro 80", CirculoEncoderBatteryMode[]>;
22
+ export declare const circuloEncoderBatteryModeMap: Map<"Node 400" | "Node 1000" | "Node 2000" | "Circulo 7" | "Circulo 9" | "Integro 60" | "Integro 80" | "Actilink 60" | "Actilink 80", CirculoEncoderBatteryMode[]>;
23
23
  export type EncoderShaft = 'motor' | 'driving';
24
24
  export declare function getCirculoEncoderBatteryModeOptions(productId: string | number, shaft?: EncoderShaft): {
25
25
  key: string;
@@ -30,6 +30,14 @@ export interface HardwareDescription {
30
30
  device: HardwareDevice;
31
31
  }
32
32
  export declare function getIdFromHardwareDescription(hd: HardwareDescription): string;
33
+ /**
34
+ * Constructs the API ID from the hardware description file.
35
+ * The API ID is a combination of the assembly or device ID, version, and optionally a Key ID, which is used for encrypting firmware binaries.
36
+ * Note: In the "Hardware Description File Format" document, the API ID is now referred to as FWID for clarity.
37
+ * @param hd The hardware description object.
38
+ * @param skipKeyId If true, assembles the API ID without including the Key ID.
39
+ * @returns An API identifier, such as "9600-02" or "9600-02-2423".
40
+ */
33
41
  export declare function getApiIdentifierFromHardwareDescription(hd: HardwareDescription, skipKeyId?: boolean): string;
34
42
  export declare function getNameFromHardwareDescription(hd: HardwareDescription): string;
35
43
  export declare function getSerialNumberFromHardwareDescription(hd: HardwareDescription): string;
@@ -10,6 +10,14 @@ function getIdFromHardwareDescription(hd) {
10
10
  : hd.device.id;
11
11
  }
12
12
  exports.getIdFromHardwareDescription = getIdFromHardwareDescription;
13
+ /**
14
+ * Constructs the API ID from the hardware description file.
15
+ * The API ID is a combination of the assembly or device ID, version, and optionally a Key ID, which is used for encrypting firmware binaries.
16
+ * Note: In the "Hardware Description File Format" document, the API ID is now referred to as FWID for clarity.
17
+ * @param hd The hardware description object.
18
+ * @param skipKeyId If true, assembles the API ID without including the Key ID.
19
+ * @returns An API identifier, such as "9600-02" or "9600-02-2423".
20
+ */
13
21
  function getApiIdentifierFromHardwareDescription(hd, skipKeyId = false) {
14
22
  let apiId = hd.assembly
15
23
  ? `${hd.assembly.id}-${hd.assembly.version}`
@@ -1 +1 @@
1
- {"version":3,"file":"hardware-description.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/hardware-description.ts"],"names":[],"mappings":";;;;AAAA,mCAAiC;AACjC,4DAA4B;AAsC5B,SAAgB,4BAA4B,CAAC,EAAuB;IAClE,OAAO,EAAE,CAAC,QAAQ;QAChB,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE;QAChB,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;AACnB,CAAC;AAJD,oEAIC;AAED,SAAgB,uCAAuC,CAAC,EAAuB,EAAE,SAAS,GAAG,KAAK;IAChG,IAAI,KAAK,GAAG,EAAE,CAAC,QAAQ;QACrB,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC5C,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAE3C,IAA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A6C,CAAC,CAAC;KAChE;IACD,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzF,MAAM,KAAK,GAAG,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC;IACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC;AAC3E,CAAC;AAPD,8CAOC"}
1
+ {"version":3,"file":"hardware-description.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/hardware-description.ts"],"names":[],"mappings":";;;;AAAA,mCAAiC;AACjC,4DAA4B;AAsC5B,SAAgB,4BAA4B,CAAC,EAAuB;IAClE,OAAO,EAAE,CAAC,QAAQ;QAChB,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE;QAChB,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;AACnB,CAAC;AAJD,oEAIC;AAED;;;;;;;GAOG;AACH,SAAgB,uCAAuC,CAAC,EAAuB,EAAE,SAAS,GAAG,KAAK;IAChG,IAAI,KAAK,GAAG,EAAE,CAAC,QAAQ;QACrB,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC5C,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAE3C,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;QACjC,KAAK,IAAI,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KAChC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,0FAUC;AAED,SAAgB,8BAA8B,CAAC,EAAuB;IACpE,OAAO,EAAE,CAAC,QAAQ;QAChB,CAAC,CAAC,EA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iB,EAAE,cAAc,EAAE,CAAC;AAC3E,CAAC;AAPD,8CAOC"}
@@ -6,13 +6,24 @@ interface VelocityProfile {
6
6
  acceleration: number;
7
7
  deceleration: number;
8
8
  }
9
+ export declare function parseIntegroEncoderFirmwareVersion(value: number): {
10
+ value: number;
11
+ major: string;
12
+ minor: string;
13
+ datestamp: string;
14
+ year: string;
15
+ month: string;
16
+ day: string;
17
+ };
9
18
  export declare class IntegroEncoderCalibration {
10
19
  private client;
11
20
  readonly deviceRef: DeviceRef;
12
21
  readonly notifications$: Subject<string>;
13
- private readonly poeCalibrationVelocityProfile;
14
- private readonly lookupTableVelocityProfileDirection1;
15
- private readonly lookupTableVelocityProfileDirection2;
22
+ feedConstant: number;
23
+ maxMotorSpeed: number;
24
+ siUnitVelocity: number;
25
+ private readonly ccwVelocityProfile;
26
+ private readonly cwVelocityProfile;
16
27
  constructor(client: MotionMasterClient, deviceRef: DeviceRef);
17
28
  start(debug?: boolean): Promise<void>;
18
29
  /**
@@ -22,13 +33,15 @@ export declare class IntegroEncoderCalibration {
22
33
  /**
23
34
  * Set velocity profile.
24
35
  */
25
- setVelocityProfile(velocityProfile: VelocityProfile, accelerationConstant?: number): Promise<void>;
36
+ setVelocityProfile(velocityProfile: VelocityProfile, accelerationConstant?: number): Promise<VelocityProfile>;
37
+ setVelocityWindow(value: number): Promise<number>;
38
+ setVelocityWindowTime(value: number): Promise<number>;
26
39
  /**
27
40
  * Write encoder register value and validate response.
28
41
  */
29
42
  writeEncoderRegisterValueAndValidateResponse(address: number, value: number, length?: number): Promise<void>;
30
43
  notifyParameterValue(index: number, subindex: number): Promise<void>;
31
- notifyExtendedErrorStatus(): Promise<void>;
44
+ notifyExtendedErrorStatusAndGetErrorCodes(): Promise<number[]>;
32
45
  notifyEncoderSpeeds(): Promise<void>;
33
46
  }
34
47
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IntegroEncoderCalibration = void 0;
3
+ exports.IntegroEncoderCalibration = exports.parseIntegroEncoderFirmwareVersion = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const rxjs_1 = require("rxjs");
6
6
  const device_1 = require("./device");
@@ -12,22 +12,31 @@ const parameter_1 = require("./parameter");
12
12
  function hex(value) {
13
13
  return `0x${value.toString(16).toUpperCase()}`;
14
14
  }
15
+ function parseIntegroEncoderFirmwareVersion(value) {
16
+ const str = String(value).padStart(10, '0');
17
+ const major = str.slice(0, 2);
18
+ const minor = str.slice(2, 4);
19
+ const datestamp = str.slice(4);
20
+ const year = datestamp.slice(0, 2);
21
+ const month = datestamp.slice(2, 4);
22
+ const day = datestamp.slice(4, 6);
23
+ return { value, major, minor, datestamp, year, month, day };
24
+ }
25
+ exports.parseIntegroEncoderFirmwareVersion = parseIntegroEncoderFirmwareVersion;
15
26
  class IntegroEncoderCalibration {
16
27
  constructor(client, deviceRef) {
17
28
  this.client = client;
18
29
  this.deviceRef = deviceRef;
19
30
  this.notifications$ = new rxjs_1.Subject();
20
- this.poeCalibrationVelocityProfile = {
21
- target: 1200,
22
- acceleration: 4800,
23
- deceleration: 4800, // RPM/s
24
- };
25
- this.lookupTableVelocityProfileDirection1 = {
31
+ this.feedConstant = 0;
32
+ this.maxMotorSpeed = 0;
33
+ this.siUnitVelocity = 0;
34
+ this.ccwVelocityProfile = {
26
35
  target: 3000,
27
36
  acceleration: 6000,
28
37
  deceleration: 6000, // RPM/s
29
38
  };
30
- this.lookupTableVelocityProfileDirection2 = {
39
+ this.cwVelocityProfile = {
31
40
  target: -3000,
32
41
  acceleration: 6000,
33
42
  deceleration: 6000, // RPM/s
@@ -39,26 +48,46 @@ class IntegroEncoderCalibration {
39
48
  // Tuning of the control loop should be done by the user.
40
49
  this.notifications$.next(`Validating the device (${this.deviceRef}) before starting the Integro encoder calibration.`);
41
50
  yield this.validateDevice();
51
+ this.feedConstant = yield (0, rxjs_1.lastValueFrom)(this.client.request.getFeedConstant(this.deviceRef));
52
+ this.maxMotorSpeed = yield this.client.request.upload(this.deviceRef, 0x6080, 0);
53
+ this.siUnitVelocity = yield this.client.request.upload(this.deviceRef, 0x60A9, 0);
54
+ // Retrieve the encoder firmware version and display it.
55
+ let osCommandResponse = yield (0, rxjs_1.lastValueFrom)(this.client.request.runKublerEncoderRegisterCommunicationOsCommand(this.deviceRef, 0, 0x04, 4, 0, 10000, 1000, false));
56
+ const encoderFirmwareVersion = parseIntegroEncoderFirmwareVersion(osCommandResponse.kublerRegisterValue);
57
+ this.notifications$.next(`The firmware version of the Integro encoder (register 0x04) is: Major=${encoderFirmwareVersion.major}, Minor=${encoderFirmwareVersion.minor}, Date=${encoderFirmwareVersion.datestamp}, Value=${encoderFirmwareVersion.value}.`);
42
58
  // Retrieve the encoder configuration index assigned to Port 1.
43
59
  const encoder1ConfigurationSensorPort = yield this.client.request.upload(this.deviceRef, 0x2110, 1);
44
60
  const encoderConfigurationIndex = encoder1ConfigurationSensorPort === 1 ? 0x2110 : 0x2112;
45
61
  this.notifications$.next(`Setting the integrated encoder sampling frequency to 16 kHz (${hex(encoderConfigurationIndex)}:28 = 1).`);
46
62
  yield this.client.request.download(this.deviceRef, encoderConfigurationIndex, 28, 1);
47
- yield (0, util_1.resolveAfter)(500);
63
+ yield (0, util_1.resolveAfter)(200);
64
+ // Configure the velocity profile window and time.
65
+ yield this.setVelocityWindow(120);
66
+ yield this.setVelocityWindowTime(500);
48
67
  this.notifications$.next('Switching the source of the velocity to the value provided by the encoder.');
49
68
  yield (0, rxjs_1.lastValueFrom)(this.client.request.runUseInternalEncoderVelocityOsCommand(this.deviceRef, 1, 10000, 1000, false));
50
69
  yield (0, util_1.resolveAfter)(200);
51
- // Trigger the POA automatic calibration with an OS command.
52
- this.notifications$.next('Triggering automatic calibration of the POA by setting register 0x25 to 0x09.');
53
- yield this.writeEncoderRegisterValueAndValidateResponse(0x25, 0x09);
54
70
  // Convert the POE calibration velocity profile values and update the device.
55
- yield this.setVelocityProfile(this.poeCalibrationVelocityProfile, 4);
71
+ let velocityProfile = yield this.setVelocityProfile(this.ccwVelocityProfile, 2);
56
72
  this.notifications$.next('Setting modes of operation to Profile velocity mode and transitioning to Operation enabled CiA402 state.');
57
73
  yield (0, rxjs_1.lastValueFrom)(this.client.request.setModesOfOperation(this.deviceRef, cia402_1.ModesOfOperation.PROFILE_VELOCITY_MODE));
58
74
  yield this.client.request.transitionToCia402State(this.deviceRef, cia402_1.Cia402State.OPERATION_ENABLED);
59
- this.notifications$.next('Polling the encoder register 0x24 until its value equals 0x11 or until 5 seconds have passed.');
60
- // Read the value of the encoder register 0x24 until its value equals 0x11 or until 5 seconds have passed.
61
- let osCommandResponse = yield (0, rxjs_1.lastValueFrom)((0, rxjs_1.defer)(() => this.client.request.runKublerEncoderRegisterCommunicationOsCommand(this.deviceRef, 0, 0x24, 1, 0, 10000, 1000, false).pipe((0, rxjs_1.repeat)({ count: 14, delay: 500 }), (0, rxjs_1.takeWhile)(osCommandResponse => {
75
+ try {
76
+ yield this.client.whenTargetReached(this.deviceRef, 500, 5000);
77
+ yield this.notifyParameterValue(0x606C, 0); // Velocity actual value
78
+ // Trigger the POA automatic calibration with an OS command.
79
+ this.notifications$.next('Triggering automatic calibration of the POA by setting register 0x25 to 0x09.');
80
+ yield this.writeEncoderRegisterValueAndValidateResponse(0x25, 0x09);
81
+ yield (0, util_1.resolveAfter)(500);
82
+ }
83
+ catch (_err) {
84
+ this.client.request.quickStop(this.deviceRef).catch();
85
+ this.notifications$.next(`Target velocity ${velocityProfile.target} can't be reached. Aborting the calibration procedure.`);
86
+ return;
87
+ }
88
+ this.notifications$.next('Polling the encoder register 0x24 until its value equals 0x11 or until 8 seconds have passed.');
89
+ // Read the value of the encoder register 0x24 until its value equals 0x11 or until 8 seconds have passed.
90
+ osCommandResponse = yield (0, rxjs_1.lastValueFrom)((0, rxjs_1.defer)(() => this.client.request.runKublerEncoderRegisterCommunicationOsCommand(this.deviceRef, 0, 0x24, 1, 0, 10000, 1000, false).pipe((0, rxjs_1.repeat)({ count: 16, delay: 500 }), (0, rxjs_1.takeWhile)(osCommandResponse => {
62
91
  if (debug) {
63
92
  this.notifications$.next(`Value read from the encoder register 0x24 is ${hex(osCommandResponse.kublerRegisterValue)}.`);
64
93
  }
@@ -70,20 +99,27 @@ class IntegroEncoderCalibration {
70
99
  else if (osCommandResponse.request === 'succeeded') {
71
100
  this.notifications$.next(`The last value retrieved from register 0x24 is ${osCommandResponse.kublerRegisterValue}: ${os_command_1.kublerEncoderRegisterValueMeaning[0x24][osCommandResponse.kublerRegisterValue]}`);
72
101
  }
73
- yield this.client.request.download(this.deviceRef, 0x60FF, 0, 0);
74
- yield (0, util_1.resolveAfter)(500);
75
- if (osCommandResponse.kublerRegisterValue === 0x09) {
76
- this.notifications$.next('The calibration of the integrated encoder analogue gains cannot converge. Writing 0x05 to the encoder register 0x25.');
77
- yield this.writeEncoderRegisterValueAndValidateResponse(0x25, 0x05);
102
+ if (osCommandResponse.kublerRegisterValue !== 0x11) {
103
+ this.notifications$.next('The analogue gains calibration did not converge. Please repeat the procedure.');
104
+ this.client.request.quickStop(this.deviceRef).catch();
105
+ return;
78
106
  }
107
+ yield (0, util_1.resolveAfter)(500);
79
108
  // Lookup table learning.
80
109
  this.notifications$.next('Running the motor at a constant speed in one direction.');
81
110
  // Run the motor at constant speed in one direction.
82
- this.setVelocityProfile(this.lookupTableVelocityProfileDirection1, 2);
83
- yield (0, util_1.resolveAfter)(2000);
84
- yield this.notifyParameterValue(0x606C, 0); // Velocity actual value
85
- this.notifications$.next('Writing 0x00C2 to the encoder register 0x50.');
86
- yield this.writeEncoderRegisterValueAndValidateResponse(0x50, 0x00C2, 2);
111
+ try {
112
+ yield this.client.whenTargetReached(this.deviceRef, 500, 5000);
113
+ yield this.notifyParameterValue(0x606C, 0); // Velocity actual value
114
+ this.notifications$.next('Writing 0x00C2 to the encoder register 0x50.');
115
+ yield this.writeEncoderRegisterValueAndValidateResponse(0x50, 0x00C2, 2);
116
+ yield (0, util_1.resolveAfter)(500);
117
+ }
118
+ catch (_err) {
119
+ this.client.request.quickStop(this.deviceRef).catch();
120
+ this.notifications$.next(`Target velocity ${velocityProfile.target} can't be reached. Aborting the calibration procedure.`);
121
+ return;
122
+ }
87
123
  // Read the value of the encoder register 0x52 until its value satisfies the following condition (bit 6 = 1) & (bit 8 = 0) or until 8 seconds have passed.
88
124
  osCommandResponse = yield (0, rxjs_1.lastValueFrom)((0, rxjs_1.defer)(() => this.client.request.runKublerEncoderRegisterCommunicationOsCommand(this.deviceRef, 0, 0x52, 2, 0, 10000, 1000, false).pipe((0, rxjs_1.repeat)({ count: 16, delay: 500 }), (0, rxjs_1.takeWhile)(osCommandResponse => {
89
125
  if (debug) {
@@ -98,25 +134,35 @@ class IntegroEncoderCalibration {
98
134
  this.notifications$.next(`The last value retrieved from register 0x52 is ${hex(osCommandResponse.kublerRegisterValue)}`);
99
135
  }
100
136
  yield this.client.request.download(this.deviceRef, 0x60FF, 0, 0);
101
- yield (0, util_1.resolveAfter)(1000);
137
+ yield (0, util_1.resolveAfter)(200);
102
138
  this.notifications$.next('Reversing the rotation direction.');
103
139
  // Reverse the rotation direction.
104
- if (debug) {
105
- try {
106
- yield this.notifyExtendedErrorStatus();
140
+ try {
141
+ const [ec1, ec2] = yield this.notifyExtendedErrorStatusAndGetErrorCodes();
142
+ if ((((ec1 >> 16) & 0xFF) === 0x0F) || (((ec2 >> 16) & 0xFF) === 0x0F)) {
143
+ this.notifications$.next('There was an error in recording the correction table. Please restart the procedure.');
144
+ return;
107
145
  }
108
- catch (err) {
109
- if (err instanceof Error) {
110
- this.notifications$.next(`Failed to notify the extended error status: ${err.message}`);
111
- }
146
+ }
147
+ catch (err) {
148
+ if (err instanceof Error) {
149
+ this.notifications$.next(`Failed to notify the extended error status: ${err.message}`);
112
150
  }
113
151
  }
114
- yield (0, util_1.resolveAfter)(1000);
115
- this.setVelocityProfile(this.lookupTableVelocityProfileDirection2, 2);
116
- yield (0, util_1.resolveAfter)(2000);
117
- yield this.notifyParameterValue(0x606C, 0); // Velocity actual value
118
- this.notifications$.next('Writing 0x00C2 to the encoder register 0x50.');
119
- yield this.writeEncoderRegisterValueAndValidateResponse(0x50, 0x00C2, 2);
152
+ velocityProfile = yield this.setVelocityProfile(this.cwVelocityProfile, 2);
153
+ try {
154
+ yield this.client.whenTargetReached(this.deviceRef, 500, 5000);
155
+ yield this.notifyParameterValue(0x606C, 0); // Velocity actual value
156
+ // Trigger the POA automatic calibration with an OS command.
157
+ this.notifications$.next('Writing 0x00C2 to the encoder register 0x50.');
158
+ yield this.writeEncoderRegisterValueAndValidateResponse(0x50, 0x00C2, 2);
159
+ yield (0, util_1.resolveAfter)(500);
160
+ }
161
+ catch (_err) {
162
+ this.client.request.quickStop(this.deviceRef).catch();
163
+ this.notifications$.next(`Target velocity ${velocityProfile.target} can't be reached. Aborting the calibration procedure.`);
164
+ return;
165
+ }
120
166
  // Read the value of the encoder register 0x52 until its value satisfies the following condition (bit 6 = 1) & (bit 8 = 0) or until 8 seconds have passed.
121
167
  osCommandResponse = yield (0, rxjs_1.lastValueFrom)((0, rxjs_1.defer)(() => this.client.request.runKublerEncoderRegisterCommunicationOsCommand(this.deviceRef, 0, 0x52, 2, 0, 10000, 1000, false).pipe((0, rxjs_1.repeat)({ count: 16, delay: 500 }), (0, rxjs_1.takeWhile)(osCommandResponse => {
122
168
  if (debug) {
@@ -131,30 +177,30 @@ class IntegroEncoderCalibration {
131
177
  this.notifications$.next(`The last value retrieved from register 0x52 is ${hex(osCommandResponse.kublerRegisterValue)}`);
132
178
  }
133
179
  yield this.client.request.download(this.deviceRef, 0x60FF, 0, 0);
134
- yield (0, util_1.resolveAfter)(500);
135
- this.notifications$.next('Saving the correction table by writing 0x00D0 to the encoder register 0x50.');
136
- yield this.writeEncoderRegisterValueAndValidateResponse(0x50, 0x00D0, 2);
137
- this.notifications$.next('Requesting Quick stop from device.');
138
- yield this.client.request.quickStop(this.deviceRef);
139
- yield (0, util_1.resolveAfter)(1000);
140
- if (debug) {
141
- try {
142
- yield this.notifyExtendedErrorStatus();
143
- }
144
- catch (err) {
145
- if (err instanceof Error) {
146
- this.notifications$.next(`Failed to notify the extended error status: ${err.message}`);
147
- }
180
+ yield (0, util_1.resolveAfter)(200);
181
+ try {
182
+ const [ec1, ec2] = yield this.notifyExtendedErrorStatusAndGetErrorCodes();
183
+ if ((((ec1 >> 16) & 0xFF) === 0x0F) || (((ec2 >> 16) & 0xFF) === 0x0F)) {
184
+ this.notifications$.next('There was an error in recording the correction table. Please restart the procedure.');
185
+ return;
148
186
  }
187
+ this.notifications$.next('Saving the correction table by writing 0x00D0 to the encoder register 0x50.');
188
+ yield this.writeEncoderRegisterValueAndValidateResponse(0x50, 0x00D0, 2);
149
189
  }
150
- if (debug) {
151
- try {
152
- yield this.notifyEncoderSpeeds();
190
+ catch (err) {
191
+ if (err instanceof Error) {
192
+ this.notifications$.next(`Failed to notify the extended error status: ${err.message}`);
153
193
  }
154
- catch (err) {
155
- if (err instanceof Error) {
156
- this.notifications$.next(`Failed to notify the encoder speeds: ${err.message}`);
157
- }
194
+ }
195
+ yield (0, util_1.resolveAfter)(500);
196
+ this.notifications$.next('Requesting Quick stop from device.');
197
+ this.client.request.quickStop(this.deviceRef).catch();
198
+ try {
199
+ yield this.notifyEncoderSpeeds();
200
+ }
201
+ catch (err) {
202
+ if (err instanceof Error) {
203
+ this.notifications$.next(`Failed to notify the encoder speeds: ${err.message}`);
158
204
  }
159
205
  }
160
206
  });
@@ -228,30 +274,46 @@ class IntegroEncoderCalibration {
228
274
  setVelocityProfile(velocityProfile, accelerationConstant = 2) {
229
275
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
230
276
  const vp = Object.assign({}, velocityProfile); // make a copy
231
- const maxMotorSpeed = yield this.client.request.upload(this.deviceRef, 0x6080, 0);
232
- const siUnitVelocity = yield this.client.request.upload(this.deviceRef, 0x60A9, 0);
233
- const feedConstant = yield (0, rxjs_1.lastValueFrom)(this.client.request.getFeedConstant(this.deviceRef));
234
277
  // The velocity target value should not exceed the maximum motor speed.
235
278
  // If it's higher than the maximum motor speed, set it to 95% of the maximum motor speed and update acceleration and deceleration accordingly.
236
- if (Math.abs(vp.target) > maxMotorSpeed) {
279
+ if (Math.abs(vp.target) > this.maxMotorSpeed) {
237
280
  const sgn = vp.target < 0 ? -1 : 1;
238
- vp.target = sgn * maxMotorSpeed * 0.95;
281
+ vp.target = sgn * this.maxMotorSpeed * 0.95;
239
282
  vp.acceleration = Math.abs(vp.target) * accelerationConstant;
240
283
  vp.deceleration = Math.abs(vp.target) * accelerationConstant;
241
284
  }
242
285
  // Convert the velocity profile values using the user-configured SI unit velocity and Feed constant.
243
286
  for (let [key, value] of Object.entries(vp)) {
244
- vp[key] = (0, device_1.convertSiUnitVelocityAffectedValue)(value, 0x00B44700, siUnitVelocity);
245
- vp[key] = (0, device_1.convertFeedConstantAffectedVelocityValue)(vp[key], 0xFFFFFFFF, feedConstant);
287
+ vp[key] = (0, device_1.convertSiUnitVelocityAffectedValue)(value, 0x00B44700, this.siUnitVelocity);
288
+ vp[key] = (0, device_1.convertFeedConstantAffectedVelocityValue)(vp[key], 0xFFFFFFFF, this.feedConstant);
246
289
  }
247
290
  // Update the velocity target, and profile acceleration and deceleration values.
248
- this.notifications$.next(`Setting velocity target value to ${vp.target}, with velocity profile acceleration and deceleration set to ${vp.acceleration} and ${vp.deceleration}, respectively.`);
291
+ this.notifications$.next(`Setting velocity target value (0x60FF:00) to ${vp.target}, with the velocity profile acceleration (0x6083:00) set to ${vp.acceleration} and deceleration (0x6084:00) set to ${vp.deceleration}.`);
249
292
  yield (0, rxjs_1.lastValueFrom)(this.client.request.setParameterValues([
250
293
  [this.deviceRef, 0x6083, 0, vp.acceleration],
251
294
  [this.deviceRef, 0x6084, 0, vp.deceleration],
252
295
  [this.deviceRef, 0x6086, 0, 0],
253
296
  [this.deviceRef, 0x60FF, 0, vp.target], // 0x60FF: Target velocity
254
297
  ]));
298
+ return vp;
299
+ });
300
+ }
301
+ setVelocityWindow(value) {
302
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
303
+ value = (0, device_1.convertSiUnitVelocityAffectedValue)(value, 0x00B44700, this.siUnitVelocity);
304
+ value = (0, device_1.convertFeedConstantAffectedVelocityValue)(value, 0xFFFFFFFF, this.feedConstant);
305
+ this.notifications$.next(`Setting the velocity window (0x606D:00) to ${value}.`);
306
+ yield this.client.request.download(this.deviceRef, 0x606D, 0, value);
307
+ return value;
308
+ });
309
+ }
310
+ setVelocityWindowTime(value) {
311
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
312
+ value = (0, device_1.convertSiUnitVelocityAffectedValue)(value, 0x00B44700, this.siUnitVelocity);
313
+ value = (0, device_1.convertFeedConstantAffectedVelocityValue)(value, 0xFFFFFFFF, this.feedConstant);
314
+ this.notifications$.next(`Setting the velocity window time (0x606E:00) to ${value}.`);
315
+ yield this.client.request.download(this.deviceRef, 0x606E, 0, value);
316
+ return value;
255
317
  });
256
318
  }
257
319
  /**
@@ -269,10 +331,10 @@ class IntegroEncoderCalibration {
269
331
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
270
332
  const id = (0, parameter_1.makeParameterId)(index, subindex);
271
333
  const value = yield this.client.request.upload(this.deviceRef, index, subindex);
272
- this.notifications$.next(`Value of ${id} is ${value}`);
334
+ this.notifications$.next(`Value of ${id} is ${value}.`);
273
335
  });
274
336
  }
275
- notifyExtendedErrorStatus() {
337
+ notifyExtendedErrorStatusAndGetErrorCodes() {
276
338
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
277
339
  const ec1Response = yield (0, rxjs_1.lastValueFrom)(this.client.request.runKublerEncoderRegisterCommunicationOsCommand(this.deviceRef, 0x00, 0x66, 0x04, 0, 10000, 1000, false));
278
340
  this.notifications$.next(`The value of register 0x66 (Error code 1) is ${hex(ec1Response.kublerRegisterValue)}.`);
@@ -280,6 +342,7 @@ class IntegroEncoderCalibration {
280
342
  this.notifications$.next(`The value of register 0x6A (Error code 2) is ${hex(ec2Response.kublerRegisterValue)}.`);
281
343
  this.notifications$.next(`Clearing the encoder errors by writing the value 0x02 to register 0x61.`);
282
344
  yield (0, rxjs_1.lastValueFrom)(this.client.request.runKublerEncoderRegisterCommunicationOsCommand(this.deviceRef, 0x01, 0x61, 0x01, 0x02, 10000, 1000, false));
345
+ return [ec1Response.kublerRegisterValue, ec2Response.kublerRegisterValue];
283
346
  });
284
347
  }
285
348
  notifyEncoderSpeeds() {