motion-master-client 0.0.308 → 0.0.310
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 +1 -1
- package/src/api.js +68 -66
- package/src/api.js.map +1 -1
- package/src/lib/fetch.js +2 -2
- package/src/lib/fetch.js.map +1 -1
- package/src/lib/motion-master-req-res-client.d.ts +48 -4
- package/src/lib/motion-master-req-res-client.js +119 -16
- package/src/lib/motion-master-req-res-client.js.map +1 -1
- package/src/lib/motion-master.proto.d.ts +182 -2
- package/src/lib/motion-master.proto.js +1882 -4
- package/src/lib/request-status-resolver.js +9 -0
- package/src/lib/request-status-resolver.js.map +1 -1
- package/src/lib/types.d.ts +26 -0
- package/src/lib/types.js.map +1 -1
- package/src/lib/util.d.ts +13 -0
- package/src/lib/util.js +32 -1
- package/src/lib/util.js.map +1 -1
|
@@ -6,7 +6,7 @@ import { HardwareDescription, StackInfo } from './hardware-description';
|
|
|
6
6
|
import { MotionMasterReqResSocket } from './motion-master-req-res-socket';
|
|
7
7
|
import { UIFeaturesConfig } from './parameter';
|
|
8
8
|
import { SystemLogLine } from './system-log-line';
|
|
9
|
-
import { MotionMasterMessage, ParameterValueType, ParameterTypeValue, DeviceParameterValuesStatus, ParameterTypeValueKey, DeviceRefObj, DeviceRef, FullAutoTuningStatus, SystemVersionStatus, DeviceInfoStatus, DeviceParameterInfoStatus, GetDeviceParameterInfoRequest, GetDeviceParameterValuesRequest, GetMultiDeviceParameterValuesRequest, MultiDeviceParameterValuesStatus, SetDeviceParameterValuesRequest, SetMultiDeviceParameterValuesRequest, GetDeviceFileListRequest, DeviceFileListStatus, GetDeviceFileRequest, DeviceFileStatus, SetDeviceFileRequest, DeleteDeviceFileRequest, ResetDeviceFaultRequest, DeviceFaultResetStatus, StopDeviceRequest, DeviceStopStatus, StartDeviceFirmwareInstallationRequest, DeviceFirmwareInstallationStatus, GetDeviceLogRequest, DeviceLogStatus, StartCoggingTorqueRecordingRequest, CoggingTorqueRecordingStatus, GetCoggingTorqueDataRequest, CoggingTorqueDataStatus, StartOffsetDetectionRequest, OffsetDetectionStatus, StartPlantModelIdentificationRequest, PlantIdentificationStatus, ComputeAutoTuningGainsRequest, AutoTuningStatus, SetMotionControllerParametersRequest, MotionControllerStatus, EnableMotionControllerRequest, SetSignalGeneratorParametersRequest, SignalGeneratorStatus, StopSignalGeneratorRequest, StartMonitoringDeviceParameterValuesRequest, MonitoringParameterValuesStatus, StopMonitoringDeviceParameterValuesRequest, GetEthercatNetworkStateRequest, EthercatNetworkStateStatus, SetEthercatNetworkStateRequest, StartNarrowAngleCalibrationRequest, NarrowAngleCalibrationStatus, SetSystemClientTimeoutRequest, StartSystemIdentificationRequest, SystemIdentificationStatus, CirculoEncoderMagnetDistanceStatus, StartCirculoEncoderNarrowAngleCalibrationProcedureRequest, CirculoEncoderNarrowAngleCalibrationProcedureStatus, GetDeviceCiA402StateRequest, DeviceCiA402StateStatus, SetDeviceCiA402StateRequest, SystemLogStatus, StartDeviceSiiRestoreRequest, DeviceSiiRestoreStatus, StartOpenLoopFieldControlRequest, OpenLoopFieldControlStatus, ComputeFullAutoTuningGainsRequest, StartFullAutoTuningRequest, StopFullAutoTuningRequest, StartCirculoEncoderConfigurationRequest, CirculoEncoderConfigurationStatus, StopCirculoEncoderNarrowAngleCalibrationProcedureRequest, StartOsCommandRequest, OsCommandStatus, RestoreDefaultParametersType, DeviceParameterAddressValue, DeviceParameterIds, DeviceParameterInfo, RequestStatusMessage, UiPdoMapping, UiConfig, RequestStatus, ExecuteForwardCallRequest, ForwardCallStatus, PlantModel } from './types';
|
|
9
|
+
import { MotionMasterMessage, ParameterValueType, ParameterTypeValue, DeviceParameterValuesStatus, ParameterTypeValueKey, DeviceRefObj, DeviceRef, FullAutoTuningStatus, SystemVersionStatus, DeviceInfoStatus, DeviceParameterInfoStatus, GetDeviceParameterInfoRequest, GetDeviceParameterValuesRequest, GetMultiDeviceParameterValuesRequest, MultiDeviceParameterValuesStatus, SetDeviceParameterValuesRequest, SetMultiDeviceParameterValuesRequest, GetDeviceFileListRequest, DeviceFileListStatus, GetDeviceFileRequest, DeviceFileStatus, SetDeviceFileRequest, DeleteDeviceFileRequest, ResetDeviceFaultRequest, DeviceFaultResetStatus, StopDeviceRequest, DeviceStopStatus, StartDeviceFirmwareInstallationRequest, DeviceFirmwareInstallationStatus, GetDeviceLogRequest, DeviceLogStatus, StartCoggingTorqueRecordingRequest, CoggingTorqueRecordingStatus, GetCoggingTorqueDataRequest, CoggingTorqueDataStatus, StartOffsetDetectionRequest, OffsetDetectionStatus, StartPlantModelIdentificationRequest, PlantIdentificationStatus, ComputeAutoTuningGainsRequest, AutoTuningStatus, SetMotionControllerParametersRequest, MotionControllerStatus, EnableMotionControllerRequest, SetSignalGeneratorParametersRequest, SignalGeneratorStatus, StopSignalGeneratorRequest, StartMonitoringDeviceParameterValuesRequest, MonitoringParameterValuesStatus, StopMonitoringDeviceParameterValuesRequest, GetEthercatNetworkStateRequest, EthercatNetworkStateStatus, SetEthercatNetworkStateRequest, StartNarrowAngleCalibrationRequest, NarrowAngleCalibrationStatus, SetSystemClientTimeoutRequest, StartSystemIdentificationRequest, SystemIdentificationStatus, CirculoEncoderMagnetDistanceStatus, StartCirculoEncoderNarrowAngleCalibrationProcedureRequest, CirculoEncoderNarrowAngleCalibrationProcedureStatus, GetDeviceCiA402StateRequest, DeviceCiA402StateStatus, SetDeviceCiA402StateRequest, SystemLogStatus, StartDeviceSiiRestoreRequest, DeviceSiiRestoreStatus, StartOpenLoopFieldControlRequest, OpenLoopFieldControlStatus, ComputeFullAutoTuningGainsRequest, StartFullAutoTuningRequest, StopFullAutoTuningRequest, StartCirculoEncoderConfigurationRequest, CirculoEncoderConfigurationStatus, StopCirculoEncoderNarrowAngleCalibrationProcedureRequest, StartOsCommandRequest, OsCommandStatus, RestoreDefaultParametersType, DeviceParameterAddressValue, DeviceParameterIds, DeviceParameterInfo, RequestStatusMessage, UiPdoMapping, UiConfig, RequestStatus, ExecuteForwardCallRequest, ForwardCallStatus, PlantModel, NotchFilter, LoadConfigStrategy, SystemInformationStatus, SetPdoModeRequest, PdoModeStatus } from './types';
|
|
10
10
|
import { Cia402State, ModesOfOperation } from './cia402';
|
|
11
11
|
import { EncoderRegisterCommunicationOsCommandResponse, MotorPhaseOrderDetectionOsCommandResponse, OpenPhaseDetectionOsCommandResponse, OsCommandMode, OsCommandResponse, PhaseResistanceMeasurementOsCommandResponse, PhaseInductanceMeasurementOsCommandResponse, PolePairDetectionOsCommandResponse, CommutationOffsetMeasurementOsCommandResponse, IcMuCalibrationModeOsCommandResponse, OpenLoopFieldModeOsCommandResponse, HrdStreamingOsCommandResponse, TorqueConstantMeasurementOsCommandResponse, SkippedCyclesCounterOsCommandResponse, IgnoreBissStatusBitsOsCommandResponse, SystemIdentificationOsCommandResponse, KublerEncoderCommandOsCommandResponse, UseInternalEncoderVelocityOsCommandResponse, KublerEncoderRegisterCommunicationOsCommandResponse, SmmAcyclicHandlerOsCommandResponse, HrdStreamingOsCommandAction, HrdStreamingOsCommandDataIndex, SmmAcyclicHandlerLoadParametersForVerificationOsCommandResponse } from './os-command';
|
|
12
12
|
import { IntegroVariant } from './integro-variant';
|
|
@@ -135,6 +135,14 @@ export declare class MotionMasterReqResClient {
|
|
|
135
135
|
* Retrieve the version of Motion Master. The version follows [Semantic Versioning 2.0.0](https://semver.org/).
|
|
136
136
|
*/
|
|
137
137
|
getSystemVersion(requestTimeout: number, messageId?: string): Observable<SystemVersionStatus>;
|
|
138
|
+
/**
|
|
139
|
+
* Retrieve system information from Motion Master.
|
|
140
|
+
*
|
|
141
|
+
* The returned information includes:
|
|
142
|
+
* - `version`: The Motion Master version, following [Semantic Versioning 2.0.0](https://semver.org/).
|
|
143
|
+
* - `startOptions`: The command-line arguments used to start Motion Master.
|
|
144
|
+
*/
|
|
145
|
+
getSystemInformation(requestTimeout: number, messageId?: string): Observable<SystemInformationStatus>;
|
|
138
146
|
/**
|
|
139
147
|
* Get device info.
|
|
140
148
|
*
|
|
@@ -784,6 +792,10 @@ export declare class MotionMasterReqResClient {
|
|
|
784
792
|
* This request is used to execute any function provided by the Standalone Auto-tuning Service which is started by the Motion Master.
|
|
785
793
|
*/
|
|
786
794
|
executeForwardCall(props: ExecuteForwardCallRequest, requestTimeout: number, messageId?: string): Observable<ForwardCallStatus>;
|
|
795
|
+
/**
|
|
796
|
+
* Set PDO mode.
|
|
797
|
+
*/
|
|
798
|
+
setPdoMode(props: SetPdoModeRequest, requestTimeout: number, messageId?: string): Observable<PdoModeStatus>;
|
|
787
799
|
/**
|
|
788
800
|
* Send request.
|
|
789
801
|
*
|
|
@@ -1255,17 +1267,18 @@ export declare class MotionMasterReqResClient {
|
|
|
1255
1267
|
*/
|
|
1256
1268
|
saveConfig(deviceRef: DeviceRef): Observable<void>;
|
|
1257
1269
|
/**
|
|
1258
|
-
* Replace the contents of the config.csv file with the provided data and instruct the device to load the updated configuration.
|
|
1270
|
+
* Replace or merge the contents of the config.csv file with the provided data and instruct the device to load the updated configuration.
|
|
1259
1271
|
* The new configuration is loaded using the 0x1011:01 Restore All Default Parameters.
|
|
1260
1272
|
* Optionally refreshes the device parameter values on Motion Master after applying the new configuration.
|
|
1261
1273
|
*
|
|
1262
1274
|
* @param deviceRef A reference to the device where the configuration will be applied.
|
|
1263
1275
|
* @param data The new configuration data to be written to the config.csv file.
|
|
1276
|
+
* @param strategy The strategy to use when loading the configuration. Can be either 'replace' to overwrite the existing configuration or 'merge' to combine the new configuration with the existing one.
|
|
1264
1277
|
* @param retryConfig Configuration settings for retrying the restore default parameters operation.
|
|
1265
1278
|
* @param refresh A flag to refresh device parameter values after loading the new configuration, as Motion Master will otherwise use the old values.
|
|
1266
1279
|
* @returns An observable that emits once the configuration has been successfully loaded.
|
|
1267
1280
|
*/
|
|
1268
|
-
loadConfig(deviceRef: DeviceRef, data: Uint8Array | string, retryConfig?: RetryConfig, refresh?: boolean): Observable<void>;
|
|
1281
|
+
loadConfig(deviceRef: DeviceRef, data: Uint8Array | string, strategy?: LoadConfigStrategy, retryConfig?: RetryConfig, refresh?: boolean): Observable<void>;
|
|
1269
1282
|
/**
|
|
1270
1283
|
* Checks if the device has firmware by reading the Manufacturer Software Version parameter (0x100A:00).
|
|
1271
1284
|
*/
|
|
@@ -1303,7 +1316,7 @@ export declare class MotionMasterReqResClient {
|
|
|
1303
1316
|
/**
|
|
1304
1317
|
* @link https://www.wrike.com/open.htm?id=1375749957
|
|
1305
1318
|
*
|
|
1306
|
-
*
|
|
1319
|
+
* @todo: Verify if the device is an Actilink S device and check the corresponding variant file.
|
|
1307
1320
|
*/
|
|
1308
1321
|
isIntegroWithMultiturnEncoder(deviceRef: DeviceRef): Promise<boolean>;
|
|
1309
1322
|
/**
|
|
@@ -1981,4 +1994,35 @@ export declare class MotionMasterReqResClient {
|
|
|
1981
1994
|
* ```
|
|
1982
1995
|
*/
|
|
1983
1996
|
executeForwardCallAndParseResponse(data: Uint8Array | string | object, requestTimeout?: number, messageId?: string): Observable<any>;
|
|
1997
|
+
/**
|
|
1998
|
+
* Auto-tunes the notch filter parameters based on the device's plant model.
|
|
1999
|
+
*
|
|
2000
|
+
* @param deviceSerialNumber - The serial number of the target device.
|
|
2001
|
+
* @returns An `Observable<NotchFilter>` that emits the parsed notch filter configuration upon success.
|
|
2002
|
+
*
|
|
2003
|
+
* @throws Will throw an error if:
|
|
2004
|
+
* - `deviceRef` is invalid.
|
|
2005
|
+
* - The device does not have a plant model.
|
|
2006
|
+
* - The forward call to the device fails.
|
|
2007
|
+
* - The auto-tune notch filter does not return finite valid values.
|
|
2008
|
+
* - The response cannot be parsed as valid JSON.
|
|
2009
|
+
*/
|
|
2010
|
+
autoTuneNotchFilter(deviceRef: DeviceRef): Observable<NotchFilter>;
|
|
2011
|
+
/**
|
|
2012
|
+
*
|
|
2013
|
+
* Writes notch filter parameter values to the specified device.
|
|
2014
|
+
*
|
|
2015
|
+
* This method sets the individual parameters of the notch filter (0x2023) on the device:
|
|
2016
|
+
* - Subindex `0x01` → enabled flag
|
|
2017
|
+
* - Subindex `0x02` → center frequency (rounded to nearest integer)
|
|
2018
|
+
* - Subindex `0x03` → rejection band (rounded to nearest integer)
|
|
2019
|
+
* - Subindex `0x04` → depth
|
|
2020
|
+
*
|
|
2021
|
+
* @param deviceRef - Reference to the target device.
|
|
2022
|
+
* @param notchFilter - Notch filter values to write to the device.
|
|
2023
|
+
* @param requestTimeout - Optional timeout in milliseconds for the request (default: 1000).
|
|
2024
|
+
* @returns An `Observable<void>` that completes when the parameter values have been written successfully.
|
|
2025
|
+
*
|
|
2026
|
+
*/
|
|
2027
|
+
setNotchFilterParameterValues(deviceRef: DeviceRef, notchFilter: NotchFilter, requestTimeout?: number): Observable<void>;
|
|
1984
2028
|
}
|
|
@@ -163,6 +163,18 @@ class MotionMasterReqResClient {
|
|
|
163
163
|
const id = this.sendRequest({ getSystemVersion }, messageId);
|
|
164
164
|
return this.socket.message$.pipe((0, operators_2.transformMotionMasterMessageToStatus)('systemVersion', requestTimeout, id));
|
|
165
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Retrieve system information from Motion Master.
|
|
168
|
+
*
|
|
169
|
+
* The returned information includes:
|
|
170
|
+
* - `version`: The Motion Master version, following [Semantic Versioning 2.0.0](https://semver.org/).
|
|
171
|
+
* - `startOptions`: The command-line arguments used to start Motion Master.
|
|
172
|
+
*/
|
|
173
|
+
getSystemInformation(requestTimeout, messageId) {
|
|
174
|
+
const getSystemInformation = types_1.MotionMasterMessage.Request.GetSystemInformation.create();
|
|
175
|
+
const id = this.sendRequest({ getSystemInformation }, messageId);
|
|
176
|
+
return this.socket.message$.pipe((0, operators_2.transformMotionMasterMessageToStatus)('systemInformation', requestTimeout, id));
|
|
177
|
+
}
|
|
166
178
|
/**
|
|
167
179
|
* Get device info.
|
|
168
180
|
*
|
|
@@ -1163,6 +1175,14 @@ class MotionMasterReqResClient {
|
|
|
1163
1175
|
const id = this.sendRequest({ executeForwardCall }, messageId);
|
|
1164
1176
|
return this.socket.message$.pipe((0, operators_2.transformMotionMasterMessageToStatus)('forwardCall', requestTimeout, id));
|
|
1165
1177
|
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Set PDO mode.
|
|
1180
|
+
*/
|
|
1181
|
+
setPdoMode(props, requestTimeout, messageId) {
|
|
1182
|
+
const setPdoMode = types_1.MotionMasterMessage.Request.SetPdoMode.create(props);
|
|
1183
|
+
const id = this.sendRequest({ setPdoMode }, messageId);
|
|
1184
|
+
return this.socket.message$.pipe((0, operators_2.transformMotionMasterMessageToStatus)('pdoMode', requestTimeout, id));
|
|
1185
|
+
}
|
|
1166
1186
|
/**
|
|
1167
1187
|
* Send request.
|
|
1168
1188
|
*
|
|
@@ -2505,34 +2525,53 @@ class MotionMasterReqResClient {
|
|
|
2505
2525
|
return this.storeParameters(deviceRef);
|
|
2506
2526
|
}
|
|
2507
2527
|
/**
|
|
2508
|
-
* Replace the contents of the config.csv file with the provided data and instruct the device to load the updated configuration.
|
|
2528
|
+
* Replace or merge the contents of the config.csv file with the provided data and instruct the device to load the updated configuration.
|
|
2509
2529
|
* The new configuration is loaded using the 0x1011:01 Restore All Default Parameters.
|
|
2510
2530
|
* Optionally refreshes the device parameter values on Motion Master after applying the new configuration.
|
|
2511
2531
|
*
|
|
2512
2532
|
* @param deviceRef A reference to the device where the configuration will be applied.
|
|
2513
2533
|
* @param data The new configuration data to be written to the config.csv file.
|
|
2534
|
+
* @param strategy The strategy to use when loading the configuration. Can be either 'replace' to overwrite the existing configuration or 'merge' to combine the new configuration with the existing one.
|
|
2514
2535
|
* @param retryConfig Configuration settings for retrying the restore default parameters operation.
|
|
2515
2536
|
* @param refresh A flag to refresh device parameter values after loading the new configuration, as Motion Master will otherwise use the old values.
|
|
2516
2537
|
* @returns An observable that emits once the configuration has been successfully loaded.
|
|
2517
2538
|
*/
|
|
2518
|
-
loadConfig(deviceRef, data, retryConfig = { count: 10, delay: 500 }, refresh = true) {
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2539
|
+
loadConfig(deviceRef, data, strategy = 'replace', retryConfig = { count: 10, delay: 500 }, refresh = true) {
|
|
2540
|
+
const encoder = new TextEncoder(); // always utf-8
|
|
2541
|
+
const decoder = new TextDecoder('utf-8'); // explicitly set utf-8
|
|
2542
|
+
const content = typeof data === 'string' ? encoder.encode(data) : data;
|
|
2543
|
+
// If merging, parse the user-provided config file to extract its parameters.
|
|
2544
|
+
const csv = decoder.decode(content);
|
|
2545
|
+
const userConfigFile = new config_file_1.ConfigFile(csv);
|
|
2546
|
+
// Function to write the config file to the device.
|
|
2547
|
+
const setConfigFile = (content) => (0, rxjs_1.defer)(() => this.setFile(deviceRef, 'config.csv', content, true));
|
|
2548
|
+
// If merging, read the existing config file from the device, merge it with the user-provided config, and prepare the merged content for writing.
|
|
2549
|
+
const mergeConfigFiles$ = (0, rxjs_1.defer)(() => this.getDecodedFile(deviceRef, 'config.csv').pipe((0, operators_1.map)((text) => {
|
|
2550
|
+
const deviceConfigFile = new config_file_1.ConfigFile(text);
|
|
2551
|
+
// Merge user and device parameters. The order is important: userConfig parameters
|
|
2552
|
+
// are kept in case of duplicates. Finally, sort by index/subindex for consistency.
|
|
2553
|
+
deviceConfigFile.parameters = [...userConfigFile.parameters, ...deviceConfigFile.parameters]
|
|
2554
|
+
.filter((item, index, array) => array.findIndex((obj) => obj.index === item.index && obj.subindex === item.subindex) === index)
|
|
2555
|
+
.sort((a, b) => a.index - b.index || a.subindex - b.subindex);
|
|
2556
|
+
return encoder.encode(deviceConfigFile.toString());
|
|
2557
|
+
})));
|
|
2558
|
+
const setConfigFile$ = (0, rxjs_1.defer)(() => strategy === 'merge'
|
|
2559
|
+
? mergeConfigFiles$.pipe((0, operators_1.mergeMap)((configContent) => setConfigFile(configContent)))
|
|
2560
|
+
: setConfigFile(content));
|
|
2561
|
+
return setConfigFile$.pipe((0, operators_1.mergeMap)(() => this.restoreDefaultParameters(deviceRef, types_1.RestoreDefaultParametersType.RESTORE_ALL_DEFAULT_PARAMETERS, retryConfig)), (0, operators_1.mergeMap)(() => {
|
|
2528
2562
|
if (!refresh) {
|
|
2529
2563
|
return rxjs_1.EMPTY;
|
|
2530
2564
|
}
|
|
2531
|
-
const decoder = new TextDecoder('utf-8'); // You can specify the encoding if needed
|
|
2532
|
-
const text = decoder.decode(content);
|
|
2533
|
-
const config = new config_file_1.ConfigFile(text);
|
|
2534
2565
|
const deviceRefObj = (0, device_1.makeDeviceRefObj)(deviceRef);
|
|
2535
|
-
return this.getDeviceParameterValues(Object.assign(Object.assign({}, deviceRefObj), {
|
|
2566
|
+
return this.getDeviceParameterValues(Object.assign(Object.assign({}, deviceRefObj), {
|
|
2567
|
+
// TODO: Currently using `userConfigFile.parameters`.
|
|
2568
|
+
// Ideally, use the combined parameters when merging,
|
|
2569
|
+
// otherwise some parameters written to the device's config.csv might not get refreshed.
|
|
2570
|
+
parameters: userConfigFile.parameters.map((p) => ({
|
|
2571
|
+
index: p.index,
|
|
2572
|
+
subindex: p.subindex,
|
|
2573
|
+
loadFromCache: false,
|
|
2574
|
+
})), sendProgress: false }), 30000).pipe((0, operators_1.map)(() => undefined));
|
|
2536
2575
|
}));
|
|
2537
2576
|
}
|
|
2538
2577
|
/**
|
|
@@ -2605,7 +2644,7 @@ class MotionMasterReqResClient {
|
|
|
2605
2644
|
/**
|
|
2606
2645
|
* @link https://www.wrike.com/open.htm?id=1375749957
|
|
2607
2646
|
*
|
|
2608
|
-
*
|
|
2647
|
+
* @todo: Verify if the device is an Actilink S device and check the corresponding variant file.
|
|
2609
2648
|
*/
|
|
2610
2649
|
isIntegroWithMultiturnEncoder(deviceRef) {
|
|
2611
2650
|
var _a;
|
|
@@ -3858,6 +3897,70 @@ class MotionMasterReqResClient {
|
|
|
3858
3897
|
throw new Error(`Failed to execute forward call: ${((_a = status.error) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown error'}`);
|
|
3859
3898
|
}));
|
|
3860
3899
|
}
|
|
3900
|
+
/**
|
|
3901
|
+
* Auto-tunes the notch filter parameters based on the device's plant model.
|
|
3902
|
+
*
|
|
3903
|
+
* @param deviceSerialNumber - The serial number of the target device.
|
|
3904
|
+
* @returns An `Observable<NotchFilter>` that emits the parsed notch filter configuration upon success.
|
|
3905
|
+
*
|
|
3906
|
+
* @throws Will throw an error if:
|
|
3907
|
+
* - `deviceRef` is invalid.
|
|
3908
|
+
* - The device does not have a plant model.
|
|
3909
|
+
* - The forward call to the device fails.
|
|
3910
|
+
* - The auto-tune notch filter does not return finite valid values.
|
|
3911
|
+
* - The response cannot be parsed as valid JSON.
|
|
3912
|
+
*/
|
|
3913
|
+
autoTuneNotchFilter(deviceRef) {
|
|
3914
|
+
return this.getPlantModel(deviceRef).pipe((0, operators_1.mergeMap)((plantModel) => {
|
|
3915
|
+
if (!plantModel) {
|
|
3916
|
+
throw new Error('Plant model is not available on the device.');
|
|
3917
|
+
}
|
|
3918
|
+
return this.executeForwardCallAndParseResponse({
|
|
3919
|
+
run: 'auto_tune_notch',
|
|
3920
|
+
data: {
|
|
3921
|
+
plant_model: {
|
|
3922
|
+
numerator: plantModel.numerator,
|
|
3923
|
+
denominator: plantModel.denominator,
|
|
3924
|
+
},
|
|
3925
|
+
},
|
|
3926
|
+
});
|
|
3927
|
+
}), (0, operators_1.map)((response) => {
|
|
3928
|
+
var _a;
|
|
3929
|
+
if (response.notch_dp === null || response.notch_fc === null || response.notch_fw === null) {
|
|
3930
|
+
throw new Error('Auto-tune notch filter returned null values.');
|
|
3931
|
+
}
|
|
3932
|
+
return {
|
|
3933
|
+
enabled: (_a = response.notch_en) !== null && _a !== void 0 ? _a : false,
|
|
3934
|
+
centerFrequency: response.notch_fc,
|
|
3935
|
+
rejectionBand: response.notch_fw,
|
|
3936
|
+
depth: response.notch_dp,
|
|
3937
|
+
};
|
|
3938
|
+
}));
|
|
3939
|
+
}
|
|
3940
|
+
/**
|
|
3941
|
+
*
|
|
3942
|
+
* Writes notch filter parameter values to the specified device.
|
|
3943
|
+
*
|
|
3944
|
+
* This method sets the individual parameters of the notch filter (0x2023) on the device:
|
|
3945
|
+
* - Subindex `0x01` → enabled flag
|
|
3946
|
+
* - Subindex `0x02` → center frequency (rounded to nearest integer)
|
|
3947
|
+
* - Subindex `0x03` → rejection band (rounded to nearest integer)
|
|
3948
|
+
* - Subindex `0x04` → depth
|
|
3949
|
+
*
|
|
3950
|
+
* @param deviceRef - Reference to the target device.
|
|
3951
|
+
* @param notchFilter - Notch filter values to write to the device.
|
|
3952
|
+
* @param requestTimeout - Optional timeout in milliseconds for the request (default: 1000).
|
|
3953
|
+
* @returns An `Observable<void>` that completes when the parameter values have been written successfully.
|
|
3954
|
+
*
|
|
3955
|
+
*/
|
|
3956
|
+
setNotchFilterParameterValues(deviceRef, notchFilter, requestTimeout = 1000) {
|
|
3957
|
+
return this.setParameterValues([
|
|
3958
|
+
[deviceRef, 0x2023, 0x01, notchFilter.enabled ? 1 : 0],
|
|
3959
|
+
[deviceRef, 0x2023, 0x02, Math.round(notchFilter.centerFrequency)],
|
|
3960
|
+
[deviceRef, 0x2023, 0x03, Math.round(notchFilter.rejectionBand)],
|
|
3961
|
+
[deviceRef, 0x2023, 0x04, notchFilter.depth],
|
|
3962
|
+
], requestTimeout);
|
|
3963
|
+
}
|
|
3861
3964
|
}
|
|
3862
3965
|
exports.MotionMasterReqResClient = MotionMasterReqResClient;
|
|
3863
3966
|
/**
|