@zaber/motion 7.5.1 → 7.6.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.
- package/LICENSE +253 -9
- package/dist/binding/wasm/zaber-motion-core.wasm +0 -0
- package/dist/lib/ascii/connection.d.ts +11 -0
- package/dist/lib/ascii/connection.d.ts.map +1 -1
- package/dist/lib/ascii/connection.js +24 -0
- package/dist/lib/ascii/connection.js.map +1 -1
- package/dist/lib/ascii/servo_tuner.d.ts +35 -6
- package/dist/lib/ascii/servo_tuner.d.ts.map +1 -1
- package/dist/lib/ascii/servo_tuner.js +20 -6
- package/dist/lib/ascii/servo_tuner.js.map +1 -1
- package/dist/lib/ascii/simple_tuning.d.ts +8 -0
- package/dist/lib/ascii/simple_tuning.d.ts.map +1 -1
- package/dist/lib/ascii/simple_tuning.js +4 -0
- package/dist/lib/ascii/simple_tuning.js.map +1 -1
- package/dist/lib/binary/connection.d.ts +11 -0
- package/dist/lib/binary/connection.d.ts.map +1 -1
- package/dist/lib/binary/connection.js +24 -0
- package/dist/lib/binary/connection.js.map +1 -1
- package/dist/lib/library.js +1 -1
- package/dist/lib/library.js.map +1 -1
- package/dist/lib/requests/set_simple_tuning.d.ts +6 -1
- package/dist/lib/requests/set_simple_tuning.d.ts.map +1 -1
- package/dist/lib/requests/set_simple_tuning.js +11 -2
- package/dist/lib/requests/set_simple_tuning.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ import { ServoTuningParam } from './servo_tuning_param';
|
|
|
5
5
|
import { PidTuning } from './pid_tuning';
|
|
6
6
|
import { SimpleTuningParamDefinition } from './simple_tuning_param_definition';
|
|
7
7
|
import { SimpleTuning } from './simple_tuning';
|
|
8
|
+
import { Units } from '../units';
|
|
8
9
|
/**
|
|
9
10
|
* Exposes the capabilities to inspect and edit an axis' servo tuning.
|
|
10
11
|
* Requires at least Firmware 6.25 or 7.00.
|
|
@@ -53,9 +54,9 @@ export declare class ServoTuner {
|
|
|
53
54
|
/**
|
|
54
55
|
* Sets the tuning of a paramset using the PID method.
|
|
55
56
|
* @param paramset The paramset to get tuning for.
|
|
56
|
-
* @param p The proportional gain. Must be in units of N/m.
|
|
57
|
-
* @param i The integral gain. Must be in units of N/m⋅s.
|
|
58
|
-
* @param d The derivative gain. Must be in units of N⋅s/m.
|
|
57
|
+
* @param p The proportional gain. Must be in units of N/m for linear devices, and N⋅m/° for rotary devices.
|
|
58
|
+
* @param i The integral gain. Must be in units of N/(m⋅s) for linear devices, and N⋅m/(°⋅s) for rotary devices.
|
|
59
|
+
* @param d The derivative gain. Must be in units of N⋅s/m for linear devices, and N⋅m⋅s/° for rotary devices.
|
|
59
60
|
* @param fc The cutoff frequency. Must be in units of Hz.
|
|
60
61
|
* @returns The PID representation of the current tuning after your changes have been applied.
|
|
61
62
|
*/
|
|
@@ -77,8 +78,17 @@ export declare class ServoTuner {
|
|
|
77
78
|
* @param tuningParams The params used to tune this device.
|
|
78
79
|
* To get what parameters are expected, call GetSimpleTuningParamList.
|
|
79
80
|
* All values must be between 0 and 1.
|
|
80
|
-
* @param loadMass The mass loaded on the stage
|
|
81
|
-
*
|
|
81
|
+
* @param loadMass The mass loaded on the stage, excluding the mass of the carriage itself.
|
|
82
|
+
* Unless specified by the LoadMassUnits parameter, this is in units of kg for linear devices,
|
|
83
|
+
* and kg⋅m² for rotary devices.
|
|
84
|
+
* @param [options.loadMassUnits=Units.NATIVE] The units the load mass was supplied in.
|
|
85
|
+
* @param [options.carriageMass=null] The mass of the carriage itself. If not supplied, the product's default mass will be used.
|
|
86
|
+
* Unless specified by the CarriageMassUnits parameter, this is in units of kg for linear devices,
|
|
87
|
+
* and kg⋅m² for rotary devices.
|
|
88
|
+
* @param [options.carriageMassUnits=Units.NATIVE] The units the carriage mass was supplied in.
|
|
89
|
+
* @param [options.motorInertia=null] The inertia of the motor. Unless specified by the MotorInertiaUnits parameter,
|
|
90
|
+
* this is in units of kg⋅m².
|
|
91
|
+
* @param [options.motorInertiaUnits=Units.NATIVE] The units the motor inertia was supplied in.
|
|
82
92
|
*/
|
|
83
93
|
setSimpleTuning(paramset: ServoTuningParamset, tuningParams: ServoTuningParam[], loadMass: number, options?: ServoTuner.SetSimpleTuningOptions): Promise<void>;
|
|
84
94
|
/**
|
|
@@ -104,9 +114,28 @@ export declare class ServoTuner {
|
|
|
104
114
|
declare namespace ServoTuner {
|
|
105
115
|
interface SetSimpleTuningOptions {
|
|
106
116
|
/**
|
|
107
|
-
* The
|
|
117
|
+
* The units the load mass was supplied in.
|
|
118
|
+
*/
|
|
119
|
+
loadMassUnits?: Units;
|
|
120
|
+
/**
|
|
121
|
+
* The mass of the carriage itself. If not supplied, the product's default mass will be used.
|
|
122
|
+
* Unless specified by the CarriageMassUnits parameter, this is in units of kg for linear devices,
|
|
123
|
+
* and kg⋅m² for rotary devices.
|
|
108
124
|
*/
|
|
109
125
|
carriageMass?: number;
|
|
126
|
+
/**
|
|
127
|
+
* The units the carriage mass was supplied in.
|
|
128
|
+
*/
|
|
129
|
+
carriageMassUnits?: Units;
|
|
130
|
+
/**
|
|
131
|
+
* The inertia of the motor. Unless specified by the MotorInertiaUnits parameter,
|
|
132
|
+
* this is in units of kg⋅m².
|
|
133
|
+
*/
|
|
134
|
+
motorInertia?: number;
|
|
135
|
+
/**
|
|
136
|
+
* The units the motor inertia was supplied in.
|
|
137
|
+
*/
|
|
138
|
+
motorInertiaUnits?: Units;
|
|
110
139
|
}
|
|
111
140
|
interface IsUsingSimpleTuningOptions {
|
|
112
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"servo_tuner.d.ts","sourceRoot":"","sources":["../../../src/ascii/servo_tuner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,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AAE,KAAK,CAAC;KAC7B;IACD,UAAiB,0BAA0B;QACvC;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB;CACF"}
|
|
@@ -31,6 +31,7 @@ const requests = __importStar(require("../requests"));
|
|
|
31
31
|
const paramset_info_1 = require("./paramset_info");
|
|
32
32
|
const pid_tuning_1 = require("./pid_tuning");
|
|
33
33
|
const simple_tuning_1 = require("./simple_tuning");
|
|
34
|
+
const units_1 = require("../units");
|
|
34
35
|
/**
|
|
35
36
|
* Exposes the capabilities to inspect and edit an axis' servo tuning.
|
|
36
37
|
* Requires at least Firmware 6.25 or 7.00.
|
|
@@ -146,9 +147,9 @@ class ServoTuner {
|
|
|
146
147
|
/**
|
|
147
148
|
* Sets the tuning of a paramset using the PID method.
|
|
148
149
|
* @param paramset The paramset to get tuning for.
|
|
149
|
-
* @param p The proportional gain. Must be in units of N/m.
|
|
150
|
-
* @param i The integral gain. Must be in units of N/m⋅s.
|
|
151
|
-
* @param d The derivative gain. Must be in units of N⋅s/m.
|
|
150
|
+
* @param p The proportional gain. Must be in units of N/m for linear devices, and N⋅m/° for rotary devices.
|
|
151
|
+
* @param i The integral gain. Must be in units of N/(m⋅s) for linear devices, and N⋅m/(°⋅s) for rotary devices.
|
|
152
|
+
* @param d The derivative gain. Must be in units of N⋅s/m for linear devices, and N⋅m⋅s/° for rotary devices.
|
|
152
153
|
* @param fc The cutoff frequency. Must be in units of Hz.
|
|
153
154
|
* @returns The PID representation of the current tuning after your changes have been applied.
|
|
154
155
|
*/
|
|
@@ -212,11 +213,20 @@ class ServoTuner {
|
|
|
212
213
|
* @param tuningParams The params used to tune this device.
|
|
213
214
|
* To get what parameters are expected, call GetSimpleTuningParamList.
|
|
214
215
|
* All values must be between 0 and 1.
|
|
215
|
-
* @param loadMass The mass loaded on the stage
|
|
216
|
-
*
|
|
216
|
+
* @param loadMass The mass loaded on the stage, excluding the mass of the carriage itself.
|
|
217
|
+
* Unless specified by the LoadMassUnits parameter, this is in units of kg for linear devices,
|
|
218
|
+
* and kg⋅m² for rotary devices.
|
|
219
|
+
* @param [options.loadMassUnits=Units.NATIVE] The units the load mass was supplied in.
|
|
220
|
+
* @param [options.carriageMass=null] The mass of the carriage itself. If not supplied, the product's default mass will be used.
|
|
221
|
+
* Unless specified by the CarriageMassUnits parameter, this is in units of kg for linear devices,
|
|
222
|
+
* and kg⋅m² for rotary devices.
|
|
223
|
+
* @param [options.carriageMassUnits=Units.NATIVE] The units the carriage mass was supplied in.
|
|
224
|
+
* @param [options.motorInertia=null] The inertia of the motor. Unless specified by the MotorInertiaUnits parameter,
|
|
225
|
+
* this is in units of kg⋅m².
|
|
226
|
+
* @param [options.motorInertiaUnits=Units.NATIVE] The units the motor inertia was supplied in.
|
|
217
227
|
*/
|
|
218
228
|
async setSimpleTuning(paramset, tuningParams, loadMass, options = {}) {
|
|
219
|
-
const { carriageMass = null, } = options;
|
|
229
|
+
const { loadMassUnits = units_1.Units.NATIVE, carriageMass = null, carriageMassUnits = units_1.Units.NATIVE, motorInertia = null, motorInertiaUnits = units_1.Units.NATIVE, } = options;
|
|
220
230
|
const request = {
|
|
221
231
|
...requests.SetSimpleTuning.DEFAULT,
|
|
222
232
|
interfaceId: this.axis.device.connection.interfaceId,
|
|
@@ -225,7 +235,11 @@ class ServoTuner {
|
|
|
225
235
|
paramset: paramset,
|
|
226
236
|
tuningParams: tuningParams,
|
|
227
237
|
loadMass: loadMass,
|
|
238
|
+
loadMassUnits: loadMassUnits,
|
|
228
239
|
carriageMass: carriageMass,
|
|
240
|
+
carriageMassUnits: carriageMassUnits,
|
|
241
|
+
motorInertia: motorInertia,
|
|
242
|
+
motorInertiaUnits: motorInertiaUnits,
|
|
229
243
|
toBinary() {
|
|
230
244
|
return requests.SetSimpleTuning.toBinary(this);
|
|
231
245
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"servo_tuner.js","sourceRoot":"","sources":["../../../src/ascii/servo_tuner.ts"],"names":[],"mappings":";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,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACpD,CAAC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,+BAA+B,EAC/B,OAAO,EACP,4BAAY,CAAC,UAAU,CAAC,CAAC;QAC3B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,mBAAmB,CAC9B,QAA6B,EAC7B,YAAgC,EAChC,QAAgB,EAChB,UAAiD,EAAE;QAEnD,MAAM,EACJ,YAAY,GAAG,IAAI,GACpB,GAAG,OAAO,CAAC;QACZ,MAAM,OAAO,GAA+C;YAC1D,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO;YACnC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW;YACpD,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;YAC1B,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,YAAY;YAC1B,QAAQ;gBACN,OAAO,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjD,CAAC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,oCAAoC,EACpC,OAAO,EACP,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACpC,OAAO,QAAQ,CAAC,KAAK,CAAC;IACxB,CAAC;CACF;AAtUD,gCAsUC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Axis } from './axis';\nimport * as gateway from '../gateway';\nimport * as requests from '../requests';\nimport { ServoTuningParamset } from './servo_tuning_paramset';\nimport { ParamsetInfo } from './paramset_info';\nimport { ServoTuningParam } from './servo_tuning_param';\nimport { PidTuning } from './pid_tuning';\nimport { SimpleTuningParamDefinition } from './simple_tuning_param_definition';\nimport { SimpleTuning } from './simple_tuning';\n\n/**\n * Exposes the capabilities to inspect and edit an axis' servo tuning.\n * Requires at least Firmware 6.25 or 7.00.\n */\nexport class ServoTuner {\n /**\n * The axis that will be tuned.\n */\n public get axis(): Axis {\n return this._axis;\n }\n private _axis: Axis;\n\n /**\n * Creates instance of ServoTuner for the given axis.\n */\n constructor(axis: Axis) {\n this._axis = axis;\n }\n\n /**\n * Get the paramset that this device uses by default when it starts up.\n * @returns The paramset used when the device restarts.\n */\n public async getStartupParamset(): Promise<ServoTuningParamset> {\n const request: requests.AxisEmptyRequest & gateway.Message = {\n ...requests.AxisEmptyRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n toBinary() {\n return requests.AxisEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.ServoTuningParamsetResponse>(\n 'servotuning/get_startup_set',\n request,\n requests.ServoTuningParamsetResponse.fromBinary);\n return response.paramset;\n }\n\n /**\n * Set the paramset that this device uses by default when it starts up.\n * @param paramset The paramset to use at startup.\n */\n public async setStartupParamset(\n paramset: ServoTuningParamset\n ): Promise<void> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/set_startup_set', request);\n }\n\n /**\n * Load the values from one paramset into another.\n * @param toParamset The paramset to load into.\n * @param fromParamset The paramset to load from.\n */\n public async loadParamset(\n toParamset: ServoTuningParamset,\n fromParamset: ServoTuningParamset\n ): Promise<void> {\n const request: requests.LoadParamset & gateway.Message = {\n ...requests.LoadParamset.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n toParamset: toParamset,\n fromParamset: fromParamset,\n toBinary() {\n return requests.LoadParamset.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/load_paramset', request);\n }\n\n /**\n * Get the full set of tuning parameters used by the firmware driving this axis.\n * @param paramset The paramset to get tuning for.\n * @returns The raw representation of the current tuning.\n */\n public async getTuning(\n paramset: ServoTuningParamset\n ): Promise<ParamsetInfo> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<ParamsetInfo>(\n 'servotuning/get_raw',\n request,\n ParamsetInfo.fromBinary);\n return response;\n }\n\n /**\n * Set individual tuning parameters.\n * Only use this method if you have a strong understanding of Zaber specific tuning parameters.\n * @param paramset The paramset to set tuning of.\n * @param tuningParams The params to set.\n * @param [setUnspecifiedToDefault=false] If true, any tuning parameters not included in TuningParams\n * are reset to their default values.\n */\n public async setTuning(\n paramset: ServoTuningParamset,\n tuningParams: ServoTuningParam[],\n setUnspecifiedToDefault: boolean = false\n ): Promise<void> {\n const request: requests.SetServoTuningRequest & gateway.Message = {\n ...requests.SetServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n tuningParams: tuningParams,\n setUnspecifiedToDefault: setUnspecifiedToDefault,\n toBinary() {\n return requests.SetServoTuningRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/set_raw', request);\n }\n\n /**\n * Sets the tuning of a paramset using the PID method.\n * @param paramset The paramset to get tuning for.\n * @param p The proportional gain. Must be in units of N/m.\n * @param i The integral gain. Must be in units of N/m⋅s.\n * @param d The derivative gain. Must be in units of N⋅s/m.\n * @param fc The cutoff frequency. Must be in units of Hz.\n * @returns The PID representation of the current tuning after your changes have been applied.\n */\n public async setPidTuning(\n paramset: ServoTuningParamset,\n p: number,\n i: number,\n d: number,\n fc: number\n ): Promise<PidTuning> {\n const request: requests.SetServoTuningPIDRequest & gateway.Message = {\n ...requests.SetServoTuningPIDRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n p: p,\n i: i,\n d: d,\n fc: fc,\n toBinary() {\n return requests.SetServoTuningPIDRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<PidTuning>(\n 'servotuning/set_pid',\n request,\n PidTuning.fromBinary);\n return response;\n }\n\n /**\n * Gets the PID representation of this paramset's servo tuning.\n * @param paramset The paramset to get tuning for.\n * @returns The PID representation of the current tuning.\n */\n public async getPidTuning(\n paramset: ServoTuningParamset\n ): Promise<PidTuning> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<PidTuning>(\n 'servotuning/get_pid',\n request,\n PidTuning.fromBinary);\n return response;\n }\n\n /**\n * Gets the parameters that are required to tune this device.\n * @returns The tuning parameters.\n */\n public async getSimpleTuningParamDefinitions(): Promise<SimpleTuningParamDefinition[]> {\n const request: requests.AxisEmptyRequest & gateway.Message = {\n ...requests.AxisEmptyRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n toBinary() {\n return requests.AxisEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GetSimpleTuningParamDefinitionResponse>(\n 'servotuning/get_simple_params_definition',\n request,\n requests.GetSimpleTuningParamDefinitionResponse.fromBinary);\n return response.params;\n }\n\n /**\n * Set the tuning of this device using the simple input method.\n * @param paramset The paramset to set tuning for.\n * @param tuningParams The params used to tune this device.\n * To get what parameters are expected, call GetSimpleTuningParamList.\n * All values must be between 0 and 1.\n * @param loadMass The mass loaded on the stage (excluding the mass of the carriage itself) in kg.\n * @param [options.carriageMass=null] The mass of the carriage in kg. If this value is not set the default carriage mass is used.\n */\n public async setSimpleTuning(\n paramset: ServoTuningParamset,\n tuningParams: ServoTuningParam[],\n loadMass: number,\n options: ServoTuner.SetSimpleTuningOptions = {}\n ): Promise<void> {\n const {\n carriageMass = null,\n } = options;\n const request: requests.SetSimpleTuning & gateway.Message = {\n ...requests.SetSimpleTuning.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n tuningParams: tuningParams,\n loadMass: loadMass,\n carriageMass: carriageMass,\n toBinary() {\n return requests.SetSimpleTuning.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/set_simple_tuning', request);\n }\n\n /**\n * Get the simple tuning parameters for this device.\n * @param paramset The paramset to get tuning for.\n * @returns The simple tuning parameters.\n */\n public async getSimpleTuning(\n paramset: ServoTuningParamset\n ): Promise<SimpleTuning> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<SimpleTuning>(\n 'servotuning/get_simple_tuning',\n request,\n SimpleTuning.fromBinary);\n return response;\n }\n\n /**\n * @deprecated Use GetSimpleTuning instead.\n *\n * Checks if the provided simple tuning is being stored by this paramset.\n * @param paramset The paramset to set tuning for.\n * @param tuningParams The params used to tune this device.\n * To get what parameters are expected, call GetSimpleTuningParamList.\n * All values must be between 0 and 1.\n * @param loadMass The mass loaded on the stage (excluding the mass of the carriage itself) in kg.\n * @param [options.carriageMass=null] The mass of the carriage in kg. If this value is not set the default carriage mass is used.\n * @returns True if the provided simple tuning is currently stored in this paramset.\n */\n public async isUsingSimpleTuning(\n paramset: ServoTuningParamset,\n tuningParams: ServoTuningParam[],\n loadMass: number,\n options: ServoTuner.IsUsingSimpleTuningOptions = {}\n ): Promise<boolean> {\n const {\n carriageMass = null,\n } = options;\n const request: requests.SetSimpleTuning & gateway.Message = {\n ...requests.SetSimpleTuning.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n tuningParams: tuningParams,\n loadMass: loadMass,\n carriageMass: carriageMass,\n toBinary() {\n return requests.SetSimpleTuning.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BoolResponse>(\n 'servotuning/is_using_simple_tuning',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n}\n\nnamespace ServoTuner {\n export interface SetSimpleTuningOptions {\n /**\n * The mass of the carriage in kg. If this value is not set the default carriage mass is used.\n */\n carriageMass?: number;\n }\n export interface IsUsingSimpleTuningOptions {\n /**\n * The mass of the carriage in kg. If this value is not set the default carriage mass is used.\n */\n carriageMass?: number;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"servo_tuner.js","sourceRoot":"","sources":["../../../src/ascii/servo_tuner.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtD,oDAAsC;AACtC,sDAAwC;AAExC,mDAA+C;AAE/C,6CAAyC;AAEzC,mDAA+C;AAC/C,oCAAiC;AAEjC;;;GAGG;AACH,MAAa,UAAU;IACrB;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAGD;;OAEG;IACH,YAA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B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACpD,CAAC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,+BAA+B,EAC/B,OAAO,EACP,4BAAY,CAAC,UAAU,CAAC,CAAC;QAC3B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,mBAAmB,CAC9B,QAA6B,EAC7B,YAAgC,EAChC,QAAgB,EAChB,UAAiD,EAAE;QAEnD,MAAM,EACJ,YAAY,GAAG,IAAI,GACpB,GAAG,OAAO,CAAC;QACZ,MAAM,OAAO,GAA+C;YAC1D,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO;YACnC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW;YACpD,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;YAC1B,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,YAAY;YAC1B,QAAQ;gBACN,OAAO,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjD,CAAC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,oCAAoC,EACpC,OAAO,EACP,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACpC,OAAO,QAAQ,CAAC,KAAK,CAAC;IACxB,CAAC;CACF;AAvVD,gCAuVC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Axis } from './axis';\nimport * as gateway from '../gateway';\nimport * as requests from '../requests';\nimport { ServoTuningParamset } from './servo_tuning_paramset';\nimport { ParamsetInfo } from './paramset_info';\nimport { ServoTuningParam } from './servo_tuning_param';\nimport { PidTuning } from './pid_tuning';\nimport { SimpleTuningParamDefinition } from './simple_tuning_param_definition';\nimport { SimpleTuning } from './simple_tuning';\nimport { Units } from '../units';\n\n/**\n * Exposes the capabilities to inspect and edit an axis' servo tuning.\n * Requires at least Firmware 6.25 or 7.00.\n */\nexport class ServoTuner {\n /**\n * The axis that will be tuned.\n */\n public get axis(): Axis {\n return this._axis;\n }\n private _axis: Axis;\n\n /**\n * Creates instance of ServoTuner for the given axis.\n */\n constructor(axis: Axis) {\n this._axis = axis;\n }\n\n /**\n * Get the paramset that this device uses by default when it starts up.\n * @returns The paramset used when the device restarts.\n */\n public async getStartupParamset(): Promise<ServoTuningParamset> {\n const request: requests.AxisEmptyRequest & gateway.Message = {\n ...requests.AxisEmptyRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n toBinary() {\n return requests.AxisEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.ServoTuningParamsetResponse>(\n 'servotuning/get_startup_set',\n request,\n requests.ServoTuningParamsetResponse.fromBinary);\n return response.paramset;\n }\n\n /**\n * Set the paramset that this device uses by default when it starts up.\n * @param paramset The paramset to use at startup.\n */\n public async setStartupParamset(\n paramset: ServoTuningParamset\n ): Promise<void> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/set_startup_set', request);\n }\n\n /**\n * Load the values from one paramset into another.\n * @param toParamset The paramset to load into.\n * @param fromParamset The paramset to load from.\n */\n public async loadParamset(\n toParamset: ServoTuningParamset,\n fromParamset: ServoTuningParamset\n ): Promise<void> {\n const request: requests.LoadParamset & gateway.Message = {\n ...requests.LoadParamset.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n toParamset: toParamset,\n fromParamset: fromParamset,\n toBinary() {\n return requests.LoadParamset.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/load_paramset', request);\n }\n\n /**\n * Get the full set of tuning parameters used by the firmware driving this axis.\n * @param paramset The paramset to get tuning for.\n * @returns The raw representation of the current tuning.\n */\n public async getTuning(\n paramset: ServoTuningParamset\n ): Promise<ParamsetInfo> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<ParamsetInfo>(\n 'servotuning/get_raw',\n request,\n ParamsetInfo.fromBinary);\n return response;\n }\n\n /**\n * Set individual tuning parameters.\n * Only use this method if you have a strong understanding of Zaber specific tuning parameters.\n * @param paramset The paramset to set tuning of.\n * @param tuningParams The params to set.\n * @param [setUnspecifiedToDefault=false] If true, any tuning parameters not included in TuningParams\n * are reset to their default values.\n */\n public async setTuning(\n paramset: ServoTuningParamset,\n tuningParams: ServoTuningParam[],\n setUnspecifiedToDefault: boolean = false\n ): Promise<void> {\n const request: requests.SetServoTuningRequest & gateway.Message = {\n ...requests.SetServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n tuningParams: tuningParams,\n setUnspecifiedToDefault: setUnspecifiedToDefault,\n toBinary() {\n return requests.SetServoTuningRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/set_raw', request);\n }\n\n /**\n * Sets the tuning of a paramset using the PID method.\n * @param paramset The paramset to get tuning for.\n * @param p The proportional gain. Must be in units of N/m for linear devices, and N⋅m/° for rotary devices.\n * @param i The integral gain. Must be in units of N/(m⋅s) for linear devices, and N⋅m/(°⋅s) for rotary devices.\n * @param d The derivative gain. Must be in units of N⋅s/m for linear devices, and N⋅m⋅s/° for rotary devices.\n * @param fc The cutoff frequency. Must be in units of Hz.\n * @returns The PID representation of the current tuning after your changes have been applied.\n */\n public async setPidTuning(\n paramset: ServoTuningParamset,\n p: number,\n i: number,\n d: number,\n fc: number\n ): Promise<PidTuning> {\n const request: requests.SetServoTuningPIDRequest & gateway.Message = {\n ...requests.SetServoTuningPIDRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n p: p,\n i: i,\n d: d,\n fc: fc,\n toBinary() {\n return requests.SetServoTuningPIDRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<PidTuning>(\n 'servotuning/set_pid',\n request,\n PidTuning.fromBinary);\n return response;\n }\n\n /**\n * Gets the PID representation of this paramset's servo tuning.\n * @param paramset The paramset to get tuning for.\n * @returns The PID representation of the current tuning.\n */\n public async getPidTuning(\n paramset: ServoTuningParamset\n ): Promise<PidTuning> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<PidTuning>(\n 'servotuning/get_pid',\n request,\n PidTuning.fromBinary);\n return response;\n }\n\n /**\n * Gets the parameters that are required to tune this device.\n * @returns The tuning parameters.\n */\n public async getSimpleTuningParamDefinitions(): Promise<SimpleTuningParamDefinition[]> {\n const request: requests.AxisEmptyRequest & gateway.Message = {\n ...requests.AxisEmptyRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n toBinary() {\n return requests.AxisEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GetSimpleTuningParamDefinitionResponse>(\n 'servotuning/get_simple_params_definition',\n request,\n requests.GetSimpleTuningParamDefinitionResponse.fromBinary);\n return response.params;\n }\n\n /**\n * Set the tuning of this device using the simple input method.\n * @param paramset The paramset to set tuning for.\n * @param tuningParams The params used to tune this device.\n * To get what parameters are expected, call GetSimpleTuningParamList.\n * All values must be between 0 and 1.\n * @param loadMass The mass loaded on the stage, excluding the mass of the carriage itself.\n * Unless specified by the LoadMassUnits parameter, this is in units of kg for linear devices,\n * and kg⋅m² for rotary devices.\n * @param [options.loadMassUnits=Units.NATIVE] The units the load mass was supplied in.\n * @param [options.carriageMass=null] The mass of the carriage itself. If not supplied, the product's default mass will be used.\n * Unless specified by the CarriageMassUnits parameter, this is in units of kg for linear devices,\n * and kg⋅m² for rotary devices.\n * @param [options.carriageMassUnits=Units.NATIVE] The units the carriage mass was supplied in.\n * @param [options.motorInertia=null] The inertia of the motor. Unless specified by the MotorInertiaUnits parameter,\n * this is in units of kg⋅m².\n * @param [options.motorInertiaUnits=Units.NATIVE] The units the motor inertia was supplied in.\n */\n public async setSimpleTuning(\n paramset: ServoTuningParamset,\n tuningParams: ServoTuningParam[],\n loadMass: number,\n options: ServoTuner.SetSimpleTuningOptions = {}\n ): Promise<void> {\n const {\n loadMassUnits = Units.NATIVE,\n carriageMass = null,\n carriageMassUnits = Units.NATIVE,\n motorInertia = null,\n motorInertiaUnits = Units.NATIVE,\n } = options;\n const request: requests.SetSimpleTuning & gateway.Message = {\n ...requests.SetSimpleTuning.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n tuningParams: tuningParams,\n loadMass: loadMass,\n loadMassUnits: loadMassUnits,\n carriageMass: carriageMass,\n carriageMassUnits: carriageMassUnits,\n motorInertia: motorInertia,\n motorInertiaUnits: motorInertiaUnits,\n toBinary() {\n return requests.SetSimpleTuning.toBinary(this);\n },\n };\n\n await gateway.callAsync('servotuning/set_simple_tuning', request);\n }\n\n /**\n * Get the simple tuning parameters for this device.\n * @param paramset The paramset to get tuning for.\n * @returns The simple tuning parameters.\n */\n public async getSimpleTuning(\n paramset: ServoTuningParamset\n ): Promise<SimpleTuning> {\n const request: requests.ServoTuningRequest & gateway.Message = {\n ...requests.ServoTuningRequest.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n toBinary() {\n return requests.ServoTuningRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<SimpleTuning>(\n 'servotuning/get_simple_tuning',\n request,\n SimpleTuning.fromBinary);\n return response;\n }\n\n /**\n * @deprecated Use GetSimpleTuning instead.\n *\n * Checks if the provided simple tuning is being stored by this paramset.\n * @param paramset The paramset to set tuning for.\n * @param tuningParams The params used to tune this device.\n * To get what parameters are expected, call GetSimpleTuningParamList.\n * All values must be between 0 and 1.\n * @param loadMass The mass loaded on the stage (excluding the mass of the carriage itself) in kg.\n * @param [options.carriageMass=null] The mass of the carriage in kg. If this value is not set the default carriage mass is used.\n * @returns True if the provided simple tuning is currently stored in this paramset.\n */\n public async isUsingSimpleTuning(\n paramset: ServoTuningParamset,\n tuningParams: ServoTuningParam[],\n loadMass: number,\n options: ServoTuner.IsUsingSimpleTuningOptions = {}\n ): Promise<boolean> {\n const {\n carriageMass = null,\n } = options;\n const request: requests.SetSimpleTuning & gateway.Message = {\n ...requests.SetSimpleTuning.DEFAULT,\n interfaceId: this.axis.device.connection.interfaceId,\n device: this.axis.device.deviceAddress,\n axis: this.axis.axisNumber,\n paramset: paramset,\n tuningParams: tuningParams,\n loadMass: loadMass,\n carriageMass: carriageMass,\n toBinary() {\n return requests.SetSimpleTuning.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BoolResponse>(\n 'servotuning/is_using_simple_tuning',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n}\n\nnamespace ServoTuner {\n export interface SetSimpleTuningOptions {\n /**\n * The units the load mass was supplied in.\n */\n loadMassUnits?: Units;\n /**\n * The mass of the carriage itself. If not supplied, the product's default mass will be used.\n * Unless specified by the CarriageMassUnits parameter, this is in units of kg for linear devices,\n * and kg⋅m² for rotary devices.\n */\n carriageMass?: number;\n /**\n * The units the carriage mass was supplied in.\n */\n carriageMassUnits?: Units;\n /**\n * The inertia of the motor. Unless specified by the MotorInertiaUnits parameter,\n * this is in units of kg⋅m².\n */\n motorInertia?: number;\n /**\n * The units the motor inertia was supplied in.\n */\n motorInertiaUnits?: Units;\n }\n export interface IsUsingSimpleTuningOptions {\n /**\n * The mass of the carriage in kg. If this value is not set the default carriage mass is used.\n */\n carriageMass?: number;\n }\n}\n"]}
|
|
@@ -8,10 +8,18 @@ export interface SimpleTuning {
|
|
|
8
8
|
* or if it has been overwritten by a later change.
|
|
9
9
|
*/
|
|
10
10
|
isUsed: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* If this paramset has been tuned using the simple tuning method, whether or not it's currently in use.
|
|
13
|
+
*/
|
|
14
|
+
isSet: boolean;
|
|
11
15
|
/**
|
|
12
16
|
* The mass of the carriage in kg.
|
|
13
17
|
*/
|
|
14
18
|
carriageMass?: (number | null);
|
|
19
|
+
/**
|
|
20
|
+
* The mass of the carriage in kg.
|
|
21
|
+
*/
|
|
22
|
+
motorInertia?: (number | null);
|
|
15
23
|
/**
|
|
16
24
|
* The mass of the load in kg, excluding the mass of the carriage.
|
|
17
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple_tuning.d.ts","sourceRoot":"","sources":["../../../src/ascii/simple_tuning.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,YAAY,EAAE,gBAAgB,EAAE,CAAC;CAElC;AAED,eAAO,MAAM,YAAY;yBACF,UAAU,KAAG,YAAY;sBAC5B,YAAY,KAAG,UAAU;;
|
|
1
|
+
{"version":3,"file":"simple_tuning.d.ts","sourceRoot":"","sources":["../../../src/ascii/simple_tuning.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE/B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,YAAY,EAAE,gBAAgB,EAAE,CAAC;CAElC;AAED,eAAO,MAAM,YAAY;yBACF,UAAU,KAAG,YAAY;sBAC5B,YAAY,KAAG,UAAU;;sBASzB,YAAY,KAAG,YAAY;CAY9C,CAAC"}
|
|
@@ -10,7 +10,9 @@ exports.SimpleTuning = {
|
|
|
10
10
|
toBinary: (value) => bson_1.BSON.serialize(exports.SimpleTuning.sanitize(value)),
|
|
11
11
|
DEFAULT: Object.freeze({
|
|
12
12
|
isUsed: false,
|
|
13
|
+
isSet: false,
|
|
13
14
|
carriageMass: null,
|
|
15
|
+
motorInertia: null,
|
|
14
16
|
loadMass: 0,
|
|
15
17
|
tuningParams: [],
|
|
16
18
|
}),
|
|
@@ -24,7 +26,9 @@ exports.SimpleTuning = {
|
|
|
24
26
|
}
|
|
25
27
|
return {
|
|
26
28
|
isUsed: sanitizer_1.sanitizer.sanitizeBool(value.isUsed, 'isUsed'),
|
|
29
|
+
isSet: sanitizer_1.sanitizer.sanitizeBool(value.isSet, 'isSet'),
|
|
27
30
|
carriageMass: value.carriageMass != null ? sanitizer_1.sanitizer.sanitizeNumber(value.carriageMass, 'carriageMass') : null,
|
|
31
|
+
motorInertia: value.motorInertia != null ? sanitizer_1.sanitizer.sanitizeNumber(value.motorInertia, 'motorInertia') : null,
|
|
28
32
|
loadMass: sanitizer_1.sanitizer.sanitizeNumber(value.loadMass, 'loadMass'),
|
|
29
33
|
tuningParams: Array.from((_a = value.tuningParams) !== null && _a !== void 0 ? _a : [], item => servo_tuning_param_1.ServoTuningParam.sanitize(item)),
|
|
30
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple_tuning.js","sourceRoot":"","sources":["../../../src/ascii/simple_tuning.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,oEAA+D;
|
|
1
|
+
{"version":3,"file":"simple_tuning.js","sourceRoot":"","sources":["../../../src/ascii/simple_tuning.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,+BAA4B;AAC5B,oDAAiD;AACjD,oEAA+D;AAuClD,QAAA,YAAY,GAAG;IAC1B,UAAU,EAAE,CAAC,MAAkB,EAAgB,EAAE,CAAC,WAAI,CAAC,WAAW,CAAC,MAAM,CAAiB;IAC1F,QAAQ,EAAE,CAAC,KAAmB,EAAc,EAAE,CAAC,WAAI,CAAC,SAAS,CAAC,oBAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC3F,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,EAAE;KACjB,CAA2B;IAC5B,QAAQ,EAAE,CAAC,KAAmB,EAAgB,EAAE;;QAC9C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,yDAAyD,CAAC,CAAA;QAAC,CAAC;QACrG,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,MAAM,IAAI,SAAS,CAAC,wCAAwC,OAAO,KAAK,GAAG,CAAC,CAAA;QAAC,CAAC;QAC/G,OAAO;YACL,MAAM,EAAE,qBAAS,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC;YACtD,KAAK,EAAE,qBAAS,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC;YACnD,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,qBAAS,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI;YAC9G,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,qBAAS,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI;YAC9G,QAAQ,EAAE,qBAAS,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC;YAC9D,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,MAAA,KAAK,CAAC,YAAY,mCAAI,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,qCAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SAC5F,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["/* This file is generated. Do not modify by hand. */\nimport { BSON } from 'bson';\nimport { sanitizer } from '../gateway/sanitizer';\nimport { ServoTuningParam } from '../ascii/servo_tuning_param';\n\n/**\n * The masses and parameters last used by simple tuning.\n */\nexport interface SimpleTuning {\n /**\n * Whether the tuning returned is currently in use by this paramset,\n * or if it has been overwritten by a later change.\n */\n isUsed: boolean;\n\n /**\n * If this paramset has been tuned using the simple tuning method, whether or not it's currently in use.\n */\n isSet: boolean;\n\n /**\n * The mass of the carriage in kg.\n */\n carriageMass?: (number | null);\n\n /**\n * The mass of the carriage in kg.\n */\n motorInertia?: (number | null);\n\n /**\n * The mass of the load in kg, excluding the mass of the carriage.\n */\n loadMass: number;\n\n /**\n * The parameters used by simple tuning.\n */\n tuningParams: ServoTuningParam[];\n\n}\n\nexport const SimpleTuning = {\n fromBinary: (buffer: Uint8Array): SimpleTuning => BSON.deserialize(buffer) as SimpleTuning,\n toBinary: (value: SimpleTuning): Uint8Array => BSON.serialize(SimpleTuning.sanitize(value)),\n DEFAULT: Object.freeze({\n isUsed: false,\n isSet: false,\n carriageMass: null,\n motorInertia: null,\n loadMass: 0,\n tuningParams: [],\n }) as Readonly<SimpleTuning>,\n sanitize: (value: SimpleTuning): SimpleTuning => {\n if (value == null) { throw new TypeError('Expected SimpleTuning object but got null or undefined.') }\n if (typeof value !== 'object') { throw new TypeError(`Expected SimpleTuning object but got ${typeof value}.`) }\n return {\n isUsed: sanitizer.sanitizeBool(value.isUsed, 'isUsed'),\n isSet: sanitizer.sanitizeBool(value.isSet, 'isSet'),\n carriageMass: value.carriageMass != null ? sanitizer.sanitizeNumber(value.carriageMass, 'carriageMass') : null,\n motorInertia: value.motorInertia != null ? sanitizer.sanitizeNumber(value.motorInertia, 'motorInertia') : null,\n loadMass: sanitizer.sanitizeNumber(value.loadMass, 'loadMass'),\n tuningParams: Array.from(value.tuningParams ?? [], item => ServoTuningParam.sanitize(item)),\n };\n },\n};\n"]}
|
|
@@ -105,12 +105,23 @@ export declare class Connection {
|
|
|
105
105
|
* @returns A string that represents the connection.
|
|
106
106
|
*/
|
|
107
107
|
toString(): string;
|
|
108
|
+
/**
|
|
109
|
+
* Releases native resources of the connection.
|
|
110
|
+
* @param interfaceId The ID of the connection.
|
|
111
|
+
*/
|
|
112
|
+
private static _free;
|
|
108
113
|
private _disconnected;
|
|
109
114
|
/**
|
|
110
115
|
* Event invoked when connection is interrupted or closed.
|
|
111
116
|
*/
|
|
112
117
|
get disconnected(): Observable<MotionLibException>;
|
|
113
118
|
private _subscribe;
|
|
119
|
+
/**
|
|
120
|
+
* Releases the native resources of the connection.
|
|
121
|
+
* Should only be called if your environment does not support FinalizationRegistry.
|
|
122
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
|
|
123
|
+
*/
|
|
124
|
+
free(): void;
|
|
114
125
|
}
|
|
115
126
|
declare namespace Connection {
|
|
116
127
|
interface OpenSerialPortOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/binary/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAC;AAKjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/binary/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAC;AAKjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,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AM,CAAC;IAgB/C;;;;OAIG;IACU,aAAa,CACxB,OAAO,GAAE,UAAU,CAAC,oBAAyB,GAC5C,OAAO,CAAC,MAAM,EAAE,CAAC;IAoBpB;;;;;OAKG;IACI,SAAS,CACd,aAAa,EAAE,MAAM,GACpB,MAAM;IAOT;;;OAGG;IACI,QAAQ,IAAI,MAAM;IAgBzB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,KAAK;IAcpB,OAAO,CAAC,aAAa,CAA2C;IAEhE;;OAEG;IACH,IAAW,YAAY,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAExD;IAED,OAAO,CAAC,UAAU;IAuBlB;;;;OAIG;IACI,IAAI,IAAI,IAAI;CAGpB;AAED,kBAAU,UAAU,CAAC;IACnB,UAAiB,qBAAqB;QAClC;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,qBAAqB;QAClC;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;KACzB;IACD,UAAiB,kCAAkC;QAC/C;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;KACzB;IACD,UAAiB,oBAAoB;QACjC;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B;CACF"}
|
|
@@ -33,6 +33,7 @@ const gateway_1 = require("../gateway");
|
|
|
33
33
|
const requests = __importStar(require("../requests"));
|
|
34
34
|
const device_1 = require("./device");
|
|
35
35
|
const message_1 = require("./message");
|
|
36
|
+
const finalizer_1 = require("../finalizer");
|
|
36
37
|
/**
|
|
37
38
|
* Class representing access to particular connection (serial port, TCP connection) using the legacy Binary protocol.
|
|
38
39
|
*/
|
|
@@ -46,6 +47,7 @@ class Connection {
|
|
|
46
47
|
constructor(interfaceId) {
|
|
47
48
|
this._disconnected = new rxjs_1.ReplaySubject();
|
|
48
49
|
this._interfaceId = interfaceId;
|
|
50
|
+
(0, finalizer_1.registerForFinalization)(this, Connection._free.bind(null, interfaceId));
|
|
49
51
|
this._subscribe();
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
@@ -243,6 +245,20 @@ class Connection {
|
|
|
243
245
|
const response = gateway.callSync('interface/to_string', request, requests.StringResponse.fromBinary);
|
|
244
246
|
return response.value;
|
|
245
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Releases native resources of the connection.
|
|
250
|
+
* @param interfaceId The ID of the connection.
|
|
251
|
+
*/
|
|
252
|
+
static _free(interfaceId) {
|
|
253
|
+
const request = {
|
|
254
|
+
...requests.InterfaceEmptyRequest.DEFAULT,
|
|
255
|
+
interfaceId: interfaceId,
|
|
256
|
+
toBinary() {
|
|
257
|
+
return requests.InterfaceEmptyRequest.toBinary(this);
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
gateway.callSync('interface/free', request);
|
|
261
|
+
}
|
|
246
262
|
/**
|
|
247
263
|
* Event invoked when connection is interrupted or closed.
|
|
248
264
|
*/
|
|
@@ -254,6 +270,14 @@ class Connection {
|
|
|
254
270
|
this.replyOnly = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('binary/interface/reply_only'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.map)(event => event.reply));
|
|
255
271
|
gateway_1.events.pipe((0, gateway_1.filterEvent)('interface/disconnected'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.take)(1), (0, operators_1.map)(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))).subscribe(this._disconnected);
|
|
256
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Releases the native resources of the connection.
|
|
275
|
+
* Should only be called if your environment does not support FinalizationRegistry.
|
|
276
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
|
|
277
|
+
*/
|
|
278
|
+
free() {
|
|
279
|
+
Connection._free(this.interfaceId);
|
|
280
|
+
}
|
|
257
281
|
}
|
|
258
282
|
exports.Connection = Connection;
|
|
259
283
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/binary/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AACjD,sDAAwC;AACxC,qCAAkC;AAIlC,uCAAoC;AAGpC;;GAEG;AACH,MAAa,UAAU;IAgBrB;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAGD,YAAY,WAAmB;QAqRvB,kBAAa,GAAG,IAAI,oBAAa,EAAsB,CAAC;QApR9D,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAChC,QAAgB,EAChB,UAA4C,EAAE;QAE9C,MAAM,EACJ,QAAQ,GAAG,UAAU,CAAC,iBAAiB,EACvC,aAAa,GAAG,KAAK,GACtB,GAAG,OAAO,CAAC;QACZ,MAAM,OAAO,GAA0D;YACrE,GAAG,QAAQ,CAAC,0BAA0B,CAAC,OAAO;YAC9C,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,WAAW;YACjD,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;YAClB,aAAa,EAAE,aAAa;YAC5B,QAAQ;gBACN,OAAO,QAAQ,CAAC,0BAA0B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAA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AC5F,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CACpC,CAAC;QAEF,IAAI,CAAC,SAAS,GAAG,gBAAM,CAAC,IAAI,CAC1B,IAAA,qBAAS,EAAC,IAAI,CAAC,aAAa,CAAC,EAC7B,IAAA,qBAAW,EAAuC,6BAA6B,CAAC,EAChF,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAC1B,CAAC;QAEF,gBAAM,CAAC,IAAI,CACT,IAAA,qBAAW,EAA6B,wBAAwB,CAAC,EACjE,IAAA,kBAAM,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,CAAC,EACvD,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAC1F,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;;AA3UH,gCA4UC;AAjUC;;GAEG;AACoB,4BAAiB,GAAW,IAAI,AAAf,CAAgB","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport * as requests from '../requests';\nimport { Device } from './device';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { ReplyOnlyEvent } from './reply_only_event';\nimport { CommandCode } from './command_code';\nimport { Message } from './message';\nimport { MotionLibException } from '../exceptions';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection) using the legacy Binary protocol.\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when a reply-only command such as a move tracking message is received from a device.\n */\n public replyOnly!: Observable<ReplyOnlyEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 9600;\n\n /**\n * The interface ID identifies thisConnection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n this._subscribe();\n }\n\n /**\n * Opens a serial port.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 9600).\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param port Port number.\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number,\n options: Connection.OpenTcpOptions = {}\n ): Promise<Connection> {\n const {\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Sends a generic Binary command to this connection.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @returns A response to the command.\n */\n public async genericCommand(\n device: number,\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Message> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Message>(\n 'binary/interface/generic_command',\n request,\n Message.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic Binary command to this connection without expecting a response.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n */\n public async genericCommandNoResponse(\n device: number,\n command: CommandCode,\n data: number = 0\n ): Promise<void> {\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('binary/interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic Binary command to this connection and expects responses from one or more devices.\n * Responses are returned in order of arrival.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when any device rejects the command.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Message[]> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryMessageCollection>(\n 'binary/interface/generic_command_multi_response',\n request,\n requests.BinaryMessageCollection.fromBinary);\n return response.messages;\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, you must identify devices again.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(): Promise<number> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'binary/device/renumber',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request: requests.BinaryDeviceDetectRequest & gateway.Message = {\n ...requests.BinaryDeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.BinaryDeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryDeviceDetectResponse>(\n 'binary/device/detect',\n request,\n requests.BinaryDeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n private _disconnected = new ReplaySubject<MotionLibException>();\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(): void {\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.UnknownBinaryResponseEventWrapper>('binary/interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.replyOnly = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.BinaryReplyOnlyEventWrapper>('binary/interface/reply_only'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.reply)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('interface/disconnected'),\n filter(event => event.interfaceId === this.interfaceId),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n /**\n * Optional baud rate (defaults to 9600).\n */\n baudRate?: number;\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface OpenTcpOptions {\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface GenericCommandOptions {\n /**\n * Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when any device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["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B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, filter, takeUntil, take } from 'rxjs/operators';\nimport * as gateway from '../gateway';\nimport { events, filterEvent } from '../gateway';\nimport * as requests from '../requests';\nimport { Device } from './device';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { ReplyOnlyEvent } from './reply_only_event';\nimport { CommandCode } from './command_code';\nimport { Message } from './message';\nimport { MotionLibException } from '../exceptions';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection) using the legacy Binary protocol.\n */\nexport class Connection {\n /**\n * Event invoked when a response from a device cannot be matched to any known request.\n */\n public unknownResponse!: Observable<UnknownResponseEvent>;\n\n /**\n * Event invoked when a reply-only command such as a move tracking message is received from a device.\n */\n public replyOnly!: Observable<ReplyOnlyEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 9600;\n\n /**\n * The interface ID identifies thisConnection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n registerForFinalization(this, Connection._free.bind(null, interfaceId));\n this._subscribe();\n }\n\n /**\n * Opens a serial port.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 9600).\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the port.\n */\n public static async openSerialPort(\n portName: string,\n options: Connection.OpenSerialPortOptions = {}\n ): Promise<Connection> {\n const {\n baudRate = Connection.DEFAULT_BAUD_RATE,\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a TCP connection.\n * @param hostName Hostname or IP address.\n * @param port Port number.\n * @param [options.useMessageIds=false] Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number,\n options: Connection.OpenTcpOptions = {}\n ): Promise<Connection> {\n const {\n useMessageIds = false,\n } = options;\n const request: requests.OpenBinaryInterfaceRequest & gateway.Message = {\n ...requests.OpenBinaryInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n useMessageIds: useMessageIds,\n toBinary() {\n return requests.OpenBinaryInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'binary/interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Close the connection.\n */\n public async close(): Promise<void> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/close', request);\n }\n\n /**\n * Sends a generic Binary command to this connection.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @returns A response to the command.\n */\n public async genericCommand(\n device: number,\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Message> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Message>(\n 'binary/interface/generic_command',\n request,\n Message.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic Binary command to this connection without expecting a response.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param device Device address to send the command to. Use zero for broadcast.\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n */\n public async genericCommandNoResponse(\n device: number,\n command: CommandCode,\n data: number = 0\n ): Promise<void> {\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n device: device,\n command: command,\n data: data,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('binary/interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic Binary command to this connection and expects responses from one or more devices.\n * Responses are returned in order of arrival.\n * For more information please refer to the\n * [Binary Protocol Manual](https://www.zaber.com/protocol-manual?protocol=Binary#topic_quick_command_reference).\n * @param command Command to send.\n * @param [data=0] Optional data argument to the command. Defaults to zero.\n * @param [options.timeout=0.0] Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n * @param [options.checkErrors=true] Controls whether to throw an exception when any device rejects the command.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: CommandCode,\n data: number = 0,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Message[]> {\n const {\n timeout = 0.0,\n checkErrors = true,\n } = options;\n const request: requests.GenericBinaryRequest & gateway.Message = {\n ...requests.GenericBinaryRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n data: data,\n timeout: timeout,\n checkErrors: checkErrors,\n toBinary() {\n return requests.GenericBinaryRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryMessageCollection>(\n 'binary/interface/generic_command_multi_response',\n request,\n requests.BinaryMessageCollection.fromBinary);\n return response.messages;\n }\n\n /**\n * Renumbers devices present on this connection. After renumbering, you must identify devices again.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(): Promise<number> {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'binary/device/renumber',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Attempts to detect any devices present on this connection.\n * @param [options.identifyDevices=true] Determines whether device identification should be performed as well.\n * @returns Array of detected devices.\n */\n public async detectDevices(\n options: Connection.DetectDevicesOptions = {}\n ): Promise<Device[]> {\n const {\n identifyDevices = true,\n } = options;\n const request: requests.BinaryDeviceDetectRequest & gateway.Message = {\n ...requests.BinaryDeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.BinaryDeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.BinaryDeviceDetectResponse>(\n 'binary/device/detect',\n request,\n requests.BinaryDeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Gets a Device class instance which allows you to control a particular device on this connection.\n * Devices are numbered from 1.\n * @param deviceAddress Address of device intended to control. Address is configured for each device.\n * @returns Device instance.\n */\n public getDevice(\n deviceAddress: number\n ): Device {\n if (deviceAddress <= 0) {\n throw new TypeError('Invalid value; physical devices are numbered from 1.');\n }\n return new Device(this, deviceAddress);\n }\n\n /**\n * Returns a string that represents the connection.\n * @returns A string that represents the connection.\n */\n public toString(): string {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: this.interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n const response = gateway.callSync<requests.StringResponse>(\n 'interface/to_string',\n request,\n requests.StringResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Releases native resources of the connection.\n * @param interfaceId The ID of the connection.\n */\n private static _free(\n interfaceId: number\n ): void {\n const request: requests.InterfaceEmptyRequest & gateway.Message = {\n ...requests.InterfaceEmptyRequest.DEFAULT,\n interfaceId: interfaceId,\n toBinary() {\n return requests.InterfaceEmptyRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/free', request);\n }\n\n private _disconnected = new ReplaySubject<MotionLibException>();\n\n /**\n * Event invoked when connection is interrupted or closed.\n */\n public get disconnected(): Observable<MotionLibException> {\n return this._disconnected;\n }\n\n private _subscribe(): void {\n this.unknownResponse = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.UnknownBinaryResponseEventWrapper>('binary/interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.replyOnly = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.BinaryReplyOnlyEventWrapper>('binary/interface/reply_only'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.reply)\n );\n\n events.pipe(\n filterEvent<requests.DisconnectedEvent>('interface/disconnected'),\n filter(event => event.interfaceId === this.interfaceId),\n take(1),\n map(({ errorMessage, errorType }) => gateway.convertToException(errorType, errorMessage))\n ).subscribe(this._disconnected);\n }\n\n /**\n * Releases the native resources of the connection.\n * Should only be called if your environment does not support FinalizationRegistry.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry\n */\n public free(): void {\n Connection._free(this.interfaceId);\n }\n}\n\nnamespace Connection {\n export interface OpenSerialPortOptions {\n /**\n * Optional baud rate (defaults to 9600).\n */\n baudRate?: number;\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface OpenTcpOptions {\n /**\n * Enable use of message IDs (defaults to disabled).\n * All your devices must be pre-configured to match.\n */\n useMessageIds?: boolean;\n }\n export interface GenericCommandOptions {\n /**\n * Number of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Number of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.\n */\n timeout?: number;\n /**\n * Controls whether to throw an exception when any device rejects the command.\n */\n checkErrors?: boolean;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n}\n"]}
|
package/dist/lib/library.js
CHANGED
package/dist/lib/library.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AACrC,qDAAuC;AAIvC,MAAa,OAAO;IAClB;;;;OAIG;IACI,MAAM,CAAC,YAAY,CACxB,IAAmB,EACnB,QAAiB;QAEjB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,QAAQ;YAClB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,oB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;gBACN,OAAO,QAAQ,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACxD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,oBAAoB,CAChC,MAAc;QAEd,MAAM,OAAO,GAA0C;YACrD,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO;YAC9B,KAAK,EAAE,MAAM;YACb,QAAQ;gBACN,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,YAAY;QACxB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO;YAChB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAtID,0BAsIC;AAED,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport * as requests from './requests';\nimport { LogOutputMode } from './log_output_mode';\nimport { DeviceDbSourceType } from './device_db_source_type';\n\nexport class Library {\n /**\n * Sets library logging output.\n * @param mode Logging output mode.\n * @param filePath Path of the file to open.\n */\n public static setLogOutput(\n mode: LogOutputMode,\n filePath?: string\n ): void {\n const request: requests.SetLogOutputRequest & gateway.Message = {\n ...requests.SetLogOutputRequest.DEFAULT,\n mode: mode,\n filePath: filePath,\n toBinary() {\n return requests.SetLogOutputRequest.toBinary(this);\n },\n };\n\n gateway.callSync('logging/set_output', request);\n }\n\n /**\n * Sets source of Device DB data. Allows selection of a web service or a local file.\n * @param sourceType Source type.\n * @param urlOrFilePath URL of the web service or path to the local file.\n * Leave empty for the default URL of Zaber web service.\n */\n public static setDeviceDbSource(\n sourceType: DeviceDbSourceType,\n urlOrFilePath?: string\n ): void {\n const request: requests.SetDeviceDbSourceRequest & gateway.Message = {\n ...requests.SetDeviceDbSourceRequest.DEFAULT,\n sourceType: sourceType,\n urlOrFilePath: urlOrFilePath,\n toBinary() {\n return requests.SetDeviceDbSourceRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/set_source', request);\n }\n\n /**\n * Enables Device DB store.\n * The store uses filesystem to save information obtained from the Device DB.\n * The stored data are later used instead of the Device DB.\n * @param storeLocation Specifies relative or absolute path of the folder used by the store.\n * If left empty defaults to a folder in user home directory.\n * Must be accessible by the process.\n */\n public static enableDeviceDbStore(\n storeLocation?: string\n ): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toggleOn: true,\n storeLocation: storeLocation,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables Device DB store.\n */\n public static disableDeviceDbStore(): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables certain customer checks (like FF flag).\n * @param mode Whether to turn internal mode on or off.\n */\n public static setInternalMode(\n mode: boolean\n ): void {\n const request: requests.SetInternalModeRequest & gateway.Message = {\n ...requests.SetInternalModeRequest.DEFAULT,\n mode: mode,\n toBinary() {\n return requests.SetInternalModeRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_internal_mode', request);\n }\n\n /**\n * Sets the period between polling for IDLE during movements.\n * Caution: Setting the period too low may cause performance issues.\n * @param period Period in milliseconds.\n * Negative value restores the default period.\n */\n public static setIdlePollingPeriod(\n period: number\n ): void {\n const request: requests.IntRequest & gateway.Message = {\n ...requests.IntRequest.DEFAULT,\n value: period,\n toBinary() {\n return requests.IntRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_idle_polling_period', request);\n }\n\n /**\n * Throws an error if the version of the loaded shared library does not match the caller's version.\n */\n public static checkVersion(): void {\n const request: requests.CheckVersionRequest & gateway.Message = {\n ...requests.CheckVersionRequest.DEFAULT,\n host: 'js',\n version: '7.
|
|
1
|
+
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,mDAAqC;AACrC,qDAAuC;AAIvC,MAAa,OAAO;IAClB;;;;OAIG;IACI,MAAM,CAAC,YAAY,CACxB,IAAmB,EACnB,QAAiB;QAEjB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,QAAQ;YAClB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAC7B,UAA8B,EAC9B,aAAsB;QAEtB,MAAM,OAAO,GAAwD;YACnE,GAAG,QAAQ,CAAC,wBAAwB,CAAC,OAAO;YAC5C,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE,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Ed,MAAM,OAAO,GAA0C;YACrD,GAAG,QAAQ,CAAC,UAAU,CAAC,OAAO;YAC9B,KAAK,EAAE,MAAM;YACb,QAAQ;gBACN,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,YAAY;QACxB,MAAM,OAAO,GAAmD;YAC9D,GAAG,QAAQ,CAAC,mBAAmB,CAAC,OAAO;YACvC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO;YAChB,QAAQ;gBACN,OAAO,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAtID,0BAsIC;AAED,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from './gateway';\nimport * as requests from './requests';\nimport { LogOutputMode } from './log_output_mode';\nimport { DeviceDbSourceType } from './device_db_source_type';\n\nexport class Library {\n /**\n * Sets library logging output.\n * @param mode Logging output mode.\n * @param filePath Path of the file to open.\n */\n public static setLogOutput(\n mode: LogOutputMode,\n filePath?: string\n ): void {\n const request: requests.SetLogOutputRequest & gateway.Message = {\n ...requests.SetLogOutputRequest.DEFAULT,\n mode: mode,\n filePath: filePath,\n toBinary() {\n return requests.SetLogOutputRequest.toBinary(this);\n },\n };\n\n gateway.callSync('logging/set_output', request);\n }\n\n /**\n * Sets source of Device DB data. Allows selection of a web service or a local file.\n * @param sourceType Source type.\n * @param urlOrFilePath URL of the web service or path to the local file.\n * Leave empty for the default URL of Zaber web service.\n */\n public static setDeviceDbSource(\n sourceType: DeviceDbSourceType,\n urlOrFilePath?: string\n ): void {\n const request: requests.SetDeviceDbSourceRequest & gateway.Message = {\n ...requests.SetDeviceDbSourceRequest.DEFAULT,\n sourceType: sourceType,\n urlOrFilePath: urlOrFilePath,\n toBinary() {\n return requests.SetDeviceDbSourceRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/set_source', request);\n }\n\n /**\n * Enables Device DB store.\n * The store uses filesystem to save information obtained from the Device DB.\n * The stored data are later used instead of the Device DB.\n * @param storeLocation Specifies relative or absolute path of the folder used by the store.\n * If left empty defaults to a folder in user home directory.\n * Must be accessible by the process.\n */\n public static enableDeviceDbStore(\n storeLocation?: string\n ): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toggleOn: true,\n storeLocation: storeLocation,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables Device DB store.\n */\n public static disableDeviceDbStore(): void {\n const request: requests.ToggleDeviceDbStoreRequest & gateway.Message = {\n ...requests.ToggleDeviceDbStoreRequest.DEFAULT,\n toBinary() {\n return requests.ToggleDeviceDbStoreRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device_db/toggle_store', request);\n }\n\n /**\n * Disables certain customer checks (like FF flag).\n * @param mode Whether to turn internal mode on or off.\n */\n public static setInternalMode(\n mode: boolean\n ): void {\n const request: requests.SetInternalModeRequest & gateway.Message = {\n ...requests.SetInternalModeRequest.DEFAULT,\n mode: mode,\n toBinary() {\n return requests.SetInternalModeRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_internal_mode', request);\n }\n\n /**\n * Sets the period between polling for IDLE during movements.\n * Caution: Setting the period too low may cause performance issues.\n * @param period Period in milliseconds.\n * Negative value restores the default period.\n */\n public static setIdlePollingPeriod(\n period: number\n ): void {\n const request: requests.IntRequest & gateway.Message = {\n ...requests.IntRequest.DEFAULT,\n value: period,\n toBinary() {\n return requests.IntRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/set_idle_polling_period', request);\n }\n\n /**\n * Throws an error if the version of the loaded shared library does not match the caller's version.\n */\n public static checkVersion(): void {\n const request: requests.CheckVersionRequest & gateway.Message = {\n ...requests.CheckVersionRequest.DEFAULT,\n host: 'js',\n version: '7.6.0',\n toBinary() {\n return requests.CheckVersionRequest.toBinary(this);\n },\n };\n\n gateway.callSync('library/check_version', request);\n }\n}\n\ngateway.addInitCallback(Library.checkVersion);\n"]}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { ServoTuningParamset } from '../ascii/servo_tuning_paramset';
|
|
2
2
|
import { ServoTuningParam } from '../ascii/servo_tuning_param';
|
|
3
|
+
import { Units } from '../units';
|
|
3
4
|
export interface SetSimpleTuning {
|
|
4
5
|
interfaceId: number;
|
|
5
6
|
device: number;
|
|
6
7
|
axis: number;
|
|
7
8
|
paramset: ServoTuningParamset;
|
|
8
|
-
carriageMass?: (number | null);
|
|
9
9
|
loadMass: number;
|
|
10
|
+
loadMassUnits: Units;
|
|
11
|
+
carriageMass?: (number | null);
|
|
12
|
+
carriageMassUnits: Units;
|
|
13
|
+
motorInertia?: (number | null);
|
|
14
|
+
motorInertiaUnits: Units;
|
|
10
15
|
tuningParams: ServoTuningParam[];
|
|
11
16
|
}
|
|
12
17
|
export declare const SetSimpleTuning: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set_simple_tuning.d.ts","sourceRoot":"","sources":["../../../src/requests/set_simple_tuning.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"set_simple_tuning.d.ts","sourceRoot":"","sources":["../../../src/requests/set_simple_tuning.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,mBAAmB,CAAC;IAE9B,QAAQ,EAAE,MAAM,CAAC;IAEjB,aAAa,EAAE,KAAK,CAAC;IAErB,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE/B,iBAAiB,EAAE,KAAK,CAAC;IAEzB,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE/B,iBAAiB,EAAE,KAAK,CAAC;IAEzB,YAAY,EAAE,gBAAgB,EAAE,CAAC;CAElC;AAED,eAAO,MAAM,eAAe;yBACL,UAAU,KAAG,eAAe;sBAC/B,eAAe,KAAG,UAAU;;sBAc5B,eAAe,KAAG,eAAe;CAiBpD,CAAC"}
|
|
@@ -6,6 +6,7 @@ const bson_1 = require("bson");
|
|
|
6
6
|
const sanitizer_1 = require("../gateway/sanitizer");
|
|
7
7
|
const servo_tuning_paramset_1 = require("../ascii/servo_tuning_paramset");
|
|
8
8
|
const servo_tuning_param_1 = require("../ascii/servo_tuning_param");
|
|
9
|
+
const units_1 = require("../units");
|
|
9
10
|
exports.SetSimpleTuning = {
|
|
10
11
|
fromBinary: (buffer) => bson_1.BSON.deserialize(buffer),
|
|
11
12
|
toBinary: (value) => bson_1.BSON.serialize(exports.SetSimpleTuning.sanitize(value)),
|
|
@@ -14,8 +15,12 @@ exports.SetSimpleTuning = {
|
|
|
14
15
|
device: 0,
|
|
15
16
|
axis: 0,
|
|
16
17
|
paramset: 0,
|
|
17
|
-
carriageMass: null,
|
|
18
18
|
loadMass: 0,
|
|
19
|
+
loadMassUnits: units_1.Units.NATIVE,
|
|
20
|
+
carriageMass: null,
|
|
21
|
+
carriageMassUnits: units_1.Units.NATIVE,
|
|
22
|
+
motorInertia: null,
|
|
23
|
+
motorInertiaUnits: units_1.Units.NATIVE,
|
|
19
24
|
tuningParams: [],
|
|
20
25
|
}),
|
|
21
26
|
sanitize: (value) => {
|
|
@@ -31,8 +36,12 @@ exports.SetSimpleTuning = {
|
|
|
31
36
|
device: sanitizer_1.sanitizer.sanitizeInt(value.device, 'device'),
|
|
32
37
|
axis: sanitizer_1.sanitizer.sanitizeInt(value.axis, 'axis'),
|
|
33
38
|
paramset: sanitizer_1.sanitizer.sanitizeEnum(value.paramset, 'ServoTuningParamset', servo_tuning_paramset_1.ServoTuningParamset, 'paramset'),
|
|
34
|
-
carriageMass: value.carriageMass != null ? sanitizer_1.sanitizer.sanitizeNumber(value.carriageMass, 'carriageMass') : null,
|
|
35
39
|
loadMass: sanitizer_1.sanitizer.sanitizeNumber(value.loadMass, 'loadMass'),
|
|
40
|
+
loadMassUnits: sanitizer_1.sanitizer.sanitizeUnits(value.loadMassUnits, 'loadMassUnits'),
|
|
41
|
+
carriageMass: value.carriageMass != null ? sanitizer_1.sanitizer.sanitizeNumber(value.carriageMass, 'carriageMass') : null,
|
|
42
|
+
carriageMassUnits: sanitizer_1.sanitizer.sanitizeUnits(value.carriageMassUnits, 'carriageMassUnits'),
|
|
43
|
+
motorInertia: value.motorInertia != null ? sanitizer_1.sanitizer.sanitizeNumber(value.motorInertia, 'motorInertia') : null,
|
|
44
|
+
motorInertiaUnits: sanitizer_1.sanitizer.sanitizeUnits(value.motorInertiaUnits, 'motorInertiaUnits'),
|
|
36
45
|
tuningParams: Array.from((_a = value.tuningParams) !== null && _a !== void 0 ? _a : [], item => servo_tuning_param_1.ServoTuningParam.sanitize(item)),
|
|
37
46
|
};
|
|
38
47
|
},
|