motion-master-client 0.0.377 → 0.0.379
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 +236 -191
- package/src/api.js.map +1 -1
- package/src/lib/motion-master-client.d.ts +58 -18
- package/src/lib/motion-master-client.js +70 -18
- package/src/lib/motion-master-client.js.map +1 -1
- package/src/lib/motion-master-req-res-client.d.ts +17 -0
- package/src/lib/motion-master-req-res-client.js +41 -33
- package/src/lib/motion-master-req-res-client.js.map +1 -1
- package/src/lib/types.d.ts +27 -15
|
@@ -1157,6 +1157,23 @@ export declare class MotionMasterReqResClient {
|
|
|
1157
1157
|
* If you want to initiate a new set-point while the previous one is still being executed, you need to generate another rising edge of the new set-point bit in the controlword.
|
|
1158
1158
|
*/
|
|
1159
1159
|
applySetPoint(deviceRef: DeviceRef): Promise<void>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Release brake.
|
|
1162
|
+
*
|
|
1163
|
+
* Releases the brake if one is software-controllable (brakeReleaseStrategy 0x2004:04 !== 0).
|
|
1164
|
+
* Reads current brake status and skips the write if already released, then waits for
|
|
1165
|
+
* waitTime milliseconds before returning.
|
|
1166
|
+
*
|
|
1167
|
+
* @param waitTime - Time in milliseconds to wait after releasing the brake (default: 150).
|
|
1168
|
+
*/
|
|
1169
|
+
releaseBrake(deviceRef: DeviceRef, waitTime?: number): Promise<void>;
|
|
1170
|
+
/**
|
|
1171
|
+
* Engage brake.
|
|
1172
|
+
*
|
|
1173
|
+
* Engages the brake if one is software-controllable (brakeReleaseStrategy 0x2004:04 !== 0),
|
|
1174
|
+
* then waits 150ms to ensure the brake is fully applied before returning.
|
|
1175
|
+
*/
|
|
1176
|
+
engageBrake(deviceRef: DeviceRef): Promise<void>;
|
|
1160
1177
|
/**
|
|
1161
1178
|
* Run OS command.
|
|
1162
1179
|
*
|
|
@@ -2260,6 +2260,42 @@ class MotionMasterReqResClient {
|
|
|
2260
2260
|
yield this.download(deviceRef, 0x6040, 0, controlword);
|
|
2261
2261
|
});
|
|
2262
2262
|
}
|
|
2263
|
+
/**
|
|
2264
|
+
* Release brake.
|
|
2265
|
+
*
|
|
2266
|
+
* Releases the brake if one is software-controllable (brakeReleaseStrategy 0x2004:04 !== 0).
|
|
2267
|
+
* Reads current brake status and skips the write if already released, then waits for
|
|
2268
|
+
* waitTime milliseconds before returning.
|
|
2269
|
+
*
|
|
2270
|
+
* @param waitTime - Time in milliseconds to wait after releasing the brake (default: 150).
|
|
2271
|
+
*/
|
|
2272
|
+
releaseBrake(deviceRef, waitTime = 150) {
|
|
2273
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2274
|
+
const [brakeReleaseStrategy, brakeStatus] = (yield this.uploadMany([
|
|
2275
|
+
[deviceRef, 0x2004, 4],
|
|
2276
|
+
[deviceRef, 0x2004, 7],
|
|
2277
|
+
]));
|
|
2278
|
+
if (brakeReleaseStrategy !== 0 && brakeStatus !== 2) {
|
|
2279
|
+
yield this.download(deviceRef, 0x2004, 7, 2);
|
|
2280
|
+
yield (0, util_1.resolveAfter)(waitTime);
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Engage brake.
|
|
2286
|
+
*
|
|
2287
|
+
* Engages the brake if one is software-controllable (brakeReleaseStrategy 0x2004:04 !== 0),
|
|
2288
|
+
* then waits 150ms to ensure the brake is fully applied before returning.
|
|
2289
|
+
*/
|
|
2290
|
+
engageBrake(deviceRef) {
|
|
2291
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
2292
|
+
const brakeReleaseStrategy = yield this.upload(deviceRef, 0x2004, 4);
|
|
2293
|
+
if (brakeReleaseStrategy !== 0) {
|
|
2294
|
+
yield this.download(deviceRef, 0x2004, 7, 1);
|
|
2295
|
+
yield (0, util_1.resolveAfter)(150);
|
|
2296
|
+
}
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2263
2299
|
/**
|
|
2264
2300
|
* Run OS command.
|
|
2265
2301
|
*
|
|
@@ -4617,7 +4653,6 @@ class MotionMasterReqResClient {
|
|
|
4617
4653
|
// Brake-related state restored in finally block
|
|
4618
4654
|
let brakeReleaseStrategy = 0;
|
|
4619
4655
|
let brakeStatusInit = 0;
|
|
4620
|
-
let brakePullTime = 0;
|
|
4621
4656
|
let measurementMethod = 0;
|
|
4622
4657
|
// Throws if cancellation was requested
|
|
4623
4658
|
const checkCancelled = () => {
|
|
@@ -4625,32 +4660,6 @@ class MotionMasterReqResClient {
|
|
|
4625
4660
|
throw new Error('Offset detection procedure was cancelled.');
|
|
4626
4661
|
}
|
|
4627
4662
|
};
|
|
4628
|
-
// Helper function for brake control based on the initial configuration.
|
|
4629
|
-
//
|
|
4630
|
-
// This function is only executed when the brake release strategy is not 0,
|
|
4631
|
-
// meaning the brake can be controlled via software.
|
|
4632
|
-
//
|
|
4633
|
-
// The function reads the current brake status and releases the brake if it is
|
|
4634
|
-
// not already released, then waits for the configured pull time.
|
|
4635
|
-
const releaseBrake = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
4636
|
-
if (brakeReleaseStrategy !== 0) {
|
|
4637
|
-
const brakeStatus = yield this.upload(deviceRef, 0x2004, 7);
|
|
4638
|
-
if (brakeStatus !== 2) {
|
|
4639
|
-
yield this.download(deviceRef, 0x2004, 7, 2);
|
|
4640
|
-
yield (0, util_1.resolveAfter)(brakePullTime);
|
|
4641
|
-
}
|
|
4642
|
-
}
|
|
4643
|
-
});
|
|
4644
|
-
// Helper function for brake control based on the initial configuration.
|
|
4645
|
-
//
|
|
4646
|
-
// This function engages the brake if it is not already engaged, then waits
|
|
4647
|
-
// briefly to ensure the brake is fully applied before continuing.
|
|
4648
|
-
const engageBrake = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
4649
|
-
if (brakeReleaseStrategy !== 0) {
|
|
4650
|
-
yield this.download(deviceRef, 0x2004, 7, 1);
|
|
4651
|
-
yield (0, util_1.resolveAfter)(150); // Wait for 150ms to ensure brake is fully engaged
|
|
4652
|
-
}
|
|
4653
|
-
});
|
|
4654
4663
|
const runInternal = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
4655
4664
|
// Determine active steps (either provided subset or all steps)
|
|
4656
4665
|
let activeStepIds = stepIds.length > 0 ? [...stepIds] : offset_detection_1.offsetDetectionSteps.map((s) => s.id);
|
|
@@ -4667,11 +4676,10 @@ class MotionMasterReqResClient {
|
|
|
4667
4676
|
subscriber.next(steps);
|
|
4668
4677
|
}
|
|
4669
4678
|
try {
|
|
4670
|
-
// Read
|
|
4671
|
-
[brakeReleaseStrategy, brakeStatusInit,
|
|
4679
|
+
// Read initial brake configuration from device
|
|
4680
|
+
[brakeReleaseStrategy, brakeStatusInit, measurementMethod] = (yield this.uploadMany([
|
|
4672
4681
|
[deviceRef, 0x2004, 4],
|
|
4673
4682
|
[deviceRef, 0x2004, 7],
|
|
4674
|
-
[deviceRef, 0x2004, 3],
|
|
4675
4683
|
[deviceRef, 0x2009, 3],
|
|
4676
4684
|
]));
|
|
4677
4685
|
checkCancelled();
|
|
@@ -4697,21 +4705,21 @@ class MotionMasterReqResClient {
|
|
|
4697
4705
|
},
|
|
4698
4706
|
polePairDetection: {
|
|
4699
4707
|
execute: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
4700
|
-
yield releaseBrake();
|
|
4708
|
+
yield this.releaseBrake(deviceRef);
|
|
4701
4709
|
return yield (0, rxjs_1.lastValueFrom)(this.runPolePairDetectionOsCommand(deviceRef));
|
|
4702
4710
|
}),
|
|
4703
4711
|
valueKey: 'numberOfPolePairs',
|
|
4704
4712
|
},
|
|
4705
4713
|
motorPhaseOrderDetection: {
|
|
4706
4714
|
execute: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
4707
|
-
yield releaseBrake();
|
|
4715
|
+
yield this.releaseBrake(deviceRef);
|
|
4708
4716
|
return yield (0, rxjs_1.lastValueFrom)(this.runMotorPhaseOrderDetectionOsCommand(deviceRef));
|
|
4709
4717
|
}),
|
|
4710
4718
|
valueKey: 'motorPhaseOrder',
|
|
4711
4719
|
},
|
|
4712
4720
|
commutationOffsetMeasurement: {
|
|
4713
4721
|
execute: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
4714
|
-
measurementMethod === 2 ? yield engageBrake() : yield releaseBrake();
|
|
4722
|
+
measurementMethod === 2 ? yield this.engageBrake(deviceRef) : yield this.releaseBrake(deviceRef);
|
|
4715
4723
|
return yield (0, rxjs_1.lastValueFrom)(this.runCommutationOffsetMeasurementOsCommand(deviceRef));
|
|
4716
4724
|
}),
|
|
4717
4725
|
valueKey: 'commutationAngleOffset',
|