motion-master-client 0.0.158 → 0.0.160

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.158",
3
+ "version": "0.0.160",
4
4
  "type": "commonjs",
5
5
  "description": "A library and CLI program used for communicating with Motion Master.",
6
6
  "dependencies": {
@@ -1,13 +1,22 @@
1
+ import { ParseResult } from 'papaparse';
1
2
  import { Parameter } from './parameter';
2
3
  import { Optional } from './types';
3
4
  export type ConfigParameter = Optional<Parameter, 'name' | 'typeValueKey' | 'id'>;
5
+ /**
6
+ * Parses the contents of configuration files such as config.csv, .factory_config, and .assembly_config.
7
+ */
4
8
  export declare class ConfigFile {
5
9
  readonly content: string;
6
10
  readonly file?: Pick<File, "name" | "type" | "size" | "lastModified"> | undefined;
7
11
  readonly apiId?: string;
8
12
  readonly firmwareVersion?: string;
9
13
  readonly header?: string;
14
+ readonly parseResult?: ParseResult<string[]>;
10
15
  parameters: ConfigParameter[];
11
16
  constructor(content: string, file?: Pick<File, "name" | "type" | "size" | "lastModified"> | undefined);
17
+ get firmwareId(): string | undefined;
18
+ get isSmmConfigFile(): boolean;
19
+ get hasParseErrors(): boolean;
20
+ get numberOfParameters(): number;
12
21
  toString(): string;
13
22
  }
@@ -1,26 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConfigFile = void 0;
4
- const tslib_1 = require("tslib");
5
- const Papa = tslib_1.__importStar(require("papaparse"));
4
+ const papaparse_1 = require("papaparse");
6
5
  const parameter_1 = require("./parameter");
6
+ /**
7
+ * Parses the contents of configuration files such as config.csv, .factory_config, and .assembly_config.
8
+ */
7
9
  class ConfigFile {
8
10
  constructor(content, file) {
9
- var _a;
11
+ var _a, _b;
10
12
  this.content = content;
11
13
  this.file = file;
12
- const parseResult = Papa.parse(content, {
14
+ this.parseResult = (0, papaparse_1.parse)(content, {
13
15
  skipEmptyLines: true,
14
16
  transform: (value) => value.trim(),
15
17
  });
16
- if (((_a = parseResult === null || parseResult === void 0 ? void 0 : parseResult.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) {
17
- throw new Error('Failed to parse the config csv file');
18
+ if (((_b = (_a = this.parseResult) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.length) > 0) {
19
+ throw new Error('Failed to parse the contents of the configuration CSV file.');
18
20
  }
19
- const matchApiId = content.match(/^#\s+(\d{4}-\d{2})$/m);
21
+ const matchApiId = content.match(/#\s+(\d{4}-\d{2}(-\d{4})?(-\d+)*)$/m);
20
22
  if (matchApiId) {
21
23
  this.apiId = matchApiId[1];
22
24
  }
23
- const matchFirmwareVersion = content.match(/^#\s+(v\d.*)$/m);
25
+ const matchFirmwareVersion = content.match(/^#\s+(v.*)$/m);
24
26
  if (matchFirmwareVersion) {
25
27
  this.firmwareVersion = matchFirmwareVersion[1];
26
28
  }
@@ -28,7 +30,7 @@ class ConfigFile {
28
30
  if (matchFirstParameterRow === null || matchFirstParameterRow === void 0 ? void 0 : matchFirstParameterRow.index) {
29
31
  this.header = content.slice(0, matchFirstParameterRow.index - 1);
30
32
  }
31
- this.parameters = parseResult.data
33
+ this.parameters = this.parseResult.data
32
34
  .filter(([c0]) => c0.startsWith('0x'))
33
35
  .map(([c0, c1, c2]) => {
34
36
  const index = parseInt(c0, 16);
@@ -39,6 +41,25 @@ class ConfigFile {
39
41
  })
40
42
  .sort(parameter_1.parametersCompareFn);
41
43
  }
44
+ get firmwareId() {
45
+ return this.apiId;
46
+ }
47
+ get isSmmConfigFile() {
48
+ for (const parameter of this.parameters) {
49
+ if ((0, parameter_1.isSmmIndex)(parameter.index)) {
50
+ return true;
51
+ }
52
+ }
53
+ return false;
54
+ }
55
+ get hasParseErrors() {
56
+ var _a, _b;
57
+ return ((_b = (_a = this.parseResult) === null || _a === void 0 ? void 0 : _a.errors.length) !== null && _b !== void 0 ? _b : 0) > 0;
58
+ }
59
+ get numberOfParameters() {
60
+ var _a, _b;
61
+ return (_b = (_a = this.parameters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
62
+ }
42
63
  toString() {
43
64
  let out = this.parameters.map((p) => { var _a, _b; return `0x${(_a = p.index) === null || _a === void 0 ? void 0 : _a.toString(16)}, ${(_b = p.subindex) === null || _b === void 0 ? void 0 : _b.toString(10)}, ${p.value}`; }).join('\n');
44
65
  if (this.header) {
@@ -1 +1 @@
1
- {"version":3,"file":"config-file.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/config-file.ts"],"names":[],"mappings":";;;;AAAA,wDAAkC;AAClC,2CAA6D;AAK7D,MAAa,UAAU;IAQrB,YACkB,OAAe,EACf,IAA4D;;QAD5D,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAwD;QAE5E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAW,OAAO,EAAE;YAChD,cAAc,EAAE,IAAI;YACpB,SAAS,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE;SAC3C,CAAC,CAAC;QAEH,IAAI,CAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,0CAAE,MAAM,IAAG,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACzD,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;SAC5B;QAED,MAAM,oBAAoB,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC7D,IAAI,oBAAoB,EAAE;YACxB,IAAI,CAAC,eAAe,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;SAChD;QAED,MA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AAI,IAAI,CAAC,MAAM,EAAE;YACf,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC;SAChC;QACD,OAAO,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;CAEF;AAxDD,gCAwDC"}
1
+ {"version":3,"file":"config-file.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/config-file.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAC/C,2CAAyE;AAKzE;;GAEG;AACH,MAAa,UAAU;IASrB,YACkB,OAAe,EACf,IAA4D;;QAD5D,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAwD;QAE5E,IAAI,CAAC,WAAW,GAAG,IAAA,iBAAK,EAAW,OAAO,EAAE;YAC1C,cAAc,EAAE,IAAI;YACpB,SAAS,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE;SAC3C,CAAC,CAAC;QAEH,IAAI,CAAA,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,MAAM,0CAAE,MAAM,IAAG,CAAC,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;SAChF;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACxE,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;SAC5B;QAED,MAAM,oBAAoB,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC3D,IAAI,oBAAoB,EAAE;YACxB,IAAI,CAAC,eAAe,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;SAChD;QAED,MAAM,sBAAsB,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1D,IAAI,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,KAAK,EAAE;YACjC,IAAI,CAAC,MAAM,GA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AAE,MAAM,mCAAI,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACN,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,eAAC,OAAA,KAAK,MAAA,CAAC,CAAC,KAAK,0CAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,MAAA,CAAC,CAAC,QAAQ,0CAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAA,EAAA,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvH,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC;SAChC;QACD,OAAO,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;CAEF;AA9ED,gCA8EC"}
@@ -213,3 +213,11 @@ export declare function isEncoderConfigurationFirmware(version?: string): boolea
213
213
  * Filters by the specified FWID or Device, with an optional sort by version in descending order.
214
214
  */
215
215
  export declare function resolveInstallableFirmwares(filenames: string[], firmwareIdOrDevice: string | Pick<Device, 'hardwareDescription' | 'stackInfo' | 'integroVariant'>, sortByVersion?: boolean): Firmware[];
216
+ export declare function parseIntegroFirmwareVersion(value: number): {
217
+ date: Date;
218
+ day: string;
219
+ month: string;
220
+ value: number;
221
+ version: string;
222
+ year: string;
223
+ };
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveInstallableFirmwares = exports.isEncoderConfigurationFirmware = exports.isFirmwareVersionInRange = exports.firmwareVersionSatisfies = exports.removeInvalidBuildMetadataFromFirmwareVersion = exports.isCalibrationFirmware = exports.extractFirmwareVersionFromFirmwarePackageFilename = exports.extractFirmwareId = exports.isFirmwarePackageFilenameCompatibleWithDevice = exports.isStackInfo = exports.parseOldFirmwarePackageFilename = exports.extractDeviceComponentsFromOldFirmwarePackageFilename = exports.parseNewFirmwarePackageFilename = exports.isOldFirmwarePackageFilename = exports.isNewFirmwarePackageFilename = exports.parseFirmwareId = exports.oldFirmwarePackageFilenameRegExp = exports.newFirmwarePackageFilenameRegExp = exports.firmwareIdRegExp = void 0;
3
+ exports.parseIntegroFirmwareVersion = exports.resolveInstallableFirmwares = exports.isEncoderConfigurationFirmware = exports.isFirmwareVersionInRange = exports.firmwareVersionSatisfies = exports.removeInvalidBuildMetadataFromFirmwareVersion = exports.isCalibrationFirmware = exports.extractFirmwareVersionFromFirmwarePackageFilename = exports.extractFirmwareId = exports.isFirmwarePackageFilenameCompatibleWithDevice = exports.isStackInfo = exports.parseOldFirmwarePackageFilename = exports.extractDeviceComponentsFromOldFirmwarePackageFilename = exports.parseNewFirmwarePackageFilename = exports.isOldFirmwarePackageFilename = exports.isNewFirmwarePackageFilename = exports.parseFirmwareId = exports.oldFirmwarePackageFilenameRegExp = exports.newFirmwarePackageFilenameRegExp = exports.firmwareIdRegExp = void 0;
4
4
  const hardware_description_1 = require("./hardware-description");
5
5
  const semver_1 = require("semver");
6
- exports.firmwareIdRegExp = /^\d{4}-\d{2}(-\d{4})?(-\d+)*?$/;
7
- exports.newFirmwarePackageFilenameRegExp = /^package_(.*).zip$/;
8
- exports.oldFirmwarePackageFilenameRegExp = /^package-motion-drive_(.*).zip$/;
6
+ exports.firmwareIdRegExp = /\d{4}-\d{2}(-\d{4})?(-\d+)*/;
7
+ exports.newFirmwarePackageFilenameRegExp = /package_(.*).zip/;
8
+ exports.oldFirmwarePackageFilenameRegExp = /package-motion-drive_(.*).zip/;
9
9
  /**
10
10
  * Parses the FWID string and returns an instance of the {@link FirmwareId} object.
11
11
  *
@@ -314,4 +314,14 @@ function resolveInstallableFirmwares(filenames, firmwareIdOrDevice, sortByVersio
314
314
  }, []);
315
315
  }
316
316
  exports.resolveInstallableFirmwares = resolveInstallableFirmwares;
317
+ function parseIntegroFirmwareVersion(value) {
318
+ const str = value.toString();
319
+ const day = str.slice(-2);
320
+ const month = str.slice(-4, -2);
321
+ const year = str.slice(-6, -4);
322
+ const date = new Date(2000 + parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10));
323
+ const version = str.slice(-8, -6);
324
+ return { date, day, month, value, version, year };
325
+ }
326
+ exports.parseIntegroFirmwareVersion = parseIntegroFirmwareVersion;
317
327
  //# sourceMappingURL=firmware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"firmware.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/firmware.ts"],"names":[],"mappings":";;;AAAA,iEAAiI;AACjI,mCAAiD;AAepC,QAAA,gBAAgB,GAAG,gCAAgC,CAAC;AACpD,QAAA,gCAAgC,GAAG,oBAAoB,CAAC;AACxD,QAAA,gCAAgC,GAAG,iCAAiC,CAAC;AA8ElF;;;;GAIG;AACH,SAAgB,eAAe,CAAC,IAAY;IAC1C,IAAI,CAAC,wBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,wCAAwC,CAAC,CAAC;KACrF;IACD,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACzG,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;AAChE,CAAC;AAND,0CAMC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAAC,QAAgB;IAC3D,OAAO,wCAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC;AAFD,oEAEC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAAC,QAAgB;IAC3D,OAAO,wCAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC;AAFD,oEAEC;AAED;;;;;GAKG;AACH,SAAgB,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AAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC7F,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACpD,CAAC;AARD,kEAQC"}
@@ -1,15 +1,27 @@
1
+ import { Observable } from "rxjs";
2
+ import { MotionMasterClient } from "./motion-master-client";
1
3
  import { DeviceRef } from "./types";
2
- export type MotionComposerFlowCommandId = 'runVelocityProfile' | 'downloadParameter' | 'quickStop' | 'setModesOfOperation' | 'setCia402State' | 'timeDelay';
4
+ export type MotionComposerFlowCommandType = 'download' | 'quickStop' | 'resetFault' | 'runVelocityProfile' | 'setCia402State' | 'setModesOfOperation' | 'delay';
5
+ export type MotionComposerFlowCommandStatus = 'failed' | 'running' | 'succeeded';
3
6
  export interface MotionComposerFlowCommand {
4
- id: MotionComposerFlowCommandId;
7
+ type: MotionComposerFlowCommandType;
5
8
  deviceRef?: DeviceRef;
9
+ status?: MotionComposerFlowCommandStatus;
10
+ statusMessage?: string;
6
11
  }
7
12
  export interface MotionComposerFlow {
8
- name: string;
9
- repeat: boolean;
13
+ name?: string;
14
+ repeat?: boolean;
10
15
  commands: MotionComposerFlowCommand[];
11
16
  }
12
17
  export interface MotionComposer {
13
- name: string;
18
+ name?: string;
14
19
  flows: MotionComposerFlow[];
15
20
  }
21
+ export declare class MotionComposerRunner {
22
+ private client;
23
+ private stop$;
24
+ constructor(client: MotionMasterClient);
25
+ run(motionComposer: MotionComposer): Observable<MotionComposer>;
26
+ stop(): void;
27
+ }
@@ -1,3 +1,110 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MotionComposerRunner = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const rxjs_1 = require("rxjs");
6
+ const motion_master_client_1 = require("./motion-master-client");
7
+ const util_1 = require("./util");
8
+ Object.assign(globalThis, { WebSocket: require('ws') });
9
+ class MotionComposerRunner {
10
+ constructor(client) {
11
+ this.client = client;
12
+ this.stop$ = new rxjs_1.Subject;
13
+ }
14
+ run(motionComposer) {
15
+ // Clone the provided composer data to allow updates to command statuses during execution.
16
+ const mc = structuredClone(motionComposer);
17
+ // Resets the status of all commands to 'idle'.
18
+ mc.flows.forEach((flow) => flow.commands.forEach((command) => command.status = undefined));
19
+ return (0, rxjs_1.from)(mc.flows).pipe(
20
+ // Process each flow concurrently.
21
+ (0, rxjs_1.mergeMap)((flow) => (0, rxjs_1.from)(flow.commands).pipe(
22
+ // Execute each command sequentially.
23
+ (0, rxjs_1.concatMap)((command) => {
24
+ command.status = 'running';
25
+ const startEmission = (0, rxjs_1.of)(mc);
26
+ const executeCommand = (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ switch (command.type) {
28
+ case 'quickStop':
29
+ try {
30
+ yield this.client.request.quickStop(command.deviceRef);
31
+ command.status = 'succeeded';
32
+ }
33
+ catch (err) {
34
+ command.status = 'failed';
35
+ if (err instanceof Error) {
36
+ command.statusMessage = err.message;
37
+ }
38
+ }
39
+ break;
40
+ case 'delay':
41
+ yield (0, util_1.resolveAfter)(1000);
42
+ break;
43
+ case 'resetFault':
44
+ try {
45
+ yield this.client.request.resetFault(command.deviceRef);
46
+ command.status = 'succeeded';
47
+ }
48
+ catch (err) {
49
+ command.status = 'failed';
50
+ if (err instanceof Error) {
51
+ command.statusMessage = err.message;
52
+ }
53
+ }
54
+ break;
55
+ case 'runVelocityProfile':
56
+ try {
57
+ yield this.client.runVelocityProfile(command.deviceRef, { acceleration: 1000, deceleration: 1000, target: 200 });
58
+ command.status = 'succeeded';
59
+ }
60
+ catch (err) {
61
+ command.status = 'failed';
62
+ if (err instanceof Error) {
63
+ command.statusMessage = err.message;
64
+ }
65
+ }
66
+ break;
67
+ }
68
+ return mc;
69
+ }))();
70
+ const endEmission = (0, rxjs_1.from)(executeCommand);
71
+ // Emit twice: once when the command starts, and once when it ends.
72
+ return (0, rxjs_1.concat)(startEmission, endEmission);
73
+ }), (0, rxjs_1.takeUntil)(this.stop$))));
74
+ }
75
+ stop() {
76
+ this.stop$.next();
77
+ }
78
+ }
79
+ exports.MotionComposerRunner = MotionComposerRunner;
80
+ console.log('RUN MOTION COMPOSER EXAMPLE');
81
+ const client = (0, motion_master_client_1.createMotionMasterClient)();
82
+ const motionComposerRunner = new MotionComposerRunner(client);
83
+ const motionComposerExample = {
84
+ flows: [
85
+ {
86
+ commands: [
87
+ { type: 'quickStop', deviceRef: 1 },
88
+ { type: 'delay' },
89
+ ],
90
+ },
91
+ {
92
+ commands: [
93
+ { type: 'download' },
94
+ { type: 'resetFault', deviceRef: 1 },
95
+ { type: 'runVelocityProfile', deviceRef: 1 },
96
+ ],
97
+ },
98
+ ],
99
+ };
100
+ motionComposerRunner.run(motionComposerExample).subscribe({
101
+ next: (motionComposer) => {
102
+ console.log(JSON.stringify(motionComposer));
103
+ },
104
+ error: (err) => {
105
+ console.error(err);
106
+ client.closeSockets();
107
+ },
108
+ complete: () => client.closeSockets(),
109
+ });
3
110
  //# sourceMappingURL=motion-composer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"motion-composer.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/motion-composer.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"motion-composer.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/motion-composer.ts"],"names":[],"mappings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9
9
  import { Cia402State, ModesOfOperation } from "./cia402";
10
10
  import { EncoderRegisterCommunicationOsCommandResponse, MotorPhaseOrderDetectionOsCommandResponse, OpenPhaseDetectionOsCommandResponse, OsCommandMode, OsCommandResponse, PhaseResistanceMeasurementOsCommandResponse, PhaseInductanceMeasurementOsCommandResponse, PolePairDetectionOsCommandResponse, CommutationOffsetMeasurementOsCommandResponse, IcMuCalibrationModeOsCommandResponse, OpenLoopFieldModeOsCommandResponse, HrdStreamingOsCommandResponse, TorqueConstantMeasurementOsCommandResponse, SkippedCyclesCounterOsCommandResponse, IgnoreBissStatusBitsOsCommandResponse, SystemIdentificationOsCommandResponse, KublerEncoderCommandOsCommandResponse, UseInternalEncoderVelocityOsCommandResponse, KublerEncoderRegisterCommunicationOsCommandResponse, SmmAcyclicHandlerOsCommandResponse } from "./os-command";
11
11
  import { IntegroVariant } from "./integro-variant";
12
+ import { ConfigParameter } from './config-file';
12
13
  /**
13
14
  * This class contains methods for making requests to Motion Master using the injected request/response socket.
14
15
  *
@@ -860,15 +861,15 @@ export declare class MotionMasterReqResClient {
860
861
  progress: number;
861
862
  }>;
862
863
  /**
863
- * Get files.
864
+ * Get list of files.
864
865
  */
865
866
  getFiles(deviceRef: DeviceRef, requestTimeout?: number, messageId?: string): Observable<string[]>;
866
867
  /**
867
- * Get file.
868
+ * Get file content.
868
869
  */
869
870
  getFile(deviceRef: DeviceRef, name: string, requestTimeout?: number, messageId?: string): Observable<Uint8Array | null | undefined>;
870
871
  /**
871
- * Get decoded file.
872
+ * Get decoded file content.
872
873
  *
873
874
  * Content of a device file is returned as a binary data buffer.
874
875
  * This functions tries to decode the content as a text in utf-8 character encoding.
@@ -882,7 +883,7 @@ export declare class MotionMasterReqResClient {
882
883
  */
883
884
  unlockProtectedFiles(deviceRef: DeviceRef, requestTimeout?: number, messageId?: string): Observable<DeviceFileStatus>;
884
885
  /**
885
- * Set file.
886
+ * Set file content.
886
887
  */
887
888
  setFile(deviceRef: DeviceRef, name: string, content: Uint8Array, overwrite?: boolean, requestTimeout?: number, messageId?: string): Observable<DeviceFileStatus>;
888
889
  /**
@@ -925,6 +926,9 @@ export declare class MotionMasterReqResClient {
925
926
  * For 0x1011:04, the configuration is loaded from the .factory_config file, followed by the .assembly_config file,
926
927
  * with values in the latter overriding those in the former.
927
928
  *
929
+ * Restoring default parameters will only override those stored in .factory_config, config.csv, and .assembly_config.
930
+ * All other parameters, such as target values and PDO mappings, will remain unchanged.
931
+ *
928
932
  * @throws Error if the device does not revert the value to 1 after the specified number of retries.
929
933
  *
930
934
  * For more information, refer to the documentation:
@@ -1075,8 +1079,16 @@ export declare class MotionMasterReqResClient {
1075
1079
  * - 3: Abort the current command and all commands in the buffer
1076
1080
  *
1077
1081
  * Note that if you abort the OS command, you must switch the value of 0x1024 back to 0 before executing another OS command.
1082
+ *
1083
+ * @param deviceRef The reference to the device on which the command will be executed.
1084
+ * @param command The command to be executed, represented as a Uint8Array.
1085
+ * @param commandTimeout The maximum time allowed for the command to complete.
1086
+ * @param responsePollingInterval The interval (in milliseconds) for polling the command response. Defaults to 1000ms.
1087
+ * @param executeTheNextOsCommandImmediately Determines whether the next OS command should run immediately after the current one. Sets the OS Command Mode. Defaults to true.
1088
+ * @param fsBufferContent If true, the content of the fs-buffer will be read and assigned to the `fsBuffer` property of {@link OsCommandResponse}. If a Uint8Array is provided, the content will be written to the fs-buffer file. If undefined, only the OS command will be executed, and its response will be read and parsed.
1089
+ * @returns An observable of type T, which extends {@link OsCommandResponse}, representing the result of the command execution.
1078
1090
  */
1079
- runOsCommand<T extends OsCommandResponse>(deviceRef: DeviceRef, command: Uint8Array, commandTimeout: number, responsePollingInterval?: number, executeTheNextOsCommandImmediatelly?: boolean): Observable<T>;
1091
+ runOsCommand<T extends OsCommandResponse>(deviceRef: DeviceRef, command: Uint8Array, commandTimeout: number, responsePollingInterval?: number, executeTheNextOsCommandImmediatelly?: boolean, fsBufferContent?: true | Uint8Array): Observable<T>;
1080
1092
  setOsCommandMode(deviceRef: DeviceRef, value: OsCommandMode): Observable<void>;
1081
1093
  abortOsCommand(deviceRef: DeviceRef): Observable<void>;
1082
1094
  runEncoderRegisterCommunicationOsCommand(deviceRef: DeviceRef, encoderOrdinal?: number, slaveAddress?: number, rw?: number, registerAddress?: number, registerWriteValue?: number, commandTimeout?: number, responsePollingInterval?: number, executeTheNextOsCommandImmediatelly?: boolean): Observable<EncoderRegisterCommunicationOsCommandResponse>;
@@ -1100,6 +1112,8 @@ export declare class MotionMasterReqResClient {
1100
1112
  runUseInternalEncoderVelocityOsCommand(deviceRef: DeviceRef, trigger?: number, commandTimeout?: number, responsePollingInterval?: number, executeTheNextOsCommandImmediatelly?: boolean): Observable<UseInternalEncoderVelocityOsCommandResponse>;
1101
1113
  runKublerEncoderRegisterCommunicationOsCommand(deviceRef: DeviceRef, rw?: number, registerAddress?: number, registerLength?: number, registerWriteValue?: number, commandTimeout?: number, responsePollingInterval?: number, executeTheNextOsCommandImmediatelly?: boolean): Observable<KublerEncoderRegisterCommunicationOsCommandResponse>;
1102
1114
  readOsCommandResponse(deviceRef: DeviceRef): Observable<OsCommandResponse>;
1115
+ runOsCommandAndWriteFsBuffer<T extends OsCommandResponse>(deviceRef: DeviceRef, command: Uint8Array, content: Uint8Array, commandTimeout?: number): Observable<T>;
1116
+ runOsCommandAndReadFsBuffer<T extends OsCommandResponse>(deviceRef: DeviceRef, command: Uint8Array, commandTimeout: 30000): Observable<T>;
1103
1117
  /**
1104
1118
  * Set halt bit.
1105
1119
  *
@@ -1148,4 +1162,26 @@ export declare class MotionMasterReqResClient {
1148
1162
  * Checks if the device has firmware by reading the Manufacturer Software Version parameter (0x100A:00).
1149
1163
  */
1150
1164
  hasFirmware(deviceRef: DeviceRef): Observable<boolean>;
1165
+ /**
1166
+ * Reads the contents of configuration CSV files in the specified order and returns a list of unique configuration parameters.
1167
+ * If the files are provided in the order: '.factory_config', 'config.csv', '.assembly_config', this function
1168
+ * mimics the firmware's behavior during "Restore All Default Parameters," retaining only the most recent value of any duplicated parameter.
1169
+ *
1170
+ * If config files do not exist or cannot be parsed, the function will continue executing for any files that can be processed.
1171
+ */
1172
+ getConfigFileParameters(deviceRef: DeviceRef, filenames?: string[]): Observable<ConfigParameter[]>;
1173
+ getIntegroEncoderFirmwareVersion(deviceRef: DeviceRef): Observable<KublerEncoderRegisterCommunicationOsCommandResponse>;
1174
+ /**
1175
+ * Installs the Integro Encoder Firmware by performing the following steps:
1176
+ * 1. Switches to the Kubler encoder bootloader firmware.
1177
+ * 2. Validates the firmware update size.
1178
+ * 3. Erases the existing encoder firmware.
1179
+ * 4. Writes the new firmware.
1180
+ * 5. Exits bootloader mode.
1181
+ *
1182
+ * @param deviceRef The reference to the device on which the firmware will be installed.
1183
+ * @param content The firmware content to be written, provided as a Uint8Array.
1184
+ * @returns An observable that emits {@link KublerEncoderCommandOsCommandResponse} upon completion of the installation.
1185
+ */
1186
+ installIntegroEncoderFirmware(deviceRef: DeviceRef, content: Uint8Array): Observable<KublerEncoderCommandOsCommandResponse>;
1151
1187
  }
@@ -19,6 +19,7 @@ const cia402_3 = require("./cia402");
19
19
  const os_command_1 = require("./os-command");
20
20
  const util_1 = require("./util");
21
21
  const integro_variant_1 = require("./integro-variant");
22
+ const config_file_1 = require("./config-file");
22
23
  /**
23
24
  * This class contains methods for making requests to Motion Master using the injected request/response socket.
24
25
  *
@@ -1533,21 +1534,21 @@ class MotionMasterReqResClient {
1533
1534
  }));
1534
1535
  }
1535
1536
  /**
1536
- * Get files.
1537
+ * Get list of files.
1537
1538
  */
1538
1539
  getFiles(deviceRef, requestTimeout = 30000, messageId) {
1539
1540
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
1540
1541
  return this.getDeviceFileList(deviceRefObj, requestTimeout, messageId).pipe((0, operators_1.map)((status) => { var _a, _b; return (_b = (_a = status.fileList) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []; }));
1541
1542
  }
1542
1543
  /**
1543
- * Get file.
1544
+ * Get file content.
1544
1545
  */
1545
1546
  getFile(deviceRef, name, requestTimeout = 5000, messageId) {
1546
1547
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
1547
1548
  return this.getDeviceFile(Object.assign(Object.assign({}, deviceRefObj), { name }), requestTimeout, messageId).pipe((0, operators_1.map)(({ content }) => content));
1548
1549
  }
1549
1550
  /**
1550
- * Get decoded file.
1551
+ * Get decoded file content.
1551
1552
  *
1552
1553
  * Content of a device file is returned as a binary data buffer.
1553
1554
  * This functions tries to decode the content as a text in utf-8 character encoding.
@@ -1572,7 +1573,7 @@ class MotionMasterReqResClient {
1572
1573
  return this.getDeviceFile(Object.assign(Object.assign({}, deviceRefObj), { name: device_1.stackUnlockFilename }), requestTimeout, messageId);
1573
1574
  }
1574
1575
  /**
1575
- * Set file.
1576
+ * Set file content.
1576
1577
  */
1577
1578
  setFile(deviceRef, name, content, overwrite = true, requestTimeout = 5000, messageId) {
1578
1579
  const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
@@ -1641,6 +1642,9 @@ class MotionMasterReqResClient {
1641
1642
  * For 0x1011:04, the configuration is loaded from the .factory_config file, followed by the .assembly_config file,
1642
1643
  * with values in the latter overriding those in the former.
1643
1644
  *
1645
+ * Restoring default parameters will only override those stored in .factory_config, config.csv, and .assembly_config.
1646
+ * All other parameters, such as target values and PDO mappings, will remain unchanged.
1647
+ *
1644
1648
  * @throws Error if the device does not revert the value to 1 after the specified number of retries.
1645
1649
  *
1646
1650
  * For more information, refer to the documentation:
@@ -1914,17 +1918,28 @@ class MotionMasterReqResClient {
1914
1918
  * - 3: Abort the current command and all commands in the buffer
1915
1919
  *
1916
1920
  * Note that if you abort the OS command, you must switch the value of 0x1024 back to 0 before executing another OS command.
1921
+ *
1922
+ * @param deviceRef The reference to the device on which the command will be executed.
1923
+ * @param command The command to be executed, represented as a Uint8Array.
1924
+ * @param commandTimeout The maximum time allowed for the command to complete.
1925
+ * @param responsePollingInterval The interval (in milliseconds) for polling the command response. Defaults to 1000ms.
1926
+ * @param executeTheNextOsCommandImmediately Determines whether the next OS command should run immediately after the current one. Sets the OS Command Mode. Defaults to true.
1927
+ * @param fsBufferContent If true, the content of the fs-buffer will be read and assigned to the `fsBuffer` property of {@link OsCommandResponse}. If a Uint8Array is provided, the content will be written to the fs-buffer file. If undefined, only the OS command will be executed, and its response will be read and parsed.
1928
+ * @returns An observable of type T, which extends {@link OsCommandResponse}, representing the result of the command execution.
1917
1929
  */
1918
- runOsCommand(deviceRef, command, commandTimeout, responsePollingInterval = 1000, executeTheNextOsCommandImmediatelly = true) {
1930
+ runOsCommand(deviceRef, command, commandTimeout, responsePollingInterval = 1000, executeTheNextOsCommandImmediatelly = true, fsBufferContent) {
1919
1931
  let response;
1920
- // defer must be used to make a request to Motion Master on each repeat step
1921
- const getResponse$ = (0, rxjs_1.defer)(() => this.getParameterValue(deviceRef, 0x1023, 3).pipe((0, operators_1.map)((value) => (0, os_command_1.parseOsCommandResponse)(value, command)), (0, rxjs_1.tap)((r) => response = r)));
1922
- return (0, rxjs_1.concat)(executeTheNextOsCommandImmediatelly ? this.setOsCommandMode(deviceRef, os_command_1.OsCommandMode.EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY) : rxjs_1.EMPTY, this.setParameterValue(deviceRef, 0x1023, 1, command), getResponse$.pipe((0, operators_1.repeat)({
1932
+ let fsBuffer;
1933
+ // Use defer to ensure a request is made to Motion Master at each repeat step.
1934
+ const getResponse$ = (0, rxjs_1.defer)(() => this.getParameterValue(deviceRef, 0x1023, 3).pipe((0, operators_1.map)((value) => (0, os_command_1.parseOsCommandResponse)(value, command)), (0, rxjs_1.tap)((r) => {
1935
+ r.fsBuffer = fsBuffer;
1936
+ response = r;
1937
+ })));
1938
+ return (0, rxjs_1.concat)(executeTheNextOsCommandImmediatelly ? this.setOsCommandMode(deviceRef, os_command_1.OsCommandMode.EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY) : rxjs_1.EMPTY, this.setParameterValue(deviceRef, 0x1023, 1, command), fsBufferContent instanceof Uint8Array ? this.setFile(deviceRef, 'fs-buffer', fsBufferContent, true, 20000) : rxjs_1.EMPTY, fsBufferContent === true ? this.getFile(deviceRef, 'fs-buffer', 20000).pipe((0, operators_1.map)((value) => fsBuffer = value)) : rxjs_1.EMPTY, getResponse$.pipe((0, operators_1.repeat)({
1923
1939
  delay: () => (response && (response.request === 'succeeded' || response.request === 'failed'))
1924
1940
  ? rxjs_1.EMPTY
1925
1941
  : (0, rxjs_1.timer)(responsePollingInterval),
1926
- }))).pipe((0, operators_1.takeUntil)((0, rxjs_1.timer)(commandTimeout).pipe((0, operators_1.mergeMap)(() => (0, rxjs_1.throwError)(() => new Error(`A timeout has occurred for the OS command ${JSON.stringify(command)} on device ${deviceRef}.`))))), (0, operators_1.filter)(Boolean), // ignores two undefined emmisions by `setParameterValue`
1927
- (0, os_command_1.mapOsCommandResponse)());
1942
+ }))).pipe((0, operators_1.takeUntil)((0, rxjs_1.timer)(commandTimeout).pipe((0, operators_1.mergeMap)(() => (0, rxjs_1.throwError)(() => new Error(`A timeout has occurred for the OS command ${JSON.stringify(command)} on device ${deviceRef}.`))))), (0, operators_1.filter)(os_command_1.isOsCommandResponse), (0, os_command_1.mapOsCommandResponse)());
1928
1943
  }
1929
1944
  setOsCommandMode(deviceRef, value) {
1930
1945
  return this.setParameterValue(deviceRef, 0x1024, 0, value);
@@ -2012,6 +2027,12 @@ class MotionMasterReqResClient {
2012
2027
  readOsCommandResponse(deviceRef) {
2013
2028
  return this.getParameterValue(deviceRef, 0x1023, 3).pipe((0, operators_1.map)((value) => (0, os_command_1.parseOsCommandResponse)(value)));
2014
2029
  }
2030
+ runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout = 30000) {
2031
+ return this.runOsCommand(deviceRef, command, commandTimeout, 1000, true, content);
2032
+ }
2033
+ runOsCommandAndReadFsBuffer(deviceRef, command, commandTimeout) {
2034
+ return this.runOsCommand(deviceRef, command, commandTimeout, 1000, true, true);
2035
+ }
2015
2036
  /**
2016
2037
  * Set halt bit.
2017
2038
  *
@@ -2130,6 +2151,52 @@ class MotionMasterReqResClient {
2130
2151
  hasFirmware(deviceRef) {
2131
2152
  return this.getParameterValue(deviceRef, 0x100A, 0).pipe((0, operators_1.map)((value) => value ? true : false), (0, operators_1.catchError)(() => (0, rxjs_1.of)(false)));
2132
2153
  }
2154
+ /**
2155
+ * Reads the contents of configuration CSV files in the specified order and returns a list of unique configuration parameters.
2156
+ * If the files are provided in the order: '.factory_config', 'config.csv', '.assembly_config', this function
2157
+ * mimics the firmware's behavior during "Restore All Default Parameters," retaining only the most recent value of any duplicated parameter.
2158
+ *
2159
+ * If config files do not exist or cannot be parsed, the function will continue executing for any files that can be processed.
2160
+ */
2161
+ getConfigFileParameters(deviceRef, filenames = ['.factory_config', 'config.csv', '.assembly_config']) {
2162
+ return (0, rxjs_1.from)(filenames).pipe((0, operators_1.mergeMap)((name) => this.getDecodedFile(deviceRef, name)), // Retrieve and decode each config file into a UTF-8 string.
2163
+ (0, operators_1.map)((content) => new config_file_1.ConfigFile(content)), // Parse the content and create config parameters.
2164
+ (0, operators_1.catchError)(() => (0, rxjs_1.of)(undefined)), // Handles potential errors, such as a missing file or failure to instantiate ConfigFile due to parsing issues.
2165
+ (0, operators_1.map)((configFile) => { var _a; return (_a = configFile === null || configFile === void 0 ? void 0 : configFile.parameters) !== null && _a !== void 0 ? _a : []; }), // Extract the parameters from the config file.
2166
+ (0, operators_1.toArray)(), // Collect all emitted parameters into a single array.
2167
+ (0, operators_1.map)((allParameters) => {
2168
+ const parameters = allParameters.flat(); // Flatten the array into a single list of parameters.
2169
+ // Filter out duplicate parameters by 'index' and 'subindex', keeping only the most recent one.
2170
+ return Array.from(parameters.reduce((map, param) => {
2171
+ const key = (0, parameter_1.makeParameterId)(param.index, param.subindex);
2172
+ map.set(key, param); // Replace any existing entry with the same key.
2173
+ return map;
2174
+ }, new Map()).values());
2175
+ }));
2176
+ }
2177
+ getIntegroEncoderFirmwareVersion(deviceRef) {
2178
+ return this.runKublerEncoderRegisterCommunicationOsCommand(deviceRef, 0, 4, 4);
2179
+ }
2180
+ /**
2181
+ * Installs the Integro Encoder Firmware by performing the following steps:
2182
+ * 1. Switches to the Kubler encoder bootloader firmware.
2183
+ * 2. Validates the firmware update size.
2184
+ * 3. Erases the existing encoder firmware.
2185
+ * 4. Writes the new firmware.
2186
+ * 5. Exits bootloader mode.
2187
+ *
2188
+ * @param deviceRef The reference to the device on which the firmware will be installed.
2189
+ * @param content The firmware content to be written, provided as a Uint8Array.
2190
+ * @returns An observable that emits {@link KublerEncoderCommandOsCommandResponse} upon completion of the installation.
2191
+ */
2192
+ installIntegroEncoderFirmware(deviceRef, content) {
2193
+ const switchToBootloaderFirmwareCommand = (0, os_command_1.createKublerEncoderOsCommand)(os_command_1.KublerEncoderSubcommandId.SWITCH_TO_BOOTLOADER_FIRMWARE);
2194
+ const checkFirmwareUpdateSizeCommand = (0, os_command_1.createKublerEncoderCommandCheckFirmwareUpdateSizeOsCommand)(content.byteLength);
2195
+ const eraseFirmwareCommand = (0, os_command_1.createKublerEncoderOsCommand)(os_command_1.KublerEncoderSubcommandId.ERASE_FIRMWARE);
2196
+ const writeFirmwareCommand = (0, os_command_1.createKublerEncoderCommandWriteFirmwareOsCommand)(content.byteLength);
2197
+ const exitBootloaderModeCommand = (0, os_command_1.createKublerEncoderOsCommand)(os_command_1.KublerEncoderSubcommandId.EXIT_BOOTLOADER_MODE);
2198
+ return (0, rxjs_1.concat)(this.runKublerEncoderCommandOsCommand(deviceRef, switchToBootloaderFirmwareCommand), this.runKublerEncoderCommandOsCommand(deviceRef, checkFirmwareUpdateSizeCommand), this.runKublerEncoderCommandOsCommand(deviceRef, eraseFirmwareCommand), this.runOsCommandAndWriteFsBuffer(deviceRef, writeFirmwareCommand, content), this.runKublerEncoderCommandOsCommand(deviceRef, exitBootloaderModeCommand));
2199
+ }
2133
2200
  }
2134
2201
  exports.MotionMasterReqResClient = MotionMasterReqResClient;
2135
2202
  //# sourceMappingURL=motion-master-req-res-client.js.map