@zaber/motion 9.2.1 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE +6 -6
  2. package/dist/binding/wasm/zaber-motion-core.wasm +0 -0
  3. package/dist/lib/ascii/accel_type.d.ts +17 -0
  4. package/dist/lib/ascii/accel_type.d.ts.map +1 -0
  5. package/dist/lib/ascii/accel_type.js +26 -0
  6. package/dist/lib/ascii/accel_type.js.map +1 -0
  7. package/dist/lib/ascii/axis.d.ts +8 -0
  8. package/dist/lib/ascii/axis.d.ts.map +1 -1
  9. package/dist/lib/ascii/axis.js +22 -0
  10. package/dist/lib/ascii/axis.js.map +1 -1
  11. package/dist/lib/ascii/axis_settings.d.ts +6 -0
  12. package/dist/lib/ascii/axis_settings.d.ts.map +1 -1
  13. package/dist/lib/ascii/axis_settings.js +19 -0
  14. package/dist/lib/ascii/axis_settings.js.map +1 -1
  15. package/dist/lib/ascii/device.d.ts +8 -0
  16. package/dist/lib/ascii/device.d.ts.map +1 -1
  17. package/dist/lib/ascii/device.js +21 -0
  18. package/dist/lib/ascii/device.js.map +1 -1
  19. package/dist/lib/ascii/device_settings.d.ts +6 -0
  20. package/dist/lib/ascii/device_settings.d.ts.map +1 -1
  21. package/dist/lib/ascii/device_settings.js +18 -0
  22. package/dist/lib/ascii/device_settings.js.map +1 -1
  23. package/dist/lib/ascii/index.d.ts +1 -0
  24. package/dist/lib/ascii/index.d.ts.map +1 -1
  25. package/dist/lib/ascii/index.js +1 -0
  26. package/dist/lib/ascii/index.js.map +1 -1
  27. package/dist/lib/ascii/lockstep.js +2 -2
  28. package/dist/lib/ascii/lockstep.js.map +1 -1
  29. package/dist/lib/gateway/constants.js +1 -1
  30. package/dist/lib/gateway/constants.js.map +1 -1
  31. package/dist/lib/index.d.ts +2 -0
  32. package/dist/lib/index.d.ts.map +1 -1
  33. package/dist/lib/index.js +3 -1
  34. package/dist/lib/index.js.map +1 -1
  35. package/dist/lib/measurement_or_value.d.ts +21 -0
  36. package/dist/lib/measurement_or_value.d.ts.map +1 -0
  37. package/dist/lib/measurement_or_value.js +67 -0
  38. package/dist/lib/measurement_or_value.js.map +1 -0
  39. package/dist/lib/movement/default_motion_units.d.ts +32 -0
  40. package/dist/lib/movement/default_motion_units.d.ts.map +1 -0
  41. package/dist/lib/movement/default_motion_units.js +47 -0
  42. package/dist/lib/movement/default_motion_units.js.map +1 -0
  43. package/dist/lib/movement/index.d.ts +3 -0
  44. package/dist/lib/movement/index.d.ts.map +1 -0
  45. package/dist/lib/movement/index.js +21 -0
  46. package/dist/lib/movement/index.js.map +1 -0
  47. package/dist/lib/movement/moveable.d.ts +418 -0
  48. package/dist/lib/movement/moveable.d.ts.map +1 -0
  49. package/dist/lib/movement/moveable.js +639 -0
  50. package/dist/lib/movement/moveable.js.map +1 -0
  51. package/dist/lib/requests/device_has_command_request.d.ts +17 -0
  52. package/dist/lib/requests/device_has_command_request.d.ts.map +1 -0
  53. package/dist/lib/requests/device_has_command_request.js +51 -0
  54. package/dist/lib/requests/device_has_command_request.js.map +1 -0
  55. package/dist/lib/requests/index.d.ts +12 -1
  56. package/dist/lib/requests/index.d.ts.map +1 -1
  57. package/dist/lib/requests/index.js +12 -1
  58. package/dist/lib/requests/index.js.map +1 -1
  59. package/dist/lib/requests/lockstep_move_request.d.ts +4 -0
  60. package/dist/lib/requests/lockstep_move_request.d.ts.map +1 -1
  61. package/dist/lib/requests/lockstep_move_request.js +14 -1
  62. package/dist/lib/requests/lockstep_move_request.js.map +1 -1
  63. package/dist/lib/requests/moveable_driver_enable_request.d.ts +14 -0
  64. package/dist/lib/requests/moveable_driver_enable_request.d.ts.map +1 -0
  65. package/dist/lib/requests/moveable_driver_enable_request.js +39 -0
  66. package/dist/lib/requests/moveable_driver_enable_request.js.map +1 -0
  67. package/dist/lib/requests/moveable_get_acceleration_request.d.ts +17 -0
  68. package/dist/lib/requests/moveable_get_acceleration_request.d.ts.map +1 -0
  69. package/dist/lib/requests/moveable_get_acceleration_request.js +44 -0
  70. package/dist/lib/requests/moveable_get_acceleration_request.js.map +1 -0
  71. package/dist/lib/requests/moveable_get_setting_request.d.ts +15 -0
  72. package/dist/lib/requests/moveable_get_setting_request.d.ts.map +1 -0
  73. package/dist/lib/requests/moveable_get_setting_request.js +39 -0
  74. package/dist/lib/requests/moveable_get_setting_request.js.map +1 -0
  75. package/dist/lib/requests/moveable_id_request.d.ts +13 -0
  76. package/dist/lib/requests/moveable_id_request.d.ts.map +1 -0
  77. package/dist/lib/requests/moveable_id_request.js +35 -0
  78. package/dist/lib/requests/moveable_id_request.js.map +1 -0
  79. package/dist/lib/requests/moveable_move_request.d.ts +21 -0
  80. package/dist/lib/requests/moveable_move_request.d.ts.map +1 -0
  81. package/dist/lib/requests/moveable_move_request.js +72 -0
  82. package/dist/lib/requests/moveable_move_request.js.map +1 -0
  83. package/dist/lib/requests/moveable_move_sin_request.d.ts +18 -0
  84. package/dist/lib/requests/moveable_move_sin_request.d.ts.map +1 -0
  85. package/dist/lib/requests/moveable_move_sin_request.js +61 -0
  86. package/dist/lib/requests/moveable_move_sin_request.js.map +1 -0
  87. package/dist/lib/requests/moveable_set_acceleration_request.d.ts +17 -0
  88. package/dist/lib/requests/moveable_set_acceleration_request.d.ts.map +1 -0
  89. package/dist/lib/requests/moveable_set_acceleration_request.js +52 -0
  90. package/dist/lib/requests/moveable_set_acceleration_request.js.map +1 -0
  91. package/dist/lib/requests/moveable_set_setting_request.d.ts +15 -0
  92. package/dist/lib/requests/moveable_set_setting_request.d.ts.map +1 -0
  93. package/dist/lib/requests/moveable_set_setting_request.js +46 -0
  94. package/dist/lib/requests/moveable_set_setting_request.js.map +1 -0
  95. package/dist/lib/requests/moveable_setup_request.d.ts +19 -0
  96. package/dist/lib/requests/moveable_setup_request.d.ts.map +1 -0
  97. package/dist/lib/requests/moveable_setup_request.js +53 -0
  98. package/dist/lib/requests/moveable_setup_request.js.map +1 -0
  99. package/dist/lib/requests/moveable_type.d.ts +14 -0
  100. package/dist/lib/requests/moveable_type.d.ts.map +1 -0
  101. package/dist/lib/requests/moveable_type.js +23 -0
  102. package/dist/lib/requests/moveable_type.js.map +1 -0
  103. package/dist/lib/requests/moveable_wait_until_idle_request.d.ts +14 -0
  104. package/dist/lib/requests/moveable_wait_until_idle_request.d.ts.map +1 -0
  105. package/dist/lib/requests/moveable_wait_until_idle_request.js +39 -0
  106. package/dist/lib/requests/moveable_wait_until_idle_request.js.map +1 -0
  107. package/package.json +6 -2
  108. package/dist/lib/requests/lockstep_disable_request.d.ts +0 -16
  109. package/dist/lib/requests/lockstep_disable_request.d.ts.map +0 -1
  110. package/dist/lib/requests/lockstep_disable_request.js +0 -47
  111. package/dist/lib/requests/lockstep_disable_request.js.map +0 -1
@@ -0,0 +1,639 @@
1
+ "use strict";
2
+ // ===== THIS FILE IS GENERATED FROM A TEMPLATE ===== //
3
+ // ============== DO NOT EDIT DIRECTLY ============== //
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Moveable = void 0;
29
+ const gateway = __importStar(require("../gateway"));
30
+ const requests = __importStar(require("../requests"));
31
+ const finalizer_1 = require("../finalizer");
32
+ const axis_1 = require("../ascii/axis");
33
+ const lockstep_1 = require("../ascii/lockstep");
34
+ /**
35
+ * Represents something that moves: either an axis of a device, or a lockstep group.
36
+ */
37
+ class Moveable {
38
+ /**
39
+ * The identifier for the moveable instance.
40
+ */
41
+ get moveableId() {
42
+ return this._moveableId;
43
+ }
44
+ /**
45
+ * The device this moveable is on.
46
+ */
47
+ get device() {
48
+ return this._device;
49
+ }
50
+ constructor(moveableId, device) {
51
+ this._moveableId = moveableId;
52
+ this._device = device;
53
+ (0, finalizer_1.registerForFinalization)(this, Moveable._free.bind(null, moveableId));
54
+ }
55
+ /**
56
+ * Creates a Moveable instance for a given axis.
57
+ * @param axis Axis to create a Moveable for.
58
+ * @param options.units Default units of measurement used for movement operations.
59
+ * @returns A Moveable instance for the specified axis.
60
+ */
61
+ static async fromAxis(axis, options = {}) {
62
+ const { units, } = options;
63
+ const request = {
64
+ ...requests.MoveableSetupRequest.DEFAULT,
65
+ interfaceId: axis.device.connection.interfaceId,
66
+ moveableNumber: axis.axisNumber,
67
+ moveableType: requests.MoveableType.AXIS,
68
+ device: axis.device.deviceAddress,
69
+ defaultUnits: units,
70
+ toBinary() {
71
+ return requests.MoveableSetupRequest.toBinary(this);
72
+ },
73
+ };
74
+ const response = await gateway.callAsync('moveable/setup', request, requests.IntResponse.fromBinary);
75
+ return new Moveable(response.value, axis.device);
76
+ }
77
+ /**
78
+ * Creates a Moveable instance for a given lockstep group.
79
+ * @param lockstep Lockstep group to create a Moveable for.
80
+ * @param options.units Default units of measurement used for movement operations.
81
+ * @returns A Moveable instance for the specified lockstep group.
82
+ */
83
+ static async fromLockstep(lockstep, options = {}) {
84
+ const { units, } = options;
85
+ const request = {
86
+ ...requests.MoveableSetupRequest.DEFAULT,
87
+ interfaceId: lockstep.device.connection.interfaceId,
88
+ moveableNumber: lockstep.lockstepGroupId,
89
+ moveableType: requests.MoveableType.LOCKSTEP,
90
+ device: lockstep.device.deviceAddress,
91
+ defaultUnits: units,
92
+ toBinary() {
93
+ return requests.MoveableSetupRequest.toBinary(this);
94
+ },
95
+ };
96
+ const response = await gateway.callAsync('moveable/setup', request, requests.IntResponse.fromBinary);
97
+ return new Moveable(response.value, lockstep.device);
98
+ }
99
+ /**
100
+ * Creates a Moveable instance for a single-axis device.
101
+ * @param device Device to create a Moveable for.
102
+ * @param options.units Default units of measurement used for movement operations.
103
+ * @returns A Moveable instance for the specified device.
104
+ */
105
+ static async fromDevice(device, options = {}) {
106
+ const { units, } = options;
107
+ const request = {
108
+ ...requests.MoveableSetupRequest.DEFAULT,
109
+ interfaceId: device.connection.interfaceId,
110
+ moveableNumber: 1,
111
+ moveableType: requests.MoveableType.DEVICE,
112
+ device: device.deviceAddress,
113
+ defaultUnits: units,
114
+ toBinary() {
115
+ return requests.MoveableSetupRequest.toBinary(this);
116
+ },
117
+ };
118
+ const response = await gateway.callAsync('moveable/setup', request, requests.IntResponse.fromBinary);
119
+ return new Moveable(response.value, device);
120
+ }
121
+ /**
122
+ * Moves to an absolute position.
123
+ * @param position Absolute position to move to.
124
+ * @param options.velocity Movement velocity. If not specified, the maximum velocity setting is used.
125
+ * @param options.acceleration Movement acceleration. If not specified, the default acceleration setting is used.
126
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
127
+ * @param options.cyclicDirection Which direction a cyclic device should take to get to the target position.
128
+ * @param options.extraCycles Number of extra cycles to complete before stopping at the target.
129
+ */
130
+ async moveAbsolute(position, options = {}) {
131
+ const { velocity, acceleration, waitUntilIdle = true, cyclicDirection, extraCycles, } = options;
132
+ const request = {
133
+ ...requests.MoveableMoveRequest.DEFAULT,
134
+ moveableId: this.moveableId,
135
+ position: position,
136
+ velocity: velocity,
137
+ acceleration: acceleration,
138
+ waitUntilIdle: waitUntilIdle,
139
+ cyclicDirection: cyclicDirection,
140
+ extraCycles: extraCycles,
141
+ toBinary() {
142
+ return requests.MoveableMoveRequest.toBinary(this);
143
+ },
144
+ };
145
+ await gateway.callAsync('moveable/move_abs', request);
146
+ }
147
+ /**
148
+ * Moves by a relative amount from the current position.
149
+ * @param position Relative displacement to move by.
150
+ * @param options.velocity Movement velocity. If not specified, the maximum velocity setting is used.
151
+ * @param options.acceleration Movement acceleration. If not specified, the default acceleration setting is used.
152
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
153
+ */
154
+ async moveRelative(position, options = {}) {
155
+ const { velocity, acceleration, waitUntilIdle = true, } = options;
156
+ const request = {
157
+ ...requests.MoveableMoveRequest.DEFAULT,
158
+ moveableId: this.moveableId,
159
+ position: position,
160
+ velocity: velocity,
161
+ acceleration: acceleration,
162
+ waitUntilIdle: waitUntilIdle,
163
+ toBinary() {
164
+ return requests.MoveableMoveRequest.toBinary(this);
165
+ },
166
+ };
167
+ await gateway.callAsync('moveable/move_rel', request);
168
+ }
169
+ /**
170
+ * Begins moving at a specified velocity.
171
+ * @param velocity Velocity to move at.
172
+ * @param options.acceleration Movement acceleration. If not specified, the default acceleration setting is used.
173
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
174
+ */
175
+ async moveVelocity(velocity, options = {}) {
176
+ const { acceleration, waitUntilIdle = true, } = options;
177
+ const request = {
178
+ ...requests.MoveableMoveRequest.DEFAULT,
179
+ moveableId: this.moveableId,
180
+ velocity: velocity,
181
+ acceleration: acceleration,
182
+ waitUntilIdle: waitUntilIdle,
183
+ toBinary() {
184
+ return requests.MoveableMoveRequest.toBinary(this);
185
+ },
186
+ };
187
+ await gateway.callAsync('moveable/move_vel', request);
188
+ }
189
+ /**
190
+ * Moves to the end of travel.
191
+ * @param options.velocity Movement velocity. If not specified, the maximum velocity setting is used.
192
+ * @param options.acceleration Movement acceleration. If not specified, the default acceleration setting is used.
193
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
194
+ */
195
+ async moveMax(options = {}) {
196
+ const { velocity, acceleration, waitUntilIdle = true, } = options;
197
+ const request = {
198
+ ...requests.MoveableMoveRequest.DEFAULT,
199
+ moveableId: this.moveableId,
200
+ velocity: velocity,
201
+ acceleration: acceleration,
202
+ waitUntilIdle: waitUntilIdle,
203
+ toBinary() {
204
+ return requests.MoveableMoveRequest.toBinary(this);
205
+ },
206
+ };
207
+ await gateway.callAsync('moveable/move_max', request);
208
+ }
209
+ /**
210
+ * Moves to the beginning of travel.
211
+ * @param options.velocity Movement velocity. If not specified, the maximum velocity setting is used.
212
+ * @param options.acceleration Movement acceleration. If not specified, the default acceleration setting is used.
213
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
214
+ */
215
+ async moveMin(options = {}) {
216
+ const { velocity, acceleration, waitUntilIdle = true, } = options;
217
+ const request = {
218
+ ...requests.MoveableMoveRequest.DEFAULT,
219
+ moveableId: this.moveableId,
220
+ velocity: velocity,
221
+ acceleration: acceleration,
222
+ waitUntilIdle: waitUntilIdle,
223
+ toBinary() {
224
+ return requests.MoveableMoveRequest.toBinary(this);
225
+ },
226
+ };
227
+ await gateway.callAsync('moveable/move_min', request);
228
+ }
229
+ /**
230
+ * Returns the current position of the moveable.
231
+ * @param options.unit Units of position. If not specified, the default position unit is used.
232
+ * @returns Current position.
233
+ */
234
+ async getPosition(options = {}) {
235
+ const { unit, } = options;
236
+ const request = {
237
+ ...requests.MoveableGetSettingRequest.DEFAULT,
238
+ moveableId: this.moveableId,
239
+ unit: unit,
240
+ toBinary() {
241
+ return requests.MoveableGetSettingRequest.toBinary(this);
242
+ },
243
+ };
244
+ const response = await gateway.callAsync('moveable/get_position', request, requests.DoubleResponse.fromBinary);
245
+ return response.value;
246
+ }
247
+ /**
248
+ * Returns the current encoder position of the moveable.
249
+ * @param options.unit Units of position. If not specified, the default position unit is used.
250
+ * @returns Current encoder position.
251
+ */
252
+ async getEncoderPosition(options = {}) {
253
+ const { unit, } = options;
254
+ const request = {
255
+ ...requests.MoveableGetSettingRequest.DEFAULT,
256
+ moveableId: this.moveableId,
257
+ unit: unit,
258
+ toBinary() {
259
+ return requests.MoveableGetSettingRequest.toBinary(this);
260
+ },
261
+ };
262
+ const response = await gateway.callAsync('moveable/get_encoder_position', request, requests.DoubleResponse.fromBinary);
263
+ return response.value;
264
+ }
265
+ /**
266
+ * Moves the moveable to the home position.
267
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
268
+ */
269
+ async home(options = {}) {
270
+ const { waitUntilIdle = true, } = options;
271
+ const request = {
272
+ ...requests.MoveableMoveRequest.DEFAULT,
273
+ moveableId: this.moveableId,
274
+ waitUntilIdle: waitUntilIdle,
275
+ toBinary() {
276
+ return requests.MoveableMoveRequest.toBinary(this);
277
+ },
278
+ };
279
+ await gateway.callAsync('moveable/home', request);
280
+ }
281
+ /**
282
+ * Returns bool indicating whether the moveable has position reference and was homed.
283
+ * @returns True if the moveable has position reference and was homed.
284
+ */
285
+ async isHomed() {
286
+ const request = {
287
+ ...requests.MoveableIdRequest.DEFAULT,
288
+ moveableId: this.moveableId,
289
+ toBinary() {
290
+ return requests.MoveableIdRequest.toBinary(this);
291
+ },
292
+ };
293
+ const response = await gateway.callAsync('moveable/is_homed', request, requests.BoolResponse.fromBinary);
294
+ return response.value;
295
+ }
296
+ /**
297
+ * Returns bool indicating whether the moveable is executing a motion command.
298
+ * @returns True if the moveable is currently executing a motion command.
299
+ */
300
+ async isBusy() {
301
+ const request = {
302
+ ...requests.MoveableIdRequest.DEFAULT,
303
+ moveableId: this.moveableId,
304
+ toBinary() {
305
+ return requests.MoveableIdRequest.toBinary(this);
306
+ },
307
+ };
308
+ const response = await gateway.callAsync('moveable/is_busy', request, requests.BoolResponse.fromBinary);
309
+ return response.value;
310
+ }
311
+ /**
312
+ * Returns bool indicating whether the moveable is parked.
313
+ * @returns True if the moveable is parked.
314
+ */
315
+ async isParked() {
316
+ const request = {
317
+ ...requests.MoveableIdRequest.DEFAULT,
318
+ moveableId: this.moveableId,
319
+ toBinary() {
320
+ return requests.MoveableIdRequest.toBinary(this);
321
+ },
322
+ };
323
+ const response = await gateway.callAsync('moveable/is_parked', request, requests.BoolResponse.fromBinary);
324
+ return response.value;
325
+ }
326
+ /**
327
+ * Stops ongoing movement of the moveable.
328
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
329
+ */
330
+ async stop(options = {}) {
331
+ const { waitUntilIdle = true, } = options;
332
+ const request = {
333
+ ...requests.MoveableMoveRequest.DEFAULT,
334
+ moveableId: this.moveableId,
335
+ waitUntilIdle: waitUntilIdle,
336
+ toBinary() {
337
+ return requests.MoveableMoveRequest.toBinary(this);
338
+ },
339
+ };
340
+ await gateway.callAsync('moveable/stop', request);
341
+ }
342
+ /**
343
+ * Moves the moveable in a sinusoidal trajectory.
344
+ * @param amplitude Amplitude of the sinusoidal motion (half of the motion's peak-to-peak range).
345
+ * @param period Period of the sinusoidal motion.
346
+ * @param [options.count=0] Number of sinusoidal cycles to complete.
347
+ * Must be a multiple of 0.5.
348
+ * If count is not specified or set to 0, the moveable will move indefinitely.
349
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished or just started.
350
+ */
351
+ async moveSin(amplitude, period, options = {}) {
352
+ const { count = 0, waitUntilIdle = true, } = options;
353
+ const request = {
354
+ ...requests.MoveableMoveSinRequest.DEFAULT,
355
+ moveableId: this.moveableId,
356
+ amplitude: amplitude,
357
+ period: period,
358
+ count: count,
359
+ waitUntilIdle: waitUntilIdle,
360
+ toBinary() {
361
+ return requests.MoveableMoveSinRequest.toBinary(this);
362
+ },
363
+ };
364
+ await gateway.callAsync('moveable/move_sin', request);
365
+ }
366
+ /**
367
+ * Stops the moveable at the end of the sinusoidal trajectory.
368
+ * If the sinusoidal motion was started with an integer-plus-half cycle count,
369
+ * the motion ends at the half-way point of the sinusoidal trajectory.
370
+ * @param [options.waitUntilIdle=true] Determines whether function should return after the movement is finished.
371
+ */
372
+ async moveSinStop(options = {}) {
373
+ const { waitUntilIdle = true, } = options;
374
+ const request = {
375
+ ...requests.MoveableMoveRequest.DEFAULT,
376
+ moveableId: this.moveableId,
377
+ waitUntilIdle: waitUntilIdle,
378
+ toBinary() {
379
+ return requests.MoveableMoveRequest.toBinary(this);
380
+ },
381
+ };
382
+ await gateway.callAsync('moveable/move_sin_stop', request);
383
+ }
384
+ /**
385
+ * Parks the moveable.
386
+ */
387
+ async park() {
388
+ const request = {
389
+ ...requests.MoveableIdRequest.DEFAULT,
390
+ moveableId: this.moveableId,
391
+ toBinary() {
392
+ return requests.MoveableIdRequest.toBinary(this);
393
+ },
394
+ };
395
+ await gateway.callAsync('moveable/park', request);
396
+ }
397
+ /**
398
+ * Unparks the moveable.
399
+ */
400
+ async unpark() {
401
+ const request = {
402
+ ...requests.MoveableIdRequest.DEFAULT,
403
+ moveableId: this.moveableId,
404
+ toBinary() {
405
+ return requests.MoveableIdRequest.toBinary(this);
406
+ },
407
+ };
408
+ await gateway.callAsync('moveable/unpark', request);
409
+ }
410
+ /**
411
+ * Returns the current velocity of the moveable.
412
+ * @param options.unit Units of velocity. If not specified, the default velocity unit is used.
413
+ * @returns Current velocity.
414
+ */
415
+ async getVelocity(options = {}) {
416
+ const { unit, } = options;
417
+ const request = {
418
+ ...requests.MoveableGetSettingRequest.DEFAULT,
419
+ moveableId: this.moveableId,
420
+ unit: unit,
421
+ toBinary() {
422
+ return requests.MoveableGetSettingRequest.toBinary(this);
423
+ },
424
+ };
425
+ const response = await gateway.callAsync('moveable/get_velocity', request, requests.DoubleResponse.fromBinary);
426
+ return response.value;
427
+ }
428
+ /**
429
+ * Returns the maximum speed that this moveable will execute moves at by default.
430
+ * If a different velocity is specified on a move command, that will override
431
+ * this value for that command only.
432
+ * @param options.unit Units of velocity. If not specified, the default velocity unit is used.
433
+ * @returns Maximum speed.
434
+ */
435
+ async getMaxSpeed(options = {}) {
436
+ const { unit, } = options;
437
+ const request = {
438
+ ...requests.MoveableGetSettingRequest.DEFAULT,
439
+ moveableId: this.moveableId,
440
+ unit: unit,
441
+ toBinary() {
442
+ return requests.MoveableGetSettingRequest.toBinary(this);
443
+ },
444
+ };
445
+ const response = await gateway.callAsync('moveable/get_max_speed', request, requests.DoubleResponse.fromBinary);
446
+ return response.value;
447
+ }
448
+ /**
449
+ * Sets the maximum speed of the moveable. For a lockstep group, sets the value on all axes.
450
+ * @param speed Maximum speed to set.
451
+ */
452
+ async setMaxSpeed(speed) {
453
+ const request = {
454
+ ...requests.MoveableSetSettingRequest.DEFAULT,
455
+ moveableId: this.moveableId,
456
+ value: speed,
457
+ toBinary() {
458
+ return requests.MoveableSetSettingRequest.toBinary(this);
459
+ },
460
+ };
461
+ await gateway.callAsync('moveable/set_max_speed', request);
462
+ }
463
+ /**
464
+ * Returns the maximum acceleration of the moveable. For a lockstep group, returns the lowest value across all axes.
465
+ * @param options.accelType Which acceleration ramp to return. Defaults to AccelDecel.
466
+ * @param options.unit Units of acceleration. If not specified, the default acceleration unit is used.
467
+ * @returns Maximum acceleration.
468
+ */
469
+ async getMaxAcceleration(options = {}) {
470
+ const { accelType, unit, } = options;
471
+ const request = {
472
+ ...requests.MoveableGetAccelerationRequest.DEFAULT,
473
+ moveableId: this.moveableId,
474
+ accelType: accelType,
475
+ unit: unit,
476
+ toBinary() {
477
+ return requests.MoveableGetAccelerationRequest.toBinary(this);
478
+ },
479
+ };
480
+ const response = await gateway.callAsync('moveable/get_max_acceleration', request, requests.DoubleResponse.fromBinary);
481
+ return response.value;
482
+ }
483
+ /**
484
+ * Sets the maximum acceleration of the moveable. For a lockstep group, sets the value on all axes.
485
+ * @param accel Maximum acceleration to set.
486
+ * @param options.accelType Which acceleration ramp to set. Defaults to AccelDecel.
487
+ */
488
+ async setMaxAcceleration(accel, options = {}) {
489
+ const { accelType, } = options;
490
+ const request = {
491
+ ...requests.MoveableSetAccelerationRequest.DEFAULT,
492
+ moveableId: this.moveableId,
493
+ accel: accel,
494
+ accelType: accelType,
495
+ toBinary() {
496
+ return requests.MoveableSetAccelerationRequest.toBinary(this);
497
+ },
498
+ };
499
+ await gateway.callAsync('moveable/set_max_acceleration', request);
500
+ }
501
+ /**
502
+ * Returns the minimum limit of the moveable.
503
+ * @param options.unit Units of position. If not specified, the default position unit is used.
504
+ * @returns Minimum limit.
505
+ */
506
+ async getLimitMin(options = {}) {
507
+ const { unit, } = options;
508
+ const request = {
509
+ ...requests.MoveableGetSettingRequest.DEFAULT,
510
+ moveableId: this.moveableId,
511
+ unit: unit,
512
+ toBinary() {
513
+ return requests.MoveableGetSettingRequest.toBinary(this);
514
+ },
515
+ };
516
+ const response = await gateway.callAsync('moveable/get_limit_min', request, requests.DoubleResponse.fromBinary);
517
+ return response.value;
518
+ }
519
+ /**
520
+ * Returns the maximum limit of the moveable.
521
+ * @param options.unit Units of position. If not specified, the default position unit is used.
522
+ * @returns Maximum limit.
523
+ */
524
+ async getLimitMax(options = {}) {
525
+ const { unit, } = options;
526
+ const request = {
527
+ ...requests.MoveableGetSettingRequest.DEFAULT,
528
+ moveableId: this.moveableId,
529
+ unit: unit,
530
+ toBinary() {
531
+ return requests.MoveableGetSettingRequest.toBinary(this);
532
+ },
533
+ };
534
+ const response = await gateway.callAsync('moveable/get_limit_max', request, requests.DoubleResponse.fromBinary);
535
+ return response.value;
536
+ }
537
+ /**
538
+ * Returns the lockstep group this moveable represents, or null if it is not a lockstep moveable.
539
+ * @returns Lockstep instance, or null if this is not a lockstep moveable.
540
+ */
541
+ async getLockstep() {
542
+ const request = {
543
+ ...requests.MoveableIdRequest.DEFAULT,
544
+ moveableId: this.moveableId,
545
+ toBinary() {
546
+ return requests.MoveableIdRequest.toBinary(this);
547
+ },
548
+ };
549
+ const response = await gateway.callAsync('moveable/get_lockstep', request, requests.IntResponse.fromBinary);
550
+ return response.value !== 0 ? new lockstep_1.Lockstep(this.device, response.value) : null;
551
+ }
552
+ /**
553
+ * Returns the axis this moveable represents.
554
+ * For a lockstep moveable, returns the primary axis of the lockstep group.
555
+ * @returns Axis this moveable is based on.
556
+ */
557
+ async getAxis() {
558
+ const request = {
559
+ ...requests.MoveableIdRequest.DEFAULT,
560
+ moveableId: this.moveableId,
561
+ toBinary() {
562
+ return requests.MoveableIdRequest.toBinary(this);
563
+ },
564
+ };
565
+ const response = await gateway.callAsync('moveable/get_axis', request, requests.IntResponse.fromBinary);
566
+ return new axis_1.Axis(this.device, response.value);
567
+ }
568
+ /**
569
+ * Disables the driver, which prevents current from being sent to the motor or load.
570
+ * If the driver is already disabled, the driver remains disabled.
571
+ */
572
+ async driverDisable() {
573
+ const request = {
574
+ ...requests.MoveableIdRequest.DEFAULT,
575
+ moveableId: this.moveableId,
576
+ toBinary() {
577
+ return requests.MoveableIdRequest.toBinary(this);
578
+ },
579
+ };
580
+ await gateway.callAsync('moveable/driver_disable', request);
581
+ }
582
+ /**
583
+ * Attempts to enable the driver repeatedly for the specified timeout.
584
+ * If the driver is already enabled, the driver remains enabled.
585
+ * @param [options.timeout=10] Timeout in seconds. Specify 0 to attempt to enable the driver once.
586
+ */
587
+ async driverEnable(options = {}) {
588
+ const { timeout = 10, } = options;
589
+ const request = {
590
+ ...requests.MoveableDriverEnableRequest.DEFAULT,
591
+ moveableId: this.moveableId,
592
+ timeout: timeout,
593
+ toBinary() {
594
+ return requests.MoveableDriverEnableRequest.toBinary(this);
595
+ },
596
+ };
597
+ await gateway.callAsync('moveable/driver_enable', request);
598
+ }
599
+ /**
600
+ * Waits until the moveable stops moving.
601
+ * @param [options.throwErrorOnFault=true] Determines whether to throw error when fault is observed.
602
+ */
603
+ async waitUntilIdle(options = {}) {
604
+ const { throwErrorOnFault = true, } = options;
605
+ const request = {
606
+ ...requests.MoveableWaitUntilIdleRequest.DEFAULT,
607
+ moveableId: this.moveableId,
608
+ throwErrorOnFault: throwErrorOnFault,
609
+ toBinary() {
610
+ return requests.MoveableWaitUntilIdleRequest.toBinary(this);
611
+ },
612
+ };
613
+ await gateway.callAsync('moveable/wait_until_idle', request);
614
+ }
615
+ /**
616
+ * Frees the moveable instance.
617
+ * @param moveableId The ID of the moveable to free.
618
+ */
619
+ static _free(moveableId) {
620
+ const request = {
621
+ ...requests.MoveableIdRequest.DEFAULT,
622
+ moveableId: moveableId,
623
+ toBinary() {
624
+ return requests.MoveableIdRequest.toBinary(this);
625
+ },
626
+ };
627
+ gateway.callSync('moveable/free', request);
628
+ }
629
+ /**
630
+ * Releases the native resources of the moveable.
631
+ * Should only be called if your environment does not support FinalizationRegistry.
632
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
633
+ */
634
+ free() {
635
+ Moveable._free(this.moveableId);
636
+ }
637
+ }
638
+ exports.Moveable = Moveable;
639
+ //# sourceMappingURL=moveable.js.map