@viamrobotics/sdk 0.0.39 → 0.0.40-alpha.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/components/arm/Client.d.ts +5 -1
- package/dist/components/base/Client.d.ts +5 -1
- package/dist/components/board/Client.d.ts +5 -1
- package/dist/components/camera/Client.d.ts +5 -1
- 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/components/motor/Client.d.ts +5 -1
- package/dist/components/movementsensor/Client.d.ts +5 -1
- package/dist/components/sensor/Client.d.ts +5 -1
- package/dist/extra/stream/Client.d.ts +5 -0
- package/dist/main.d.ts +380 -23
- package/dist/main.es.js +688 -647
- package/dist/main.umd.js +2 -2
- package/dist/robot/Client.d.ts +5 -1
- package/dist/robot/Robot.d.ts +0 -12
- package/package.json +4 -1
package/dist/main.es.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const version = "0.0.40-alpha.1";
|
|
1
2
|
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, robot_pb = {}, googleProtobuf = {};
|
|
2
3
|
(function(exports) {
|
|
3
4
|
var $jscomp = $jscomp || {};
|
|
@@ -39168,7 +39169,202 @@ const isLocalConnection = (t) => t.includes(".local"), dialDirect = async (t) =>
|
|
|
39168
39169
|
if (!e)
|
|
39169
39170
|
throw new Error("failed to connect to robot");
|
|
39170
39171
|
return e;
|
|
39171
|
-
}
|
|
39172
|
+
};
|
|
39173
|
+
class ArmClient {
|
|
39174
|
+
client;
|
|
39175
|
+
name;
|
|
39176
|
+
options;
|
|
39177
|
+
constructor(e, s, n = {}) {
|
|
39178
|
+
this.client = e.createServiceClient(ArmServiceClient_1), this.name = s, this.options = n;
|
|
39179
|
+
}
|
|
39180
|
+
get ArmService() {
|
|
39181
|
+
return this.client;
|
|
39182
|
+
}
|
|
39183
|
+
async getEndPosition(e = {}) {
|
|
39184
|
+
const s = this.ArmService, n = new arm_pb.GetEndPositionRequest();
|
|
39185
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
39186
|
+
const g = (await promisify(s.getEndPosition.bind(s), n)).getPose();
|
|
39187
|
+
if (!g)
|
|
39188
|
+
throw new Error("no pose");
|
|
39189
|
+
return {
|
|
39190
|
+
x: g.getX(),
|
|
39191
|
+
y: g.getY(),
|
|
39192
|
+
z: g.getZ(),
|
|
39193
|
+
ox: g.getOX(),
|
|
39194
|
+
oy: g.getOY(),
|
|
39195
|
+
oz: g.getOZ(),
|
|
39196
|
+
theta: g.getTheta()
|
|
39197
|
+
};
|
|
39198
|
+
}
|
|
39199
|
+
async moveToPosition(e, s = {}) {
|
|
39200
|
+
const n = this.ArmService, u = new common_pb.Pose();
|
|
39201
|
+
u.setX(e.x), u.setY(e.y), u.setZ(e.z), u.setOX(e.ox), u.setOY(e.oy), u.setOZ(e.oz), u.setTheta(e.theta);
|
|
39202
|
+
const g = new arm_pb.MoveToPositionRequest();
|
|
39203
|
+
g.setName(this.name), g.setTo(u), g.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(g), await promisify(
|
|
39204
|
+
n.moveToPosition.bind(n),
|
|
39205
|
+
g
|
|
39206
|
+
);
|
|
39207
|
+
}
|
|
39208
|
+
async moveToJointPositions(e, s = {}) {
|
|
39209
|
+
const n = this.ArmService, u = new arm_pb.JointPositions();
|
|
39210
|
+
u.setValuesList(e);
|
|
39211
|
+
const g = new arm_pb.MoveToJointPositionsRequest();
|
|
39212
|
+
g.setName(this.name), g.setPositions(u), g.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(g), await promisify(n.moveToJointPositions.bind(n), g);
|
|
39213
|
+
}
|
|
39214
|
+
async getJointPositions(e = {}) {
|
|
39215
|
+
const s = this.ArmService, n = new arm_pb.GetJointPositionsRequest();
|
|
39216
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
39217
|
+
const g = (await promisify(s.getJointPositions.bind(s), n)).getPositions();
|
|
39218
|
+
if (!g)
|
|
39219
|
+
throw new Error("no pose");
|
|
39220
|
+
return g;
|
|
39221
|
+
}
|
|
39222
|
+
async stop(e = {}) {
|
|
39223
|
+
const s = this.ArmService, n = new arm_pb.StopRequest();
|
|
39224
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
39225
|
+
s.stop.bind(s),
|
|
39226
|
+
n
|
|
39227
|
+
);
|
|
39228
|
+
}
|
|
39229
|
+
async isMoving() {
|
|
39230
|
+
const e = this.ArmService, s = new arm_pb.IsMovingRequest();
|
|
39231
|
+
return this.options.requestLogger?.(s), (await promisify(
|
|
39232
|
+
e.isMoving.bind(e),
|
|
39233
|
+
s
|
|
39234
|
+
)).getIsMoving();
|
|
39235
|
+
}
|
|
39236
|
+
}
|
|
39237
|
+
class BaseClient {
|
|
39238
|
+
client;
|
|
39239
|
+
name;
|
|
39240
|
+
options;
|
|
39241
|
+
constructor(e, s, n = {}) {
|
|
39242
|
+
this.client = e.createServiceClient(BaseServiceClient_1), this.name = s, this.options = n;
|
|
39243
|
+
}
|
|
39244
|
+
get baseService() {
|
|
39245
|
+
return this.client;
|
|
39246
|
+
}
|
|
39247
|
+
async moveStraight(e, s, n = {}) {
|
|
39248
|
+
const u = this.baseService, g = new base_pb.MoveStraightRequest();
|
|
39249
|
+
g.setName(this.name), g.setMmPerSec(s), g.setDistanceMm(e), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
39250
|
+
u.moveStraight.bind(u),
|
|
39251
|
+
g
|
|
39252
|
+
);
|
|
39253
|
+
}
|
|
39254
|
+
async spin(e, s, n = {}) {
|
|
39255
|
+
const u = this.baseService, g = new base_pb.SpinRequest();
|
|
39256
|
+
g.setName(this.name), g.setAngleDeg(e), g.setDegsPerSec(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
39257
|
+
u.spin.bind(u),
|
|
39258
|
+
g
|
|
39259
|
+
);
|
|
39260
|
+
}
|
|
39261
|
+
async setPower(e, s, n = {}) {
|
|
39262
|
+
const u = this.baseService, g = new base_pb.SetPowerRequest();
|
|
39263
|
+
g.setName(this.name), g.setLinear(encodeVector3D(e)), g.setAngular(encodeVector3D(s)), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
39264
|
+
u.setPower.bind(u),
|
|
39265
|
+
g
|
|
39266
|
+
);
|
|
39267
|
+
}
|
|
39268
|
+
async setVelocity(e, s, n = {}) {
|
|
39269
|
+
const u = this.baseService, g = new base_pb.SetVelocityRequest();
|
|
39270
|
+
g.setName(this.name), g.setLinear(encodeVector3D(e)), g.setAngular(encodeVector3D(s)), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
39271
|
+
u.setVelocity.bind(u),
|
|
39272
|
+
g
|
|
39273
|
+
);
|
|
39274
|
+
}
|
|
39275
|
+
async stop(e = {}) {
|
|
39276
|
+
const s = this.baseService, n = new base_pb.StopRequest();
|
|
39277
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
39278
|
+
s.stop.bind(s),
|
|
39279
|
+
n
|
|
39280
|
+
);
|
|
39281
|
+
}
|
|
39282
|
+
}
|
|
39283
|
+
class BoardClient {
|
|
39284
|
+
client;
|
|
39285
|
+
name;
|
|
39286
|
+
options;
|
|
39287
|
+
constructor(e, s, n = {}) {
|
|
39288
|
+
this.client = e.createServiceClient(BoardServiceClient_1), this.name = s, this.options = n;
|
|
39289
|
+
}
|
|
39290
|
+
get boardService() {
|
|
39291
|
+
return this.client;
|
|
39292
|
+
}
|
|
39293
|
+
async getRawStatusResponse(e = {}) {
|
|
39294
|
+
const s = this.boardService, n = new board_pb.StatusRequest();
|
|
39295
|
+
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
39296
|
+
s.status.bind(s),
|
|
39297
|
+
n
|
|
39298
|
+
);
|
|
39299
|
+
}
|
|
39300
|
+
/**
|
|
39301
|
+
* Get the status of the board as a raw protobuf response.
|
|
39302
|
+
*
|
|
39303
|
+
* @deprecated Use {@link BoardClient#getStatus} instead.
|
|
39304
|
+
*/
|
|
39305
|
+
status(e = {}) {
|
|
39306
|
+
return this.getRawStatusResponse(e);
|
|
39307
|
+
}
|
|
39308
|
+
async getStatus(e = {}) {
|
|
39309
|
+
const n = (await this.getRawStatusResponse(e)).getStatus();
|
|
39310
|
+
if (!n)
|
|
39311
|
+
throw new Error("no status");
|
|
39312
|
+
const u = {};
|
|
39313
|
+
for (const [p, o] of n.getAnalogsMap().entries())
|
|
39314
|
+
u[p] = o.getValue();
|
|
39315
|
+
const g = {};
|
|
39316
|
+
for (const [p, o] of n.getDigitalInterruptsMap().entries())
|
|
39317
|
+
g[p] = o.getValue();
|
|
39318
|
+
return { analogs: u, digitalInterrupts: g };
|
|
39319
|
+
}
|
|
39320
|
+
async setGPIO(e, s, n = {}) {
|
|
39321
|
+
const u = this.boardService, g = new board_pb.SetGPIORequest();
|
|
39322
|
+
g.setName(this.name), g.setPin(e), g.setHigh(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
39323
|
+
u.setGPIO.bind(u),
|
|
39324
|
+
g
|
|
39325
|
+
);
|
|
39326
|
+
}
|
|
39327
|
+
async getGPIO(e, s = {}) {
|
|
39328
|
+
const n = this.boardService, u = new board_pb.GetGPIORequest();
|
|
39329
|
+
return u.setName(this.name), u.setPin(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(
|
|
39330
|
+
n.getGPIO.bind(n),
|
|
39331
|
+
u
|
|
39332
|
+
)).getHigh();
|
|
39333
|
+
}
|
|
39334
|
+
async getPWM(e, s = {}) {
|
|
39335
|
+
const n = this.boardService, u = new board_pb.PWMRequest();
|
|
39336
|
+
return u.setName(this.name), u.setPin(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(
|
|
39337
|
+
n.pWM.bind(n),
|
|
39338
|
+
u
|
|
39339
|
+
)).getDutyCyclePct();
|
|
39340
|
+
}
|
|
39341
|
+
async setPWM(e, s, n = {}) {
|
|
39342
|
+
const u = this.boardService, g = new board_pb.SetPWMRequest();
|
|
39343
|
+
g.setName(this.name), g.setPin(e), g.setDutyCyclePct(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
39344
|
+
u.setPWM.bind(u),
|
|
39345
|
+
g
|
|
39346
|
+
);
|
|
39347
|
+
}
|
|
39348
|
+
async getPWMFrequency(e, s = {}) {
|
|
39349
|
+
const n = this.boardService, u = new board_pb.PWMFrequencyRequest();
|
|
39350
|
+
return u.setName(this.name), u.setPin(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(n.pWMFrequency.bind(n), u)).getFrequencyHz();
|
|
39351
|
+
}
|
|
39352
|
+
async setPWMFrequency(e, s, n = {}) {
|
|
39353
|
+
const u = this.boardService, g = new board_pb.SetPWMFrequencyRequest();
|
|
39354
|
+
g.setName(this.name), g.setPin(e), g.setFrequencyHz(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
39355
|
+
u.setPWMFrequency.bind(u),
|
|
39356
|
+
g
|
|
39357
|
+
);
|
|
39358
|
+
}
|
|
39359
|
+
async readAnalogReader(e, s = {}) {
|
|
39360
|
+
const n = this.boardService, u = new board_pb.ReadAnalogReaderRequest();
|
|
39361
|
+
return u.setBoardName(this.name), u.setAnalogReaderName(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(n.readAnalogReader.bind(n), u)).getValue();
|
|
39362
|
+
}
|
|
39363
|
+
async getDigitalInterruptValue(e, s = {}) {
|
|
39364
|
+
const n = this.boardService, u = new board_pb.GetDigitalInterruptValueRequest();
|
|
39365
|
+
return u.setBoardName(this.name), u.setDigitalInterruptName(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(n.getDigitalInterruptValue.bind(n), u)).getValue();
|
|
39366
|
+
}
|
|
39367
|
+
}
|
|
39172
39368
|
var camera_pb = {}, httpbody_pb = {}, any_pb = {};
|
|
39173
39369
|
(function(t) {
|
|
39174
39370
|
var e = googleProtobuf, s = e, n = typeof globalThis < "u" && globalThis || typeof window < "u" && window || typeof n < "u" && n || typeof self < "u" && self || function() {
|
|
@@ -40270,6 +40466,263 @@ var camera_pb = {}, httpbody_pb = {}, any_pb = {};
|
|
|
40270
40466
|
return this.setParametersList([]);
|
|
40271
40467
|
}, s.object.extend(t, proto.viam.component.camera.v1);
|
|
40272
40468
|
})(camera_pb);
|
|
40469
|
+
var component_camera_v1_camera_pb = camera_pb, common_v1_common_pb$1 = common_pb, google_api_httpbody_pb = httpbody_pb, grpc$2 = grpcWebClient_umdExports.grpc, CameraService = function() {
|
|
40470
|
+
function t() {
|
|
40471
|
+
}
|
|
40472
|
+
return t.serviceName = "viam.component.camera.v1.CameraService", t;
|
|
40473
|
+
}();
|
|
40474
|
+
CameraService.GetImage = {
|
|
40475
|
+
methodName: "GetImage",
|
|
40476
|
+
service: CameraService,
|
|
40477
|
+
requestStream: !1,
|
|
40478
|
+
responseStream: !1,
|
|
40479
|
+
requestType: component_camera_v1_camera_pb.GetImageRequest,
|
|
40480
|
+
responseType: component_camera_v1_camera_pb.GetImageResponse
|
|
40481
|
+
};
|
|
40482
|
+
CameraService.RenderFrame = {
|
|
40483
|
+
methodName: "RenderFrame",
|
|
40484
|
+
service: CameraService,
|
|
40485
|
+
requestStream: !1,
|
|
40486
|
+
responseStream: !1,
|
|
40487
|
+
requestType: component_camera_v1_camera_pb.RenderFrameRequest,
|
|
40488
|
+
responseType: google_api_httpbody_pb.HttpBody
|
|
40489
|
+
};
|
|
40490
|
+
CameraService.GetPointCloud = {
|
|
40491
|
+
methodName: "GetPointCloud",
|
|
40492
|
+
service: CameraService,
|
|
40493
|
+
requestStream: !1,
|
|
40494
|
+
responseStream: !1,
|
|
40495
|
+
requestType: component_camera_v1_camera_pb.GetPointCloudRequest,
|
|
40496
|
+
responseType: component_camera_v1_camera_pb.GetPointCloudResponse
|
|
40497
|
+
};
|
|
40498
|
+
CameraService.GetProperties = {
|
|
40499
|
+
methodName: "GetProperties",
|
|
40500
|
+
service: CameraService,
|
|
40501
|
+
requestStream: !1,
|
|
40502
|
+
responseStream: !1,
|
|
40503
|
+
requestType: component_camera_v1_camera_pb.GetPropertiesRequest,
|
|
40504
|
+
responseType: component_camera_v1_camera_pb.GetPropertiesResponse
|
|
40505
|
+
};
|
|
40506
|
+
CameraService.DoCommand = {
|
|
40507
|
+
methodName: "DoCommand",
|
|
40508
|
+
service: CameraService,
|
|
40509
|
+
requestStream: !1,
|
|
40510
|
+
responseStream: !1,
|
|
40511
|
+
requestType: common_v1_common_pb$1.DoCommandRequest,
|
|
40512
|
+
responseType: common_v1_common_pb$1.DoCommandResponse
|
|
40513
|
+
};
|
|
40514
|
+
function CameraServiceClient(t, e) {
|
|
40515
|
+
this.serviceHost = t, this.options = e || {};
|
|
40516
|
+
}
|
|
40517
|
+
CameraServiceClient.prototype.getImage = function t(e, s, n) {
|
|
40518
|
+
arguments.length === 2 && (n = arguments[1]);
|
|
40519
|
+
var u = grpc$2.unary(CameraService.GetImage, {
|
|
40520
|
+
request: e,
|
|
40521
|
+
host: this.serviceHost,
|
|
40522
|
+
metadata: s,
|
|
40523
|
+
transport: this.options.transport,
|
|
40524
|
+
debug: this.options.debug,
|
|
40525
|
+
onEnd: function(g) {
|
|
40526
|
+
if (n)
|
|
40527
|
+
if (g.status !== grpc$2.Code.OK) {
|
|
40528
|
+
var p = new Error(g.statusMessage);
|
|
40529
|
+
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40530
|
+
} else
|
|
40531
|
+
n(null, g.message);
|
|
40532
|
+
}
|
|
40533
|
+
});
|
|
40534
|
+
return {
|
|
40535
|
+
cancel: function() {
|
|
40536
|
+
n = null, u.close();
|
|
40537
|
+
}
|
|
40538
|
+
};
|
|
40539
|
+
};
|
|
40540
|
+
CameraServiceClient.prototype.renderFrame = function t(e, s, n) {
|
|
40541
|
+
arguments.length === 2 && (n = arguments[1]);
|
|
40542
|
+
var u = grpc$2.unary(CameraService.RenderFrame, {
|
|
40543
|
+
request: e,
|
|
40544
|
+
host: this.serviceHost,
|
|
40545
|
+
metadata: s,
|
|
40546
|
+
transport: this.options.transport,
|
|
40547
|
+
debug: this.options.debug,
|
|
40548
|
+
onEnd: function(g) {
|
|
40549
|
+
if (n)
|
|
40550
|
+
if (g.status !== grpc$2.Code.OK) {
|
|
40551
|
+
var p = new Error(g.statusMessage);
|
|
40552
|
+
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40553
|
+
} else
|
|
40554
|
+
n(null, g.message);
|
|
40555
|
+
}
|
|
40556
|
+
});
|
|
40557
|
+
return {
|
|
40558
|
+
cancel: function() {
|
|
40559
|
+
n = null, u.close();
|
|
40560
|
+
}
|
|
40561
|
+
};
|
|
40562
|
+
};
|
|
40563
|
+
CameraServiceClient.prototype.getPointCloud = function t(e, s, n) {
|
|
40564
|
+
arguments.length === 2 && (n = arguments[1]);
|
|
40565
|
+
var u = grpc$2.unary(CameraService.GetPointCloud, {
|
|
40566
|
+
request: e,
|
|
40567
|
+
host: this.serviceHost,
|
|
40568
|
+
metadata: s,
|
|
40569
|
+
transport: this.options.transport,
|
|
40570
|
+
debug: this.options.debug,
|
|
40571
|
+
onEnd: function(g) {
|
|
40572
|
+
if (n)
|
|
40573
|
+
if (g.status !== grpc$2.Code.OK) {
|
|
40574
|
+
var p = new Error(g.statusMessage);
|
|
40575
|
+
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40576
|
+
} else
|
|
40577
|
+
n(null, g.message);
|
|
40578
|
+
}
|
|
40579
|
+
});
|
|
40580
|
+
return {
|
|
40581
|
+
cancel: function() {
|
|
40582
|
+
n = null, u.close();
|
|
40583
|
+
}
|
|
40584
|
+
};
|
|
40585
|
+
};
|
|
40586
|
+
CameraServiceClient.prototype.getProperties = function t(e, s, n) {
|
|
40587
|
+
arguments.length === 2 && (n = arguments[1]);
|
|
40588
|
+
var u = grpc$2.unary(CameraService.GetProperties, {
|
|
40589
|
+
request: e,
|
|
40590
|
+
host: this.serviceHost,
|
|
40591
|
+
metadata: s,
|
|
40592
|
+
transport: this.options.transport,
|
|
40593
|
+
debug: this.options.debug,
|
|
40594
|
+
onEnd: function(g) {
|
|
40595
|
+
if (n)
|
|
40596
|
+
if (g.status !== grpc$2.Code.OK) {
|
|
40597
|
+
var p = new Error(g.statusMessage);
|
|
40598
|
+
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40599
|
+
} else
|
|
40600
|
+
n(null, g.message);
|
|
40601
|
+
}
|
|
40602
|
+
});
|
|
40603
|
+
return {
|
|
40604
|
+
cancel: function() {
|
|
40605
|
+
n = null, u.close();
|
|
40606
|
+
}
|
|
40607
|
+
};
|
|
40608
|
+
};
|
|
40609
|
+
CameraServiceClient.prototype.doCommand = function t(e, s, n) {
|
|
40610
|
+
arguments.length === 2 && (n = arguments[1]);
|
|
40611
|
+
var u = grpc$2.unary(CameraService.DoCommand, {
|
|
40612
|
+
request: e,
|
|
40613
|
+
host: this.serviceHost,
|
|
40614
|
+
metadata: s,
|
|
40615
|
+
transport: this.options.transport,
|
|
40616
|
+
debug: this.options.debug,
|
|
40617
|
+
onEnd: function(g) {
|
|
40618
|
+
if (n)
|
|
40619
|
+
if (g.status !== grpc$2.Code.OK) {
|
|
40620
|
+
var p = new Error(g.statusMessage);
|
|
40621
|
+
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40622
|
+
} else
|
|
40623
|
+
n(null, g.message);
|
|
40624
|
+
}
|
|
40625
|
+
});
|
|
40626
|
+
return {
|
|
40627
|
+
cancel: function() {
|
|
40628
|
+
n = null, u.close();
|
|
40629
|
+
}
|
|
40630
|
+
};
|
|
40631
|
+
};
|
|
40632
|
+
var CameraServiceClient_1 = CameraServiceClient;
|
|
40633
|
+
const PointCloudPCD = "pointcloud/pcd";
|
|
40634
|
+
class CameraClient {
|
|
40635
|
+
client;
|
|
40636
|
+
name;
|
|
40637
|
+
options;
|
|
40638
|
+
constructor(e, s, n = {}) {
|
|
40639
|
+
this.client = e.createServiceClient(CameraServiceClient_1), this.name = s, this.options = n;
|
|
40640
|
+
}
|
|
40641
|
+
get cameraService() {
|
|
40642
|
+
return this.client;
|
|
40643
|
+
}
|
|
40644
|
+
async getImage(e) {
|
|
40645
|
+
const s = this.cameraService, n = new camera_pb.GetImageRequest();
|
|
40646
|
+
return n.setName(this.name), n.setMimeType(e), this.options.requestLogger?.(n), (await promisify(
|
|
40647
|
+
s.getImage.bind(s),
|
|
40648
|
+
n
|
|
40649
|
+
)).getImage_asU8();
|
|
40650
|
+
}
|
|
40651
|
+
async renderFrame(e) {
|
|
40652
|
+
const s = this.cameraService, n = new camera_pb.GetPointCloudRequest();
|
|
40653
|
+
n.setName(this.name), n.setMimeType(e), this.options.requestLogger?.(n);
|
|
40654
|
+
const u = await promisify(
|
|
40655
|
+
s.renderFrame.bind(s),
|
|
40656
|
+
n
|
|
40657
|
+
);
|
|
40658
|
+
return new Blob([u.getData_asU8()], { type: e });
|
|
40659
|
+
}
|
|
40660
|
+
async getPointCloud() {
|
|
40661
|
+
const e = this.cameraService, s = new camera_pb.GetPointCloudRequest();
|
|
40662
|
+
return s.setName(this.name), s.setMimeType(PointCloudPCD), this.options.requestLogger?.(s), (await promisify(e.getPointCloud.bind(e), s)).getPointCloud_asU8();
|
|
40663
|
+
}
|
|
40664
|
+
async getProperties() {
|
|
40665
|
+
const e = this.cameraService, s = new camera_pb.GetPropertiesRequest();
|
|
40666
|
+
return s.setName(this.name), this.options.requestLogger?.(s), (await promisify(e.getProperties.bind(e), s)).toObject();
|
|
40667
|
+
}
|
|
40668
|
+
}
|
|
40669
|
+
class MotorClient {
|
|
40670
|
+
client;
|
|
40671
|
+
name;
|
|
40672
|
+
options;
|
|
40673
|
+
constructor(e, s, n = {}) {
|
|
40674
|
+
this.client = e.createServiceClient(MotorServiceClient_1), this.name = s, this.options = n;
|
|
40675
|
+
}
|
|
40676
|
+
get motorService() {
|
|
40677
|
+
return this.client;
|
|
40678
|
+
}
|
|
40679
|
+
async setPower(e, s = {}) {
|
|
40680
|
+
const n = this.motorService, u = new motor_pb.SetPowerRequest();
|
|
40681
|
+
u.setName(this.name), u.setPowerPct(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), await promisify(
|
|
40682
|
+
n.setPower.bind(n),
|
|
40683
|
+
u
|
|
40684
|
+
);
|
|
40685
|
+
}
|
|
40686
|
+
async goFor(e, s, n = {}) {
|
|
40687
|
+
const u = this.motorService, g = new motor_pb.GoForRequest();
|
|
40688
|
+
g.setName(this.name), g.setRpm(e), g.setRevolutions(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40689
|
+
u.goFor.bind(u),
|
|
40690
|
+
g
|
|
40691
|
+
);
|
|
40692
|
+
}
|
|
40693
|
+
async goTo(e, s, n = {}) {
|
|
40694
|
+
const u = this.motorService, g = new motor_pb.GoToRequest();
|
|
40695
|
+
g.setName(this.name), g.setRpm(e), g.setPositionRevolutions(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40696
|
+
u.goTo.bind(u),
|
|
40697
|
+
g
|
|
40698
|
+
);
|
|
40699
|
+
}
|
|
40700
|
+
async resetZeroPosition(e, s = {}) {
|
|
40701
|
+
const n = this.motorService, u = new motor_pb.ResetZeroPositionRequest();
|
|
40702
|
+
u.setName(this.name), u.setOffset(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), await promisify(n.resetZeroPosition.bind(n), u);
|
|
40703
|
+
}
|
|
40704
|
+
async stop(e = {}) {
|
|
40705
|
+
const s = this.motorService, n = new motor_pb.StopRequest();
|
|
40706
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
40707
|
+
s.stop.bind(s),
|
|
40708
|
+
n
|
|
40709
|
+
);
|
|
40710
|
+
}
|
|
40711
|
+
async getProperties(e = {}) {
|
|
40712
|
+
const s = this.motorService, n = new motor_pb.GetPropertiesRequest();
|
|
40713
|
+
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), { positionReporting: (await promisify(s.getProperties.bind(s), n)).getPositionReporting() };
|
|
40714
|
+
}
|
|
40715
|
+
async getPosition(e = {}) {
|
|
40716
|
+
const s = this.motorService, n = new motor_pb.GetPositionRequest();
|
|
40717
|
+
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), (await promisify(s.getPosition.bind(s), n)).getPosition();
|
|
40718
|
+
}
|
|
40719
|
+
async isPowered(e = {}) {
|
|
40720
|
+
const s = this.motorService, n = new motor_pb.IsPoweredRequest();
|
|
40721
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40722
|
+
const u = await promisify(s.isPowered.bind(s), n);
|
|
40723
|
+
return [u.getIsOn(), u.getPowerPct()];
|
|
40724
|
+
}
|
|
40725
|
+
}
|
|
40273
40726
|
var sensor_pb = {};
|
|
40274
40727
|
(function(t) {
|
|
40275
40728
|
var e = googleProtobuf, s = e, n = function() {
|
|
@@ -40392,6 +40845,200 @@ var sensor_pb = {};
|
|
|
40392
40845
|
return this.getReadingsMap().clear(), this;
|
|
40393
40846
|
}, s.object.extend(t, proto.viam.component.sensor.v1);
|
|
40394
40847
|
})(sensor_pb);
|
|
40848
|
+
var component_sensor_v1_sensor_pb = sensor_pb, common_v1_common_pb = common_pb, grpc$1 = grpcWebClient_umdExports.grpc, SensorService = function() {
|
|
40849
|
+
function t() {
|
|
40850
|
+
}
|
|
40851
|
+
return t.serviceName = "viam.component.sensor.v1.SensorService", t;
|
|
40852
|
+
}();
|
|
40853
|
+
SensorService.GetReadings = {
|
|
40854
|
+
methodName: "GetReadings",
|
|
40855
|
+
service: SensorService,
|
|
40856
|
+
requestStream: !1,
|
|
40857
|
+
responseStream: !1,
|
|
40858
|
+
requestType: component_sensor_v1_sensor_pb.GetReadingsRequest,
|
|
40859
|
+
responseType: component_sensor_v1_sensor_pb.GetReadingsResponse
|
|
40860
|
+
};
|
|
40861
|
+
SensorService.DoCommand = {
|
|
40862
|
+
methodName: "DoCommand",
|
|
40863
|
+
service: SensorService,
|
|
40864
|
+
requestStream: !1,
|
|
40865
|
+
responseStream: !1,
|
|
40866
|
+
requestType: common_v1_common_pb.DoCommandRequest,
|
|
40867
|
+
responseType: common_v1_common_pb.DoCommandResponse
|
|
40868
|
+
};
|
|
40869
|
+
function SensorServiceClient(t, e) {
|
|
40870
|
+
this.serviceHost = t, this.options = e || {};
|
|
40871
|
+
}
|
|
40872
|
+
SensorServiceClient.prototype.getReadings = function t(e, s, n) {
|
|
40873
|
+
arguments.length === 2 && (n = arguments[1]);
|
|
40874
|
+
var u = grpc$1.unary(SensorService.GetReadings, {
|
|
40875
|
+
request: e,
|
|
40876
|
+
host: this.serviceHost,
|
|
40877
|
+
metadata: s,
|
|
40878
|
+
transport: this.options.transport,
|
|
40879
|
+
debug: this.options.debug,
|
|
40880
|
+
onEnd: function(g) {
|
|
40881
|
+
if (n)
|
|
40882
|
+
if (g.status !== grpc$1.Code.OK) {
|
|
40883
|
+
var p = new Error(g.statusMessage);
|
|
40884
|
+
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40885
|
+
} else
|
|
40886
|
+
n(null, g.message);
|
|
40887
|
+
}
|
|
40888
|
+
});
|
|
40889
|
+
return {
|
|
40890
|
+
cancel: function() {
|
|
40891
|
+
n = null, u.close();
|
|
40892
|
+
}
|
|
40893
|
+
};
|
|
40894
|
+
};
|
|
40895
|
+
SensorServiceClient.prototype.doCommand = function t(e, s, n) {
|
|
40896
|
+
arguments.length === 2 && (n = arguments[1]);
|
|
40897
|
+
var u = grpc$1.unary(SensorService.DoCommand, {
|
|
40898
|
+
request: e,
|
|
40899
|
+
host: this.serviceHost,
|
|
40900
|
+
metadata: s,
|
|
40901
|
+
transport: this.options.transport,
|
|
40902
|
+
debug: this.options.debug,
|
|
40903
|
+
onEnd: function(g) {
|
|
40904
|
+
if (n)
|
|
40905
|
+
if (g.status !== grpc$1.Code.OK) {
|
|
40906
|
+
var p = new Error(g.statusMessage);
|
|
40907
|
+
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40908
|
+
} else
|
|
40909
|
+
n(null, g.message);
|
|
40910
|
+
}
|
|
40911
|
+
});
|
|
40912
|
+
return {
|
|
40913
|
+
cancel: function() {
|
|
40914
|
+
n = null, u.close();
|
|
40915
|
+
}
|
|
40916
|
+
};
|
|
40917
|
+
};
|
|
40918
|
+
var SensorServiceClient_1 = SensorServiceClient;
|
|
40919
|
+
class SensorClient {
|
|
40920
|
+
client;
|
|
40921
|
+
name;
|
|
40922
|
+
options;
|
|
40923
|
+
constructor(e, s, n = {}) {
|
|
40924
|
+
this.client = e.createServiceClient(SensorServiceClient_1), this.name = s, this.options = n;
|
|
40925
|
+
}
|
|
40926
|
+
get sensorService() {
|
|
40927
|
+
return this.client;
|
|
40928
|
+
}
|
|
40929
|
+
async getReadings(e = {}) {
|
|
40930
|
+
const s = this.sensorService, n = new sensor_pb.GetReadingsRequest();
|
|
40931
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40932
|
+
const u = await promisify(s.getReadings.bind(s), n), g = {};
|
|
40933
|
+
for (const [p, o] of u.getReadingsMap().entries())
|
|
40934
|
+
g[p] = o.toJavaScript();
|
|
40935
|
+
return g;
|
|
40936
|
+
}
|
|
40937
|
+
}
|
|
40938
|
+
class MovementSensorClient {
|
|
40939
|
+
client;
|
|
40940
|
+
sensorclient;
|
|
40941
|
+
name;
|
|
40942
|
+
options;
|
|
40943
|
+
constructor(e, s, n = {}) {
|
|
40944
|
+
this.client = e.createServiceClient(MovementSensorServiceClient_1), this.sensorclient = new SensorClient(e, s, n), this.name = s, this.options = n;
|
|
40945
|
+
}
|
|
40946
|
+
get movementsensorService() {
|
|
40947
|
+
return this.client;
|
|
40948
|
+
}
|
|
40949
|
+
async getLinearVelocity(e = {}) {
|
|
40950
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetLinearVelocityRequest();
|
|
40951
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40952
|
+
const g = (await promisify(
|
|
40953
|
+
s.getLinearVelocity.bind(s),
|
|
40954
|
+
n
|
|
40955
|
+
)).getLinearVelocity();
|
|
40956
|
+
if (!g)
|
|
40957
|
+
throw new Error("no linear velocity");
|
|
40958
|
+
return decodeVector3D(g);
|
|
40959
|
+
}
|
|
40960
|
+
async getAngularVelocity(e = {}) {
|
|
40961
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetAngularVelocityRequest();
|
|
40962
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40963
|
+
const g = (await promisify(
|
|
40964
|
+
s.getAngularVelocity.bind(s),
|
|
40965
|
+
n
|
|
40966
|
+
)).getAngularVelocity();
|
|
40967
|
+
if (!g)
|
|
40968
|
+
throw new Error("no angular velocity");
|
|
40969
|
+
return decodeVector3D(g);
|
|
40970
|
+
}
|
|
40971
|
+
async getCompassHeading(e = {}) {
|
|
40972
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetCompassHeadingRequest();
|
|
40973
|
+
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), (await promisify(
|
|
40974
|
+
s.getCompassHeading.bind(s),
|
|
40975
|
+
n
|
|
40976
|
+
)).getValue();
|
|
40977
|
+
}
|
|
40978
|
+
async getOrientation(e = {}) {
|
|
40979
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetOrientationRequest();
|
|
40980
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40981
|
+
const g = (await promisify(
|
|
40982
|
+
s.getOrientation.bind(s),
|
|
40983
|
+
n
|
|
40984
|
+
)).getOrientation();
|
|
40985
|
+
if (!g)
|
|
40986
|
+
throw new Error("no orientation");
|
|
40987
|
+
return {
|
|
40988
|
+
ox: g.getOX(),
|
|
40989
|
+
oy: g.getOY(),
|
|
40990
|
+
oz: g.getOZ(),
|
|
40991
|
+
theta: g.getTheta()
|
|
40992
|
+
};
|
|
40993
|
+
}
|
|
40994
|
+
async getPosition(e = {}) {
|
|
40995
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetPositionRequest();
|
|
40996
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40997
|
+
const u = await promisify(s.getPosition.bind(s), n), g = u.getCoordinate();
|
|
40998
|
+
if (!g)
|
|
40999
|
+
throw new Error("no coordinate");
|
|
41000
|
+
return {
|
|
41001
|
+
latitude: g.getLatitude(),
|
|
41002
|
+
longitude: g.getLongitude(),
|
|
41003
|
+
altitudeMM: u.getAltitudeMm()
|
|
41004
|
+
};
|
|
41005
|
+
}
|
|
41006
|
+
async getProperties(e = {}) {
|
|
41007
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetPropertiesRequest();
|
|
41008
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41009
|
+
const u = await promisify(s.getProperties.bind(s), n);
|
|
41010
|
+
return {
|
|
41011
|
+
linearVelocitySupported: u.getLinearVelocitySupported(),
|
|
41012
|
+
angularVelocitySupported: u.getAngularVelocitySupported(),
|
|
41013
|
+
orientationSupported: u.getOrientationSupported(),
|
|
41014
|
+
positionSupported: u.getPositionSupported(),
|
|
41015
|
+
compassHeadingSupported: u.getCompassHeadingSupported(),
|
|
41016
|
+
linearAccelerationSupported: u.getLinearAccelerationSupported()
|
|
41017
|
+
};
|
|
41018
|
+
}
|
|
41019
|
+
async getAccuracy(e = {}) {
|
|
41020
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetAccuracyRequest();
|
|
41021
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41022
|
+
const g = (await promisify(s.getAccuracy.bind(s), n)).getAccuracyMmMap(), p = {};
|
|
41023
|
+
for (const [o, r] of g.entries())
|
|
41024
|
+
p[o] = r;
|
|
41025
|
+
return p;
|
|
41026
|
+
}
|
|
41027
|
+
async getLinearAcceleration(e = {}) {
|
|
41028
|
+
const s = this.movementsensorService, n = new movementsensor_pb.GetLinearAccelerationRequest();
|
|
41029
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41030
|
+
const g = (await promisify(
|
|
41031
|
+
s.getLinearAcceleration.bind(s),
|
|
41032
|
+
n
|
|
41033
|
+
)).getLinearAcceleration();
|
|
41034
|
+
if (!g)
|
|
41035
|
+
throw new Error("no linear acceleration");
|
|
41036
|
+
return decodeVector3D(g);
|
|
41037
|
+
}
|
|
41038
|
+
getReadings(e = {}) {
|
|
41039
|
+
return this.sensorclient.getReadings(e);
|
|
41040
|
+
}
|
|
41041
|
+
}
|
|
40395
41042
|
var stream_pb = {};
|
|
40396
41043
|
(function(t) {
|
|
40397
41044
|
var e = googleProtobuf, s = e, n = function() {
|
|
@@ -40610,652 +41257,6 @@ var stream_pb = {};
|
|
|
40610
41257
|
}, proto.proto.stream.v1.RemoveStreamResponse.serializeBinaryToWriter = function(u, g) {
|
|
40611
41258
|
}, s.object.extend(t, proto.proto.stream.v1);
|
|
40612
41259
|
})(stream_pb);
|
|
40613
|
-
class ArmClient {
|
|
40614
|
-
client;
|
|
40615
|
-
name;
|
|
40616
|
-
options;
|
|
40617
|
-
constructor(e, s, n = {}) {
|
|
40618
|
-
this.client = e.createServiceClient(ArmServiceClient_1), this.name = s, this.options = n;
|
|
40619
|
-
}
|
|
40620
|
-
get ArmService() {
|
|
40621
|
-
return this.client;
|
|
40622
|
-
}
|
|
40623
|
-
async getEndPosition(e = {}) {
|
|
40624
|
-
const s = this.ArmService, n = new arm_pb.GetEndPositionRequest();
|
|
40625
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40626
|
-
const g = (await promisify(s.getEndPosition.bind(s), n)).getPose();
|
|
40627
|
-
if (!g)
|
|
40628
|
-
throw new Error("no pose");
|
|
40629
|
-
return {
|
|
40630
|
-
x: g.getX(),
|
|
40631
|
-
y: g.getY(),
|
|
40632
|
-
z: g.getZ(),
|
|
40633
|
-
ox: g.getOX(),
|
|
40634
|
-
oy: g.getOY(),
|
|
40635
|
-
oz: g.getOZ(),
|
|
40636
|
-
theta: g.getTheta()
|
|
40637
|
-
};
|
|
40638
|
-
}
|
|
40639
|
-
async moveToPosition(e, s = {}) {
|
|
40640
|
-
const n = this.ArmService, u = new common_pb.Pose();
|
|
40641
|
-
u.setX(e.x), u.setY(e.y), u.setZ(e.z), u.setOX(e.ox), u.setOY(e.oy), u.setOZ(e.oz), u.setTheta(e.theta);
|
|
40642
|
-
const g = new arm_pb.MoveToPositionRequest();
|
|
40643
|
-
g.setName(this.name), g.setTo(u), g.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(g), await promisify(
|
|
40644
|
-
n.moveToPosition.bind(n),
|
|
40645
|
-
g
|
|
40646
|
-
);
|
|
40647
|
-
}
|
|
40648
|
-
async moveToJointPositions(e, s = {}) {
|
|
40649
|
-
const n = this.ArmService, u = new arm_pb.JointPositions();
|
|
40650
|
-
u.setValuesList(e);
|
|
40651
|
-
const g = new arm_pb.MoveToJointPositionsRequest();
|
|
40652
|
-
g.setName(this.name), g.setPositions(u), g.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(g), await promisify(n.moveToJointPositions.bind(n), g);
|
|
40653
|
-
}
|
|
40654
|
-
async getJointPositions(e = {}) {
|
|
40655
|
-
const s = this.ArmService, n = new arm_pb.GetJointPositionsRequest();
|
|
40656
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
40657
|
-
const g = (await promisify(s.getJointPositions.bind(s), n)).getPositions();
|
|
40658
|
-
if (!g)
|
|
40659
|
-
throw new Error("no pose");
|
|
40660
|
-
return g;
|
|
40661
|
-
}
|
|
40662
|
-
async stop(e = {}) {
|
|
40663
|
-
const s = this.ArmService, n = new arm_pb.StopRequest();
|
|
40664
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
40665
|
-
s.stop.bind(s),
|
|
40666
|
-
n
|
|
40667
|
-
);
|
|
40668
|
-
}
|
|
40669
|
-
async isMoving() {
|
|
40670
|
-
const e = this.ArmService, s = new arm_pb.IsMovingRequest();
|
|
40671
|
-
return this.options.requestLogger?.(s), (await promisify(
|
|
40672
|
-
e.isMoving.bind(e),
|
|
40673
|
-
s
|
|
40674
|
-
)).getIsMoving();
|
|
40675
|
-
}
|
|
40676
|
-
}
|
|
40677
|
-
class BaseClient {
|
|
40678
|
-
client;
|
|
40679
|
-
name;
|
|
40680
|
-
options;
|
|
40681
|
-
constructor(e, s, n = {}) {
|
|
40682
|
-
this.client = e.createServiceClient(BaseServiceClient_1), this.name = s, this.options = n;
|
|
40683
|
-
}
|
|
40684
|
-
get baseService() {
|
|
40685
|
-
return this.client;
|
|
40686
|
-
}
|
|
40687
|
-
async moveStraight(e, s, n = {}) {
|
|
40688
|
-
const u = this.baseService, g = new base_pb.MoveStraightRequest();
|
|
40689
|
-
g.setName(this.name), g.setMmPerSec(s), g.setDistanceMm(e), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40690
|
-
u.moveStraight.bind(u),
|
|
40691
|
-
g
|
|
40692
|
-
);
|
|
40693
|
-
}
|
|
40694
|
-
async spin(e, s, n = {}) {
|
|
40695
|
-
const u = this.baseService, g = new base_pb.SpinRequest();
|
|
40696
|
-
g.setName(this.name), g.setAngleDeg(e), g.setDegsPerSec(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40697
|
-
u.spin.bind(u),
|
|
40698
|
-
g
|
|
40699
|
-
);
|
|
40700
|
-
}
|
|
40701
|
-
async setPower(e, s, n = {}) {
|
|
40702
|
-
const u = this.baseService, g = new base_pb.SetPowerRequest();
|
|
40703
|
-
g.setName(this.name), g.setLinear(encodeVector3D(e)), g.setAngular(encodeVector3D(s)), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40704
|
-
u.setPower.bind(u),
|
|
40705
|
-
g
|
|
40706
|
-
);
|
|
40707
|
-
}
|
|
40708
|
-
async setVelocity(e, s, n = {}) {
|
|
40709
|
-
const u = this.baseService, g = new base_pb.SetVelocityRequest();
|
|
40710
|
-
g.setName(this.name), g.setLinear(encodeVector3D(e)), g.setAngular(encodeVector3D(s)), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40711
|
-
u.setVelocity.bind(u),
|
|
40712
|
-
g
|
|
40713
|
-
);
|
|
40714
|
-
}
|
|
40715
|
-
async stop(e = {}) {
|
|
40716
|
-
const s = this.baseService, n = new base_pb.StopRequest();
|
|
40717
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
40718
|
-
s.stop.bind(s),
|
|
40719
|
-
n
|
|
40720
|
-
);
|
|
40721
|
-
}
|
|
40722
|
-
}
|
|
40723
|
-
class BoardClient {
|
|
40724
|
-
client;
|
|
40725
|
-
name;
|
|
40726
|
-
options;
|
|
40727
|
-
constructor(e, s, n = {}) {
|
|
40728
|
-
this.client = e.createServiceClient(BoardServiceClient_1), this.name = s, this.options = n;
|
|
40729
|
-
}
|
|
40730
|
-
get boardService() {
|
|
40731
|
-
return this.client;
|
|
40732
|
-
}
|
|
40733
|
-
async getRawStatusResponse(e = {}) {
|
|
40734
|
-
const s = this.boardService, n = new board_pb.StatusRequest();
|
|
40735
|
-
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
40736
|
-
s.status.bind(s),
|
|
40737
|
-
n
|
|
40738
|
-
);
|
|
40739
|
-
}
|
|
40740
|
-
/**
|
|
40741
|
-
* Get the status of the board as a raw protobuf response.
|
|
40742
|
-
*
|
|
40743
|
-
* @deprecated Use {@link BoardClient#getStatus} instead.
|
|
40744
|
-
*/
|
|
40745
|
-
status(e = {}) {
|
|
40746
|
-
return this.getRawStatusResponse(e);
|
|
40747
|
-
}
|
|
40748
|
-
async getStatus(e = {}) {
|
|
40749
|
-
const n = (await this.getRawStatusResponse(e)).getStatus();
|
|
40750
|
-
if (!n)
|
|
40751
|
-
throw new Error("no status");
|
|
40752
|
-
const u = {};
|
|
40753
|
-
for (const [p, o] of n.getAnalogsMap().entries())
|
|
40754
|
-
u[p] = o.getValue();
|
|
40755
|
-
const g = {};
|
|
40756
|
-
for (const [p, o] of n.getDigitalInterruptsMap().entries())
|
|
40757
|
-
g[p] = o.getValue();
|
|
40758
|
-
return { analogs: u, digitalInterrupts: g };
|
|
40759
|
-
}
|
|
40760
|
-
async setGPIO(e, s, n = {}) {
|
|
40761
|
-
const u = this.boardService, g = new board_pb.SetGPIORequest();
|
|
40762
|
-
g.setName(this.name), g.setPin(e), g.setHigh(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40763
|
-
u.setGPIO.bind(u),
|
|
40764
|
-
g
|
|
40765
|
-
);
|
|
40766
|
-
}
|
|
40767
|
-
async getGPIO(e, s = {}) {
|
|
40768
|
-
const n = this.boardService, u = new board_pb.GetGPIORequest();
|
|
40769
|
-
return u.setName(this.name), u.setPin(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(
|
|
40770
|
-
n.getGPIO.bind(n),
|
|
40771
|
-
u
|
|
40772
|
-
)).getHigh();
|
|
40773
|
-
}
|
|
40774
|
-
async getPWM(e, s = {}) {
|
|
40775
|
-
const n = this.boardService, u = new board_pb.PWMRequest();
|
|
40776
|
-
return u.setName(this.name), u.setPin(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(
|
|
40777
|
-
n.pWM.bind(n),
|
|
40778
|
-
u
|
|
40779
|
-
)).getDutyCyclePct();
|
|
40780
|
-
}
|
|
40781
|
-
async setPWM(e, s, n = {}) {
|
|
40782
|
-
const u = this.boardService, g = new board_pb.SetPWMRequest();
|
|
40783
|
-
g.setName(this.name), g.setPin(e), g.setDutyCyclePct(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40784
|
-
u.setPWM.bind(u),
|
|
40785
|
-
g
|
|
40786
|
-
);
|
|
40787
|
-
}
|
|
40788
|
-
async getPWMFrequency(e, s = {}) {
|
|
40789
|
-
const n = this.boardService, u = new board_pb.PWMFrequencyRequest();
|
|
40790
|
-
return u.setName(this.name), u.setPin(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(n.pWMFrequency.bind(n), u)).getFrequencyHz();
|
|
40791
|
-
}
|
|
40792
|
-
async setPWMFrequency(e, s, n = {}) {
|
|
40793
|
-
const u = this.boardService, g = new board_pb.SetPWMFrequencyRequest();
|
|
40794
|
-
g.setName(this.name), g.setPin(e), g.setFrequencyHz(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
40795
|
-
u.setPWMFrequency.bind(u),
|
|
40796
|
-
g
|
|
40797
|
-
);
|
|
40798
|
-
}
|
|
40799
|
-
async readAnalogReader(e, s = {}) {
|
|
40800
|
-
const n = this.boardService, u = new board_pb.ReadAnalogReaderRequest();
|
|
40801
|
-
return u.setBoardName(this.name), u.setAnalogReaderName(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(n.readAnalogReader.bind(n), u)).getValue();
|
|
40802
|
-
}
|
|
40803
|
-
async getDigitalInterruptValue(e, s = {}) {
|
|
40804
|
-
const n = this.boardService, u = new board_pb.GetDigitalInterruptValueRequest();
|
|
40805
|
-
return u.setBoardName(this.name), u.setDigitalInterruptName(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), (await promisify(n.getDigitalInterruptValue.bind(n), u)).getValue();
|
|
40806
|
-
}
|
|
40807
|
-
}
|
|
40808
|
-
var component_camera_v1_camera_pb = camera_pb, common_v1_common_pb$1 = common_pb, google_api_httpbody_pb = httpbody_pb, grpc$2 = grpcWebClient_umdExports.grpc, CameraService = function() {
|
|
40809
|
-
function t() {
|
|
40810
|
-
}
|
|
40811
|
-
return t.serviceName = "viam.component.camera.v1.CameraService", t;
|
|
40812
|
-
}();
|
|
40813
|
-
CameraService.GetImage = {
|
|
40814
|
-
methodName: "GetImage",
|
|
40815
|
-
service: CameraService,
|
|
40816
|
-
requestStream: !1,
|
|
40817
|
-
responseStream: !1,
|
|
40818
|
-
requestType: component_camera_v1_camera_pb.GetImageRequest,
|
|
40819
|
-
responseType: component_camera_v1_camera_pb.GetImageResponse
|
|
40820
|
-
};
|
|
40821
|
-
CameraService.RenderFrame = {
|
|
40822
|
-
methodName: "RenderFrame",
|
|
40823
|
-
service: CameraService,
|
|
40824
|
-
requestStream: !1,
|
|
40825
|
-
responseStream: !1,
|
|
40826
|
-
requestType: component_camera_v1_camera_pb.RenderFrameRequest,
|
|
40827
|
-
responseType: google_api_httpbody_pb.HttpBody
|
|
40828
|
-
};
|
|
40829
|
-
CameraService.GetPointCloud = {
|
|
40830
|
-
methodName: "GetPointCloud",
|
|
40831
|
-
service: CameraService,
|
|
40832
|
-
requestStream: !1,
|
|
40833
|
-
responseStream: !1,
|
|
40834
|
-
requestType: component_camera_v1_camera_pb.GetPointCloudRequest,
|
|
40835
|
-
responseType: component_camera_v1_camera_pb.GetPointCloudResponse
|
|
40836
|
-
};
|
|
40837
|
-
CameraService.GetProperties = {
|
|
40838
|
-
methodName: "GetProperties",
|
|
40839
|
-
service: CameraService,
|
|
40840
|
-
requestStream: !1,
|
|
40841
|
-
responseStream: !1,
|
|
40842
|
-
requestType: component_camera_v1_camera_pb.GetPropertiesRequest,
|
|
40843
|
-
responseType: component_camera_v1_camera_pb.GetPropertiesResponse
|
|
40844
|
-
};
|
|
40845
|
-
CameraService.DoCommand = {
|
|
40846
|
-
methodName: "DoCommand",
|
|
40847
|
-
service: CameraService,
|
|
40848
|
-
requestStream: !1,
|
|
40849
|
-
responseStream: !1,
|
|
40850
|
-
requestType: common_v1_common_pb$1.DoCommandRequest,
|
|
40851
|
-
responseType: common_v1_common_pb$1.DoCommandResponse
|
|
40852
|
-
};
|
|
40853
|
-
function CameraServiceClient(t, e) {
|
|
40854
|
-
this.serviceHost = t, this.options = e || {};
|
|
40855
|
-
}
|
|
40856
|
-
CameraServiceClient.prototype.getImage = function t(e, s, n) {
|
|
40857
|
-
arguments.length === 2 && (n = arguments[1]);
|
|
40858
|
-
var u = grpc$2.unary(CameraService.GetImage, {
|
|
40859
|
-
request: e,
|
|
40860
|
-
host: this.serviceHost,
|
|
40861
|
-
metadata: s,
|
|
40862
|
-
transport: this.options.transport,
|
|
40863
|
-
debug: this.options.debug,
|
|
40864
|
-
onEnd: function(g) {
|
|
40865
|
-
if (n)
|
|
40866
|
-
if (g.status !== grpc$2.Code.OK) {
|
|
40867
|
-
var p = new Error(g.statusMessage);
|
|
40868
|
-
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40869
|
-
} else
|
|
40870
|
-
n(null, g.message);
|
|
40871
|
-
}
|
|
40872
|
-
});
|
|
40873
|
-
return {
|
|
40874
|
-
cancel: function() {
|
|
40875
|
-
n = null, u.close();
|
|
40876
|
-
}
|
|
40877
|
-
};
|
|
40878
|
-
};
|
|
40879
|
-
CameraServiceClient.prototype.renderFrame = function t(e, s, n) {
|
|
40880
|
-
arguments.length === 2 && (n = arguments[1]);
|
|
40881
|
-
var u = grpc$2.unary(CameraService.RenderFrame, {
|
|
40882
|
-
request: e,
|
|
40883
|
-
host: this.serviceHost,
|
|
40884
|
-
metadata: s,
|
|
40885
|
-
transport: this.options.transport,
|
|
40886
|
-
debug: this.options.debug,
|
|
40887
|
-
onEnd: function(g) {
|
|
40888
|
-
if (n)
|
|
40889
|
-
if (g.status !== grpc$2.Code.OK) {
|
|
40890
|
-
var p = new Error(g.statusMessage);
|
|
40891
|
-
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40892
|
-
} else
|
|
40893
|
-
n(null, g.message);
|
|
40894
|
-
}
|
|
40895
|
-
});
|
|
40896
|
-
return {
|
|
40897
|
-
cancel: function() {
|
|
40898
|
-
n = null, u.close();
|
|
40899
|
-
}
|
|
40900
|
-
};
|
|
40901
|
-
};
|
|
40902
|
-
CameraServiceClient.prototype.getPointCloud = function t(e, s, n) {
|
|
40903
|
-
arguments.length === 2 && (n = arguments[1]);
|
|
40904
|
-
var u = grpc$2.unary(CameraService.GetPointCloud, {
|
|
40905
|
-
request: e,
|
|
40906
|
-
host: this.serviceHost,
|
|
40907
|
-
metadata: s,
|
|
40908
|
-
transport: this.options.transport,
|
|
40909
|
-
debug: this.options.debug,
|
|
40910
|
-
onEnd: function(g) {
|
|
40911
|
-
if (n)
|
|
40912
|
-
if (g.status !== grpc$2.Code.OK) {
|
|
40913
|
-
var p = new Error(g.statusMessage);
|
|
40914
|
-
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40915
|
-
} else
|
|
40916
|
-
n(null, g.message);
|
|
40917
|
-
}
|
|
40918
|
-
});
|
|
40919
|
-
return {
|
|
40920
|
-
cancel: function() {
|
|
40921
|
-
n = null, u.close();
|
|
40922
|
-
}
|
|
40923
|
-
};
|
|
40924
|
-
};
|
|
40925
|
-
CameraServiceClient.prototype.getProperties = function t(e, s, n) {
|
|
40926
|
-
arguments.length === 2 && (n = arguments[1]);
|
|
40927
|
-
var u = grpc$2.unary(CameraService.GetProperties, {
|
|
40928
|
-
request: e,
|
|
40929
|
-
host: this.serviceHost,
|
|
40930
|
-
metadata: s,
|
|
40931
|
-
transport: this.options.transport,
|
|
40932
|
-
debug: this.options.debug,
|
|
40933
|
-
onEnd: function(g) {
|
|
40934
|
-
if (n)
|
|
40935
|
-
if (g.status !== grpc$2.Code.OK) {
|
|
40936
|
-
var p = new Error(g.statusMessage);
|
|
40937
|
-
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40938
|
-
} else
|
|
40939
|
-
n(null, g.message);
|
|
40940
|
-
}
|
|
40941
|
-
});
|
|
40942
|
-
return {
|
|
40943
|
-
cancel: function() {
|
|
40944
|
-
n = null, u.close();
|
|
40945
|
-
}
|
|
40946
|
-
};
|
|
40947
|
-
};
|
|
40948
|
-
CameraServiceClient.prototype.doCommand = function t(e, s, n) {
|
|
40949
|
-
arguments.length === 2 && (n = arguments[1]);
|
|
40950
|
-
var u = grpc$2.unary(CameraService.DoCommand, {
|
|
40951
|
-
request: e,
|
|
40952
|
-
host: this.serviceHost,
|
|
40953
|
-
metadata: s,
|
|
40954
|
-
transport: this.options.transport,
|
|
40955
|
-
debug: this.options.debug,
|
|
40956
|
-
onEnd: function(g) {
|
|
40957
|
-
if (n)
|
|
40958
|
-
if (g.status !== grpc$2.Code.OK) {
|
|
40959
|
-
var p = new Error(g.statusMessage);
|
|
40960
|
-
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
40961
|
-
} else
|
|
40962
|
-
n(null, g.message);
|
|
40963
|
-
}
|
|
40964
|
-
});
|
|
40965
|
-
return {
|
|
40966
|
-
cancel: function() {
|
|
40967
|
-
n = null, u.close();
|
|
40968
|
-
}
|
|
40969
|
-
};
|
|
40970
|
-
};
|
|
40971
|
-
var CameraServiceClient_1 = CameraServiceClient;
|
|
40972
|
-
const PointCloudPCD = "pointcloud/pcd";
|
|
40973
|
-
class CameraClient {
|
|
40974
|
-
client;
|
|
40975
|
-
name;
|
|
40976
|
-
options;
|
|
40977
|
-
constructor(e, s, n = {}) {
|
|
40978
|
-
this.client = e.createServiceClient(CameraServiceClient_1), this.name = s, this.options = n;
|
|
40979
|
-
}
|
|
40980
|
-
get cameraService() {
|
|
40981
|
-
return this.client;
|
|
40982
|
-
}
|
|
40983
|
-
async getImage(e) {
|
|
40984
|
-
const s = this.cameraService, n = new camera_pb.GetImageRequest();
|
|
40985
|
-
return n.setName(this.name), n.setMimeType(e), this.options.requestLogger?.(n), (await promisify(
|
|
40986
|
-
s.getImage.bind(s),
|
|
40987
|
-
n
|
|
40988
|
-
)).getImage_asU8();
|
|
40989
|
-
}
|
|
40990
|
-
async renderFrame(e) {
|
|
40991
|
-
const s = this.cameraService, n = new camera_pb.GetPointCloudRequest();
|
|
40992
|
-
n.setName(this.name), n.setMimeType(e), this.options.requestLogger?.(n);
|
|
40993
|
-
const u = await promisify(
|
|
40994
|
-
s.renderFrame.bind(s),
|
|
40995
|
-
n
|
|
40996
|
-
);
|
|
40997
|
-
return new Blob([u.getData_asU8()], { type: e });
|
|
40998
|
-
}
|
|
40999
|
-
async getPointCloud() {
|
|
41000
|
-
const e = this.cameraService, s = new camera_pb.GetPointCloudRequest();
|
|
41001
|
-
return s.setName(this.name), s.setMimeType(PointCloudPCD), this.options.requestLogger?.(s), (await promisify(e.getPointCloud.bind(e), s)).getPointCloud_asU8();
|
|
41002
|
-
}
|
|
41003
|
-
async getProperties() {
|
|
41004
|
-
const e = this.cameraService, s = new camera_pb.GetPropertiesRequest();
|
|
41005
|
-
return s.setName(this.name), this.options.requestLogger?.(s), (await promisify(e.getProperties.bind(e), s)).toObject();
|
|
41006
|
-
}
|
|
41007
|
-
}
|
|
41008
|
-
class MotorClient {
|
|
41009
|
-
client;
|
|
41010
|
-
name;
|
|
41011
|
-
options;
|
|
41012
|
-
constructor(e, s, n = {}) {
|
|
41013
|
-
this.client = e.createServiceClient(MotorServiceClient_1), this.name = s, this.options = n;
|
|
41014
|
-
}
|
|
41015
|
-
get motorService() {
|
|
41016
|
-
return this.client;
|
|
41017
|
-
}
|
|
41018
|
-
async setPower(e, s = {}) {
|
|
41019
|
-
const n = this.motorService, u = new motor_pb.SetPowerRequest();
|
|
41020
|
-
u.setName(this.name), u.setPowerPct(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), await promisify(
|
|
41021
|
-
n.setPower.bind(n),
|
|
41022
|
-
u
|
|
41023
|
-
);
|
|
41024
|
-
}
|
|
41025
|
-
async goFor(e, s, n = {}) {
|
|
41026
|
-
const u = this.motorService, g = new motor_pb.GoForRequest();
|
|
41027
|
-
g.setName(this.name), g.setRpm(e), g.setRevolutions(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
41028
|
-
u.goFor.bind(u),
|
|
41029
|
-
g
|
|
41030
|
-
);
|
|
41031
|
-
}
|
|
41032
|
-
async goTo(e, s, n = {}) {
|
|
41033
|
-
const u = this.motorService, g = new motor_pb.GoToRequest();
|
|
41034
|
-
g.setName(this.name), g.setRpm(e), g.setPositionRevolutions(s), g.setExtra(struct_pb.Struct.fromJavaScript(n)), this.options.requestLogger?.(g), await promisify(
|
|
41035
|
-
u.goTo.bind(u),
|
|
41036
|
-
g
|
|
41037
|
-
);
|
|
41038
|
-
}
|
|
41039
|
-
async resetZeroPosition(e, s = {}) {
|
|
41040
|
-
const n = this.motorService, u = new motor_pb.ResetZeroPositionRequest();
|
|
41041
|
-
u.setName(this.name), u.setOffset(e), u.setExtra(struct_pb.Struct.fromJavaScript(s)), this.options.requestLogger?.(u), await promisify(n.resetZeroPosition.bind(n), u);
|
|
41042
|
-
}
|
|
41043
|
-
async stop(e = {}) {
|
|
41044
|
-
const s = this.motorService, n = new motor_pb.StopRequest();
|
|
41045
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
41046
|
-
s.stop.bind(s),
|
|
41047
|
-
n
|
|
41048
|
-
);
|
|
41049
|
-
}
|
|
41050
|
-
async getProperties(e = {}) {
|
|
41051
|
-
const s = this.motorService, n = new motor_pb.GetPropertiesRequest();
|
|
41052
|
-
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), { positionReporting: (await promisify(s.getProperties.bind(s), n)).getPositionReporting() };
|
|
41053
|
-
}
|
|
41054
|
-
async getPosition(e = {}) {
|
|
41055
|
-
const s = this.motorService, n = new motor_pb.GetPositionRequest();
|
|
41056
|
-
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), (await promisify(s.getPosition.bind(s), n)).getPosition();
|
|
41057
|
-
}
|
|
41058
|
-
async isPowered(e = {}) {
|
|
41059
|
-
const s = this.motorService, n = new motor_pb.IsPoweredRequest();
|
|
41060
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41061
|
-
const u = await promisify(s.isPowered.bind(s), n);
|
|
41062
|
-
return [u.getIsOn(), u.getPowerPct()];
|
|
41063
|
-
}
|
|
41064
|
-
}
|
|
41065
|
-
var component_sensor_v1_sensor_pb = sensor_pb, common_v1_common_pb = common_pb, grpc$1 = grpcWebClient_umdExports.grpc, SensorService = function() {
|
|
41066
|
-
function t() {
|
|
41067
|
-
}
|
|
41068
|
-
return t.serviceName = "viam.component.sensor.v1.SensorService", t;
|
|
41069
|
-
}();
|
|
41070
|
-
SensorService.GetReadings = {
|
|
41071
|
-
methodName: "GetReadings",
|
|
41072
|
-
service: SensorService,
|
|
41073
|
-
requestStream: !1,
|
|
41074
|
-
responseStream: !1,
|
|
41075
|
-
requestType: component_sensor_v1_sensor_pb.GetReadingsRequest,
|
|
41076
|
-
responseType: component_sensor_v1_sensor_pb.GetReadingsResponse
|
|
41077
|
-
};
|
|
41078
|
-
SensorService.DoCommand = {
|
|
41079
|
-
methodName: "DoCommand",
|
|
41080
|
-
service: SensorService,
|
|
41081
|
-
requestStream: !1,
|
|
41082
|
-
responseStream: !1,
|
|
41083
|
-
requestType: common_v1_common_pb.DoCommandRequest,
|
|
41084
|
-
responseType: common_v1_common_pb.DoCommandResponse
|
|
41085
|
-
};
|
|
41086
|
-
function SensorServiceClient(t, e) {
|
|
41087
|
-
this.serviceHost = t, this.options = e || {};
|
|
41088
|
-
}
|
|
41089
|
-
SensorServiceClient.prototype.getReadings = function t(e, s, n) {
|
|
41090
|
-
arguments.length === 2 && (n = arguments[1]);
|
|
41091
|
-
var u = grpc$1.unary(SensorService.GetReadings, {
|
|
41092
|
-
request: e,
|
|
41093
|
-
host: this.serviceHost,
|
|
41094
|
-
metadata: s,
|
|
41095
|
-
transport: this.options.transport,
|
|
41096
|
-
debug: this.options.debug,
|
|
41097
|
-
onEnd: function(g) {
|
|
41098
|
-
if (n)
|
|
41099
|
-
if (g.status !== grpc$1.Code.OK) {
|
|
41100
|
-
var p = new Error(g.statusMessage);
|
|
41101
|
-
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
41102
|
-
} else
|
|
41103
|
-
n(null, g.message);
|
|
41104
|
-
}
|
|
41105
|
-
});
|
|
41106
|
-
return {
|
|
41107
|
-
cancel: function() {
|
|
41108
|
-
n = null, u.close();
|
|
41109
|
-
}
|
|
41110
|
-
};
|
|
41111
|
-
};
|
|
41112
|
-
SensorServiceClient.prototype.doCommand = function t(e, s, n) {
|
|
41113
|
-
arguments.length === 2 && (n = arguments[1]);
|
|
41114
|
-
var u = grpc$1.unary(SensorService.DoCommand, {
|
|
41115
|
-
request: e,
|
|
41116
|
-
host: this.serviceHost,
|
|
41117
|
-
metadata: s,
|
|
41118
|
-
transport: this.options.transport,
|
|
41119
|
-
debug: this.options.debug,
|
|
41120
|
-
onEnd: function(g) {
|
|
41121
|
-
if (n)
|
|
41122
|
-
if (g.status !== grpc$1.Code.OK) {
|
|
41123
|
-
var p = new Error(g.statusMessage);
|
|
41124
|
-
p.code = g.status, p.metadata = g.trailers, n(p, null);
|
|
41125
|
-
} else
|
|
41126
|
-
n(null, g.message);
|
|
41127
|
-
}
|
|
41128
|
-
});
|
|
41129
|
-
return {
|
|
41130
|
-
cancel: function() {
|
|
41131
|
-
n = null, u.close();
|
|
41132
|
-
}
|
|
41133
|
-
};
|
|
41134
|
-
};
|
|
41135
|
-
var SensorServiceClient_1 = SensorServiceClient;
|
|
41136
|
-
class SensorClient {
|
|
41137
|
-
client;
|
|
41138
|
-
name;
|
|
41139
|
-
options;
|
|
41140
|
-
constructor(e, s, n = {}) {
|
|
41141
|
-
this.client = e.createServiceClient(SensorServiceClient_1), this.name = s, this.options = n;
|
|
41142
|
-
}
|
|
41143
|
-
get sensorService() {
|
|
41144
|
-
return this.client;
|
|
41145
|
-
}
|
|
41146
|
-
async getReadings(e = {}) {
|
|
41147
|
-
const s = this.sensorService, n = new sensor_pb.GetReadingsRequest();
|
|
41148
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41149
|
-
const u = await promisify(s.getReadings.bind(s), n), g = {};
|
|
41150
|
-
for (const [p, o] of u.getReadingsMap().entries())
|
|
41151
|
-
g[p] = o.toJavaScript();
|
|
41152
|
-
return g;
|
|
41153
|
-
}
|
|
41154
|
-
}
|
|
41155
|
-
class MovementSensorClient {
|
|
41156
|
-
client;
|
|
41157
|
-
sensorclient;
|
|
41158
|
-
name;
|
|
41159
|
-
options;
|
|
41160
|
-
constructor(e, s, n = {}) {
|
|
41161
|
-
this.client = e.createServiceClient(MovementSensorServiceClient_1), this.sensorclient = new SensorClient(e, s, n), this.name = s, this.options = n;
|
|
41162
|
-
}
|
|
41163
|
-
get movementsensorService() {
|
|
41164
|
-
return this.client;
|
|
41165
|
-
}
|
|
41166
|
-
async getLinearVelocity(e = {}) {
|
|
41167
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetLinearVelocityRequest();
|
|
41168
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41169
|
-
const g = (await promisify(
|
|
41170
|
-
s.getLinearVelocity.bind(s),
|
|
41171
|
-
n
|
|
41172
|
-
)).getLinearVelocity();
|
|
41173
|
-
if (!g)
|
|
41174
|
-
throw new Error("no linear velocity");
|
|
41175
|
-
return decodeVector3D(g);
|
|
41176
|
-
}
|
|
41177
|
-
async getAngularVelocity(e = {}) {
|
|
41178
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetAngularVelocityRequest();
|
|
41179
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41180
|
-
const g = (await promisify(
|
|
41181
|
-
s.getAngularVelocity.bind(s),
|
|
41182
|
-
n
|
|
41183
|
-
)).getAngularVelocity();
|
|
41184
|
-
if (!g)
|
|
41185
|
-
throw new Error("no angular velocity");
|
|
41186
|
-
return decodeVector3D(g);
|
|
41187
|
-
}
|
|
41188
|
-
async getCompassHeading(e = {}) {
|
|
41189
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetCompassHeadingRequest();
|
|
41190
|
-
return n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), (await promisify(
|
|
41191
|
-
s.getCompassHeading.bind(s),
|
|
41192
|
-
n
|
|
41193
|
-
)).getValue();
|
|
41194
|
-
}
|
|
41195
|
-
async getOrientation(e = {}) {
|
|
41196
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetOrientationRequest();
|
|
41197
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41198
|
-
const g = (await promisify(
|
|
41199
|
-
s.getOrientation.bind(s),
|
|
41200
|
-
n
|
|
41201
|
-
)).getOrientation();
|
|
41202
|
-
if (!g)
|
|
41203
|
-
throw new Error("no orientation");
|
|
41204
|
-
return {
|
|
41205
|
-
ox: g.getOX(),
|
|
41206
|
-
oy: g.getOY(),
|
|
41207
|
-
oz: g.getOZ(),
|
|
41208
|
-
theta: g.getTheta()
|
|
41209
|
-
};
|
|
41210
|
-
}
|
|
41211
|
-
async getPosition(e = {}) {
|
|
41212
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetPositionRequest();
|
|
41213
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41214
|
-
const u = await promisify(s.getPosition.bind(s), n), g = u.getCoordinate();
|
|
41215
|
-
if (!g)
|
|
41216
|
-
throw new Error("no coordinate");
|
|
41217
|
-
return {
|
|
41218
|
-
latitude: g.getLatitude(),
|
|
41219
|
-
longitude: g.getLongitude(),
|
|
41220
|
-
altitudeMM: u.getAltitudeMm()
|
|
41221
|
-
};
|
|
41222
|
-
}
|
|
41223
|
-
async getProperties(e = {}) {
|
|
41224
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetPropertiesRequest();
|
|
41225
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41226
|
-
const u = await promisify(s.getProperties.bind(s), n);
|
|
41227
|
-
return {
|
|
41228
|
-
linearVelocitySupported: u.getLinearVelocitySupported(),
|
|
41229
|
-
angularVelocitySupported: u.getAngularVelocitySupported(),
|
|
41230
|
-
orientationSupported: u.getOrientationSupported(),
|
|
41231
|
-
positionSupported: u.getPositionSupported(),
|
|
41232
|
-
compassHeadingSupported: u.getCompassHeadingSupported(),
|
|
41233
|
-
linearAccelerationSupported: u.getLinearAccelerationSupported()
|
|
41234
|
-
};
|
|
41235
|
-
}
|
|
41236
|
-
async getAccuracy(e = {}) {
|
|
41237
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetAccuracyRequest();
|
|
41238
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41239
|
-
const g = (await promisify(s.getAccuracy.bind(s), n)).getAccuracyMmMap(), p = {};
|
|
41240
|
-
for (const [o, r] of g.entries())
|
|
41241
|
-
p[o] = r;
|
|
41242
|
-
return p;
|
|
41243
|
-
}
|
|
41244
|
-
async getLinearAcceleration(e = {}) {
|
|
41245
|
-
const s = this.movementsensorService, n = new movementsensor_pb.GetLinearAccelerationRequest();
|
|
41246
|
-
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n);
|
|
41247
|
-
const g = (await promisify(
|
|
41248
|
-
s.getLinearAcceleration.bind(s),
|
|
41249
|
-
n
|
|
41250
|
-
)).getLinearAcceleration();
|
|
41251
|
-
if (!g)
|
|
41252
|
-
throw new Error("no linear acceleration");
|
|
41253
|
-
return decodeVector3D(g);
|
|
41254
|
-
}
|
|
41255
|
-
getReadings(e = {}) {
|
|
41256
|
-
return this.sensorclient.getReadings(e);
|
|
41257
|
-
}
|
|
41258
|
-
}
|
|
41259
41260
|
var proto_stream_v1_stream_pb = stream_pb, grpc = grpcWebClient_umdExports.grpc, StreamService = function() {
|
|
41260
41261
|
function t() {
|
|
41261
41262
|
}
|
|
@@ -41401,12 +41402,52 @@ class StreamClient extends EventDispatcher {
|
|
|
41401
41402
|
}
|
|
41402
41403
|
}
|
|
41403
41404
|
}
|
|
41405
|
+
class GripperClient {
|
|
41406
|
+
client;
|
|
41407
|
+
name;
|
|
41408
|
+
options;
|
|
41409
|
+
constructor(e, s, n = {}) {
|
|
41410
|
+
this.client = e.createServiceClient(GripperServiceClient_1), this.name = s, this.options = n;
|
|
41411
|
+
}
|
|
41412
|
+
get GripperService() {
|
|
41413
|
+
return this.client;
|
|
41414
|
+
}
|
|
41415
|
+
async open(e = {}) {
|
|
41416
|
+
const s = this.GripperService, n = new gripper_pb.OpenRequest();
|
|
41417
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
41418
|
+
s.open.bind(s),
|
|
41419
|
+
n
|
|
41420
|
+
);
|
|
41421
|
+
}
|
|
41422
|
+
async grab(e = {}) {
|
|
41423
|
+
const s = this.GripperService, n = new gripper_pb.GrabRequest();
|
|
41424
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
41425
|
+
s.grab.bind(s),
|
|
41426
|
+
n
|
|
41427
|
+
);
|
|
41428
|
+
}
|
|
41429
|
+
async stop(e = {}) {
|
|
41430
|
+
const s = this.GripperService, n = new gripper_pb.StopRequest();
|
|
41431
|
+
n.setName(this.name), n.setExtra(struct_pb.Struct.fromJavaScript(e)), this.options.requestLogger?.(n), await promisify(
|
|
41432
|
+
s.stop.bind(s),
|
|
41433
|
+
n
|
|
41434
|
+
);
|
|
41435
|
+
}
|
|
41436
|
+
async isMoving() {
|
|
41437
|
+
const e = this.GripperService, s = new gripper_pb.IsMovingRequest();
|
|
41438
|
+
return s.setName(this.name), this.options.requestLogger?.(s), (await promisify(
|
|
41439
|
+
e.isMoving.bind(e),
|
|
41440
|
+
s
|
|
41441
|
+
)).getIsMoving();
|
|
41442
|
+
}
|
|
41443
|
+
}
|
|
41404
41444
|
export {
|
|
41405
41445
|
ArmClient,
|
|
41406
41446
|
BaseClient,
|
|
41407
41447
|
BoardClient,
|
|
41408
41448
|
CameraClient,
|
|
41409
41449
|
RobotClient as Client,
|
|
41450
|
+
GripperClient,
|
|
41410
41451
|
MotorClient,
|
|
41411
41452
|
MovementSensorClient,
|
|
41412
41453
|
RobotClient,
|