@zaber/motion 2.9.1 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/binding/wasm/zaber-motion-lib.wasm +0 -0
  2. package/dist/lib/ascii/connection.d.ts +11 -0
  3. package/dist/lib/ascii/connection.js +11 -0
  4. package/dist/lib/ascii/connection.js.map +1 -1
  5. package/dist/lib/ascii/device.d.ts +6 -0
  6. package/dist/lib/ascii/device.js +8 -0
  7. package/dist/lib/ascii/device.js.map +1 -1
  8. package/dist/lib/ascii/index.d.ts +9 -0
  9. package/dist/lib/ascii/index.js +19 -1
  10. package/dist/lib/ascii/index.js.map +1 -1
  11. package/dist/lib/ascii/oscilloscope.d.ts +62 -0
  12. package/dist/lib/ascii/oscilloscope.js +153 -0
  13. package/dist/lib/ascii/oscilloscope.js.map +1 -0
  14. package/dist/lib/ascii/oscilloscope_capture_properties.d.ts +16 -0
  15. package/dist/lib/ascii/oscilloscope_capture_properties.js +18 -0
  16. package/dist/lib/ascii/oscilloscope_capture_properties.js.map +1 -0
  17. package/dist/lib/ascii/oscilloscope_data.d.ts +67 -0
  18. package/dist/lib/ascii/oscilloscope_data.js +151 -0
  19. package/dist/lib/ascii/oscilloscope_data.js.map +1 -0
  20. package/dist/lib/ascii/paramset_info.d.ts +17 -0
  21. package/dist/lib/ascii/paramset_info.js +19 -0
  22. package/dist/lib/ascii/paramset_info.js.map +1 -0
  23. package/dist/lib/ascii/pid_tuning.d.ts +32 -0
  24. package/dist/lib/ascii/pid_tuning.js +22 -0
  25. package/dist/lib/ascii/pid_tuning.js.map +1 -0
  26. package/dist/lib/ascii/servo_tuner.d.ts +77 -0
  27. package/dist/lib/ascii/servo_tuner.js +180 -0
  28. package/dist/lib/ascii/servo_tuner.js.map +1 -0
  29. package/dist/lib/ascii/servo_tuning_param.d.ts +16 -0
  30. package/dist/lib/ascii/servo_tuning_param.js +49 -0
  31. package/dist/lib/ascii/servo_tuning_param.js.map +1 -0
  32. package/dist/lib/ascii/servo_tuning_paramset.d.ts +17 -0
  33. package/dist/lib/ascii/servo_tuning_paramset.js +24 -0
  34. package/dist/lib/ascii/servo_tuning_paramset.js.map +1 -0
  35. package/dist/lib/ascii/simple_tuning_param.d.ts +24 -0
  36. package/dist/lib/ascii/simple_tuning_param.js +20 -0
  37. package/dist/lib/ascii/simple_tuning_param.js.map +1 -0
  38. package/dist/lib/ascii/stream.d.ts +7 -0
  39. package/dist/lib/ascii/stream.js +14 -0
  40. package/dist/lib/ascii/stream.js.map +1 -1
  41. package/dist/lib/ascii/stream_axis_definition.js +3 -0
  42. package/dist/lib/ascii/stream_axis_definition.js.map +1 -1
  43. package/dist/lib/ascii/transport.d.ts +4 -0
  44. package/dist/lib/ascii/transport.js +4 -0
  45. package/dist/lib/ascii/transport.js.map +1 -1
  46. package/dist/lib/ascii_ns.d.ts +18 -0
  47. package/dist/lib/ascii_ns.js +9 -0
  48. package/dist/lib/ascii_ns.js.map +1 -1
  49. package/dist/lib/exceptions/index.d.ts +1 -0
  50. package/dist/lib/exceptions/index.js +4 -2
  51. package/dist/lib/exceptions/index.js.map +1 -1
  52. package/dist/lib/exceptions/invalid_operation_exception.d.ts +7 -0
  53. package/dist/lib/exceptions/invalid_operation_exception.js +17 -0
  54. package/dist/lib/exceptions/invalid_operation_exception.js.map +1 -0
  55. package/dist/lib/gateway/convert_exceptions.js +1 -0
  56. package/dist/lib/gateway/convert_exceptions.js.map +1 -1
  57. package/dist/lib/gcode/axis_definition.d.ts +18 -0
  58. package/dist/lib/gcode/{translator_axis_definition.js → axis_definition.js} +11 -10
  59. package/dist/lib/gcode/axis_definition.js.map +1 -0
  60. package/dist/lib/gcode/axis_mapping.js +3 -0
  61. package/dist/lib/gcode/axis_mapping.js.map +1 -1
  62. package/dist/lib/gcode/axis_transformation.d.ts +21 -0
  63. package/dist/lib/gcode/axis_transformation.js +43 -0
  64. package/dist/lib/gcode/axis_transformation.js.map +1 -0
  65. package/dist/lib/gcode/device_definition.d.ts +24 -0
  66. package/dist/lib/gcode/{translator_definition.js → device_definition.js} +14 -9
  67. package/dist/lib/gcode/device_definition.js.map +1 -0
  68. package/dist/lib/gcode/index.d.ts +4 -3
  69. package/dist/lib/gcode/index.js +9 -7
  70. package/dist/lib/gcode/index.js.map +1 -1
  71. package/dist/lib/gcode/offline_translator.d.ts +114 -0
  72. package/dist/lib/gcode/offline_translator.js +226 -0
  73. package/dist/lib/gcode/offline_translator.js.map +1 -0
  74. package/dist/lib/gcode/translator.d.ts +66 -12
  75. package/dist/lib/gcode/translator.js +113 -17
  76. package/dist/lib/gcode/translator.js.map +1 -1
  77. package/dist/lib/gcode/translator_config.d.ts +6 -6
  78. package/dist/lib/gcode/translator_config.js +7 -4
  79. package/dist/lib/gcode/translator_config.js.map +1 -1
  80. package/dist/lib/gcode_ns.d.ts +8 -6
  81. package/dist/lib/gcode_ns.js +4 -3
  82. package/dist/lib/gcode_ns.js.map +1 -1
  83. package/dist/lib/measurement.js +3 -0
  84. package/dist/lib/measurement.js.map +1 -1
  85. package/dist/lib/protobufs/main_pb.d.ts +1011 -30
  86. package/dist/lib/protobufs/main_pb.js +12857 -5306
  87. package/dist/lib/protobufs/main_pb.js.map +1 -1
  88. package/dist/lib/tools.d.ts +6 -0
  89. package/dist/lib/tools.js +10 -0
  90. package/dist/lib/tools.js.map +1 -1
  91. package/package.json +1 -1
  92. package/dist/lib/gcode/translator_axis_definition.d.ts +0 -20
  93. package/dist/lib/gcode/translator_axis_definition.js.map +0 -1
  94. package/dist/lib/gcode/translator_definition.d.ts +0 -18
  95. package/dist/lib/gcode/translator_definition.js.map +0 -1
  96. package/dist/lib/gcode/translator_live.d.ts +0 -70
  97. package/dist/lib/gcode/translator_live.js +0 -147
  98. package/dist/lib/gcode/translator_live.js.map +0 -1
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ }) : (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ o[k2] = m[k];
10
+ }));
11
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
12
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
13
+ }) : function(o, v) {
14
+ o["default"] = v;
15
+ });
16
+ var __importStar = (this && this.__importStar) || function (mod) {
17
+ if (mod && mod.__esModule) return mod;
18
+ var result = {};
19
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
20
+ __setModuleDefault(result, mod);
21
+ return result;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.Oscilloscope = void 0;
25
+ const oscilloscope_data_1 = require("./oscilloscope_data");
26
+ const units_1 = require("../units");
27
+ const gateway = __importStar(require("../gateway"));
28
+ /**
29
+ * Provides a convenient way to control the oscilloscope data recording feature of some devices.
30
+ * The oscilloscope can record the values of some settings over time at high resolution.
31
+ */
32
+ class Oscilloscope {
33
+ constructor(device) {
34
+ this._device = device;
35
+ }
36
+ /**
37
+ * Device that this Oscilloscope measures.
38
+ */
39
+ get device() {
40
+ return this._device;
41
+ }
42
+ /**
43
+ * Select a setting to be recorded.
44
+ * @param axis The 1-based index of the axis to record the value from.
45
+ * @param setting The name of a setting to record.
46
+ */
47
+ async addChannel(axis, setting) {
48
+ const request = new gateway.OscilloscopeAddChannelRequest();
49
+ request.setInterfaceId(this.device.connection.interfaceId);
50
+ request.setDevice(this.device.deviceAddress);
51
+ request.setAxis(axis);
52
+ request.setSetting(setting);
53
+ await gateway.callAsync('oscilloscope/add_channel', request);
54
+ }
55
+ /**
56
+ * Clear the list of channels to record.
57
+ */
58
+ async clear() {
59
+ const request = new gateway.OscilloscopeClearChannelsRequest();
60
+ request.setInterfaceId(this.device.connection.interfaceId);
61
+ request.setDevice(this.device.deviceAddress);
62
+ await gateway.callAsync('oscilloscope/clear_channels', request);
63
+ }
64
+ /**
65
+ * Get the current sampling interval.
66
+ * @param unit Unit of measure to represent the timebase in.
67
+ * @return The current sampling interval in the selected time units.
68
+ */
69
+ async getTimebase(unit = units_1.Units.NATIVE) {
70
+ const request = new gateway.DeviceGetSettingRequest();
71
+ request.setInterfaceId(this.device.connection.interfaceId);
72
+ request.setDevice(this.device.deviceAddress);
73
+ request.setSetting('scope.timebase');
74
+ request.setUnit(unit);
75
+ const response = await gateway.callAsync('device/get_setting', request, gateway.DeviceGetSettingResponse);
76
+ return response.getValue();
77
+ }
78
+ /**
79
+ * Set the sampling interval.
80
+ * @param interval Sample interval for the next oscilloscope recording. Minimum value is 100µs.
81
+ * @param unit Unit of measure the timebase is represented in.
82
+ */
83
+ async setTimebase(interval, unit = units_1.Units.NATIVE) {
84
+ const request = new gateway.DeviceSetSettingRequest();
85
+ request.setInterfaceId(this.device.connection.interfaceId);
86
+ request.setDevice(this.device.deviceAddress);
87
+ request.setSetting('scope.timebase');
88
+ request.setValue(interval);
89
+ request.setUnit(unit);
90
+ await gateway.callAsync('device/set_setting', request);
91
+ }
92
+ /**
93
+ * Get the delay before oscilloscope recording starts.
94
+ * @param unit Unit of measure to represent the delay in.
95
+ * @return The current start delay in the selected time units.
96
+ */
97
+ async getDelay(unit = units_1.Units.NATIVE) {
98
+ const request = new gateway.DeviceGetSettingRequest();
99
+ request.setInterfaceId(this.device.connection.interfaceId);
100
+ request.setDevice(this.device.deviceAddress);
101
+ request.setSetting('scope.delay');
102
+ request.setUnit(unit);
103
+ const response = await gateway.callAsync('device/get_setting', request, gateway.DeviceGetSettingResponse);
104
+ return response.getValue();
105
+ }
106
+ /**
107
+ * Set the sampling start delay.
108
+ * @param interval Delay time between triggering a recording and the first data point being recorded.
109
+ * @param unit Unit of measure the delay is represented in.
110
+ */
111
+ async setDelay(interval, unit = units_1.Units.NATIVE) {
112
+ const request = new gateway.DeviceSetSettingRequest();
113
+ request.setInterfaceId(this.device.connection.interfaceId);
114
+ request.setDevice(this.device.deviceAddress);
115
+ request.setSetting('scope.delay');
116
+ request.setValue(interval);
117
+ request.setUnit(unit);
118
+ await gateway.callAsync('device/set_setting', request);
119
+ }
120
+ /**
121
+ * Trigger data recording.
122
+ */
123
+ async start() {
124
+ const request = new gateway.OscilloscopeStartStopRequest();
125
+ request.setInterfaceId(this.device.connection.interfaceId);
126
+ request.setDevice(this.device.deviceAddress);
127
+ request.setStart(true);
128
+ await gateway.callAsync('oscilloscope/start_or_stop', request);
129
+ }
130
+ /**
131
+ * End data recording if currently in progress.
132
+ */
133
+ async stop() {
134
+ const request = new gateway.OscilloscopeStartStopRequest();
135
+ request.setInterfaceId(this.device.connection.interfaceId);
136
+ request.setDevice(this.device.deviceAddress);
137
+ request.setStart(false);
138
+ await gateway.callAsync('oscilloscope/start_or_stop', request);
139
+ }
140
+ /**
141
+ * Reads the last-recorded data from the oscilloscope. Will block until any in-progress recording completes.
142
+ * @return Array of recorded channel data arrays, in the order added.
143
+ */
144
+ async read() {
145
+ const request = new gateway.OscilloscopeReadRequest();
146
+ request.setInterfaceId(this.device.connection.interfaceId);
147
+ request.setDevice(this.device.deviceAddress);
148
+ const response = await gateway.callAsync('oscilloscope/read', request, gateway.OscilloscopeReadResponse);
149
+ return response.getDataIdsList().map(id => new oscilloscope_data_1.OscilloscopeData(this.device, id));
150
+ }
151
+ }
152
+ exports.Oscilloscope = Oscilloscope;
153
+ //# sourceMappingURL=oscilloscope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oscilloscope.js","sourceRoot":"","sources":["../../../src/ascii/oscilloscope.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAGtD,2DAAuD;AACvD,oCAA+C;AAC/C,oDAAsC;AAEtC;;;GAGG;AAC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UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAExB,MAAM,OAAO,CAAC,SAAS,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QACf,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QACtD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE7C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,mBAAmB,EACnB,OAAO,EACP,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACpC,OAAO,QAAQ,CAAC,cAAc,EAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,oCAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;CACF;AAjKD,oCAiKC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Device } from './device';\nimport { OscilloscopeData } from './oscilloscope_data';\nimport { Native, Time, Units } from '../units';\nimport * as gateway from '../gateway';\n\n/**\n * Provides a convenient way to control the oscilloscope data recording feature of some devices.\n * The oscilloscope can record the values of some settings over time at high resolution.\n */\nexport class Oscilloscope {\n /**\n * Device that this Oscilloscope measures.\n */\n public get device(): Device {\n return this._device;\n }\n private _device: Device;\n\n constructor(device: Device) {\n this._device = device;\n }\n\n /**\n * Select a setting to be recorded.\n * @param axis The 1-based index of the axis to record the value from.\n * @param setting The name of a setting to record.\n */\n public async addChannel(\n axis: number,\n setting: string\n ): Promise<void> {\n const request = new gateway.OscilloscopeAddChannelRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setAxis(axis);\n request.setSetting(setting);\n\n await gateway.callAsync('oscilloscope/add_channel', request);\n }\n\n /**\n * Clear the list of channels to record.\n */\n public async clear(): Promise<void> {\n const request = new gateway.OscilloscopeClearChannelsRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n\n await gateway.callAsync('oscilloscope/clear_channels', request);\n }\n\n /**\n * Get the current sampling interval.\n * @param unit Unit of measure to represent the timebase in.\n * @return The current sampling interval in the selected time units.\n */\n public async getTimebase(\n unit: Time | Native = Units.NATIVE\n ): Promise<number> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.timebase');\n request.setUnit(unit);\n\n const response = await gateway.callAsync<gateway.DeviceGetSettingResponse>(\n 'device/get_setting',\n request,\n gateway.DeviceGetSettingResponse);\n return response.getValue();\n }\n\n /**\n * Set the sampling interval.\n * @param interval Sample interval for the next oscilloscope recording. Minimum value is 100µs.\n * @param unit Unit of measure the timebase is represented in.\n */\n public async setTimebase(\n interval: number,\n unit: Time | Native = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.timebase');\n request.setValue(interval);\n request.setUnit(unit);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Get the delay before oscilloscope recording starts.\n * @param unit Unit of measure to represent the delay in.\n * @return The current start delay in the selected time units.\n */\n public async getDelay(\n unit: Time | Native = Units.NATIVE\n ): Promise<number> {\n const request = new gateway.DeviceGetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.delay');\n request.setUnit(unit);\n\n const response = await gateway.callAsync<gateway.DeviceGetSettingResponse>(\n 'device/get_setting',\n request,\n gateway.DeviceGetSettingResponse);\n return response.getValue();\n }\n\n /**\n * Set the sampling start delay.\n * @param interval Delay time between triggering a recording and the first data point being recorded.\n * @param unit Unit of measure the delay is represented in.\n */\n public async setDelay(\n interval: number,\n unit: Time | Native = Units.NATIVE\n ): Promise<void> {\n const request = new gateway.DeviceSetSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setSetting('scope.delay');\n request.setValue(interval);\n request.setUnit(unit);\n\n await gateway.callAsync('device/set_setting', request);\n }\n\n /**\n * Trigger data recording.\n */\n public async start(): Promise<void> {\n const request = new gateway.OscilloscopeStartStopRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setStart(true);\n\n await gateway.callAsync('oscilloscope/start_or_stop', request);\n }\n\n /**\n * End data recording if currently in progress.\n */\n public async stop(): Promise<void> {\n const request = new gateway.OscilloscopeStartStopRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setStart(false);\n\n await gateway.callAsync('oscilloscope/start_or_stop', request);\n }\n\n /**\n * Reads the last-recorded data from the oscilloscope. Will block until any in-progress recording completes.\n * @return Array of recorded channel data arrays, in the order added.\n */\n public async read(): Promise<OscilloscopeData[]> {\n const request = new gateway.OscilloscopeReadRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n\n const response = await gateway.callAsync<gateway.OscilloscopeReadResponse>(\n 'oscilloscope/read',\n request,\n gateway.OscilloscopeReadResponse);\n return response.getDataIdsList()!.map(id => new OscilloscopeData(this.device, id));\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The public properties of one channel of recorded oscilloscope data.
3
+ */
4
+ export interface OscilloscopeCaptureProperties {
5
+ /**
6
+ * The name of the recorded setting.
7
+ */
8
+ setting: string;
9
+ /**
10
+ * The number of the axis the data was recorded from, or 0 for the controller.
11
+ */
12
+ axisNumber: number;
13
+ }
14
+ export declare namespace OscilloscopeCaptureProperties {
15
+ const __type = "OscilloscopeCaptureProperties";
16
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.OscilloscopeCaptureProperties = void 0;
6
+ var OscilloscopeCaptureProperties;
7
+ (function (OscilloscopeCaptureProperties) {
8
+ OscilloscopeCaptureProperties.__type = 'OscilloscopeCaptureProperties';
9
+ /** @internal */
10
+ function fromProtobuf(pbData) {
11
+ return {
12
+ setting: pbData.setting,
13
+ axisNumber: pbData.axisNumber,
14
+ };
15
+ }
16
+ OscilloscopeCaptureProperties.fromProtobuf = fromProtobuf;
17
+ })(OscilloscopeCaptureProperties = exports.OscilloscopeCaptureProperties || (exports.OscilloscopeCaptureProperties = {}));
18
+ //# sourceMappingURL=oscilloscope_capture_properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oscilloscope_capture_properties.js","sourceRoot":"","sources":["../../../src/ascii/oscilloscope_capture_properties.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAoBtD,IAAiB,6BAA6B,CAU7C;AAVD,WAAiB,6BAA6B;IAC/B,oCAAM,GAAG,+BAA+B,CAAC;IAEtD,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAAsD;QACjF,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;IALe,0CAAY,eAK3B,CAAA;AACH,CAAC,EAVgB,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAU7C","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\n\n/**\n * The public properties of one channel of recorded oscilloscope data.\n */\nexport interface OscilloscopeCaptureProperties {\n /**\n * The name of the recorded setting.\n */\n setting: string;\n\n /**\n * The number of the axis the data was recorded from, or 0 for the controller.\n */\n axisNumber: number;\n\n}\n\nexport namespace OscilloscopeCaptureProperties {\n export const __type = 'OscilloscopeCaptureProperties';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.OscilloscopeCaptureProperties.AsObject): OscilloscopeCaptureProperties {\n return {\n setting: pbData.setting,\n axisNumber: pbData.axisNumber,\n };\n }\n}\n"]}
@@ -0,0 +1,67 @@
1
+ import { Device } from './device';
2
+ import { Native, Time, Units } from '../units';
3
+ /**
4
+ * Contains a block of contiguous recorded data for one channel of the device's oscilloscope.
5
+ */
6
+ export declare class OscilloscopeData {
7
+ /**
8
+ * Device that this Oscilloscope measures.
9
+ */
10
+ get device(): Device;
11
+ private _device;
12
+ /**
13
+ * Unique ID for this block of recorded data.
14
+ */
15
+ get dataId(): number;
16
+ private _dataId;
17
+ /**
18
+ * The name of the recorded setting.
19
+ */
20
+ get setting(): string;
21
+ /**
22
+ * The number of the axis the data was recorded from, or 0 for the controller.
23
+ */
24
+ get axisNumber(): number;
25
+ constructor(device: Device, dataId: number);
26
+ /**
27
+ * Get the sample interval that this data was recorded with.
28
+ * @param unit Unit of measure to represent the timebase in.
29
+ * @return The timebase setting at the time the data was recorded.
30
+ */
31
+ getTimebase(unit?: Time | Native): number;
32
+ /**
33
+ * Get the sample interval that this data was recorded with.
34
+ * @param unit Unit of measure to represent the delay in.
35
+ * @return The delay setting at the time the data was recorded.
36
+ */
37
+ getDelay(unit?: Time | Native): number;
38
+ /**
39
+ * Calculate the time a sample was recorded, relative to when the recording was triggered.
40
+ * @param index 0-based index of the sample to calculate the time of.
41
+ * @param unit Unit of measure to represent the calculated time in.
42
+ * @return The calculated time offset of the data sample at the given index.
43
+ */
44
+ getSampleTime(index: number, unit?: Time | Native): number;
45
+ /**
46
+ * Get the recorded data as an array of doubles.
47
+ * @param unit Unit of measure to convert the data to.
48
+ * @return The recorded data for one oscilloscope channel, converted to the units specified.
49
+ */
50
+ getData(unit?: Units): number[];
51
+ /**
52
+ * Releases native resources of an oscilloscope data buffer.
53
+ * @param dataId The ID of the data buffer to delete.
54
+ */
55
+ private static _free;
56
+ /**
57
+ * Returns recording properties.
58
+ * @return Capture properties.
59
+ */
60
+ private _retrieveProperties;
61
+ /**
62
+ * Releases the native resources of the oscilloscope data.
63
+ * Should only be called if your environment does not support FinalizationRegistry.
64
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
65
+ */
66
+ free(): void;
67
+ }
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ }) : (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ o[k2] = m[k];
10
+ }));
11
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
12
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
13
+ }) : function(o, v) {
14
+ o["default"] = v;
15
+ });
16
+ var __importStar = (this && this.__importStar) || function (mod) {
17
+ if (mod && mod.__esModule) return mod;
18
+ var result = {};
19
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
20
+ __setModuleDefault(result, mod);
21
+ return result;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.OscilloscopeData = void 0;
25
+ const units_1 = require("../units");
26
+ const gateway = __importStar(require("../gateway"));
27
+ const finalizer_1 = require("../finalizer");
28
+ const oscilloscope_capture_properties_1 = require("./oscilloscope_capture_properties");
29
+ /**
30
+ * Contains a block of contiguous recorded data for one channel of the device's oscilloscope.
31
+ */
32
+ class OscilloscopeData {
33
+ constructor(device, dataId) {
34
+ this._device = device;
35
+ this._dataId = dataId;
36
+ (0, finalizer_1.registerForFinalization)(this, OscilloscopeData._free.bind(null, dataId));
37
+ }
38
+ /**
39
+ * Device that this Oscilloscope measures.
40
+ */
41
+ get device() {
42
+ return this._device;
43
+ }
44
+ /**
45
+ * Unique ID for this block of recorded data.
46
+ */
47
+ get dataId() {
48
+ return this._dataId;
49
+ }
50
+ /**
51
+ * The name of the recorded setting.
52
+ */
53
+ get setting() {
54
+ return this._retrieveProperties().setting;
55
+ }
56
+ /**
57
+ * The number of the axis the data was recorded from, or 0 for the controller.
58
+ */
59
+ get axisNumber() {
60
+ return this._retrieveProperties().axisNumber;
61
+ }
62
+ /**
63
+ * Get the sample interval that this data was recorded with.
64
+ * @param unit Unit of measure to represent the timebase in.
65
+ * @return The timebase setting at the time the data was recorded.
66
+ */
67
+ getTimebase(unit = units_1.Units.NATIVE) {
68
+ const request = new gateway.OscilloscopeDataGetSavedSettingRequest();
69
+ request.setInterfaceId(this.device.connection.interfaceId);
70
+ request.setDevice(this.device.deviceAddress);
71
+ request.setDataId(this.dataId);
72
+ request.setUnit(unit);
73
+ const response = gateway.callSync('oscilloscopedata/get_timebase', request, gateway.OscilloscopeDataGetSavedSettingResponse);
74
+ return response.getValue();
75
+ }
76
+ /**
77
+ * Get the sample interval that this data was recorded with.
78
+ * @param unit Unit of measure to represent the delay in.
79
+ * @return The delay setting at the time the data was recorded.
80
+ */
81
+ getDelay(unit = units_1.Units.NATIVE) {
82
+ const request = new gateway.OscilloscopeDataGetSavedSettingRequest();
83
+ request.setInterfaceId(this.device.connection.interfaceId);
84
+ request.setDevice(this.device.deviceAddress);
85
+ request.setDataId(this.dataId);
86
+ request.setUnit(unit);
87
+ const response = gateway.callSync('oscilloscopedata/get_delay', request, gateway.OscilloscopeDataGetSavedSettingResponse);
88
+ return response.getValue();
89
+ }
90
+ /**
91
+ * Calculate the time a sample was recorded, relative to when the recording was triggered.
92
+ * @param index 0-based index of the sample to calculate the time of.
93
+ * @param unit Unit of measure to represent the calculated time in.
94
+ * @return The calculated time offset of the data sample at the given index.
95
+ */
96
+ getSampleTime(index, unit = units_1.Units.NATIVE) {
97
+ const request = new gateway.OscilloscopeDataGetSampleTimeRequest();
98
+ request.setInterfaceId(this.device.connection.interfaceId);
99
+ request.setDevice(this.device.deviceAddress);
100
+ request.setDataId(this.dataId);
101
+ request.setIndex(index);
102
+ request.setUnit(unit);
103
+ const response = gateway.callSync('oscilloscopedata/get_sample_time', request, gateway.OscilloscopeDataGetSavedSettingResponse);
104
+ return response.getValue();
105
+ }
106
+ /**
107
+ * Get the recorded data as an array of doubles.
108
+ * @param unit Unit of measure to convert the data to.
109
+ * @return The recorded data for one oscilloscope channel, converted to the units specified.
110
+ */
111
+ getData(unit = units_1.Units.NATIVE) {
112
+ const request = new gateway.OscilloscopeDataGetSamplesRequest();
113
+ request.setInterfaceId(this.device.connection.interfaceId);
114
+ request.setDevice(this.device.deviceAddress);
115
+ request.setDataId(this.dataId);
116
+ request.setUnit(unit);
117
+ const response = gateway.callSync('oscilloscopedata/get_samples', request, gateway.OscilloscopeDataGetSamplesResponse);
118
+ return response.getDataList();
119
+ }
120
+ /**
121
+ * Releases native resources of an oscilloscope data buffer.
122
+ * @param dataId The ID of the data buffer to delete.
123
+ */
124
+ static _free(dataId) {
125
+ const request = new gateway.OscilloscopeDataIdentifier();
126
+ request.setDataId(dataId);
127
+ gateway.callSync('oscilloscopedata/free', request);
128
+ }
129
+ /**
130
+ * Returns recording properties.
131
+ * @return Capture properties.
132
+ */
133
+ _retrieveProperties() {
134
+ const request = new gateway.OscilloscopeDataIdentifier();
135
+ request.setInterfaceId(this.device.connection.interfaceId);
136
+ request.setDevice(this.device.deviceAddress);
137
+ request.setDataId(this.dataId);
138
+ const response = gateway.callSync('oscilloscopedata/get_properties', request, gateway.OscilloscopeDataGetPropertiesResponse);
139
+ return oscilloscope_capture_properties_1.OscilloscopeCaptureProperties.fromProtobuf(response.getProperties().toObject());
140
+ }
141
+ /**
142
+ * Releases the native resources of the oscilloscope data.
143
+ * Should only be called if your environment does not support FinalizationRegistry.
144
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
145
+ */
146
+ free() {
147
+ OscilloscopeData._free(this.dataId);
148
+ }
149
+ }
150
+ exports.OscilloscopeData = OscilloscopeData;
151
+ //# sourceMappingURL=oscilloscope_data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oscilloscope_data.js","sourceRoot":"","sources":["../../../src/ascii/oscilloscope_data.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAGtD,oCAA+C;AAC/C,oDAAsC;AACtC,4CAAuD;AAEvD,uFAAkF;AAElF;;GAEG;AACH,MAAa,gBAAgB;IA+B3B,YAAY,MAAc,EAAE,MAAc;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAA,mCAAuB,EAAC,IAAI,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3E,CAAC;IAlCD;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAGD;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAGD;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,UAAU,CAAC;IAC/C,CAAC;IAQD;;;;OAIG;I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BAAuB,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACK,mBAAmB;QACzB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,0BAA0B,EAAE,CAAC;QACzD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7C,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE/B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,iCAAiC,EACjC,OAAO,EACP,OAAO,CAAC,qCAAqC,CAAC,CAAC;QACjD,OAAO,+DAA6B,CAAC,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF;AAlKD,4CAkKC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Device } from './device';\nimport { Native, Time, Units } from '../units';\nimport * as gateway from '../gateway';\nimport { registerForFinalization } from '../finalizer';\n\nimport { OscilloscopeCaptureProperties } from './oscilloscope_capture_properties';\n\n/**\n * Contains a block of contiguous recorded data for one channel of the device's oscilloscope.\n */\nexport class OscilloscopeData {\n /**\n * Device that this Oscilloscope measures.\n */\n public get device(): Device {\n return this._device;\n }\n private _device: Device;\n\n /**\n * Unique ID for this block of recorded data.\n */\n public get dataId(): number {\n return this._dataId;\n }\n private _dataId: number;\n\n /**\n * The name of the recorded setting.\n */\n public get setting(): string {\n return this._retrieveProperties().setting;\n }\n\n /**\n * The number of the axis the data was recorded from, or 0 for the controller.\n */\n public get axisNumber(): number {\n return this._retrieveProperties().axisNumber;\n }\n\n constructor(device: Device, dataId: number) {\n this._device = device;\n this._dataId = dataId;\n registerForFinalization(this, OscilloscopeData._free.bind(null, dataId));\n }\n\n /**\n * Get the sample interval that this data was recorded with.\n * @param unit Unit of measure to represent the timebase in.\n * @return The timebase setting at the time the data was recorded.\n */\n public getTimebase(\n unit: Time | Native = Units.NATIVE\n ): number {\n const request = new gateway.OscilloscopeDataGetSavedSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSavedSettingResponse>(\n 'oscilloscopedata/get_timebase',\n request,\n gateway.OscilloscopeDataGetSavedSettingResponse);\n return response.getValue();\n }\n\n /**\n * Get the sample interval that this data was recorded with.\n * @param unit Unit of measure to represent the delay in.\n * @return The delay setting at the time the data was recorded.\n */\n public getDelay(\n unit: Time | Native = Units.NATIVE\n ): number {\n const request = new gateway.OscilloscopeDataGetSavedSettingRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSavedSettingResponse>(\n 'oscilloscopedata/get_delay',\n request,\n gateway.OscilloscopeDataGetSavedSettingResponse);\n return response.getValue();\n }\n\n /**\n * Calculate the time a sample was recorded, relative to when the recording was triggered.\n * @param index 0-based index of the sample to calculate the time of.\n * @param unit Unit of measure to represent the calculated time in.\n * @return The calculated time offset of the data sample at the given index.\n */\n public getSampleTime(\n index: number,\n unit: Time | Native = Units.NATIVE\n ): number {\n const request = new gateway.OscilloscopeDataGetSampleTimeRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setIndex(index);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSavedSettingResponse>(\n 'oscilloscopedata/get_sample_time',\n request,\n gateway.OscilloscopeDataGetSavedSettingResponse);\n return response.getValue();\n }\n\n /**\n * Get the recorded data as an array of doubles.\n * @param unit Unit of measure to convert the data to.\n * @return The recorded data for one oscilloscope channel, converted to the units specified.\n */\n public getData(\n unit: Units = Units.NATIVE\n ): number[] {\n const request = new gateway.OscilloscopeDataGetSamplesRequest();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetSamplesResponse>(\n 'oscilloscopedata/get_samples',\n request,\n gateway.OscilloscopeDataGetSamplesResponse);\n return response.getDataList();\n }\n\n /**\n * Releases native resources of an oscilloscope data buffer.\n * @param dataId The ID of the data buffer to delete.\n */\n private static _free(\n dataId: number\n ): void {\n const request = new gateway.OscilloscopeDataIdentifier();\n request.setDataId(dataId);\n\n gateway.callSync('oscilloscopedata/free', request);\n }\n\n /**\n * Returns recording properties.\n * @return Capture properties.\n */\n private _retrieveProperties(): OscilloscopeCaptureProperties {\n const request = new gateway.OscilloscopeDataIdentifier();\n request.setInterfaceId(this.device.connection.interfaceId);\n request.setDevice(this.device.deviceAddress);\n request.setDataId(this.dataId);\n\n const response = gateway.callSync<gateway.OscilloscopeDataGetPropertiesResponse>(\n 'oscilloscopedata/get_properties',\n request,\n gateway.OscilloscopeDataGetPropertiesResponse);\n return OscilloscopeCaptureProperties.fromProtobuf(response.getProperties()!.toObject());\n }\n\n /**\n * Releases the native resources of the oscilloscope data.\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 OscilloscopeData._free(this.dataId);\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { ServoTuningParam } from './servo_tuning_param';
2
+ /**
3
+ * The raw parameters currently saved to a given paramset.
4
+ */
5
+ export interface ParamsetInfo {
6
+ /**
7
+ * The tuning algorithm used for this axis.
8
+ */
9
+ type: string;
10
+ /**
11
+ * The raw tuning parameters of this device.
12
+ */
13
+ params: ServoTuningParam[];
14
+ }
15
+ export declare namespace ParamsetInfo {
16
+ const __type = "ParamsetInfo";
17
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.ParamsetInfo = void 0;
6
+ const servo_tuning_param_1 = require("./servo_tuning_param");
7
+ var ParamsetInfo;
8
+ (function (ParamsetInfo) {
9
+ ParamsetInfo.__type = 'ParamsetInfo';
10
+ /** @internal */
11
+ function fromProtobuf(pbData) {
12
+ return {
13
+ type: pbData.type,
14
+ params: pbData.paramsList.map(item => servo_tuning_param_1.ServoTuningParam.fromProtobuf(item)),
15
+ };
16
+ }
17
+ ParamsetInfo.fromProtobuf = fromProtobuf;
18
+ })(ParamsetInfo = exports.ParamsetInfo || (exports.ParamsetInfo = {}));
19
+ //# sourceMappingURL=paramset_info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paramset_info.js","sourceRoot":"","sources":["../../../src/ascii/paramset_info.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAGtD,6DAAwD;AAkBxD,IAAiB,YAAY,CAU5B;AAVD,WAAiB,YAAY;IACd,mBAAM,GAAG,cAAc,CAAC;IAErC,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAAqC;QAChE,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,qCAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;SAC3E,CAAC;IACJ,CAAC;IALe,yBAAY,eAK3B,CAAA;AACH,CAAC,EAVgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAU5B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { ServoTuningParam } from './servo_tuning_param';\n\n/**\n * The raw parameters currently saved to a given paramset.\n */\nexport interface ParamsetInfo {\n /**\n * The tuning algorithm used for this axis.\n */\n type: string;\n\n /**\n * The raw tuning parameters of this device.\n */\n params: ServoTuningParam[];\n\n}\n\nexport namespace ParamsetInfo {\n export const __type = 'ParamsetInfo';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.ParamsetInfo.AsObject): ParamsetInfo {\n return {\n type: pbData.type,\n params: pbData.paramsList.map(item => ServoTuningParam.fromProtobuf(item)),\n };\n }\n}\n"]}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The tuning of this axis represented by PID parameters.
3
+ */
4
+ export interface PidTuning {
5
+ /**
6
+ * The tuning algorithm used to tune this axis.
7
+ */
8
+ type: string;
9
+ /**
10
+ * The version of the tuning algorithm used to tune this axis.
11
+ */
12
+ version: number;
13
+ /**
14
+ * The positional tuning argument.
15
+ */
16
+ p: number;
17
+ /**
18
+ * The integral tuning argument.
19
+ */
20
+ i: number;
21
+ /**
22
+ * The derivative tuning argument.
23
+ */
24
+ d: number;
25
+ /**
26
+ * The frequency cutoff for the tuning.
27
+ */
28
+ fc: number;
29
+ }
30
+ export declare namespace PidTuning {
31
+ const __type = "PidTuning";
32
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //
3
+ // ============= DO NOT EDIT DIRECTLY ============= //
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PidTuning = void 0;
6
+ var PidTuning;
7
+ (function (PidTuning) {
8
+ PidTuning.__type = 'PidTuning';
9
+ /** @internal */
10
+ function fromProtobuf(pbData) {
11
+ return {
12
+ type: pbData.type,
13
+ version: pbData.version,
14
+ p: pbData.p,
15
+ i: pbData.i,
16
+ d: pbData.d,
17
+ fc: pbData.fc,
18
+ };
19
+ }
20
+ PidTuning.fromProtobuf = fromProtobuf;
21
+ })(PidTuning = exports.PidTuning || (exports.PidTuning = {}));
22
+ //# sourceMappingURL=pid_tuning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pid_tuning.js","sourceRoot":"","sources":["../../../src/ascii/pid_tuning.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAwCtD,IAAiB,SAAS,CAczB;AAdD,WAAiB,SAAS;IACX,gBAAM,GAAG,WAAW,CAAC;IAElC,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAAkC;QAC7D,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,CAAC,EAAE,MAAM,CAAC,CAAC;YACX,CAAC,EAAE,MAAM,CAAC,CAAC;YACX,CAAC,EAAE,MAAM,CAAC,CAAC;YACX,EAAE,EAAE,MAAM,CAAC,EAAE;SACd,CAAC;IACJ,CAAC;IATe,sBAAY,eAS3B,CAAA;AACH,CAAC,EAdgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAczB","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\n\n/**\n * The tuning of this axis represented by PID parameters.\n */\nexport interface PidTuning {\n /**\n * The tuning algorithm used to tune this axis.\n */\n type: string;\n\n /**\n * The version of the tuning algorithm used to tune this axis.\n */\n version: number;\n\n /**\n * The positional tuning argument.\n */\n p: number;\n\n /**\n * The integral tuning argument.\n */\n i: number;\n\n /**\n * The derivative tuning argument.\n */\n d: number;\n\n /**\n * The frequency cutoff for the tuning.\n */\n fc: number;\n\n}\n\nexport namespace PidTuning {\n export const __type = 'PidTuning';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.PidTuning.AsObject): PidTuning {\n return {\n type: pbData.type,\n version: pbData.version,\n p: pbData.p,\n i: pbData.i,\n d: pbData.d,\n fc: pbData.fc,\n };\n }\n}\n"]}
@@ -0,0 +1,77 @@
1
+ import { Axis } from './axis';
2
+ import { ServoTuningParamset } from './servo_tuning_paramset';
3
+ import { ParamsetInfo } from './paramset_info';
4
+ import { ServoTuningParam } from './servo_tuning_param';
5
+ import { PidTuning } from './pid_tuning';
6
+ import { SimpleTuningParam } from './simple_tuning_param';
7
+ /**
8
+ * Exposes the capabilities to inspect and edit an axis' servo tuning.
9
+ */
10
+ export declare class ServoTuner {
11
+ /**
12
+ * The axis that will be tuned.
13
+ */
14
+ get axis(): Axis;
15
+ private _axis;
16
+ constructor(axis: Axis);
17
+ /**
18
+ * Get the paramset that this device uses by default when it starts up.
19
+ * @return The paramset used at when the device restarts.
20
+ */
21
+ getStartupParamset(): Promise<ServoTuningParamset>;
22
+ /**
23
+ * Set the paramset that this device uses by default when it starts up.
24
+ * @param paramset The paramset to use at startup.
25
+ */
26
+ setStartupParamset(paramset: ServoTuningParamset): Promise<void>;
27
+ /**
28
+ * Load the values from one paramset into another.
29
+ * @param toParamset The paramset to load into.
30
+ * @param fromParamset The paramset to load from.
31
+ */
32
+ loadParamset(toParamset: ServoTuningParamset, fromParamset: ServoTuningParamset): Promise<void>;
33
+ /**
34
+ * Get the full set of tuning parameters used by the firmware driving this axis.
35
+ * @param paramset The paramset to get tuning for.
36
+ * @return The raw representation of the current tuning.
37
+ */
38
+ getTuning(paramset: ServoTuningParamset): Promise<ParamsetInfo>;
39
+ /**
40
+ * Set individual tuning parameters.
41
+ * Only use this method if you have a strong understanding of Zaber specific tuning parameters.
42
+ * @param paramset The paramset to set tuning of.
43
+ * @param tuningParams The params to set.
44
+ */
45
+ setTuning(paramset: ServoTuningParamset, tuningParams: ServoTuningParam[]): Promise<void>;
46
+ /**
47
+ * Sets the tuning of a paramset using the PID method.
48
+ * @param paramset The paramset to get tuning for.
49
+ * @param p The proportional gain. Must be in units of N/m.
50
+ * @param i The integral gain. Must be in units of N/m⋅s.
51
+ * @param d The derivative gain. Must be in units of N⋅s/m.
52
+ * @param fc The cutoff frequency. Must be in units of Hz.
53
+ * @return The PID representation of the current tuning after your changes have been applied.
54
+ */
55
+ setPidTuning(paramset: ServoTuningParamset, p: number, i: number, d: number, fc: number): Promise<PidTuning>;
56
+ /**
57
+ * Gets the PID representation of this paramset's servo tuning.
58
+ * @param paramset The paramset to get tuning for.
59
+ * @return The PID representation of the current tuning.
60
+ */
61
+ getPidTuning(paramset: ServoTuningParamset): Promise<PidTuning>;
62
+ /**
63
+ * Gets the parameters that are required to tune this device.
64
+ * @return The tuning parameters.
65
+ */
66
+ getSimpleTuningParamList(): Promise<SimpleTuningParam[]>;
67
+ /**
68
+ * Set the tuning of this device using the simple input method.
69
+ * @param paramset The paramset to set tuning for.
70
+ * @param tuningParams The params used to tune this device.
71
+ * To get what parameters are expected, call GetSimpleTuningParamList.
72
+ * All values must be between 0 and 1.
73
+ * @param loadMass The mass loaded on the stage (excluding the mass of the carriage itself) in kg.
74
+ * @param carriageMass The mass of the carriage in kg. If this value is not set the default carriage mass is used.
75
+ */
76
+ setSimpleTuning(paramset: ServoTuningParamset, tuningParams: ServoTuningParam[], loadMass: number, carriageMass?: number): Promise<void>;
77
+ }