@viamrobotics/sdk 0.2.4 → 0.2.5-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gen/component/powersensor/v1/powersensor_pb.d.ts +154 -0
- package/dist/gen/component/powersensor/v1/powersensor_pb_service.d.ts +121 -0
- package/dist/main.d.ts +2 -19
- package/dist/main.es.js +218 -58
- package/dist/main.umd.js +4 -2
- package/dist/robot/client.d.ts +12 -2
- package/dist/robot/dial.d.ts +4 -1
- package/dist/robot/grpc-connection-manager.d.ts +12 -0
- package/dist/services/motion/client.d.ts +2 -1
- package/dist/services/motion/motion.d.ts +32 -10
- package/dist/services/navigation/client.d.ts +25 -0
- package/dist/services/navigation/navigation.d.ts +36 -0
- package/dist/services/navigation/types.d.ts +3 -0
- package/dist/services/navigation.d.ts +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +4 -0
- package/package.json +1 -1
package/dist/main.es.js
CHANGED
|
@@ -13838,10 +13838,10 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
13838
13838
|
var C = c(this.buffer, this.position, this.position + 5), q = new DataView(C.buffer, C.byteOffset, C.byteLength), W = n(q);
|
|
13839
13839
|
if (!l(this.buffer, this.position, 5 + W))
|
|
13840
13840
|
return b;
|
|
13841
|
-
var
|
|
13841
|
+
var x = c(this.buffer, this.position + 5, this.position + 5 + W);
|
|
13842
13842
|
if (this.position += 5 + W, r(q))
|
|
13843
|
-
return b.push({ chunkType: u.TRAILERS, trailers: (f =
|
|
13844
|
-
b.push({ chunkType: u.MESSAGE, data:
|
|
13843
|
+
return b.push({ chunkType: u.TRAILERS, trailers: (f = x, new g.Metadata(o(f))) }), b;
|
|
13844
|
+
b.push({ chunkType: u.MESSAGE, data: x });
|
|
13845
13845
|
}
|
|
13846
13846
|
}, d;
|
|
13847
13847
|
}();
|
|
@@ -20418,22 +20418,22 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20418
20418
|
}
|
|
20419
20419
|
function y(h, O, w) {
|
|
20420
20420
|
return i.__awaiter(this, void 0, void 0, function() {
|
|
20421
|
-
var C, q, W,
|
|
20421
|
+
var C, q, W, x = this;
|
|
20422
20422
|
return i.__generator(this, function(U) {
|
|
20423
20423
|
switch (U.label) {
|
|
20424
20424
|
case 0:
|
|
20425
20425
|
return C = "", q = function() {
|
|
20426
|
-
return i.__awaiter(
|
|
20427
|
-
var I,
|
|
20426
|
+
return i.__awaiter(x, void 0, void 0, function() {
|
|
20427
|
+
var I, z, k, S, R, _, E, F, P, T;
|
|
20428
20428
|
return i.__generator(this, function(j) {
|
|
20429
20429
|
switch (j.label) {
|
|
20430
20430
|
case 0:
|
|
20431
20431
|
return C != "" ? [3, 5] : (I = "", w.accessToken && w.accessToken !== "" ? [3, 2] : ((E = new n.AuthenticateRequest()).setEntity(w.authEntity ? w.authEntity : h.replace(/^(.*:\/\/)/, "")), (S = new n.Credentials()).setType((P = w.credentials) === null || P === void 0 ? void 0 : P.type), S.setPayload((T = w.credentials) === null || T === void 0 ? void 0 : T.payload), E.setCredentials(S), _ = new Promise(function(A, D) {
|
|
20432
|
-
|
|
20432
|
+
z = A, k = D;
|
|
20433
20433
|
}), u.grpc.invoke(l.AuthService.Authenticate, { request: E, host: w.externalAuthAddress ? w.externalAuthAddress : h, transport: O, onMessage: function(A) {
|
|
20434
20434
|
I = A.getAccessToken();
|
|
20435
20435
|
}, onEnd: function(A, D, B) {
|
|
20436
|
-
A == u.grpc.Code.OK ?
|
|
20436
|
+
A == u.grpc.Code.OK ? z(F) : k(D);
|
|
20437
20437
|
} }), [4, _]));
|
|
20438
20438
|
case 1:
|
|
20439
20439
|
return j.sent(), [3, 3];
|
|
@@ -20441,11 +20441,11 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20441
20441
|
I = w.accessToken, j.label = 3;
|
|
20442
20442
|
case 3:
|
|
20443
20443
|
return C = I, w.externalAuthAddress && w.externalAuthToEntity ? ((R = new u.grpc.Metadata()).set("authorization", "Bearer ".concat(C)), _ = new Promise(function(A, D) {
|
|
20444
|
-
|
|
20444
|
+
z = A, k = D;
|
|
20445
20445
|
}), I = "", (E = new n.AuthenticateToRequest()).setEntity(w.externalAuthToEntity), u.grpc.invoke(l.ExternalAuthService.AuthenticateTo, { request: E, host: w.externalAuthAddress, transport: O, metadata: R, onMessage: function(A) {
|
|
20446
20446
|
I = A.getAccessToken();
|
|
20447
20447
|
}, onEnd: function(A, D, B) {
|
|
20448
|
-
A == u.grpc.Code.OK ?
|
|
20448
|
+
A == u.grpc.Code.OK ? z(R) : k(D);
|
|
20449
20449
|
} }), [4, _]) : [3, 5];
|
|
20450
20450
|
case 4:
|
|
20451
20451
|
j.sent(), C = I, j.label = 5;
|
|
@@ -20482,14 +20482,14 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20482
20482
|
}();
|
|
20483
20483
|
function b(h, O, w) {
|
|
20484
20484
|
return i.__awaiter(this, void 0, void 0, function() {
|
|
20485
|
-
var C, q, W,
|
|
20486
|
-
return i.__generator(this, function(
|
|
20487
|
-
switch (
|
|
20485
|
+
var C, q, W, x, U, I;
|
|
20486
|
+
return i.__generator(this, function(z) {
|
|
20487
|
+
switch (z.label) {
|
|
20488
20488
|
case 0:
|
|
20489
20489
|
return C = i.__assign({}, w), [4, v(h, C)];
|
|
20490
20490
|
case 1:
|
|
20491
|
-
return q =
|
|
20492
|
-
W = k,
|
|
20491
|
+
return q = z.sent(), I = new Promise(function(k, S) {
|
|
20492
|
+
W = k, x = S;
|
|
20493
20493
|
}), u.grpc.unary(m.SignalingService.OptionalWebRTCConfig, { request: new c.OptionalWebRTCConfigRequest(), metadata: { "rpc-host": O }, host: h, transport: q, onEnd: function(k) {
|
|
20494
20494
|
var S = k.status, R = k.statusMessage, _ = k.message;
|
|
20495
20495
|
if (S === u.grpc.Code.OK && _) {
|
|
@@ -20497,10 +20497,10 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20497
20497
|
return void W(new c.WebRTCConfig());
|
|
20498
20498
|
W(U);
|
|
20499
20499
|
} else
|
|
20500
|
-
|
|
20500
|
+
x(R);
|
|
20501
20501
|
} }), [4, I];
|
|
20502
20502
|
case 2:
|
|
20503
|
-
if (
|
|
20503
|
+
if (z.sent(), !U)
|
|
20504
20504
|
throw new Error("no config");
|
|
20505
20505
|
return [2, U];
|
|
20506
20506
|
}
|
|
@@ -20533,7 +20533,7 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20533
20533
|
}
|
|
20534
20534
|
}
|
|
20535
20535
|
e.dialWebRTC = function(h, O, w) {
|
|
20536
|
-
var C, q, W,
|
|
20536
|
+
var C, q, W, x, U, I, z;
|
|
20537
20537
|
return i.__awaiter(this, void 0, void 0, function() {
|
|
20538
20538
|
var k, S, R, _, E, F, P, T, j, A, D, B, G, V, Z, oe, re, ge, ae, ne, pe, ie, le, se, ce, ue, me = this;
|
|
20539
20539
|
return i.__generator(this, function(J) {
|
|
@@ -20547,7 +20547,7 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20547
20547
|
case 2:
|
|
20548
20548
|
_ = J.sent(), E = _.pc, F = _.dc, P = !1, J.label = 3;
|
|
20549
20549
|
case 3:
|
|
20550
|
-
return J.trys.push([3, , 10, 11]), T = w, w && (T = i.__assign({}, w), w.accessToken || (T.authEntity = (C = w?.webrtcOptions) === null || C === void 0 ? void 0 : C.signalingAuthEntity, T.authEntity || (T.externalAuthAddress ? T.authEntity = (q = w.externalAuthAddress) === null || q === void 0 ? void 0 : q.replace(/^(.*:\/\/)/, "") : T.authEntity = h.replace(/^(.*:\/\/)/, "")), T.credentials = (W = w?.webrtcOptions) === null || W === void 0 ? void 0 : W.signalingCredentials, T.accessToken = (
|
|
20550
|
+
return J.trys.push([3, , 10, 11]), T = w, w && (T = i.__assign({}, w), w.accessToken || (T.authEntity = (C = w?.webrtcOptions) === null || C === void 0 ? void 0 : C.signalingAuthEntity, T.authEntity || (T.externalAuthAddress ? T.authEntity = (q = w.externalAuthAddress) === null || q === void 0 ? void 0 : q.replace(/^(.*:\/\/)/, "") : T.authEntity = h.replace(/^(.*:\/\/)/, "")), T.credentials = (W = w?.webrtcOptions) === null || W === void 0 ? void 0 : W.signalingCredentials, T.accessToken = (x = w?.webrtcOptions) === null || x === void 0 ? void 0 : x.signalingAccessToken), T.externalAuthAddress = (U = w?.webrtcOptions) === null || U === void 0 ? void 0 : U.signalingExternalAuthAddress, T.externalAuthToEntity = (I = w?.webrtcOptions) === null || I === void 0 ? void 0 : I.signalingExternalAuthToEntity), [4, v(h, T)];
|
|
20551
20551
|
case 4:
|
|
20552
20552
|
return j = J.sent(), A = u.grpc.client(m.SignalingService.Call, { host: h, transport: j }), D = "", B = !1, G = function(L) {
|
|
20553
20553
|
if (!B) {
|
|
@@ -20638,7 +20638,7 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20638
20638
|
case 8:
|
|
20639
20639
|
return J.sent(), [4, ue.ready];
|
|
20640
20640
|
case 9:
|
|
20641
|
-
return J.sent(), re = !0, V(), w?.externalAuthAddress || (
|
|
20641
|
+
return J.sent(), re = !0, V(), w?.externalAuthAddress || (z = w?.credentials) === null || z === void 0 || z.type, P = !0, [2, { transportFactory: ue.transportFactory(), peerConnection: E }];
|
|
20642
20642
|
case 10:
|
|
20643
20643
|
return P || E.close(), [7];
|
|
20644
20644
|
case 11:
|
|
@@ -20742,7 +20742,7 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
20742
20742
|
});
|
|
20743
20743
|
};
|
|
20744
20744
|
}, 655: (t, e, s) => {
|
|
20745
|
-
s.r(e), s.d(e, { __assign: () => g, __asyncDelegator: () => w, __asyncGenerator: () => O, __asyncValues: () => C, __await: () => h, __awaiter: () => l, __classPrivateFieldGet: () => I, __classPrivateFieldIn: () => k, __classPrivateFieldSet: () =>
|
|
20745
|
+
s.r(e), s.d(e, { __assign: () => g, __asyncDelegator: () => w, __asyncGenerator: () => O, __asyncValues: () => C, __await: () => h, __awaiter: () => l, __classPrivateFieldGet: () => I, __classPrivateFieldIn: () => k, __classPrivateFieldSet: () => z, __createBinding: () => m, __decorate: () => o, __exportStar: () => d, __extends: () => u, __generator: () => c, __importDefault: () => U, __importStar: () => x, __makeTemplateObject: () => q, __metadata: () => n, __param: () => r, __read: () => y, __rest: () => p, __spread: () => f, __spreadArray: () => M, __spreadArrays: () => b, __values: () => v });
|
|
20746
20746
|
var i = function(S, R) {
|
|
20747
20747
|
return i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(_, E) {
|
|
20748
20748
|
_.__proto__ = E;
|
|
@@ -21023,7 +21023,7 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
21023
21023
|
} : function(S, R) {
|
|
21024
21024
|
S.default = R;
|
|
21025
21025
|
};
|
|
21026
|
-
function
|
|
21026
|
+
function x(S) {
|
|
21027
21027
|
if (S && S.__esModule)
|
|
21028
21028
|
return S;
|
|
21029
21029
|
var R = {};
|
|
@@ -21042,7 +21042,7 @@ var backOff_1 = backoff.backOff = backOff, BackOff = (
|
|
|
21042
21042
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
21043
21043
|
return _ === "m" ? E : _ === "a" ? E.call(S) : E ? E.value : R.get(S);
|
|
21044
21044
|
}
|
|
21045
|
-
function
|
|
21045
|
+
function z(S, R, _, E, F) {
|
|
21046
21046
|
if (E === "m")
|
|
21047
21047
|
throw new TypeError("Private method is not writable");
|
|
21048
21048
|
if (E === "a" && !F)
|
|
@@ -23260,13 +23260,13 @@ var grpcWebClient_umdExports = {}, grpcWebClient_umd = {
|
|
|
23260
23260
|
for (; ; ) {
|
|
23261
23261
|
if (!d(this.buffer, this.position, 5))
|
|
23262
23262
|
return O;
|
|
23263
|
-
var
|
|
23263
|
+
var x = v(this.buffer, this.position, this.position + 5), U = new DataView(x.buffer, x.byteOffset, x.byteLength), I = m(U);
|
|
23264
23264
|
if (!d(this.buffer, this.position, 5 + I))
|
|
23265
23265
|
return O;
|
|
23266
|
-
var
|
|
23266
|
+
var z = v(this.buffer, this.position + 5, this.position + 5 + I);
|
|
23267
23267
|
if (this.position += 5 + I, c(U))
|
|
23268
|
-
return O.push({ chunkType: o.TRAILERS, trailers: (h =
|
|
23269
|
-
O.push({ chunkType: o.MESSAGE, data:
|
|
23268
|
+
return O.push({ chunkType: o.TRAILERS, trailers: (h = z, new r.Metadata(l(h))) }), O;
|
|
23269
|
+
O.push({ chunkType: o.MESSAGE, data: z });
|
|
23270
23270
|
}
|
|
23271
23271
|
}, f;
|
|
23272
23272
|
}();
|
|
@@ -23834,6 +23834,12 @@ const promisify = (t, e) => new Promise((s, i) => {
|
|
|
23834
23834
|
return e.setObstaclesList(
|
|
23835
23835
|
t.obstaclesList.map((s) => encodeGeometriesInFrame(s))
|
|
23836
23836
|
), e.setTransformsList(t.transformsList.map((s) => encodeTransform(s))), e;
|
|
23837
|
+
}, encodeGeoPoint = (t) => {
|
|
23838
|
+
const e = new common_pb.GeoPoint();
|
|
23839
|
+
return e.setLatitude(t.latitude), e.setLongitude(t.longitude), e;
|
|
23840
|
+
}, encodeGeoObstacle = (t) => {
|
|
23841
|
+
const e = new common_pb.GeoObstacle();
|
|
23842
|
+
return t.location && e.setLocation(encodeGeoPoint(t.location)), e.setGeometriesList(t.geometriesList.map((s) => encodeGeometry(s))), e;
|
|
23837
23843
|
};
|
|
23838
23844
|
var arm_pb = {};
|
|
23839
23845
|
(function(t) {
|
|
@@ -39760,7 +39766,7 @@ class SessionTransport {
|
|
|
39760
39766
|
this.transport.cancel();
|
|
39761
39767
|
}
|
|
39762
39768
|
}
|
|
39763
|
-
const timeoutBlob = new Blob(
|
|
39769
|
+
const timeoutBlob$1 = new Blob(
|
|
39764
39770
|
[
|
|
39765
39771
|
`self.onmessage = function(e) {
|
|
39766
39772
|
setTimeout(() => self.postMessage(""), e.data);
|
|
@@ -39818,7 +39824,7 @@ class SessionManager {
|
|
|
39818
39824
|
);
|
|
39819
39825
|
};
|
|
39820
39826
|
if (this.backgroundHeartbeat && window.Worker) {
|
|
39821
|
-
const i = window.URL.createObjectURL(timeoutBlob);
|
|
39827
|
+
const i = window.URL.createObjectURL(timeoutBlob$1);
|
|
39822
39828
|
e = new Worker(i), URL.revokeObjectURL(i), e.onmessage = () => {
|
|
39823
39829
|
s();
|
|
39824
39830
|
};
|
|
@@ -39872,10 +39878,80 @@ class SessionManager {
|
|
|
39872
39878
|
}
|
|
39873
39879
|
}
|
|
39874
39880
|
}
|
|
39881
|
+
const timeoutBlob = new Blob(
|
|
39882
|
+
[
|
|
39883
|
+
`self.onmessage = function(e) {
|
|
39884
|
+
setTimeout(() => self.postMessage(""), e.data);
|
|
39885
|
+
};`
|
|
39886
|
+
],
|
|
39887
|
+
{ type: "text/javascript" }
|
|
39888
|
+
);
|
|
39889
|
+
class GRPCConnectionManager {
|
|
39890
|
+
innerTransportFactory;
|
|
39891
|
+
client;
|
|
39892
|
+
heartbeatIntervalMs;
|
|
39893
|
+
connecting;
|
|
39894
|
+
connectResolve;
|
|
39895
|
+
connectReject;
|
|
39896
|
+
constructor(e, s) {
|
|
39897
|
+
this.innerTransportFactory = s, this.client = new RobotServiceClient_1(e, {
|
|
39898
|
+
transport: this.innerTransportFactory
|
|
39899
|
+
});
|
|
39900
|
+
}
|
|
39901
|
+
heartbeat() {
|
|
39902
|
+
let e;
|
|
39903
|
+
const s = () => {
|
|
39904
|
+
const i = new robot_pb.GetOperationsRequest();
|
|
39905
|
+
this.client.getOperations(
|
|
39906
|
+
i,
|
|
39907
|
+
new grpcWebClient_umdExports.grpc.Metadata(),
|
|
39908
|
+
(u, g) => {
|
|
39909
|
+
if (u) {
|
|
39910
|
+
console.debug(u, g), events.emit(DISCONNECTED, {});
|
|
39911
|
+
return;
|
|
39912
|
+
}
|
|
39913
|
+
e ? e.postMessage(this.heartbeatIntervalMs) : setTimeout(() => s(), this.heartbeatIntervalMs);
|
|
39914
|
+
}
|
|
39915
|
+
);
|
|
39916
|
+
};
|
|
39917
|
+
if (window.Worker) {
|
|
39918
|
+
const i = window.URL.createObjectURL(timeoutBlob);
|
|
39919
|
+
e = new Worker(i), URL.revokeObjectURL(i), e.onmessage = () => {
|
|
39920
|
+
s();
|
|
39921
|
+
};
|
|
39922
|
+
}
|
|
39923
|
+
s();
|
|
39924
|
+
}
|
|
39925
|
+
async start() {
|
|
39926
|
+
this.connecting && await this.connecting, this.connecting = new Promise((s, i) => {
|
|
39927
|
+
this.connectResolve = s, this.connectReject = i;
|
|
39928
|
+
});
|
|
39929
|
+
const e = new robot_pb.GetOperationsRequest();
|
|
39930
|
+
this.client.getOperations(
|
|
39931
|
+
e,
|
|
39932
|
+
new grpcWebClient_umdExports.grpc.Metadata(),
|
|
39933
|
+
(s, i) => {
|
|
39934
|
+
if (s) {
|
|
39935
|
+
this.connectReject?.(s), console.debug("failed to connect");
|
|
39936
|
+
return;
|
|
39937
|
+
}
|
|
39938
|
+
this.connectResolve?.();
|
|
39939
|
+
}
|
|
39940
|
+
);
|
|
39941
|
+
try {
|
|
39942
|
+
await this.connecting;
|
|
39943
|
+
} finally {
|
|
39944
|
+
this.connecting = void 0;
|
|
39945
|
+
}
|
|
39946
|
+
this.heartbeat();
|
|
39947
|
+
}
|
|
39948
|
+
}
|
|
39875
39949
|
class RobotClient extends EventDispatcher {
|
|
39876
39950
|
serviceHost;
|
|
39877
39951
|
webrtcOptions;
|
|
39952
|
+
directOptions;
|
|
39878
39953
|
sessionOptions;
|
|
39954
|
+
gRPCConnectionManager;
|
|
39879
39955
|
sessionManager;
|
|
39880
39956
|
peerConn;
|
|
39881
39957
|
transportFactory;
|
|
@@ -39900,39 +39976,55 @@ class RobotClient extends EventDispatcher {
|
|
|
39900
39976
|
sensorsServiceClient;
|
|
39901
39977
|
servoServiceClient;
|
|
39902
39978
|
slamServiceClient;
|
|
39903
|
-
constructor(e, s, i) {
|
|
39904
|
-
super(), this.serviceHost = e, this.webrtcOptions = s, this.sessionOptions = i, this.
|
|
39979
|
+
constructor(e, s, i, u) {
|
|
39980
|
+
super(), this.serviceHost = e, this.webrtcOptions = s, this.directOptions = u, this.sessionOptions = i, this.gRPCConnectionManager = new GRPCConnectionManager(
|
|
39905
39981
|
e,
|
|
39906
|
-
(
|
|
39982
|
+
(g) => {
|
|
39907
39983
|
if (!this.transportFactory)
|
|
39908
39984
|
throw new Error(RobotClient.notConnectedYetStr);
|
|
39909
|
-
return this.transportFactory(
|
|
39985
|
+
return this.transportFactory(g);
|
|
39986
|
+
}
|
|
39987
|
+
), this.sessionManager = new SessionManager(
|
|
39988
|
+
e,
|
|
39989
|
+
(g) => {
|
|
39990
|
+
if (!this.transportFactory)
|
|
39991
|
+
throw new Error(RobotClient.notConnectedYetStr);
|
|
39992
|
+
return this.transportFactory(g);
|
|
39910
39993
|
}
|
|
39911
39994
|
), events.on(RECONNECTED, () => {
|
|
39912
39995
|
this.emit(RECONNECTED, {});
|
|
39913
39996
|
}), events.on(DISCONNECTED, () => {
|
|
39914
|
-
if (this.emit(DISCONNECTED, {}), this.
|
|
39997
|
+
if (this.emit(DISCONNECTED, {}), this.noReconnect)
|
|
39915
39998
|
return;
|
|
39916
|
-
let
|
|
39999
|
+
let g = 0;
|
|
39917
40000
|
console.debug("connection closed, will try to reconnect"), backOff_1(
|
|
39918
40001
|
() => this.connect().then(
|
|
39919
40002
|
() => {
|
|
39920
40003
|
console.debug("reconnected successfully!"), events.emit(RECONNECTED, {});
|
|
39921
40004
|
},
|
|
39922
|
-
(
|
|
39923
|
-
throw console.debug(`failed to reconnect - retries count: ${
|
|
39924
|
-
`reached max attempts: ${this.
|
|
39925
|
-
),
|
|
40005
|
+
(p) => {
|
|
40006
|
+
throw console.debug(`failed to reconnect - retries count: ${g}`), g += 1, g === this.reconnectMaxAttempts && console.debug(
|
|
40007
|
+
`reached max attempts: ${this.reconnectMaxAttempts}`
|
|
40008
|
+
), p;
|
|
39926
40009
|
}
|
|
39927
40010
|
),
|
|
39928
40011
|
{
|
|
39929
40012
|
// default values taken from `exponential-backoff` library
|
|
39930
|
-
maxDelay: this.
|
|
39931
|
-
numOfAttempts: this.
|
|
40013
|
+
maxDelay: this.reconnectMaxWait || Number.POSITIVE_INFINITY,
|
|
40014
|
+
numOfAttempts: this.reconnectMaxAttempts || 10
|
|
39932
40015
|
}
|
|
39933
40016
|
);
|
|
39934
40017
|
});
|
|
39935
40018
|
}
|
|
40019
|
+
get noReconnect() {
|
|
40020
|
+
return this.webrtcOptions?.noReconnect || this.directOptions?.noReconnect;
|
|
40021
|
+
}
|
|
40022
|
+
get reconnectMaxAttempts() {
|
|
40023
|
+
return this.webrtcOptions?.reconnectMaxAttempts || this.directOptions?.reconnectMaxAttempts;
|
|
40024
|
+
}
|
|
40025
|
+
get reconnectMaxWait() {
|
|
40026
|
+
return this.webrtcOptions?.reconnectMaxWait || this.directOptions?.reconnectMaxWait;
|
|
40027
|
+
}
|
|
39936
40028
|
get sessionId() {
|
|
39937
40029
|
return this.sessionManager.sessionID;
|
|
39938
40030
|
}
|
|
@@ -40077,7 +40169,7 @@ class RobotClient extends EventDispatcher {
|
|
|
40077
40169
|
}), events.emit("track", o);
|
|
40078
40170
|
};
|
|
40079
40171
|
} else
|
|
40080
|
-
this.transportFactory = await __webpack_exports__dialDirect(this.serviceHost, i);
|
|
40172
|
+
this.transportFactory = await __webpack_exports__dialDirect(this.serviceHost, i), await this.gRPCConnectionManager.start();
|
|
40081
40173
|
const g = { transport: this.sessionOptions?.disabled ? this.transportFactory : this.sessionManager.transportFactory };
|
|
40082
40174
|
this.robotServiceClient = new RobotServiceClient_1(
|
|
40083
40175
|
this.serviceHost,
|
|
@@ -40216,11 +40308,16 @@ const isPosInt = (t) => !!(t > 0 && Number.isInteger(t)), isLocalConnection = (t
|
|
|
40216
40308
|
throw new Error(
|
|
40217
40309
|
`cannot dial "${t.host}" directly, please use a local url instead.`
|
|
40218
40310
|
);
|
|
40219
|
-
|
|
40220
|
-
|
|
40221
|
-
|
|
40222
|
-
|
|
40223
|
-
|
|
40311
|
+
const e = {
|
|
40312
|
+
noReconnect: t.noReconnect,
|
|
40313
|
+
reconnectMaxWait: t.reconnectMaxWait,
|
|
40314
|
+
reconnectMaxAttempts: t.reconnectMaxAttempts
|
|
40315
|
+
};
|
|
40316
|
+
let s;
|
|
40317
|
+
t.disableSessions && (s = { disabled: !0 });
|
|
40318
|
+
const i = new RobotClient(t.host, void 0, s, e);
|
|
40319
|
+
let u;
|
|
40320
|
+
return t.credential && (u = t.credential), await i.connect(t.authEntity, u), console.debug("connected via gRPC"), i;
|
|
40224
40321
|
}, dialWebRTC = async (t) => {
|
|
40225
40322
|
console.debug("dialing via WebRTC...");
|
|
40226
40323
|
const e = t.host, { signalingAddress: s } = t, u = { iceServers: t.iceServers ?? [] }, g = {
|
|
@@ -40242,21 +40339,20 @@ const isPosInt = (t) => !!(t > 0 && Number.isInteger(t)), isLocalConnection = (t
|
|
|
40242
40339
|
return typeof e.signalingAddress != "string" ? !1 : !e.iceServers || Array.isArray(e.iceServers);
|
|
40243
40340
|
}, createRobotClient = async (t) => {
|
|
40244
40341
|
let e;
|
|
40245
|
-
if (
|
|
40246
|
-
|
|
40247
|
-
|
|
40248
|
-
|
|
40249
|
-
|
|
40250
|
-
|
|
40251
|
-
|
|
40252
|
-
|
|
40253
|
-
|
|
40342
|
+
if (t.reconnectMaxAttempts && !isPosInt(t.reconnectMaxAttempts))
|
|
40343
|
+
throw new Error(
|
|
40344
|
+
`Value of max reconnect attempts (${t.reconnectMaxAttempts}) should be a positive integer`
|
|
40345
|
+
);
|
|
40346
|
+
if (t.reconnectMaxWait && !isPosInt(t.reconnectMaxWait))
|
|
40347
|
+
throw new Error(
|
|
40348
|
+
`Value of max reconnect wait (${t.reconnectMaxWait}) should be a positive integer`
|
|
40349
|
+
);
|
|
40350
|
+
if (isDialWebRTCConf(t))
|
|
40254
40351
|
try {
|
|
40255
40352
|
e = await dialWebRTC(t);
|
|
40256
40353
|
} catch {
|
|
40257
40354
|
console.debug("failed to connect via WebRTC...");
|
|
40258
40355
|
}
|
|
40259
|
-
}
|
|
40260
40356
|
if (!e)
|
|
40261
40357
|
try {
|
|
40262
40358
|
e = await dialDirect(t);
|
|
@@ -43073,6 +43169,10 @@ class MotionClient {
|
|
|
43073
43169
|
p
|
|
43074
43170
|
)).getSuccess();
|
|
43075
43171
|
}
|
|
43172
|
+
async moveOnGlobe(e, s, i, u, g, p, o, r = {}) {
|
|
43173
|
+
const { service: n } = this, l = new motion_pb.MoveOnGlobeRequest();
|
|
43174
|
+
return l.setDestination(encodeGeoPoint(e)), l.setComponentName(encodeResourceName(s)), l.setMovementSensorName(encodeResourceName(i)), u && l.setHeading(u), g && l.setObstaclesList(g.map((m) => encodeGeoObstacle(m))), p && l.setLinearMetersPerSec(p), o && l.setAngularDegPerSec(o), l.setExtra(struct_pb.Struct.fromJavaScript(r)), this.options.requestLogger?.(l), (await promisify(n.moveOnGlobe.bind(n), l)).getSuccess();
|
|
43175
|
+
}
|
|
43076
43176
|
async moveSingleComponent(e, s, i, u = {}) {
|
|
43077
43177
|
const { service: g } = this, p = new motion_pb.MoveSingleComponentRequest();
|
|
43078
43178
|
return p.setName(this.name), p.setDestination(encodePoseInFrame(e)), p.setComponentName(encodeResourceName(s)), i !== void 0 && p.setWorldState(encodeWorldState(i)), p.setExtra(struct_pb.Struct.fromJavaScript(u)), this.options.requestLogger?.(p), (await promisify(g.moveSingleComponent.bind(g), p)).getSuccess();
|
|
@@ -43293,6 +43393,65 @@ class DataManagerClient {
|
|
|
43293
43393
|
);
|
|
43294
43394
|
}
|
|
43295
43395
|
}
|
|
43396
|
+
class NavigationClient {
|
|
43397
|
+
client;
|
|
43398
|
+
name;
|
|
43399
|
+
options;
|
|
43400
|
+
constructor(e, s, i = {}) {
|
|
43401
|
+
this.client = e.createServiceClient(NavigationServiceClient_1), this.name = s, this.options = i;
|
|
43402
|
+
}
|
|
43403
|
+
get service() {
|
|
43404
|
+
return this.client;
|
|
43405
|
+
}
|
|
43406
|
+
async getMode(e = {}) {
|
|
43407
|
+
const { service: s } = this, i = new navigation_pb.GetModeRequest();
|
|
43408
|
+
return i.setName(this.name), i.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(i), (await promisify(
|
|
43409
|
+
s.getMode.bind(s),
|
|
43410
|
+
i
|
|
43411
|
+
)).getMode();
|
|
43412
|
+
}
|
|
43413
|
+
async setMode(e, s = {}) {
|
|
43414
|
+
const { service: i } = this, u = new navigation_pb.SetModeRequest();
|
|
43415
|
+
u.setName(this.name), u.setMode(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), await promisify(
|
|
43416
|
+
i.setMode.bind(i),
|
|
43417
|
+
u
|
|
43418
|
+
);
|
|
43419
|
+
}
|
|
43420
|
+
async getLocation(e = {}) {
|
|
43421
|
+
const { service: s } = this, i = new navigation_pb.GetLocationRequest();
|
|
43422
|
+
i.setName(this.name), i.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(i);
|
|
43423
|
+
const g = (await promisify(s.getLocation.bind(s), i)).getLocation();
|
|
43424
|
+
if (!g)
|
|
43425
|
+
throw new Error("no location");
|
|
43426
|
+
return g.toObject();
|
|
43427
|
+
}
|
|
43428
|
+
async getWayPoints(e = {}) {
|
|
43429
|
+
const { service: s } = this, i = new navigation_pb.GetWaypointsRequest();
|
|
43430
|
+
return i.setName(this.name), i.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(i), (await promisify(s.getWaypoints.bind(s), i)).getWaypointsList().map((g) => g.toObject());
|
|
43431
|
+
}
|
|
43432
|
+
async addWayPoint(e, s = {}) {
|
|
43433
|
+
const { service: i } = this, u = new navigation_pb.AddWaypointRequest();
|
|
43434
|
+
u.setName(this.name), u.setLocation(encodeGeoPoint(e)), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), await promisify(
|
|
43435
|
+
i.addWaypoint.bind(i),
|
|
43436
|
+
u
|
|
43437
|
+
);
|
|
43438
|
+
}
|
|
43439
|
+
async removeWayPoint(e, s = {}) {
|
|
43440
|
+
const { service: i } = this, u = new navigation_pb.RemoveWaypointRequest();
|
|
43441
|
+
u.setName(this.name), u.setId(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), await promisify(
|
|
43442
|
+
i.removeWaypoint.bind(i),
|
|
43443
|
+
u
|
|
43444
|
+
);
|
|
43445
|
+
}
|
|
43446
|
+
async getObstacles(e = {}) {
|
|
43447
|
+
const { service: s } = this, i = new navigation_pb.GetObstaclesRequest();
|
|
43448
|
+
return i.setName(this.name), i.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(i), (await promisify(s.getObstacles.bind(s), i)).getObstaclesList().map((g) => g.toObject());
|
|
43449
|
+
}
|
|
43450
|
+
async doCommand(e) {
|
|
43451
|
+
const { service: s } = this;
|
|
43452
|
+
return doCommandFromClient(s, this.name, e, this.options);
|
|
43453
|
+
}
|
|
43454
|
+
}
|
|
43296
43455
|
class ServoClient {
|
|
43297
43456
|
client;
|
|
43298
43457
|
name;
|
|
@@ -43333,7 +43492,7 @@ class ServoClient {
|
|
|
43333
43492
|
return doCommandFromClient(s, this.name, e, this.options);
|
|
43334
43493
|
}
|
|
43335
43494
|
}
|
|
43336
|
-
const version = "0.2.
|
|
43495
|
+
const version = "0.2.5-next.0";
|
|
43337
43496
|
export {
|
|
43338
43497
|
ArmClient,
|
|
43339
43498
|
BaseClient,
|
|
@@ -43348,6 +43507,7 @@ export {
|
|
|
43348
43507
|
MotionClient,
|
|
43349
43508
|
MotorClient,
|
|
43350
43509
|
MovementSensorClient,
|
|
43510
|
+
NavigationClient,
|
|
43351
43511
|
RobotClient,
|
|
43352
43512
|
SensorClient,
|
|
43353
43513
|
ServoClient,
|