@zaber/motion 7.5.0 → 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/binding.gyp CHANGED
@@ -112,7 +112,8 @@
112
112
  ]
113
113
  }]
114
114
  ],
115
- }],
115
+ }
116
+ ],
116
117
  ]
117
118
  },
118
119
  {
@@ -222,12 +222,23 @@ export declare class Connection {
222
222
  * @param isEnabled Checksum enabled.
223
223
  */
224
224
  private _changeChecksumEnabled;
225
+ /**
226
+ * Releases native resources of the connection.
227
+ * @param interfaceId The ID of the connection.
228
+ */
229
+ private static _free;
225
230
  private _disconnected;
226
231
  /**
227
232
  * Event invoked when connection is interrupted or closed.
228
233
  */
229
234
  get disconnected(): Observable<MotionLibException>;
230
235
  private _subscribe;
236
+ /**
237
+ * Releases the native resources of the connection.
238
+ * Should only be called if your environment does not support FinalizationRegistry.
239
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
240
+ */
241
+ free(): void;
231
242
  }
232
243
  declare namespace Connection {
233
244
  interface OpenSerialPortOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAiB,MAAM,MAAM,CAAC;AAKjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,qBAAa,UAAU;IACrB;;OAEG;IACI,eAAe,EAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAE1D;;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AK,CAAC,EAAE,MAAM,CAAC;QACf;;;;WAIG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB;IACD,UAAiB,qBAAqB;QAClC;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IACD,UAAiB,+BAA+B;QAC5C;;;WAGG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB;IACD,UAAiB,kCAAkC;QAC/C;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IACD,UAAiB,sBAAsB;QACnC;;;WAGG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB;IACD,UAAiB,oBAAoB;QACjC;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC7B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;IACD,UAAiB,cAAc;QAC3B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KAC3B;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 response_1 = require("./response");
36
+ const finalizer_1 = require("../finalizer");
36
37
  /**
37
38
  * Class representing access to particular connection (serial port, TCP connection).
38
39
  */
@@ -66,6 +67,7 @@ class Connection {
66
67
  constructor(interfaceId) {
67
68
  this._disconnected = new rxjs_1.ReplaySubject();
68
69
  this._interfaceId = interfaceId;
70
+ (0, finalizer_1.registerForFinalization)(this, Connection._free.bind(null, interfaceId));
69
71
  this._subscribe();
70
72
  }
71
73
  /**
@@ -501,6 +503,20 @@ class Connection {
501
503
  };
502
504
  gateway.callSync('interface/set_checksum_enabled', request);
503
505
  }
506
+ /**
507
+ * Releases native resources of the connection.
508
+ * @param interfaceId The ID of the connection.
509
+ */
510
+ static _free(interfaceId) {
511
+ const request = {
512
+ ...requests.InterfaceEmptyRequest.DEFAULT,
513
+ interfaceId: interfaceId,
514
+ toBinary() {
515
+ return requests.InterfaceEmptyRequest.toBinary(this);
516
+ },
517
+ };
518
+ gateway.callSync('interface/free', request);
519
+ }
504
520
  /**
505
521
  * Event invoked when connection is interrupted or closed.
506
522
  */
@@ -512,6 +528,14 @@ class Connection {
512
528
  this.alert = gateway_1.events.pipe((0, operators_1.takeUntil)(this._disconnected), (0, gateway_1.filterEvent)('interface/alert'), (0, operators_1.filter)(event => event.interfaceId === this.interfaceId), (0, operators_1.map)(event => event.alert));
513
529
  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);
514
530
  }
531
+ /**
532
+ * Releases the native resources of the connection.
533
+ * Should only be called if your environment does not support FinalizationRegistry.
534
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
535
+ */
536
+ free() {
537
+ Connection._free(this.interfaceId);
538
+ }
515
539
  }
516
540
  exports.Connection = Connection;
517
541
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDA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OT 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 { Transport } from './transport';\nimport { Device } from './device';\nimport { Response } from './response';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { AlertEvent } from './alert_event';\nimport { MotionLibException } from '../exceptions';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection).\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 an alert is received from a device.\n */\n public alert!: Observable<AlertEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 115200;\n\n /**\n * Commands sent over this port are forwarded to the device chain.\n * The bandwidth may be limited as the commands are forwarded over a serial connection.\n */\n public static readonly TCP_PORT_CHAIN: number = 55550;\n\n /**\n * Local area network share port.\n */\n public static readonly NETWORK_SHARE_PORT: number = 11421;\n\n /**\n * Commands send over this port are processed only by the device\n * and not forwarded to the rest of the chain.\n * Using this port typically makes the communication faster.\n */\n public static readonly TCP_PORT_DEVICE_ONLY: number = 55551;\n\n /**\n * The interface ID identifies this Connection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n /**\n * The default timeout, in milliseconds, for a device to respond to a request.\n * Setting the timeout to a too low value may cause request timeout exceptions.\n * The initial value is 1000 (one second).\n */\n public get defaultRequestTimeout(): number {\n return this._retrieveTimeout();\n }\n\n public set defaultRequestTimeout(value: number) {\n this._changeTimeout(value);\n }\n\n /**\n * Controls whether outgoing messages contain checksum.\n */\n public get checksumEnabled(): boolean {\n return this._retrieveChecksumEnabled();\n }\n\n public set checksumEnabled(value: boolean) {\n this._changeChecksumEnabled(value);\n }\n\n constructor(interfaceId: number) {\n this._interfaceId = interfaceId;\n this._subscribe();\n }\n\n /**\n * Opens a serial port, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.\n * Zaber Launcher allows sharing of the port between multiple applications,\n * If port sharing is not desirable, use the `direct` parameter.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).\n * @param [options.direct=false] If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\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 direct = false,\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n rejectRoutedConnection: direct,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n '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=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number = Connection.TCP_PORT_CHAIN\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection using a custom transport.\n * @param transport The custom connection transport.\n * @returns An object representing the connection.\n */\n public static async openCustom(\n transport: Transport\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.CUSTOM,\n transport: transport.transportId,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a secured connection to a cloud connected device chain.\n * Use this method to connect to devices on your account.\n * @param cloudId The cloud ID to connect to.\n * @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.\n * @param options.connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @param options.realm The realm to connect to.\n * Can be left empty for the default account realm.\n * @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.\n * @returns An object representing the connection.\n */\n public static async openIot(\n cloudId: string,\n options: Connection.OpenIotOptions = {}\n ): Promise<Connection> {\n const {\n token = 'unauthenticated',\n connectionName,\n realm,\n api = 'https://api.zaber.io',\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.IOT,\n cloudId: cloudId,\n token: token,\n connectionName: connectionName,\n realm: realm,\n api: api,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection to Zaber Launcher in your Local Area Network.\n * The connection is not secured.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.NETWORK_SHARE_PORT] Port number.\n * @param connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @returns An object representing the connection.\n */\n public static async openNetworkShare(\n hostName: string,\n port: number = Connection.NETWORK_SHARE_PORT,\n connectionName?: string\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.NETWORK_SHARE,\n hostName: hostName,\n port: port,\n connectionName: connectionName,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Sends a generic ASCII command to this connection.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Response>(\n 'interface/generic_command',\n request,\n Response.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n * @param [options.axis=0] Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n public async genericCommandNoResponse(\n command: string,\n options: Connection.GenericCommandNoResponseOptions = {}\n ): Promise<void> {\n const {\n device = 0,\n axis = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic ASCII command to this connection and expect multiple responses,\n * either from one device or from many devices.\n * Responses are returned in order of arrival.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n requests.GenericCommandResponseCollection.fromBinary);\n return response.responses;\n }\n\n /**\n * Enables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 1 on all supported devices.\n */\n public async enableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 1',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Disables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 0 on all supported devices.\n */\n public async disableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 0',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Resets ASCII protocol message IDs. Only for testing purposes.\n */\n public resetIds(): 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 gateway.callSync('interface/reset_ids', request);\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 * 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 * Renumbers devices present on this connection. After renumbering, devices need to be identified again.\n * @param [options.firstAddress=1] This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(\n options: Connection.RenumberDevicesOptions = {}\n ): Promise<number> {\n const {\n firstAddress = 1,\n } = options;\n if (firstAddress <= 0) {\n throw new TypeError('Invalid value; device addresses are numbered from 1.');\n }\n const request: requests.RenumberRequest & gateway.Message = {\n ...requests.RenumberRequest.DEFAULT,\n interfaceId: this.interfaceId,\n address: firstAddress,\n toBinary() {\n return requests.RenumberRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'device/renumber_all',\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.DeviceDetectRequest & gateway.Message = {\n ...requests.DeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.DeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceDetectResponse>(\n 'device/detect',\n request,\n requests.DeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Forgets all the information associated with devices on the connection.\n * Useful when devices are removed from the chain indefinitely.\n * @param [exceptDevices=[]] Addresses of devices that should not be forgotten.\n */\n public forgetDevices(\n exceptDevices: number[] = []\n ): void {\n const request: requests.ForgetDevicesRequest & gateway.Message = {\n ...requests.ForgetDevicesRequest.DEFAULT,\n interfaceId: this.interfaceId,\n exceptDevices: exceptDevices,\n toBinary() {\n return requests.ForgetDevicesRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device/forget', request);\n }\n\n /**\n * Stops all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are stopped.\n * @returns The addresses of the devices that were stopped by this command.\n */\n public async stopAll(\n options: Connection.StopAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\n }\n\n /**\n * Homes all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are homed.\n * @returns The addresses of the devices that were homed by this command.\n */\n public async homeAll(\n options: Connection.HomeAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\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 * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): 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 = gateway.callSync<requests.IntResponse>(\n 'interface/get_timeout',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets default request timeout.\n * @param timeout Default request timeout.\n */\n private _changeTimeout(\n timeout: number\n ): void {\n const request: requests.SetInterfaceTimeoutRequest & gateway.Message = {\n ...requests.SetInterfaceTimeoutRequest.DEFAULT,\n interfaceId: this.interfaceId,\n timeout: timeout,\n toBinary() {\n return requests.SetInterfaceTimeoutRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_timeout', request);\n }\n\n /**\n * Returns checksum enabled.\n * @returns Checksum enabled.\n */\n private _retrieveChecksumEnabled(): boolean {\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.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request: requests.SetInterfaceChecksumEnabledRequest & gateway.Message = {\n ...requests.SetInterfaceChecksumEnabledRequest.DEFAULT,\n interfaceId: this.interfaceId,\n isEnabled: isEnabled,\n toBinary() {\n return requests.SetInterfaceChecksumEnabledRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_checksum_enabled', 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.UnknownResponseEventWrapper>('interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.AlertEventWrapper>('interface/alert'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.alert)\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 115200).\n */\n baudRate?: number;\n /**\n * If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n */\n direct?: boolean;\n }\n export interface OpenIotOptions {\n /**\n * The token to authenticate with. By default the connection will be unauthenticated.\n */\n token?: string;\n /**\n * The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n */\n connectionName?: string;\n /**\n * The realm to connect to.\n * Can be left empty for the default account realm.\n */\n realm?: string;\n /**\n * The URL of the API to receive connection info from.\n */\n api?: string;\n }\n export interface GenericCommandOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface GenericCommandNoResponseOptions {\n /**\n * Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n axis?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when a device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface RenumberDevicesOptions {\n /**\n * This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n */\n firstAddress?: number;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n export interface StopAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are stopped.\n */\n waitUntilIdle?: boolean;\n }\n export interface HomeAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are homed.\n */\n waitUntilIdle?: boolean;\n }\n}\n"]}
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/ascii/connection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,+BAAiD;AACjD,8CAA8D;AAC9D,oDAAsC;AACtC,wCAAiD;AACjD,sDAAwC;AAExC,qCAAkC;AAClC,yCAAsC;AAItC,4CAAuD;AAEvD;;GAEG;AACH,MAAa,UAAU;IAkCrB;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAGD;;;;OAIG;IACH,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,qBAAqB,CAAC,KAAa;QAC5C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACzC,CAAC;IAED,IAAW,eAAe,CAAC,KAAc;QACvC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,YAAY,WAAmB;QAqmBvB,kBAAa,GAAG,IAAI,oBAAa,EAAsB,CAAC;QApmB9D,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAA,mCAAuB,EAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAChC,QAAgB,EAChB,UAA4C,EAAE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EF,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;IAED;;;;OAIG;IACI,IAAI;QACT,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;;AA9sBH,gCA+sBC;AApsBC;;GAEG;AACoB,4BAAiB,GAAW,MAAM,AAAjB,CAAkB;AAE1D;;;GAGG;AACoB,yBAAc,GAAW,KAAK,AAAhB,CAAiB;AAEtD;;GAEG;AACoB,6BAAkB,GAAW,KAAK,AAAhB,CAAiB;AAE1D;;;;GAIG;AACoB,+BAAoB,GAAW,KAAK,AAAhB,CAAiB","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 { Transport } from './transport';\nimport { Device } from './device';\nimport { Response } from './response';\nimport { UnknownResponseEvent } from './unknown_response_event';\nimport { AlertEvent } from './alert_event';\nimport { MotionLibException } from '../exceptions';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Class representing access to particular connection (serial port, TCP connection).\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 an alert is received from a device.\n */\n public alert!: Observable<AlertEvent>;\n\n /**\n * Default baud rate for serial connections.\n */\n public static readonly DEFAULT_BAUD_RATE: number = 115200;\n\n /**\n * Commands sent over this port are forwarded to the device chain.\n * The bandwidth may be limited as the commands are forwarded over a serial connection.\n */\n public static readonly TCP_PORT_CHAIN: number = 55550;\n\n /**\n * Local area network share port.\n */\n public static readonly NETWORK_SHARE_PORT: number = 11421;\n\n /**\n * Commands send over this port are processed only by the device\n * and not forwarded to the rest of the chain.\n * Using this port typically makes the communication faster.\n */\n public static readonly TCP_PORT_DEVICE_ONLY: number = 55551;\n\n /**\n * The interface ID identifies this Connection instance with the underlying library.\n */\n public get interfaceId(): number {\n return this._interfaceId;\n }\n private _interfaceId: number;\n\n /**\n * The default timeout, in milliseconds, for a device to respond to a request.\n * Setting the timeout to a too low value may cause request timeout exceptions.\n * The initial value is 1000 (one second).\n */\n public get defaultRequestTimeout(): number {\n return this._retrieveTimeout();\n }\n\n public set defaultRequestTimeout(value: number) {\n this._changeTimeout(value);\n }\n\n /**\n * Controls whether outgoing messages contain checksum.\n */\n public get checksumEnabled(): boolean {\n return this._retrieveChecksumEnabled();\n }\n\n public set checksumEnabled(value: boolean) {\n this._changeChecksumEnabled(value);\n }\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, if Zaber Launcher controls the port, the port will be opened through Zaber Launcher.\n * Zaber Launcher allows sharing of the port between multiple applications,\n * If port sharing is not desirable, use the `direct` parameter.\n * @param portName Name of the port to open.\n * @param [options.baudRate=Connection.DEFAULT_BAUD_RATE] Optional baud rate (defaults to 115200).\n * @param [options.direct=false] If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\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 direct = false,\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.SERIAL_PORT,\n portName: portName,\n baudRate: baudRate,\n rejectRoutedConnection: direct,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n '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=Connection.TCP_PORT_CHAIN] Optional port number (defaults to 55550).\n * @returns An object representing the connection.\n */\n public static async openTcp(\n hostName: string,\n port: number = Connection.TCP_PORT_CHAIN\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.TCP,\n hostName: hostName,\n port: port,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection using a custom transport.\n * @param transport The custom connection transport.\n * @returns An object representing the connection.\n */\n public static async openCustom(\n transport: Transport\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.CUSTOM,\n transport: transport.transportId,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a secured connection to a cloud connected device chain.\n * Use this method to connect to devices on your account.\n * @param cloudId The cloud ID to connect to.\n * @param [options.token='unauthenticated'] The token to authenticate with. By default the connection will be unauthenticated.\n * @param options.connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @param options.realm The realm to connect to.\n * Can be left empty for the default account realm.\n * @param [options.api='https://api.zaber.io'] The URL of the API to receive connection info from.\n * @returns An object representing the connection.\n */\n public static async openIot(\n cloudId: string,\n options: Connection.OpenIotOptions = {}\n ): Promise<Connection> {\n const {\n token = 'unauthenticated',\n connectionName,\n realm,\n api = 'https://api.zaber.io',\n } = options;\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.IOT,\n cloudId: cloudId,\n token: token,\n connectionName: connectionName,\n realm: realm,\n api: api,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Opens a connection to Zaber Launcher in your Local Area Network.\n * The connection is not secured.\n * @param hostName Hostname or IP address.\n * @param [port=Connection.NETWORK_SHARE_PORT] Port number.\n * @param connectionName The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n * @returns An object representing the connection.\n */\n public static async openNetworkShare(\n hostName: string,\n port: number = Connection.NETWORK_SHARE_PORT,\n connectionName?: string\n ): Promise<Connection> {\n const request: requests.OpenInterfaceRequest & gateway.Message = {\n ...requests.OpenInterfaceRequest.DEFAULT,\n interfaceType: requests.InterfaceType.NETWORK_SHARE,\n hostName: hostName,\n port: port,\n connectionName: connectionName,\n toBinary() {\n return requests.OpenInterfaceRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.OpenInterfaceResponse>(\n 'interface/open',\n request,\n requests.OpenInterfaceResponse.fromBinary);\n return new Connection(response.interfaceId);\n }\n\n /**\n * Sends a generic ASCII command to this connection.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when the device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns A response to the command.\n */\n public async genericCommand(\n command: string,\n options: Connection.GenericCommandOptions = {}\n ): Promise<Response> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<Response>(\n 'interface/generic_command',\n request,\n Response.fromBinary);\n return response;\n }\n\n /**\n * Sends a generic ASCII command to this connection without expecting a response and without adding a message ID.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n * @param [options.axis=0] Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n public async genericCommandNoResponse(\n command: string,\n options: Connection.GenericCommandNoResponseOptions = {}\n ): Promise<void> {\n const {\n device = 0,\n axis = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Sends a generic ASCII command to this connection and expect multiple responses,\n * either from one device or from many devices.\n * Responses are returned in order of arrival.\n * For more information refer to the [ASCII Protocol Manual](https://www.zaber.com/protocol-manual#topic_commands).\n * @param command Command and its parameters.\n * @param [options.device=0] Optional device address to send the command to.\n * @param [options.axis=0] Optional axis number to send the command to.\n * @param [options.checkErrors=true] Controls whether to throw an exception when a device rejects the command.\n * @param [options.timeout=0] The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n * @returns All responses to the command.\n */\n public async genericCommandMultiResponse(\n command: string,\n options: Connection.GenericCommandMultiResponseOptions = {}\n ): Promise<Response[]> {\n const {\n device = 0,\n axis = 0,\n checkErrors = true,\n timeout = 0,\n } = options;\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: command,\n device: device,\n axis: axis,\n checkErrors: checkErrors,\n timeout: timeout,\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.GenericCommandResponseCollection>(\n 'interface/generic_command_multi_response',\n request,\n requests.GenericCommandResponseCollection.fromBinary);\n return response.responses;\n }\n\n /**\n * Enables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 1 on all supported devices.\n */\n public async enableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 1',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Disables alerts for all devices on the connection.\n * This will change the \"comm.alert\" setting to 0 on all supported devices.\n */\n public async disableAlerts(): Promise<void> {\n const request: requests.GenericCommandRequest & gateway.Message = {\n ...requests.GenericCommandRequest.DEFAULT,\n interfaceId: this.interfaceId,\n command: 'set comm.alert 0',\n toBinary() {\n return requests.GenericCommandRequest.toBinary(this);\n },\n };\n\n await gateway.callAsync('interface/generic_command_no_response', request);\n }\n\n /**\n * Resets ASCII protocol message IDs. Only for testing purposes.\n */\n public resetIds(): 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 gateway.callSync('interface/reset_ids', request);\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 * 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 * Renumbers devices present on this connection. After renumbering, devices need to be identified again.\n * @param [options.firstAddress=1] This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n * @returns Total number of devices that responded to the renumber.\n */\n public async renumberDevices(\n options: Connection.RenumberDevicesOptions = {}\n ): Promise<number> {\n const {\n firstAddress = 1,\n } = options;\n if (firstAddress <= 0) {\n throw new TypeError('Invalid value; device addresses are numbered from 1.');\n }\n const request: requests.RenumberRequest & gateway.Message = {\n ...requests.RenumberRequest.DEFAULT,\n interfaceId: this.interfaceId,\n address: firstAddress,\n toBinary() {\n return requests.RenumberRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.IntResponse>(\n 'device/renumber_all',\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.DeviceDetectRequest & gateway.Message = {\n ...requests.DeviceDetectRequest.DEFAULT,\n interfaceId: this.interfaceId,\n identifyDevices: identifyDevices,\n toBinary() {\n return requests.DeviceDetectRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceDetectResponse>(\n 'device/detect',\n request,\n requests.DeviceDetectResponse.fromBinary);\n return response.devices.map(deviceAddress => this.getDevice(deviceAddress));\n }\n\n /**\n * Forgets all the information associated with devices on the connection.\n * Useful when devices are removed from the chain indefinitely.\n * @param [exceptDevices=[]] Addresses of devices that should not be forgotten.\n */\n public forgetDevices(\n exceptDevices: number[] = []\n ): void {\n const request: requests.ForgetDevicesRequest & gateway.Message = {\n ...requests.ForgetDevicesRequest.DEFAULT,\n interfaceId: this.interfaceId,\n exceptDevices: exceptDevices,\n toBinary() {\n return requests.ForgetDevicesRequest.toBinary(this);\n },\n };\n\n gateway.callSync('device/forget', request);\n }\n\n /**\n * Stops all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are stopped.\n * @returns The addresses of the devices that were stopped by this command.\n */\n public async stopAll(\n options: Connection.StopAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/stop_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\n }\n\n /**\n * Homes all of the devices on this connection.\n * @param [options.waitUntilIdle=true] Determines whether the function should return immediately\n * or wait until the devices are homed.\n * @returns The addresses of the devices that were homed by this command.\n */\n public async homeAll(\n options: Connection.HomeAllOptions = {}\n ): Promise<number[]> {\n const {\n waitUntilIdle = true,\n } = options;\n const request: requests.DeviceOnAllRequest & gateway.Message = {\n ...requests.DeviceOnAllRequest.DEFAULT,\n interfaceId: this.interfaceId,\n waitUntilIdle: waitUntilIdle,\n toBinary() {\n return requests.DeviceOnAllRequest.toBinary(this);\n },\n };\n\n const response = await gateway.callAsync<requests.DeviceOnAllResponse>(\n 'device/home_all',\n request,\n requests.DeviceOnAllResponse.fromBinary);\n return response.deviceAddresses;\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 * Returns default request timeout.\n * @returns Default request timeout.\n */\n private _retrieveTimeout(): 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 = gateway.callSync<requests.IntResponse>(\n 'interface/get_timeout',\n request,\n requests.IntResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets default request timeout.\n * @param timeout Default request timeout.\n */\n private _changeTimeout(\n timeout: number\n ): void {\n const request: requests.SetInterfaceTimeoutRequest & gateway.Message = {\n ...requests.SetInterfaceTimeoutRequest.DEFAULT,\n interfaceId: this.interfaceId,\n timeout: timeout,\n toBinary() {\n return requests.SetInterfaceTimeoutRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_timeout', request);\n }\n\n /**\n * Returns checksum enabled.\n * @returns Checksum enabled.\n */\n private _retrieveChecksumEnabled(): boolean {\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.BoolResponse>(\n 'interface/get_checksum_enabled',\n request,\n requests.BoolResponse.fromBinary);\n return response.value;\n }\n\n /**\n * Sets checksum enabled.\n * @param isEnabled Checksum enabled.\n */\n private _changeChecksumEnabled(\n isEnabled: boolean\n ): void {\n const request: requests.SetInterfaceChecksumEnabledRequest & gateway.Message = {\n ...requests.SetInterfaceChecksumEnabledRequest.DEFAULT,\n interfaceId: this.interfaceId,\n isEnabled: isEnabled,\n toBinary() {\n return requests.SetInterfaceChecksumEnabledRequest.toBinary(this);\n },\n };\n\n gateway.callSync('interface/set_checksum_enabled', request);\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.UnknownResponseEventWrapper>('interface/unknown_response'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.unknownResponse)\n );\n\n this.alert = events.pipe(\n takeUntil(this._disconnected),\n filterEvent<requests.AlertEventWrapper>('interface/alert'),\n filter(event => event.interfaceId === this.interfaceId),\n map(event => event.alert)\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 115200).\n */\n baudRate?: number;\n /**\n * If true will connect to the serial port directly,\n * failing if the connection is already opened by a message router instance.\n */\n direct?: boolean;\n }\n export interface OpenIotOptions {\n /**\n * The token to authenticate with. By default the connection will be unauthenticated.\n */\n token?: string;\n /**\n * The name of the connection to open.\n * Can be left empty to default to the only connection present.\n * Otherwise, use serial port name for serial port connection or hostname:port for TCP connection.\n */\n connectionName?: string;\n /**\n * The realm to connect to.\n * Can be left empty for the default account realm.\n */\n realm?: string;\n /**\n * The URL of the API to receive connection info from.\n */\n api?: string;\n }\n export interface GenericCommandOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when the device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface GenericCommandNoResponseOptions {\n /**\n * Optional device address to send the command to.\n * Specifying -1 omits the number completely.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n * Specifying -1 omits the number completely.\n */\n axis?: number;\n }\n export interface GenericCommandMultiResponseOptions {\n /**\n * Optional device address to send the command to.\n */\n device?: number;\n /**\n * Optional axis number to send the command to.\n */\n axis?: number;\n /**\n * Controls whether to throw an exception when a device rejects the command.\n */\n checkErrors?: boolean;\n /**\n * The timeout, in milliseconds, for a device to respond to the command.\n * Overrides the connection default request timeout.\n */\n timeout?: number;\n }\n export interface RenumberDevicesOptions {\n /**\n * This is the address that the device closest to the computer is given.\n * Remaining devices are numbered consecutively.\n */\n firstAddress?: number;\n }\n export interface DetectDevicesOptions {\n /**\n * Determines whether device identification should be performed as well.\n */\n identifyDevices?: boolean;\n }\n export interface StopAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are stopped.\n */\n waitUntilIdle?: boolean;\n }\n export interface HomeAllOptions {\n /**\n * Determines whether the function should return immediately\n * or wait until the devices are homed.\n */\n waitUntilIdle?: boolean;\n }\n}\n"]}
@@ -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 (excluding the mass of the carriage itself) in kg.
81
- * @param [options.carriageMass=null] The mass of the carriage in kg. If this value is not set the default carriage mass is used.
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 mass of the carriage in kg. If this value is not set the default carriage mass is used.
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,mBAA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5B,OAAO,CAAC,YAAY,CAAC;IAmBxB;;;;;;;;;;;OAWG;IACU,mBAAmB,CAC9B,QAAQ,EAAE,mBAAmB,EAC7B,YAAY,EAAE,gBAAgB,EAAE,EAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,UAAU,CAAC,0BAA+B,GAClD,OAAO,CAAC,OAAO,CAAC;CAwBpB;AAED,kBAAU,UAAU,CAAC;IACnB,UAAiB,sBAAsB;QACnC;;WAEG;QACH,aAAa,CAAC,EAAE,KAAK,CAAC;QACtB;;;;WAIG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB;;WAEG;QACH,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAC1B;;;WAGG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB;;WAEG;QACH,iBAAiB,CAAC,EAAE,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 (excluding the mass of the carriage itself) in kg.
216
- * @param [options.carriageMass=null] The mass of the carriage in kg. If this value is not set the default carriage mass is used.
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":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtD,oDAAsC;AACtC,sDAAwC;AAExC,mDAA+C;AAE/C,6CAAyC;AAEzC,mDAA+C;AAE/C;;;GAGG;AACH,MAAa,UAAU;IACrB;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAGD;;OAEG;IACH,YAAY,IAAU;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,kBAAkB;QAC7B,MAAM,OAAO,GAAgD;YAC3D,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO;YACpC,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;gBACN,OAAO,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAClD,CAAC;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,6BAA6B,EAC7B,OAAO,EACP,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;QACnD,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,kBAAkB,CAC7B,QAA6B;QAE7B,MAAM,OAAO,GAAkD;YAC7D,GAAG,QAAQ,CAAC,kBAAkB,CAAC,OAAO;YACtC,WAAW,EAAE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ent":["// ==== 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/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E 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;;sBAOzB,YAAY,KAAG,YAAY;CAU9C,CAAC"}
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;AA6BlD,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,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,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 * The mass of the carriage in kg.\n */\n carriageMass?: (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 carriageMass: 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 carriageMass: value.carriageMass != null ? sanitizer.sanitizeNumber(value.carriageMass, 'carriageMass') : null,\n loadMass: sanitizer.sanitizeNumber(value.loadMass, 'loadMass'),\n tuningParams: Array.from(value.tuningParams ?? [], item => ServoTuningParam.sanitize(item)),\n };\n },\n};\n"]}
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"]}