@zaber/motion 2.10.0 → 2.11.1
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/dist/binding/wasm/zaber-motion-lib.wasm +0 -0
- package/dist/lib/ascii/connection.d.ts +11 -0
- package/dist/lib/ascii/connection.js +11 -0
- package/dist/lib/ascii/connection.js.map +1 -1
- package/dist/lib/ascii/index.d.ts +6 -0
- package/dist/lib/ascii/index.js +13 -1
- package/dist/lib/ascii/index.js.map +1 -1
- package/dist/lib/ascii/paramset_info.d.ts +17 -0
- package/dist/lib/ascii/paramset_info.js +19 -0
- package/dist/lib/ascii/paramset_info.js.map +1 -0
- package/dist/lib/ascii/pid_tuning.d.ts +32 -0
- package/dist/lib/ascii/pid_tuning.js +22 -0
- package/dist/lib/ascii/pid_tuning.js.map +1 -0
- package/dist/lib/ascii/servo_tuner.d.ts +77 -0
- package/dist/lib/ascii/servo_tuner.js +180 -0
- package/dist/lib/ascii/servo_tuner.js.map +1 -0
- package/dist/lib/ascii/servo_tuning_param.d.ts +16 -0
- package/dist/lib/ascii/servo_tuning_param.js +49 -0
- package/dist/lib/ascii/servo_tuning_param.js.map +1 -0
- package/dist/lib/ascii/servo_tuning_paramset.d.ts +17 -0
- package/dist/lib/ascii/servo_tuning_paramset.js +24 -0
- package/dist/lib/ascii/servo_tuning_paramset.js.map +1 -0
- package/dist/lib/ascii/simple_tuning_param.d.ts +24 -0
- package/dist/lib/ascii/simple_tuning_param.js +20 -0
- package/dist/lib/ascii/simple_tuning_param.js.map +1 -0
- package/dist/lib/ascii_ns.d.ts +12 -0
- package/dist/lib/ascii_ns.js +6 -0
- package/dist/lib/ascii_ns.js.map +1 -1
- package/dist/lib/gcode/offline_translator.d.ts +11 -3
- package/dist/lib/gcode/offline_translator.js +19 -4
- package/dist/lib/gcode/offline_translator.js.map +1 -1
- package/dist/lib/gcode/translator.d.ts +11 -3
- package/dist/lib/gcode/translator.js +19 -4
- package/dist/lib/gcode/translator.js.map +1 -1
- package/dist/lib/protobufs/main_pb.d.ts +452 -0
- package/dist/lib/protobufs/main_pb.js +3490 -4
- package/dist/lib/protobufs/main_pb.js.map +1 -1
- package/dist/lib/tools.d.ts +6 -0
- package/dist/lib/tools.js +10 -0
- package/dist/lib/tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servo_tuner.js","sourceRoot":"","sources":["../../../src/ascii/servo_tuner.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAGtD,oDAAsC;AAEtC,mDAA+C;AAC/C,6DAAwD;AACxD,6CAAyC;AACzC,+DAA0D;AAE1D;;GAEG;AACH,MAAa,UAAU;IASrB,YAAY,IAAU;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAVD;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAOD;;;OAGG;IACI,KAAK,CAAC,kBAAkB;QAC7B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;QACjD,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAChE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAClD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEtC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CACtC,6BAA6B,EAC7B,OAAO,EACP,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3B,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,kBAAkB,CAC7B,QAA6B;QAE7B,MAAM,OAAO,GAAG,IAA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MAAM,OAAO,CAAC,SAAS,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;CACF;AA3MD,gCA2MC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport { Axis } from './axis';\nimport * as gateway from '../gateway';\nimport { ServoTuningParamset } from './servo_tuning_paramset';\nimport { ParamsetInfo } from './paramset_info';\nimport { ServoTuningParam } from './servo_tuning_param';\nimport { PidTuning } from './pid_tuning';\nimport { SimpleTuningParam } from './simple_tuning_param';\n\n/**\n * Exposes the capabilities to inspect and edit an axis' servo tuning.\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 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 * @return The paramset used at when the device restarts.\n */\n public async getStartupParamset(): Promise<ServoTuningParamset> {\n const request = new gateway.GetStartupParamset();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n\n const response = await gateway.callAsync<gateway.StartupParamset>(\n 'servotuning/get_startup_set',\n request,\n gateway.StartupParamset);\n return response.getParamset();\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 = new gateway.ServoTuningRequest();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n request.setParamset(paramset as any);\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 = new gateway.LoadParamset();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n request.setToParamset(toParamset as any);\n request.setFromParamset(fromParamset as any);\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 * @return The raw representation of the current tuning.\n */\n public async getTuning(\n paramset: ServoTuningParamset\n ): Promise<ParamsetInfo> {\n const request = new gateway.ServoTuningRequest();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n request.setParamset(paramset as any);\n\n const response = await gateway.callAsync<gateway.ParamsetInfo>(\n 'servotuning/get_raw',\n request,\n gateway.ParamsetInfo);\n return ParamsetInfo.fromProtobuf(response.toObject());\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 */\n public async setTuning(\n paramset: ServoTuningParamset,\n tuningParams: ServoTuningParam[]\n ): Promise<void> {\n const request = new gateway.SetServoTuningRequest();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n request.setParamset(paramset as any);\n request.setTuningParamsList(tuningParams.map(ServoTuningParam.toProtobuf));\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 * @return 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 = new gateway.SetServoTuningPIDRequest();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n request.setParamset(paramset as any);\n request.setP(p);\n request.setI(i);\n request.setD(d);\n request.setFc(fc);\n\n const response = await gateway.callAsync<gateway.PidTuning>(\n 'servotuning/set_pid',\n request,\n gateway.PidTuning);\n return PidTuning.fromProtobuf(response.toObject());\n }\n\n /**\n * Gets the PID representation of this paramset's servo tuning.\n * @param paramset The paramset to get tuning for.\n * @return The PID representation of the current tuning.\n */\n public async getPidTuning(\n paramset: ServoTuningParamset\n ): Promise<PidTuning> {\n const request = new gateway.ServoTuningRequest();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n request.setParamset(paramset as any);\n\n const response = await gateway.callAsync<gateway.PidTuning>(\n 'servotuning/get_pid',\n request,\n gateway.PidTuning);\n return PidTuning.fromProtobuf(response.toObject());\n }\n\n /**\n * Gets the parameters that are required to tune this device.\n * @return The tuning parameters.\n */\n public async getSimpleTuningParamList(): Promise<SimpleTuningParam[]> {\n const request = new gateway.GetSimpleTuningParamListRequest();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n\n const response = await gateway.callAsync<gateway.SimpleTuningParamList>(\n 'servotuning/get_simple_params',\n request,\n gateway.SimpleTuningParamList);\n return response.toObject().paramsList.map(SimpleTuningParam.fromProtobuf);\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 carriageMass 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 carriageMass: number = -1.0\n ): Promise<void> {\n const request = new gateway.SetSimpleTuning();\n request.setInterfaceId(this.axis.device.connection.interfaceId);\n request.setDevice(this.axis.device.deviceAddress);\n request.setAxis(this.axis.axisNumber);\n request.setParamset(paramset as any);\n request.setTuningParamsList(tuningParams.map(ServoTuningParam.toProtobuf));\n request.setLoadMass(loadMass);\n request.setCarriageMass(carriageMass);\n\n await gateway.callAsync('servotuning/set_simple_tuning', request);\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A parameter used to establish the servo tuning of an axis.
|
|
3
|
+
*/
|
|
4
|
+
export interface ServoTuningParam {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the parameter to set.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The value to use for this parameter.
|
|
11
|
+
*/
|
|
12
|
+
value: number;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace ServoTuningParam {
|
|
15
|
+
const __type = "ServoTuningParam";
|
|
16
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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.ServoTuningParam = void 0;
|
|
25
|
+
const gateway = __importStar(require("../gateway"));
|
|
26
|
+
var ServoTuningParam;
|
|
27
|
+
(function (ServoTuningParam) {
|
|
28
|
+
ServoTuningParam.__type = 'ServoTuningParam';
|
|
29
|
+
/** @internal */
|
|
30
|
+
function fromProtobuf(pbData) {
|
|
31
|
+
return {
|
|
32
|
+
name: pbData.name,
|
|
33
|
+
value: pbData.value,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
ServoTuningParam.fromProtobuf = fromProtobuf;
|
|
37
|
+
/** @internal */
|
|
38
|
+
function toProtobuf(source) {
|
|
39
|
+
const pbData = new gateway.ServoTuningParam();
|
|
40
|
+
if (source == null) {
|
|
41
|
+
return pbData;
|
|
42
|
+
}
|
|
43
|
+
pbData.setName(source.name);
|
|
44
|
+
pbData.setValue(source.value);
|
|
45
|
+
return pbData;
|
|
46
|
+
}
|
|
47
|
+
ServoTuningParam.toProtobuf = toProtobuf;
|
|
48
|
+
})(ServoTuningParam = exports.ServoTuningParam || (exports.ServoTuningParam = {}));
|
|
49
|
+
//# sourceMappingURL=servo_tuning_param.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servo_tuning_param.js","sourceRoot":"","sources":["../../../src/ascii/servo_tuning_param.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AAkBtC,IAAiB,gBAAgB,CAqBhC;AArBD,WAAiB,gBAAgB;IAClB,uBAAM,GAAG,kBAAkB,CAAC;IAEzC,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAAyC;QACpE,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;IALe,6BAAY,eAK3B,CAAA;IACD,gBAAgB;IAChB,SAAgB,UAAU,CAAC,MAA2C;QACpE,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC9C,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,OAAO,MAAM,CAAC;SACf;QAED,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;IATe,2BAAU,aASzB,CAAA;AACH,CAAC,EArBgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAqBhC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\n\n/**\n * A parameter used to establish the servo tuning of an axis.\n */\nexport interface ServoTuningParam {\n /**\n * The name of the parameter to set.\n */\n name: string;\n\n /**\n * The value to use for this parameter.\n */\n value: number;\n\n}\n\nexport namespace ServoTuningParam {\n export const __type = 'ServoTuningParam';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.ServoTuningParam.AsObject): ServoTuningParam {\n return {\n name: pbData.name,\n value: pbData.value,\n };\n }\n /** @internal */\n export function toProtobuf(source: ServoTuningParam | null | undefined): gateway.ServoTuningParam {\n const pbData = new gateway.ServoTuningParam();\n if (source == null) {\n return pbData;\n }\n\n pbData.setName(source.name);\n pbData.setValue(source.value);\n return pbData;\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Servo Tuning Parameter Set to target.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum ServoTuningParamset {
|
|
5
|
+
LIVE = 0,
|
|
6
|
+
P_1 = 1,
|
|
7
|
+
P_2 = 2,
|
|
8
|
+
P_3 = 3,
|
|
9
|
+
P_4 = 4,
|
|
10
|
+
P_5 = 5,
|
|
11
|
+
P_6 = 6,
|
|
12
|
+
P_7 = 7,
|
|
13
|
+
P_8 = 8,
|
|
14
|
+
P_9 = 9,
|
|
15
|
+
STAGING = 10,
|
|
16
|
+
DEFAULT = 11
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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.ServoTuningParamset = void 0;
|
|
6
|
+
/**
|
|
7
|
+
* Servo Tuning Parameter Set to target.
|
|
8
|
+
*/
|
|
9
|
+
var ServoTuningParamset;
|
|
10
|
+
(function (ServoTuningParamset) {
|
|
11
|
+
ServoTuningParamset[ServoTuningParamset["LIVE"] = 0] = "LIVE";
|
|
12
|
+
ServoTuningParamset[ServoTuningParamset["P_1"] = 1] = "P_1";
|
|
13
|
+
ServoTuningParamset[ServoTuningParamset["P_2"] = 2] = "P_2";
|
|
14
|
+
ServoTuningParamset[ServoTuningParamset["P_3"] = 3] = "P_3";
|
|
15
|
+
ServoTuningParamset[ServoTuningParamset["P_4"] = 4] = "P_4";
|
|
16
|
+
ServoTuningParamset[ServoTuningParamset["P_5"] = 5] = "P_5";
|
|
17
|
+
ServoTuningParamset[ServoTuningParamset["P_6"] = 6] = "P_6";
|
|
18
|
+
ServoTuningParamset[ServoTuningParamset["P_7"] = 7] = "P_7";
|
|
19
|
+
ServoTuningParamset[ServoTuningParamset["P_8"] = 8] = "P_8";
|
|
20
|
+
ServoTuningParamset[ServoTuningParamset["P_9"] = 9] = "P_9";
|
|
21
|
+
ServoTuningParamset[ServoTuningParamset["STAGING"] = 10] = "STAGING";
|
|
22
|
+
ServoTuningParamset[ServoTuningParamset["DEFAULT"] = 11] = "DEFAULT";
|
|
23
|
+
})(ServoTuningParamset = exports.ServoTuningParamset || (exports.ServoTuningParamset = {}));
|
|
24
|
+
//# sourceMappingURL=servo_tuning_paramset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servo_tuning_paramset.js","sourceRoot":"","sources":["../../../src/ascii/servo_tuning_paramset.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AAEtD;;GAEG;AACH,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC7B,6DAAQ,CAAA;IACR,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,2DAAO,CAAA;IACP,oEAAY,CAAA;IACZ,oEAAY,CAAA;AACd,CAAC,EAbW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAa9B","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\n/**\n * Servo Tuning Parameter Set to target.\n */\nexport enum ServoTuningParamset {\n LIVE = 0,\n P_1 = 1,\n P_2 = 2,\n P_3 = 3,\n P_4 = 4,\n P_5 = 5,\n P_6 = 6,\n P_7 = 7,\n P_8 = 8,\n P_9 = 9,\n STAGING = 10,\n DEFAULT = 11,\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a parameter used for the simple tuning method.
|
|
3
|
+
*/
|
|
4
|
+
export interface SimpleTuningParam {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the parameter.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The human readable description of the effect of a lower value on this setting.
|
|
11
|
+
*/
|
|
12
|
+
minLabel: string;
|
|
13
|
+
/**
|
|
14
|
+
* The human readable description of the effect of a higher value on this setting.
|
|
15
|
+
*/
|
|
16
|
+
maxLabel: string;
|
|
17
|
+
/**
|
|
18
|
+
* How this parameter will be parsed by the tuner.
|
|
19
|
+
*/
|
|
20
|
+
dataType: string;
|
|
21
|
+
}
|
|
22
|
+
export declare namespace SimpleTuningParam {
|
|
23
|
+
const __type = "SimpleTuningParam";
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.SimpleTuningParam = void 0;
|
|
6
|
+
var SimpleTuningParam;
|
|
7
|
+
(function (SimpleTuningParam) {
|
|
8
|
+
SimpleTuningParam.__type = 'SimpleTuningParam';
|
|
9
|
+
/** @internal */
|
|
10
|
+
function fromProtobuf(pbData) {
|
|
11
|
+
return {
|
|
12
|
+
name: pbData.name,
|
|
13
|
+
minLabel: pbData.minLabel,
|
|
14
|
+
maxLabel: pbData.maxLabel,
|
|
15
|
+
dataType: pbData.dataType,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
SimpleTuningParam.fromProtobuf = fromProtobuf;
|
|
19
|
+
})(SimpleTuningParam = exports.SimpleTuningParam || (exports.SimpleTuningParam = {}));
|
|
20
|
+
//# sourceMappingURL=simple_tuning_param.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple_tuning_param.js","sourceRoot":"","sources":["../../../src/ascii/simple_tuning_param.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;AA8BtD,IAAiB,iBAAiB,CAYjC;AAZD,WAAiB,iBAAiB;IACnB,wBAAM,GAAG,mBAAmB,CAAC;IAE1C,gBAAgB;IAChB,SAAgB,YAAY,CAAC,MAA0C;QACrE,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC;IACJ,CAAC;IAPe,8BAAY,eAO3B,CAAA;AACH,CAAC,EAZgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAYjC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\n\n/**\n * Information about a parameter used for the simple tuning method.\n */\nexport interface SimpleTuningParam {\n /**\n * The name of the parameter.\n */\n name: string;\n\n /**\n * The human readable description of the effect of a lower value on this setting.\n */\n minLabel: string;\n\n /**\n * The human readable description of the effect of a higher value on this setting.\n */\n maxLabel: string;\n\n /**\n * How this parameter will be parsed by the tuner.\n */\n dataType: string;\n\n}\n\nexport namespace SimpleTuningParam {\n export const __type = 'SimpleTuningParam';\n\n /** @internal */\n export function fromProtobuf(pbData: gateway.SimpleTuningParam.AsObject): SimpleTuningParam {\n return {\n name: pbData.name,\n minLabel: pbData.minLabel,\n maxLabel: pbData.maxLabel,\n dataType: pbData.dataType,\n };\n }\n}\n"]}
|
package/dist/lib/ascii_ns.d.ts
CHANGED
|
@@ -58,4 +58,16 @@ export declare namespace ascii {
|
|
|
58
58
|
type StreamAxisDefinition = asciiImport.StreamAxisDefinition;
|
|
59
59
|
const Transport: typeof asciiImport.Transport;
|
|
60
60
|
type Transport = asciiImport.Transport;
|
|
61
|
+
const ServoTuner: typeof asciiImport.ServoTuner;
|
|
62
|
+
type ServoTuner = asciiImport.ServoTuner;
|
|
63
|
+
const ServoTuningParamset: typeof asciiImport.ServoTuningParamset;
|
|
64
|
+
type ServoTuningParamset = asciiImport.ServoTuningParamset;
|
|
65
|
+
const ParamsetInfo: typeof asciiImport.ParamsetInfo;
|
|
66
|
+
type ParamsetInfo = asciiImport.ParamsetInfo;
|
|
67
|
+
const PidTuning: typeof asciiImport.PidTuning;
|
|
68
|
+
type PidTuning = asciiImport.PidTuning;
|
|
69
|
+
const ServoTuningParam: typeof asciiImport.ServoTuningParam;
|
|
70
|
+
type ServoTuningParam = asciiImport.ServoTuningParam;
|
|
71
|
+
const SimpleTuningParam: typeof asciiImport.SimpleTuningParam;
|
|
72
|
+
type SimpleTuningParam = asciiImport.SimpleTuningParam;
|
|
61
73
|
}
|
package/dist/lib/ascii_ns.js
CHANGED
|
@@ -52,5 +52,11 @@ var ascii;
|
|
|
52
52
|
ascii.StreamAxisType = asciiImport.StreamAxisType;
|
|
53
53
|
ascii.StreamAxisDefinition = asciiImport.StreamAxisDefinition;
|
|
54
54
|
ascii.Transport = asciiImport.Transport;
|
|
55
|
+
ascii.ServoTuner = asciiImport.ServoTuner;
|
|
56
|
+
ascii.ServoTuningParamset = asciiImport.ServoTuningParamset;
|
|
57
|
+
ascii.ParamsetInfo = asciiImport.ParamsetInfo;
|
|
58
|
+
ascii.PidTuning = asciiImport.PidTuning;
|
|
59
|
+
ascii.ServoTuningParam = asciiImport.ServoTuningParam;
|
|
60
|
+
ascii.SimpleTuningParam = asciiImport.SimpleTuningParam;
|
|
55
61
|
})(ascii = exports.ascii || (exports.ascii = {}));
|
|
56
62
|
//# sourceMappingURL=ascii_ns.js.map
|
package/dist/lib/ascii_ns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ascii_ns.js","sourceRoot":"","sources":["../../src/ascii_ns.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAEvC,IAAiB,KAAK,
|
|
1
|
+
{"version":3,"file":"ascii_ns.js","sourceRoot":"","sources":["../../src/ascii_ns.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;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BAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IAE5C,0BAAoB,GAAG,WAAW,CAAC,oBAAoB,CAAC;IAExD,eAAS,GAAG,WAAW,CAAC,SAAS,CAAC;IAElC,gBAAU,GAAG,WAAW,CAAC,UAAU,CAAC;IAEpC,yBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC;IAEtD,kBAAY,GAAG,WAAW,CAAC,YAAY,CAAC;IAExC,eAAS,GAAG,WAAW,CAAC,SAAS,CAAC;IAElC,sBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IAEhD,uBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;AAEjE,CAAC,EAvEgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAuErB","sourcesContent":["import * as asciiImport from './ascii';\n\nexport namespace ascii {\n export const AlertEvent = asciiImport.AlertEvent;\n export type AlertEvent = asciiImport.AlertEvent;\n export const AllAxes = asciiImport.AllAxes;\n export type AllAxes = asciiImport.AllAxes;\n export const Axis = asciiImport.Axis;\n export type Axis = asciiImport.Axis;\n export const AxisIdentity = asciiImport.AxisIdentity;\n export type AxisIdentity = asciiImport.AxisIdentity;\n export const AxisSettings = asciiImport.AxisSettings;\n export type AxisSettings = asciiImport.AxisSettings;\n export const AxisType = asciiImport.AxisType;\n export type AxisType = asciiImport.AxisType;\n export const Connection = asciiImport.Connection;\n export type Connection = asciiImport.Connection;\n export const Device = asciiImport.Device;\n export type Device = asciiImport.Device;\n export const DeviceIO = asciiImport.DeviceIO;\n export type DeviceIO = asciiImport.DeviceIO;\n export const DeviceIOInfo = asciiImport.DeviceIOInfo;\n export type DeviceIOInfo = asciiImport.DeviceIOInfo;\n export const DeviceIdentity = asciiImport.DeviceIdentity;\n export type DeviceIdentity = asciiImport.DeviceIdentity;\n export const DeviceSettings = asciiImport.DeviceSettings;\n export type DeviceSettings = asciiImport.DeviceSettings;\n export const Lockstep = asciiImport.Lockstep;\n export type Lockstep = asciiImport.Lockstep;\n export const LockstepAxes = asciiImport.LockstepAxes;\n export type LockstepAxes = asciiImport.LockstepAxes;\n export const Oscilloscope = asciiImport.Oscilloscope;\n export type Oscilloscope = asciiImport.Oscilloscope;\n export const OscilloscopeData = asciiImport.OscilloscopeData;\n export type OscilloscopeData = asciiImport.OscilloscopeData;\n export const OscilloscopeCaptureProperties = asciiImport.OscilloscopeCaptureProperties;\n export type OscilloscopeCaptureProperties = asciiImport.OscilloscopeCaptureProperties;\n export const MessageType = asciiImport.MessageType;\n export type MessageType = asciiImport.MessageType;\n export const Response = asciiImport.Response;\n export type Response = asciiImport.Response;\n export const SettingConstants = asciiImport.SettingConstants;\n export type SettingConstants = asciiImport.SettingConstants;\n export const UnknownResponseEvent = asciiImport.UnknownResponseEvent;\n export type UnknownResponseEvent = asciiImport.UnknownResponseEvent;\n export const Warnings = asciiImport.Warnings;\n export type Warnings = asciiImport.Warnings;\n export const WarningFlags = asciiImport.WarningFlags;\n export type WarningFlags = asciiImport.WarningFlags;\n export const Stream = asciiImport.Stream;\n export type Stream = asciiImport.Stream;\n export const StreamBuffer = asciiImport.StreamBuffer;\n export type StreamBuffer = asciiImport.StreamBuffer;\n export const StreamMode = asciiImport.StreamMode;\n export type StreamMode = asciiImport.StreamMode;\n export const StreamAxisType = asciiImport.StreamAxisType;\n export type StreamAxisType = asciiImport.StreamAxisType;\n export const StreamAxisDefinition = asciiImport.StreamAxisDefinition;\n export type StreamAxisDefinition = asciiImport.StreamAxisDefinition;\n export const Transport = asciiImport.Transport;\n export type Transport = asciiImport.Transport;\n export const ServoTuner = asciiImport.ServoTuner;\n export type ServoTuner = asciiImport.ServoTuner;\n export const ServoTuningParamset = asciiImport.ServoTuningParamset;\n export type ServoTuningParamset = asciiImport.ServoTuningParamset;\n export const ParamsetInfo = asciiImport.ParamsetInfo;\n export type ParamsetInfo = asciiImport.ParamsetInfo;\n export const PidTuning = asciiImport.PidTuning;\n export type PidTuning = asciiImport.PidTuning;\n export const ServoTuningParam = asciiImport.ServoTuningParam;\n export type ServoTuningParam = asciiImport.ServoTuningParam;\n export const SimpleTuningParam = asciiImport.SimpleTuningParam;\n export type SimpleTuningParam = asciiImport.SimpleTuningParam;\n}\n"]}
|
|
@@ -62,13 +62,21 @@ export declare class OfflineTranslator {
|
|
|
62
62
|
*/
|
|
63
63
|
getAxisPosition(axis: string, unit: Length | Angle | Native): number;
|
|
64
64
|
/**
|
|
65
|
-
* Sets
|
|
65
|
+
* Sets the home position of translator's axis.
|
|
66
66
|
* This position is used by G28.
|
|
67
67
|
* @param axis Letter of the axis.
|
|
68
|
-
* @param position The
|
|
68
|
+
* @param position The home position.
|
|
69
69
|
* @param unit Units of position.
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
setAxisHomePosition(axis: string, position: number, unit: Length | Angle | Native): void;
|
|
72
|
+
/**
|
|
73
|
+
* Sets the secondary home position of translator's axis.
|
|
74
|
+
* This position is used by G30.
|
|
75
|
+
* @param axis Letter of the axis.
|
|
76
|
+
* @param position The home position.
|
|
77
|
+
* @param unit Units of position.
|
|
78
|
+
*/
|
|
79
|
+
setAxisSecondaryHomePosition(axis: string, position: number, unit: Length | Angle | Native): void;
|
|
72
80
|
/**
|
|
73
81
|
* Gets offset of an axis in a given coordinate system.
|
|
74
82
|
* @param coordinateSystem Coordinate system (e.g. G54).
|
|
@@ -130,19 +130,34 @@ class OfflineTranslator {
|
|
|
130
130
|
return response.getValue();
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
-
* Sets
|
|
133
|
+
* Sets the home position of translator's axis.
|
|
134
134
|
* This position is used by G28.
|
|
135
135
|
* @param axis Letter of the axis.
|
|
136
|
-
* @param position The
|
|
136
|
+
* @param position The home position.
|
|
137
137
|
* @param unit Units of position.
|
|
138
138
|
*/
|
|
139
|
-
|
|
139
|
+
setAxisHomePosition(axis, position, unit) {
|
|
140
140
|
const request = new gateway.TranslatorSetAxisPositionRequest();
|
|
141
141
|
request.setTranslatorId(this.translatorId);
|
|
142
142
|
request.setAxis(axis);
|
|
143
143
|
request.setPosition(position);
|
|
144
144
|
request.setUnit(unit);
|
|
145
|
-
gateway.callSync('gcode/
|
|
145
|
+
gateway.callSync('gcode/set_axis_home', request);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Sets the secondary home position of translator's axis.
|
|
149
|
+
* This position is used by G30.
|
|
150
|
+
* @param axis Letter of the axis.
|
|
151
|
+
* @param position The home position.
|
|
152
|
+
* @param unit Units of position.
|
|
153
|
+
*/
|
|
154
|
+
setAxisSecondaryHomePosition(axis, position, unit) {
|
|
155
|
+
const request = new gateway.TranslatorSetAxisPositionRequest();
|
|
156
|
+
request.setTranslatorId(this.translatorId);
|
|
157
|
+
request.setAxis(axis);
|
|
158
|
+
request.setPosition(position);
|
|
159
|
+
request.setUnit(unit);
|
|
160
|
+
gateway.callSync('gcode/set_axis_secondary_home', request);
|
|
146
161
|
}
|
|
147
162
|
/**
|
|
148
163
|
* Gets offset of an axis in a given coordinate system.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offline_translator.js","sourceRoot":"","sources":["../../../src/gcode/offline_translator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,2DAAuD;AACvD,2DAAuD;AACvD,yDAAqD;AAErD,4CAAuD;AAEvD;;;;GAIG;AACH,MAAa,iBAAiB;IAgB5B,YAAY,YAAoB;QAC9B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAA,mCAAuB,EAAC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAClF,CAAC;IAlBD;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAGD;;OAEG;IACH,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,2BAA2B,EAAE,CAAC;IAC5C,CAAC;IAO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QACnE,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3C,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAEpC,OAAO,CAAC,QAAQ,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,KAAK,CAClB,YAAoB;QAEpB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAEtC,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACK,2BAA2B;QACjC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE3C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,qCAAqC,EACrC,OAAO,EACP,OAAO,CAAC,4CAA4C,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;CACF;AAvPD,8CAuPC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { DeviceDefinition } from './device_definition';\nimport { TranslatorConfig } from './translator_config';\nimport { TranslateResult } from './translate_result';\nimport { Angle, Length, Native, AngularVelocity, Velocity } from '../units';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Represents an offline G-Code translator.\n * It allows to translate G-Code blocks to Zaber ASCII protocol stream commands.\n * This translator does not need a connected device to perform translation.\n */\nexport class OfflineTranslator {\n /**\n * The ID of the translator that serves to identify native resources.\n */\n public get translatorId(): number {\n return this._translatorId;\n }\n private _translatorId: number;\n\n /**\n * Current coordinate system.\n */\n public get coordinateSystem(): string {\n return this._getCurrentCoordinateSystem();\n }\n\n constructor(translatorId: number) {\n this._translatorId = translatorId;\n registerForFinalization(this, OfflineTranslator._free.bind(null, translatorId));\n }\n\n /**\n * Sets up translator from provided device definition and configuration.\n * @param definition Definition of device and its peripherals.\n * The definition must match a device that later performs the commands.\n * @param config? Configuration of the translator.\n * @return New instance of translator.\n */\n public static async setup(\n definition: DeviceDefinition,\n config?: TranslatorConfig\n ): Promise<OfflineTranslator> {\n const request = new gateway.TranslatorCreateRequest();\n request.setDefinition(DeviceDefinition.toProtobuf(definition));\n request.setConfig(TranslatorConfig.toProtobuf(config));\n\n const response = await gateway.callAsync<gateway.TranslatorCreateResponse>(\n 'gcode/create',\n request,\n gateway.TranslatorCreateResponse);\n return new OfflineTranslator(response.getTranslatorId());\n }\n\n /**\n * Translates a single block (line) of G-code.\n * @param block Block (line) of G-code.\n * @return Result of translation containing the stream commands.\n */\n public translate(\n block: string\n ): TranslateResult {\n const request = new gateway.TranslatorTranslateRequest();\n request.setTranslatorId(this.translatorId);\n request.setBlock(block);\n\n const response = gateway.callSync<gateway.TranslatorTranslateResponse>(\n 'gcode/translate',\n request,\n gateway.TranslatorTranslateResponse);\n return TranslateResult.fromProtobuf(response.toObject());\n }\n\n /**\n * Flushes the remaining stream commands waiting in optimization buffer.\n * The flush is also performed by M2 and M30 codes.\n * @return The remaining stream commands.\n */\n public flush(): string[] {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n const response = gateway.callSync<gateway.TranslatorFlushResponse>(\n 'gcode/flush',\n request,\n gateway.TranslatorFlushResponse);\n return response.getCommandsList();\n }\n\n /**\n * Sets the speed at which the device moves when traversing (G0).\n * @param traverseRate The traverse rate.\n * @param unit Units of the traverse rate.\n */\n public setTraverseRate(\n traverseRate: number,\n unit: Velocity | AngularVelocity | Native\n ): void {\n const request = new gateway.TranslatorSetTraverseRateRequest();\n request.setTranslatorId(this.translatorId);\n request.setTraverseRate(traverseRate);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_traverse_rate', request);\n }\n\n /**\n * Sets position of translator's axis.\n * Use this method to set position after performing movement outside of the translator.\n * This method does not cause any movement.\n * @param axis Letter of the axis.\n * @param position The position.\n * @param unit Units of position.\n */\n public setAxisPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_position', request);\n }\n\n /**\n * Gets position of translator's axis.\n * This method does not query device but returns value from translator's state.\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Position of translator's axis.\n */\n public getAxisPosition(\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_position',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Sets default position of translator's axis.\n * This position is used by G28.\n * @param axis Letter of the axis.\n * @param position The default position.\n * @param unit Units of position.\n */\n public setAxisDefaultPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_default', request);\n }\n\n /**\n * Gets offset of an axis in a given coordinate system.\n * @param coordinateSystem Coordinate system (e.g. G54).\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Offset in translator units of the axis.\n */\n public getAxisCoordinateSystemOffset(\n coordinateSystem: string,\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisOffsetRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoordinateSystem(coordinateSystem);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_offset',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Resets internal state after device rejected generated command.\n * Axis positions become uninitialized.\n */\n public resetAfterStreamError(): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n gateway.callSync('gcode/reset_after_stream_error', request);\n }\n\n /**\n * Allows to scale feed rate of the translated code by a coefficient.\n * @param coefficient Coefficient of the original feed rate.\n */\n public setFeedRateOverride(\n coefficient: number\n ): void {\n const request = new gateway.TranslatorSetFeedRateOverrideRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoefficient(coefficient);\n\n gateway.callSync('gcode/set_feed_rate_override', request);\n }\n\n /**\n * Releases native resources of a translator.\n * @param translatorId The ID of the translator.\n */\n private static _free(\n translatorId: number\n ): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(translatorId);\n\n gateway.callSync('gcode/free', request);\n }\n\n /**\n * Gets current coordinate system (e.g. G54).\n * @return Current coordinate system.\n */\n private _getCurrentCoordinateSystem(): string {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n const response = gateway.callSync<gateway.TranslatorGetCurrentCoordinateSystemResponse>(\n 'gcode/get_current_coordinate_system',\n request,\n gateway.TranslatorGetCurrentCoordinateSystemResponse);\n return response.getValue();\n }\n\n /**\n * Releases the native resources of the translator.\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 OfflineTranslator._free(this.translatorId);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"offline_translator.js","sourceRoot":"","sources":["../../../src/gc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AAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAEtC,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACK,2BAA2B;QACjC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE3C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,qCAAqC,EACrC,OAAO,EACP,OAAO,CAAC,4CAA4C,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;CACF;AA5QD,8CA4QC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { DeviceDefinition } from './device_definition';\nimport { TranslatorConfig } from './translator_config';\nimport { TranslateResult } from './translate_result';\nimport { Angle, Length, Native, AngularVelocity, Velocity } from '../units';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Represents an offline G-Code translator.\n * It allows to translate G-Code blocks to Zaber ASCII protocol stream commands.\n * This translator does not need a connected device to perform translation.\n */\nexport class OfflineTranslator {\n /**\n * The ID of the translator that serves to identify native resources.\n */\n public get translatorId(): number {\n return this._translatorId;\n }\n private _translatorId: number;\n\n /**\n * Current coordinate system.\n */\n public get coordinateSystem(): string {\n return this._getCurrentCoordinateSystem();\n }\n\n constructor(translatorId: number) {\n this._translatorId = translatorId;\n registerForFinalization(this, OfflineTranslator._free.bind(null, translatorId));\n }\n\n /**\n * Sets up translator from provided device definition and configuration.\n * @param definition Definition of device and its peripherals.\n * The definition must match a device that later performs the commands.\n * @param config? Configuration of the translator.\n * @return New instance of translator.\n */\n public static async setup(\n definition: DeviceDefinition,\n config?: TranslatorConfig\n ): Promise<OfflineTranslator> {\n const request = new gateway.TranslatorCreateRequest();\n request.setDefinition(DeviceDefinition.toProtobuf(definition));\n request.setConfig(TranslatorConfig.toProtobuf(config));\n\n const response = await gateway.callAsync<gateway.TranslatorCreateResponse>(\n 'gcode/create',\n request,\n gateway.TranslatorCreateResponse);\n return new OfflineTranslator(response.getTranslatorId());\n }\n\n /**\n * Translates a single block (line) of G-code.\n * @param block Block (line) of G-code.\n * @return Result of translation containing the stream commands.\n */\n public translate(\n block: string\n ): TranslateResult {\n const request = new gateway.TranslatorTranslateRequest();\n request.setTranslatorId(this.translatorId);\n request.setBlock(block);\n\n const response = gateway.callSync<gateway.TranslatorTranslateResponse>(\n 'gcode/translate',\n request,\n gateway.TranslatorTranslateResponse);\n return TranslateResult.fromProtobuf(response.toObject());\n }\n\n /**\n * Flushes the remaining stream commands waiting in optimization buffer.\n * The flush is also performed by M2 and M30 codes.\n * @return The remaining stream commands.\n */\n public flush(): string[] {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n const response = gateway.callSync<gateway.TranslatorFlushResponse>(\n 'gcode/flush',\n request,\n gateway.TranslatorFlushResponse);\n return response.getCommandsList();\n }\n\n /**\n * Sets the speed at which the device moves when traversing (G0).\n * @param traverseRate The traverse rate.\n * @param unit Units of the traverse rate.\n */\n public setTraverseRate(\n traverseRate: number,\n unit: Velocity | AngularVelocity | Native\n ): void {\n const request = new gateway.TranslatorSetTraverseRateRequest();\n request.setTranslatorId(this.translatorId);\n request.setTraverseRate(traverseRate);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_traverse_rate', request);\n }\n\n /**\n * Sets position of translator's axis.\n * Use this method to set position after performing movement outside of the translator.\n * This method does not cause any movement.\n * @param axis Letter of the axis.\n * @param position The position.\n * @param unit Units of position.\n */\n public setAxisPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_position', request);\n }\n\n /**\n * Gets position of translator's axis.\n * This method does not query device but returns value from translator's state.\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Position of translator's axis.\n */\n public getAxisPosition(\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_position',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Sets the home position of translator's axis.\n * This position is used by G28.\n * @param axis Letter of the axis.\n * @param position The home position.\n * @param unit Units of position.\n */\n public setAxisHomePosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_home', request);\n }\n\n /**\n * Sets the secondary home position of translator's axis.\n * This position is used by G30.\n * @param axis Letter of the axis.\n * @param position The home position.\n * @param unit Units of position.\n */\n public setAxisSecondaryHomePosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_secondary_home', request);\n }\n\n /**\n * Gets offset of an axis in a given coordinate system.\n * @param coordinateSystem Coordinate system (e.g. G54).\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Offset in translator units of the axis.\n */\n public getAxisCoordinateSystemOffset(\n coordinateSystem: string,\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisOffsetRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoordinateSystem(coordinateSystem);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_offset',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Resets internal state after device rejected generated command.\n * Axis positions become uninitialized.\n */\n public resetAfterStreamError(): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n gateway.callSync('gcode/reset_after_stream_error', request);\n }\n\n /**\n * Allows to scale feed rate of the translated code by a coefficient.\n * @param coefficient Coefficient of the original feed rate.\n */\n public setFeedRateOverride(\n coefficient: number\n ): void {\n const request = new gateway.TranslatorSetFeedRateOverrideRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoefficient(coefficient);\n\n gateway.callSync('gcode/set_feed_rate_override', request);\n }\n\n /**\n * Releases native resources of a translator.\n * @param translatorId The ID of the translator.\n */\n private static _free(\n translatorId: number\n ): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(translatorId);\n\n gateway.callSync('gcode/free', request);\n }\n\n /**\n * Gets current coordinate system (e.g. G54).\n * @return Current coordinate system.\n */\n private _getCurrentCoordinateSystem(): string {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n const response = gateway.callSync<gateway.TranslatorGetCurrentCoordinateSystemResponse>(\n 'gcode/get_current_coordinate_system',\n request,\n gateway.TranslatorGetCurrentCoordinateSystemResponse);\n return response.getValue();\n }\n\n /**\n * Releases the native resources of the translator.\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 OfflineTranslator._free(this.translatorId);\n }\n}\n"]}
|
|
@@ -70,13 +70,21 @@ export declare class Translator {
|
|
|
70
70
|
*/
|
|
71
71
|
getAxisPosition(axis: string, unit: Length | Angle | Native): number;
|
|
72
72
|
/**
|
|
73
|
-
* Sets
|
|
73
|
+
* Sets the home position of translator's axis.
|
|
74
74
|
* This position is used by G28.
|
|
75
75
|
* @param axis Letter of the axis.
|
|
76
|
-
* @param position The
|
|
76
|
+
* @param position The home position.
|
|
77
77
|
* @param unit Units of position.
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
setAxisHomePosition(axis: string, position: number, unit: Length | Angle | Native): void;
|
|
80
|
+
/**
|
|
81
|
+
* Sets the secondary home position of translator's axis.
|
|
82
|
+
* This position is used by G30.
|
|
83
|
+
* @param axis Letter of the axis.
|
|
84
|
+
* @param position The home position.
|
|
85
|
+
* @param unit Units of position.
|
|
86
|
+
*/
|
|
87
|
+
setAxisSecondaryHomePosition(axis: string, position: number, unit: Length | Angle | Native): void;
|
|
80
88
|
/**
|
|
81
89
|
* Gets offset of an axis in a given coordinate system.
|
|
82
90
|
* @param coordinateSystem Coordinate system (e.g. G54).
|
|
@@ -144,19 +144,34 @@ class Translator {
|
|
|
144
144
|
return response.getValue();
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
|
-
* Sets
|
|
147
|
+
* Sets the home position of translator's axis.
|
|
148
148
|
* This position is used by G28.
|
|
149
149
|
* @param axis Letter of the axis.
|
|
150
|
-
* @param position The
|
|
150
|
+
* @param position The home position.
|
|
151
151
|
* @param unit Units of position.
|
|
152
152
|
*/
|
|
153
|
-
|
|
153
|
+
setAxisHomePosition(axis, position, unit) {
|
|
154
154
|
const request = new gateway.TranslatorSetAxisPositionRequest();
|
|
155
155
|
request.setTranslatorId(this.translatorId);
|
|
156
156
|
request.setAxis(axis);
|
|
157
157
|
request.setPosition(position);
|
|
158
158
|
request.setUnit(unit);
|
|
159
|
-
gateway.callSync('gcode/
|
|
159
|
+
gateway.callSync('gcode/set_axis_home', request);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Sets the secondary home position of translator's axis.
|
|
163
|
+
* This position is used by G30.
|
|
164
|
+
* @param axis Letter of the axis.
|
|
165
|
+
* @param position The home position.
|
|
166
|
+
* @param unit Units of position.
|
|
167
|
+
*/
|
|
168
|
+
setAxisSecondaryHomePosition(axis, position, unit) {
|
|
169
|
+
const request = new gateway.TranslatorSetAxisPositionRequest();
|
|
170
|
+
request.setTranslatorId(this.translatorId);
|
|
171
|
+
request.setAxis(axis);
|
|
172
|
+
request.setPosition(position);
|
|
173
|
+
request.setUnit(unit);
|
|
174
|
+
gateway.callSync('gcode/set_axis_secondary_home', request);
|
|
160
175
|
}
|
|
161
176
|
/**
|
|
162
177
|
* Gets offset of an axis in a given coordinate system.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translator.js","sourceRoot":"","sources":["../../../src/gcode/translator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,yDAAqD;AACrD,2DAAuD;AAGvD,4CAAuD;AAEvD;;;;GAIG;AACH,MAAa,UAAU;IAgBrB,YAAY,YAAoB;QAC9B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAA,mCAAuB,EAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAC3E,CAAC;IAlBD;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAGD;;OAEG;IACH,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,2BAA2B,EAAE,CAAC;IAC5C,CAAC;IAOD;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,KAAK,CACvB,MAAc,EACd,MAAyB;QAEzB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,2BAA2B,EAAE,CAAC;QAC1D,OAAO,CAAC,SAAS,CAAC,MAAM,C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OT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { TranslateResult } from './translate_result';\nimport { TranslatorConfig } from './translator_config';\nimport { Stream } from '../ascii/stream';\nimport { Angle, Length, Native, AngularVelocity, Velocity } from '../units';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Represents a live G-Code translator.\n * It allows to stream G-Code blocks to a connected device.\n * It requires a stream to be setup on the device.\n */\nexport class Translator {\n /**\n * The ID of the translator that serves to identify native resources.\n */\n public get translatorId(): number {\n return this._translatorId;\n }\n private _translatorId: number;\n\n /**\n * Current coordinate system.\n */\n public get coordinateSystem(): string {\n return this._getCurrentCoordinateSystem();\n }\n\n constructor(translatorId: number) {\n this._translatorId = translatorId;\n registerForFinalization(this, Translator._free.bind(null, translatorId));\n }\n\n /**\n * Sets up the translator on top of a provided stream.\n * @param stream The stream to setup the translator on.\n * The stream must be already setup in a live or a store mode.\n * @param config? Configuration of the translator.\n * @return New instance of translator.\n */\n public static async setup(\n stream: Stream,\n config?: TranslatorConfig\n ): Promise<Translator> {\n const request = new gateway.TranslatorCreateLiveRequest();\n request.setDevice(stream.device.deviceAddress);\n request.setInterfaceId(stream.device.connection.interfaceId);\n request.setStreamId(stream.streamId);\n request.setConfig(TranslatorConfig.toProtobuf(config));\n\n const response = await gateway.callAsync<gateway.TranslatorCreateResponse>(\n 'gcode/create_live',\n request,\n gateway.TranslatorCreateResponse);\n return new Translator(response.getTranslatorId());\n }\n\n /**\n * Translates a single block (line) of G-code.\n * The commands are queued in the underlying stream to ensure smooth continues movement.\n * Returning of this method indicates that the commands are queued (not necessarily executed).\n * @param block Block (line) of G-code.\n * @return Result of translation containing the commands sent to the device.\n */\n public async translate(\n block: string\n ): Promise<TranslateResult> {\n const request = new gateway.TranslatorTranslateRequest();\n request.setTranslatorId(this.translatorId);\n request.setBlock(block);\n\n const response = await gateway.callAsync<gateway.TranslatorTranslateResponse>(\n 'gcode/translate_live',\n request,\n gateway.TranslatorTranslateResponse);\n return TranslateResult.fromProtobuf(response.toObject());\n }\n\n /**\n * Flushes the remaining stream commands waiting in optimization buffer into the underlying stream.\n * The flush is also performed by M2 and M30 codes.\n * @param waitUntilIdle Determines whether to wait for the stream to finish all the movements.\n * @return The remaining stream commands.\n */\n public async flush(\n waitUntilIdle: boolean = true\n ): Promise<string[]> {\n const request = new gateway.TranslatorFlushLiveRequest();\n request.setTranslatorId(this.translatorId);\n request.setWaitUntilIdle(waitUntilIdle);\n\n const response = await gateway.callAsync<gateway.TranslatorFlushResponse>(\n 'gcode/flush_live',\n request,\n gateway.TranslatorFlushResponse);\n return response.getCommandsList();\n }\n\n /**\n * Resets position of the translator from the underlying stream.\n * Call this method after performing a movement outside of translator.\n */\n public async resetPosition(): Promise<void> {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n await gateway.callAsync('gcode/reset_position_from_stream', request);\n }\n\n /**\n * Sets the speed at which the device moves when traversing (G0).\n * @param traverseRate The traverse rate.\n * @param unit Units of the traverse rate.\n */\n public setTraverseRate(\n traverseRate: number,\n unit: Velocity | AngularVelocity | Native\n ): void {\n const request = new gateway.TranslatorSetTraverseRateRequest();\n request.setTranslatorId(this.translatorId);\n request.setTraverseRate(traverseRate);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_traverse_rate', request);\n }\n\n /**\n * Sets position of translator's axis.\n * Use this method to set position after performing movement outside of the translator.\n * This method does not cause any movement.\n * @param axis Letter of the axis.\n * @param position The position.\n * @param unit Units of position.\n */\n public setAxisPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_position', request);\n }\n\n /**\n * Gets position of translator's axis.\n * This method does not query device but returns value from translator's state.\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Position of translator's axis.\n */\n public getAxisPosition(\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_position',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Sets default position of translator's axis.\n * This position is used by G28.\n * @param axis Letter of the axis.\n * @param position The default position.\n * @param unit Units of position.\n */\n public setAxisDefaultPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_default', request);\n }\n\n /**\n * Gets offset of an axis in a given coordinate system.\n * @param coordinateSystem Coordinate system (e.g. G54).\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Offset in translator units of the axis.\n */\n public getAxisCoordinateSystemOffset(\n coordinateSystem: string,\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisOffsetRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoordinateSystem(coordinateSystem);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_offset',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Resets internal state after device rejected generated command.\n * Axis positions become uninitialized.\n */\n public resetAfterStreamError(): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n gateway.callSync('gcode/reset_after_stream_error', request);\n }\n\n /**\n * Allows to scale feed rate of the translated code by a coefficient.\n * @param coefficient Coefficient of the original feed rate.\n */\n public setFeedRateOverride(\n coefficient: number\n ): void {\n const request = new gateway.TranslatorSetFeedRateOverrideRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoefficient(coefficient);\n\n gateway.callSync('gcode/set_feed_rate_override', request);\n }\n\n /**\n * Releases native resources of a translator.\n * @param translatorId The ID of the translator.\n */\n private static _free(\n translatorId: number\n ): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(translatorId);\n\n gateway.callSync('gcode/free', request);\n }\n\n /**\n * Gets current coordinate system (e.g. G54).\n * @return Current coordinate system.\n */\n private _getCurrentCoordinateSystem(): string {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n const response = gateway.callSync<gateway.TranslatorGetCurrentCoordinateSystemResponse>(\n 'gcode/get_current_coordinate_system',\n request,\n gateway.TranslatorGetCurrentCoordinateSystemResponse);\n return response.getValue();\n }\n\n /**\n * Releases the native resources of the translator.\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 Translator._free(this.translatorId);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"translator.js","sourceRoot":"","sources":["../../../src/gcode/translator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;AAEtD,oDAAsC;AACtC,yDAAqD;AACrD,2DAAuD;AAGvD,4CAAuD;AAEvD;;;;GAIG;AACH,MAAa,UAAU;IAgBrB,YAAY,YAAoB;QAC9B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAA,mCAAuB,EAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAC3E,CAAC;IAlBD;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAGD;;OAEG;IACH,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,2BAA2B,EAAE,CAAC;IAC5C,CAAC;IAOD;;;;;;OAMG;IACI,MAAM,CAAC,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,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACK,2BAA2B;QACjC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE3C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAC/B,qCAAqC,EACrC,OAAO,EACP,OAAO,CAAC,4CAA4C,CAAC,CAAC;QACxD,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,IAAI;QACT,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;CACF;AA/RD,gCA+RC","sourcesContent":["// ==== THIS FILE IS GENERATED FROM A TEMPLATE ==== //\n// ============= DO NOT EDIT DIRECTLY ============= //\n\nimport * as gateway from '../gateway';\nimport { TranslateResult } from './translate_result';\nimport { TranslatorConfig } from './translator_config';\nimport { Stream } from '../ascii/stream';\nimport { Angle, Length, Native, AngularVelocity, Velocity } from '../units';\nimport { registerForFinalization } from '../finalizer';\n\n/**\n * Represents a live G-Code translator.\n * It allows to stream G-Code blocks to a connected device.\n * It requires a stream to be setup on the device.\n */\nexport class Translator {\n /**\n * The ID of the translator that serves to identify native resources.\n */\n public get translatorId(): number {\n return this._translatorId;\n }\n private _translatorId: number;\n\n /**\n * Current coordinate system.\n */\n public get coordinateSystem(): string {\n return this._getCurrentCoordinateSystem();\n }\n\n constructor(translatorId: number) {\n this._translatorId = translatorId;\n registerForFinalization(this, Translator._free.bind(null, translatorId));\n }\n\n /**\n * Sets up the translator on top of a provided stream.\n * @param stream The stream to setup the translator on.\n * The stream must be already setup in a live or a store mode.\n * @param config? Configuration of the translator.\n * @return New instance of translator.\n */\n public static async setup(\n stream: Stream,\n config?: TranslatorConfig\n ): Promise<Translator> {\n const request = new gateway.TranslatorCreateLiveRequest();\n request.setDevice(stream.device.deviceAddress);\n request.setInterfaceId(stream.device.connection.interfaceId);\n request.setStreamId(stream.streamId);\n request.setConfig(TranslatorConfig.toProtobuf(config));\n\n const response = await gateway.callAsync<gateway.TranslatorCreateResponse>(\n 'gcode/create_live',\n request,\n gateway.TranslatorCreateResponse);\n return new Translator(response.getTranslatorId());\n }\n\n /**\n * Translates a single block (line) of G-code.\n * The commands are queued in the underlying stream to ensure smooth continues movement.\n * Returning of this method indicates that the commands are queued (not necessarily executed).\n * @param block Block (line) of G-code.\n * @return Result of translation containing the commands sent to the device.\n */\n public async translate(\n block: string\n ): Promise<TranslateResult> {\n const request = new gateway.TranslatorTranslateRequest();\n request.setTranslatorId(this.translatorId);\n request.setBlock(block);\n\n const response = await gateway.callAsync<gateway.TranslatorTranslateResponse>(\n 'gcode/translate_live',\n request,\n gateway.TranslatorTranslateResponse);\n return TranslateResult.fromProtobuf(response.toObject());\n }\n\n /**\n * Flushes the remaining stream commands waiting in optimization buffer into the underlying stream.\n * The flush is also performed by M2 and M30 codes.\n * @param waitUntilIdle Determines whether to wait for the stream to finish all the movements.\n * @return The remaining stream commands.\n */\n public async flush(\n waitUntilIdle: boolean = true\n ): Promise<string[]> {\n const request = new gateway.TranslatorFlushLiveRequest();\n request.setTranslatorId(this.translatorId);\n request.setWaitUntilIdle(waitUntilIdle);\n\n const response = await gateway.callAsync<gateway.TranslatorFlushResponse>(\n 'gcode/flush_live',\n request,\n gateway.TranslatorFlushResponse);\n return response.getCommandsList();\n }\n\n /**\n * Resets position of the translator from the underlying stream.\n * Call this method after performing a movement outside of translator.\n */\n public async resetPosition(): Promise<void> {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n await gateway.callAsync('gcode/reset_position_from_stream', request);\n }\n\n /**\n * Sets the speed at which the device moves when traversing (G0).\n * @param traverseRate The traverse rate.\n * @param unit Units of the traverse rate.\n */\n public setTraverseRate(\n traverseRate: number,\n unit: Velocity | AngularVelocity | Native\n ): void {\n const request = new gateway.TranslatorSetTraverseRateRequest();\n request.setTranslatorId(this.translatorId);\n request.setTraverseRate(traverseRate);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_traverse_rate', request);\n }\n\n /**\n * Sets position of translator's axis.\n * Use this method to set position after performing movement outside of the translator.\n * This method does not cause any movement.\n * @param axis Letter of the axis.\n * @param position The position.\n * @param unit Units of position.\n */\n public setAxisPosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_position', request);\n }\n\n /**\n * Gets position of translator's axis.\n * This method does not query device but returns value from translator's state.\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Position of translator's axis.\n */\n public getAxisPosition(\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_position',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Sets the home position of translator's axis.\n * This position is used by G28.\n * @param axis Letter of the axis.\n * @param position The home position.\n * @param unit Units of position.\n */\n public setAxisHomePosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_home', request);\n }\n\n /**\n * Sets the secondary home position of translator's axis.\n * This position is used by G30.\n * @param axis Letter of the axis.\n * @param position The home position.\n * @param unit Units of position.\n */\n public setAxisSecondaryHomePosition(\n axis: string,\n position: number,\n unit: Length | Angle | Native\n ): void {\n const request = new gateway.TranslatorSetAxisPositionRequest();\n request.setTranslatorId(this.translatorId);\n request.setAxis(axis);\n request.setPosition(position);\n request.setUnit(unit);\n\n gateway.callSync('gcode/set_axis_secondary_home', request);\n }\n\n /**\n * Gets offset of an axis in a given coordinate system.\n * @param coordinateSystem Coordinate system (e.g. G54).\n * @param axis Letter of the axis.\n * @param unit Units of position.\n * @return Offset in translator units of the axis.\n */\n public getAxisCoordinateSystemOffset(\n coordinateSystem: string,\n axis: string,\n unit: Length | Angle | Native\n ): number {\n const request = new gateway.TranslatorGetAxisOffsetRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoordinateSystem(coordinateSystem);\n request.setAxis(axis);\n request.setUnit(unit);\n\n const response = gateway.callSync<gateway.TranslatorGetAxisPositionResponse>(\n 'gcode/get_axis_offset',\n request,\n gateway.TranslatorGetAxisPositionResponse);\n return response.getValue();\n }\n\n /**\n * Resets internal state after device rejected generated command.\n * Axis positions become uninitialized.\n */\n public resetAfterStreamError(): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n gateway.callSync('gcode/reset_after_stream_error', request);\n }\n\n /**\n * Allows to scale feed rate of the translated code by a coefficient.\n * @param coefficient Coefficient of the original feed rate.\n */\n public setFeedRateOverride(\n coefficient: number\n ): void {\n const request = new gateway.TranslatorSetFeedRateOverrideRequest();\n request.setTranslatorId(this.translatorId);\n request.setCoefficient(coefficient);\n\n gateway.callSync('gcode/set_feed_rate_override', request);\n }\n\n /**\n * Releases native resources of a translator.\n * @param translatorId The ID of the translator.\n */\n private static _free(\n translatorId: number\n ): void {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(translatorId);\n\n gateway.callSync('gcode/free', request);\n }\n\n /**\n * Gets current coordinate system (e.g. G54).\n * @return Current coordinate system.\n */\n private _getCurrentCoordinateSystem(): string {\n const request = new gateway.TranslatorEmptyRequest();\n request.setTranslatorId(this.translatorId);\n\n const response = gateway.callSync<gateway.TranslatorGetCurrentCoordinateSystemResponse>(\n 'gcode/get_current_coordinate_system',\n request,\n gateway.TranslatorGetCurrentCoordinateSystemResponse);\n return response.getValue();\n }\n\n /**\n * Releases the native resources of the translator.\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 Translator._free(this.translatorId);\n }\n}\n"]}
|