@viamrobotics/sdk 0.0.44 → 0.0.45
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/components/gripper/client.d.ts +19 -0
- package/dist/components/gripper/gripper.d.ts +12 -0
- package/dist/components/gripper.d.ts +2 -0
- package/dist/main.d.ts +2 -19
- package/dist/main.es.js +75 -35
- package/dist/main.umd.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RobotClient } from '../../robot';
|
|
2
|
+
import type { Options } from '../../types';
|
|
3
|
+
import type { Gripper } from './gripper';
|
|
4
|
+
/**
|
|
5
|
+
* A gRPC-web client for the Gripper component.
|
|
6
|
+
*
|
|
7
|
+
* @group Clients
|
|
8
|
+
*/
|
|
9
|
+
export declare class GripperClient implements Gripper {
|
|
10
|
+
private client;
|
|
11
|
+
private readonly name;
|
|
12
|
+
private readonly options;
|
|
13
|
+
constructor(client: RobotClient, name: string, options?: Options);
|
|
14
|
+
private get gripperService();
|
|
15
|
+
open(extra?: {}): Promise<void>;
|
|
16
|
+
grab(extra?: {}): Promise<void>;
|
|
17
|
+
stop(extra?: {}): Promise<void>;
|
|
18
|
+
isMoving(): Promise<boolean>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Extra } from '../../types';
|
|
2
|
+
/** Represents a physical robotic gripper. */
|
|
3
|
+
export interface Gripper {
|
|
4
|
+
/** Open a gripper of the underlying robot. */
|
|
5
|
+
open: (extra?: Extra) => Promise<void>;
|
|
6
|
+
/** Request a gripper of the underlying robot to grab. */
|
|
7
|
+
grab: (extra?: Extra) => Promise<void>;
|
|
8
|
+
/** Stop a robot's gripper. */
|
|
9
|
+
stop: (extra?: Extra) => Promise<void>;
|
|
10
|
+
/** Report if the gripper is in motion. */
|
|
11
|
+
isMoving: () => Promise<boolean>;
|
|
12
|
+
}
|
package/dist/main.d.ts
CHANGED
|
@@ -203,29 +203,12 @@ export { default as genericApi } from './gen/component/generic/v1/generic_pb';
|
|
|
203
203
|
*
|
|
204
204
|
* Generated with https://github.com/improbable-eng/grpc-web
|
|
205
205
|
*
|
|
206
|
-
* @
|
|
207
|
-
*
|
|
208
|
-
* ```ts
|
|
209
|
-
* import { grpc } from '@improbable-eng/grpc-web';
|
|
210
|
-
*
|
|
211
|
-
* const client = {}; // replace with a connected robot client
|
|
212
|
-
*
|
|
213
|
-
* const request = new gripperApi.IsMovingRequest();
|
|
214
|
-
* request.setName('mygripper');
|
|
215
|
-
*
|
|
216
|
-
* client.gripperService.isMoving(
|
|
217
|
-
* request,
|
|
218
|
-
* new grpc.Metadata(),
|
|
219
|
-
* (error, response) => {
|
|
220
|
-
* // do something with error or response
|
|
221
|
-
* }
|
|
222
|
-
* );
|
|
223
|
-
* ```
|
|
224
|
-
*
|
|
206
|
+
* @deprecated Use {@link GripperClient} instead.
|
|
225
207
|
* @alpha
|
|
226
208
|
* @group Raw Protobufs
|
|
227
209
|
*/
|
|
228
210
|
export { default as gripperApi } from './gen/component/gripper/v1/gripper_pb';
|
|
211
|
+
export { type Gripper, GripperClient } from './components/gripper';
|
|
229
212
|
/**
|
|
230
213
|
* Raw Protobuf interfaces for an InputController component.
|
|
231
214
|
*
|
package/dist/main.es.js
CHANGED
|
@@ -12665,10 +12665,10 @@ var grpcWebClient_umdExports = {}, grpcWebClient_umd = {
|
|
|
12665
12665
|
var x = v(this.buffer, this.position, this.position + 5), q = new DataView(x.buffer, x.byteOffset, x.byteLength), k = d(q);
|
|
12666
12666
|
if (!m(this.buffer, this.position, 5 + k))
|
|
12667
12667
|
return _;
|
|
12668
|
-
var
|
|
12668
|
+
var N = v(this.buffer, this.position + 5, this.position + 5 + k);
|
|
12669
12669
|
if (this.position += 5 + k, c(q))
|
|
12670
|
-
return _.push({ chunkType: o.TRAILERS, trailers: (R =
|
|
12671
|
-
_.push({ chunkType: o.MESSAGE, data:
|
|
12670
|
+
return _.push({ chunkType: o.TRAILERS, trailers: (R = N, new r.Metadata(l(R))) }), _;
|
|
12671
|
+
_.push({ chunkType: o.MESSAGE, data: N });
|
|
12672
12672
|
}
|
|
12673
12673
|
}, f;
|
|
12674
12674
|
}();
|
|
@@ -20423,16 +20423,16 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20423
20423
|
case 0:
|
|
20424
20424
|
return P = "", D = function() {
|
|
20425
20425
|
return n.__awaiter(z, void 0, void 0, function() {
|
|
20426
|
-
var q, k,
|
|
20426
|
+
var q, k, N, X, S, M, O, E, F, T;
|
|
20427
20427
|
return n.__generator(this, function(w) {
|
|
20428
20428
|
switch (w.label) {
|
|
20429
20429
|
case 0:
|
|
20430
20430
|
return P != "" ? [3, 5] : (q = "", _.accessToken && _.accessToken !== "" ? [3, 2] : ((O = new i.AuthenticateRequest()).setEntity(_.authEntity ? _.authEntity : h.replace(/^(.*:\/\/)/, "")), (X = new i.Credentials()).setType((F = _.credentials) === null || F === void 0 ? void 0 : F.type), X.setPayload((T = _.credentials) === null || T === void 0 ? void 0 : T.payload), O.setCredentials(X), M = new Promise(function(C, j) {
|
|
20431
|
-
k = C,
|
|
20431
|
+
k = C, N = j;
|
|
20432
20432
|
}), u.grpc.invoke(l.AuthService.Authenticate, { request: O, host: _.externalAuthAddress ? _.externalAuthAddress : h, transport: R, onMessage: function(C) {
|
|
20433
20433
|
q = C.getAccessToken();
|
|
20434
20434
|
}, onEnd: function(C, j, G) {
|
|
20435
|
-
C == u.grpc.Code.OK ? k(E) :
|
|
20435
|
+
C == u.grpc.Code.OK ? k(E) : N(j);
|
|
20436
20436
|
} }), [4, M]));
|
|
20437
20437
|
case 1:
|
|
20438
20438
|
return w.sent(), [3, 3];
|
|
@@ -20440,11 +20440,11 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20440
20440
|
q = _.accessToken, w.label = 3;
|
|
20441
20441
|
case 3:
|
|
20442
20442
|
return P = q, _.externalAuthAddress && _.externalAuthToEntity ? ((S = new u.grpc.Metadata()).set("authorization", "Bearer ".concat(P)), M = new Promise(function(C, j) {
|
|
20443
|
-
k = C,
|
|
20443
|
+
k = C, N = j;
|
|
20444
20444
|
}), q = "", (O = new i.AuthenticateToRequest()).setEntity(_.externalAuthToEntity), u.grpc.invoke(l.ExternalAuthService.AuthenticateTo, { request: O, host: _.externalAuthAddress, transport: R, metadata: S, onMessage: function(C) {
|
|
20445
20445
|
q = C.getAccessToken();
|
|
20446
20446
|
}, onEnd: function(C, j, G) {
|
|
20447
|
-
C == u.grpc.Code.OK ? k(S) :
|
|
20447
|
+
C == u.grpc.Code.OK ? k(S) : N(j);
|
|
20448
20448
|
} }), [4, M]) : [3, 5];
|
|
20449
20449
|
case 4:
|
|
20450
20450
|
w.sent(), P = q, w.label = 5;
|
|
@@ -20507,11 +20507,11 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20507
20507
|
e.dialWebRTC = function(h, R, _) {
|
|
20508
20508
|
var P, D, I, z, x, q, k;
|
|
20509
20509
|
return n.__awaiter(this, void 0, void 0, function() {
|
|
20510
|
-
var
|
|
20510
|
+
var N, X, S, M, O, E, F, T, w, C, j, G, B, W, H, Z, ee, re, se, ie, pe, ne, ue, ae, ge = this;
|
|
20511
20511
|
return n.__generator(this, function(J) {
|
|
20512
20512
|
switch (J.label) {
|
|
20513
20513
|
case 0:
|
|
20514
|
-
return b(_),
|
|
20514
|
+
return b(_), N = _?.webrtcOptions, [4, (0, m.newPeerConnectionForClient)(N !== void 0 && N.disableTrickleICE, N?.rtcConfig)];
|
|
20515
20515
|
case 1:
|
|
20516
20516
|
X = J.sent(), S = X.pc, M = X.dc, O = !1, J.label = 2;
|
|
20517
20517
|
case 2:
|
|
@@ -20537,9 +20537,9 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20537
20537
|
V === u.grpc.Code.OK && U || console.error($);
|
|
20538
20538
|
} });
|
|
20539
20539
|
}
|
|
20540
|
-
},
|
|
20540
|
+
}, W = new Promise(function(L) {
|
|
20541
20541
|
B = L;
|
|
20542
|
-
}), H = !1,
|
|
20542
|
+
}), H = !1, N?.disableTrickleICE ? [3, 6] : [4, S.createOffer()];
|
|
20543
20543
|
case 4:
|
|
20544
20544
|
return Z = J.sent(), ee = !1, S.onicecandidate = function(L) {
|
|
20545
20545
|
return n.__awaiter(ge, void 0, void 0, function() {
|
|
@@ -20547,7 +20547,7 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20547
20547
|
return n.__generator(this, function($) {
|
|
20548
20548
|
switch ($.label) {
|
|
20549
20549
|
case 0:
|
|
20550
|
-
return [4,
|
|
20550
|
+
return [4, W];
|
|
20551
20551
|
case 1:
|
|
20552
20552
|
return $.sent(), H ? [2] : L.candidate === null ? (ee = !0, G(), [2]) : (U = L.candidate, (Y = new c.ICECandidate()).setCandidate(U.candidate), U.sdpMid && Y.setSdpMid(U.sdpMid), U.sdpMLineIndex && Y.setSdpmLineIndex(U.sdpMLineIndex), U.usernameFragment && Y.setUsernameFragment(U.usernameFragment), A = Y, (V = new c.CallUpdateRequest()).setUuid(w), V.setCandidate(A), u.grpc.unary(d.SignalingService.CallUpdate, { request: V, metadata: { "rpc-host": R }, host: h, transport: F, onEnd: function(Q) {
|
|
20553
20553
|
var te = Q.status, K = Q.statusMessage, oe = Q.message;
|
|
@@ -20567,7 +20567,7 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20567
20567
|
return n.__generator(this, function(te) {
|
|
20568
20568
|
switch (te.label) {
|
|
20569
20569
|
case 0:
|
|
20570
|
-
return (A = L).hasInit() ? re ? (j("got init stage more than once"), [2]) : (V = A.getInit(), re = !0, w = A.getUuid(), $ = new RTCSessionDescription(JSON.parse(atob(V.getSdp()))), S.setRemoteDescription($), B(!0),
|
|
20570
|
+
return (A = L).hasInit() ? re ? (j("got init stage more than once"), [2]) : (V = A.getInit(), re = !0, w = A.getUuid(), $ = new RTCSessionDescription(JSON.parse(atob(V.getSdp()))), S.setRemoteDescription($), B(!0), N?.disableTrickleICE ? (H = !0, G(), [2]) : [3, 7]) : [3, 1];
|
|
20571
20571
|
case 1:
|
|
20572
20572
|
if (!A.hasUpdate())
|
|
20573
20573
|
return [3, 6];
|
|
@@ -20596,7 +20596,7 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20596
20596
|
se = L, ie = A;
|
|
20597
20597
|
}), T.onEnd(function(L, A, V) {
|
|
20598
20598
|
L !== u.grpc.Code.OK ? A !== "Response closed without headers" ? (console.error(A), ie(A)) : ie(new p.ConnectionClosedError("failed to dial")) : se();
|
|
20599
|
-
}), T.start({ "rpc-host": R }), ne = new c.CallRequest(), ue = btoa(JSON.stringify(S.localDescription)), ne.setSdp(ue),
|
|
20599
|
+
}), T.start({ "rpc-host": R }), ne = new c.CallRequest(), ue = btoa(JSON.stringify(S.localDescription)), ne.setSdp(ue), N && N.disableTrickleICE && ne.setDisableTrickle(N.disableTrickleICE), T.send(ne), (ae = new g.ClientChannel(S, M)).ready.then(function() {
|
|
20600
20600
|
return se();
|
|
20601
20601
|
}).catch(function(L) {
|
|
20602
20602
|
return ie(L);
|
|
@@ -20708,7 +20708,7 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20708
20708
|
});
|
|
20709
20709
|
};
|
|
20710
20710
|
}, 655: (t, e, s) => {
|
|
20711
|
-
s.r(e), s.d(e, { __assign: () => g, __asyncDelegator: () => P, __asyncGenerator: () => _, __asyncValues: () => D, __await: () => R, __awaiter: () => l, __classPrivateFieldGet: () => k, __classPrivateFieldIn: () => X, __classPrivateFieldSet: () =>
|
|
20711
|
+
s.r(e), s.d(e, { __assign: () => g, __asyncDelegator: () => P, __asyncGenerator: () => _, __asyncValues: () => D, __await: () => R, __awaiter: () => l, __classPrivateFieldGet: () => k, __classPrivateFieldIn: () => X, __classPrivateFieldSet: () => N, __createBinding: () => d, __decorate: () => o, __exportStar: () => m, __extends: () => u, __generator: () => c, __importDefault: () => q, __importStar: () => x, __makeTemplateObject: () => I, __metadata: () => i, __param: () => r, __read: () => y, __rest: () => p, __spread: () => f, __spreadArray: () => h, __spreadArrays: () => b, __values: () => v });
|
|
20712
20712
|
var n = function(S, M) {
|
|
20713
20713
|
return n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(O, E) {
|
|
20714
20714
|
O.__proto__ = E;
|
|
@@ -20780,8 +20780,8 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20780
20780
|
}
|
|
20781
20781
|
function j(G) {
|
|
20782
20782
|
var B;
|
|
20783
|
-
G.done ? F(G.value) : (B = G.value, B instanceof O ? B : new O(function(
|
|
20784
|
-
|
|
20783
|
+
G.done ? F(G.value) : (B = G.value, B instanceof O ? B : new O(function(W) {
|
|
20784
|
+
W(B);
|
|
20785
20785
|
})).then(w, C);
|
|
20786
20786
|
}
|
|
20787
20787
|
j((E = E.apply(S, M || [])).next());
|
|
@@ -20839,8 +20839,8 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20839
20839
|
continue;
|
|
20840
20840
|
}
|
|
20841
20841
|
B = M.call(S, w);
|
|
20842
|
-
} catch (
|
|
20843
|
-
B = [6,
|
|
20842
|
+
} catch (W) {
|
|
20843
|
+
B = [6, W], E = 0;
|
|
20844
20844
|
} finally {
|
|
20845
20845
|
O = F = 0;
|
|
20846
20846
|
}
|
|
@@ -20924,29 +20924,29 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20924
20924
|
return E = {}, w("next"), w("throw"), w("return"), E[Symbol.asyncIterator] = function() {
|
|
20925
20925
|
return this;
|
|
20926
20926
|
}, E;
|
|
20927
|
-
function w(
|
|
20928
|
-
F[
|
|
20927
|
+
function w(W) {
|
|
20928
|
+
F[W] && (E[W] = function(H) {
|
|
20929
20929
|
return new Promise(function(Z, ee) {
|
|
20930
|
-
T.push([
|
|
20930
|
+
T.push([W, H, Z, ee]) > 1 || C(W, H);
|
|
20931
20931
|
});
|
|
20932
20932
|
});
|
|
20933
20933
|
}
|
|
20934
|
-
function C(
|
|
20934
|
+
function C(W, H) {
|
|
20935
20935
|
try {
|
|
20936
|
-
(Z = F[
|
|
20936
|
+
(Z = F[W](H)).value instanceof R ? Promise.resolve(Z.value.v).then(j, G) : B(T[0][2], Z);
|
|
20937
20937
|
} catch (ee) {
|
|
20938
20938
|
B(T[0][3], ee);
|
|
20939
20939
|
}
|
|
20940
20940
|
var Z;
|
|
20941
20941
|
}
|
|
20942
|
-
function j(
|
|
20943
|
-
C("next",
|
|
20942
|
+
function j(W) {
|
|
20943
|
+
C("next", W);
|
|
20944
20944
|
}
|
|
20945
|
-
function G(
|
|
20946
|
-
C("throw",
|
|
20945
|
+
function G(W) {
|
|
20946
|
+
C("throw", W);
|
|
20947
20947
|
}
|
|
20948
|
-
function B(
|
|
20949
|
-
|
|
20948
|
+
function B(W, H) {
|
|
20949
|
+
W(H), T.shift(), T.length && C(T[0][0], T[0][1]);
|
|
20950
20950
|
}
|
|
20951
20951
|
}
|
|
20952
20952
|
function P(S) {
|
|
@@ -20972,8 +20972,8 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
20972
20972
|
function E(F) {
|
|
20973
20973
|
M[F] = S[F] && function(T) {
|
|
20974
20974
|
return new Promise(function(w, C) {
|
|
20975
|
-
(function(j, G, B,
|
|
20976
|
-
Promise.resolve(
|
|
20975
|
+
(function(j, G, B, W) {
|
|
20976
|
+
Promise.resolve(W).then(function(H) {
|
|
20977
20977
|
j({ value: H, done: B });
|
|
20978
20978
|
}, G);
|
|
20979
20979
|
})(w, C, (T = S[F](T)).done, T.value);
|
|
@@ -21008,7 +21008,7 @@ var __webpack_modules__ = { 37: function(t) {
|
|
|
21008
21008
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
21009
21009
|
return O === "m" ? E : O === "a" ? E.call(S) : E ? E.value : M.get(S);
|
|
21010
21010
|
}
|
|
21011
|
-
function
|
|
21011
|
+
function N(S, M, O, E, F) {
|
|
21012
21012
|
if (E === "m")
|
|
21013
21013
|
throw new TypeError("Private method is not writable");
|
|
21014
21014
|
if (E === "a" && !F)
|
|
@@ -42025,6 +42025,45 @@ class StreamClient extends EventDispatcher {
|
|
|
42025
42025
|
}
|
|
42026
42026
|
}
|
|
42027
42027
|
}
|
|
42028
|
+
class GripperClient {
|
|
42029
|
+
client;
|
|
42030
|
+
name;
|
|
42031
|
+
options;
|
|
42032
|
+
constructor(e, s, n = {}) {
|
|
42033
|
+
this.client = e.createServiceClient(GripperServiceClient_1), this.name = s, this.options = n;
|
|
42034
|
+
}
|
|
42035
|
+
get gripperService() {
|
|
42036
|
+
return this.client;
|
|
42037
|
+
}
|
|
42038
|
+
async open(e = {}) {
|
|
42039
|
+
const s = this.gripperService, n = new gripper_pb.OpenRequest();
|
|
42040
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
42041
|
+
s.open.bind(s),
|
|
42042
|
+
n
|
|
42043
|
+
);
|
|
42044
|
+
}
|
|
42045
|
+
async grab(e = {}) {
|
|
42046
|
+
const s = this.gripperService, n = new gripper_pb.GrabRequest();
|
|
42047
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
42048
|
+
s.grab.bind(s),
|
|
42049
|
+
n
|
|
42050
|
+
);
|
|
42051
|
+
}
|
|
42052
|
+
async stop(e = {}) {
|
|
42053
|
+
const s = this.gripperService, n = new gripper_pb.StopRequest();
|
|
42054
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
42055
|
+
s.stop.bind(s),
|
|
42056
|
+
n
|
|
42057
|
+
);
|
|
42058
|
+
}
|
|
42059
|
+
async isMoving() {
|
|
42060
|
+
const e = this.gripperService, s = new gripper_pb.IsMovingRequest();
|
|
42061
|
+
return s.setName(this.name), this.options.requestLogger?.(s), (await promisify(
|
|
42062
|
+
e.isMoving.bind(e),
|
|
42063
|
+
s
|
|
42064
|
+
)).getIsMoving();
|
|
42065
|
+
}
|
|
42066
|
+
}
|
|
42028
42067
|
const encodeLinearConstraint = (t) => {
|
|
42029
42068
|
const e = new motion_pb.LinearConstraint();
|
|
42030
42069
|
return e.setLineToleranceMm(t.lineToleranceMm), e.setOrientationToleranceDegs(t.orientationToleranceDegs), e;
|
|
@@ -42280,7 +42319,7 @@ class DataManagerClient {
|
|
|
42280
42319
|
);
|
|
42281
42320
|
}
|
|
42282
42321
|
}
|
|
42283
|
-
const version = "0.0.
|
|
42322
|
+
const version = "0.0.45";
|
|
42284
42323
|
export {
|
|
42285
42324
|
ArmClient,
|
|
42286
42325
|
BaseClient,
|
|
@@ -42289,6 +42328,7 @@ export {
|
|
|
42289
42328
|
RobotClient as Client,
|
|
42290
42329
|
DataManagerClient,
|
|
42291
42330
|
EncoderClient,
|
|
42331
|
+
GripperClient,
|
|
42292
42332
|
MotionClient,
|
|
42293
42333
|
MotorClient,
|
|
42294
42334
|
MovementSensorClient,
|