@viamrobotics/sdk 0.0.22 → 0.0.23

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/main.d.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  import Client from './Client';
2
+ import * as Base from './components/base/Base';
3
+ import * as Board from './components/board/Board';
4
+ import * as Camera from './components/camera/Camera';
5
+ import * as Motor from './components/motor/Motor';
6
+ export { Base, Board, Camera, Motor };
2
7
  import armApi from './gen/component/arm/v1/arm_pb.esm';
3
8
  import baseApi from './gen/component/base/v1/base_pb.esm';
4
9
  import boardApi from './gen/component/board/v1/board_pb.esm';
@@ -21,10 +26,10 @@ import streamApi from './gen/proto/stream/v1/stream_pb.esm';
21
26
  import visionApi from './gen/service/vision/v1/vision_pb.esm';
22
27
  export { type Robot, RobotClient } from './components/robot';
23
28
  export { type Arm, ArmClient } from './components/arm';
24
- export { type Base, BaseClient } from './components/base';
25
- export { type Board, BoardClient } from './components/board';
26
- export { type Camera, CameraClient } from './components/camera';
27
- export { type Motor, MotorClient } from './components/motor';
29
+ export { type BaseClient } from './components/base';
30
+ export { type BoardClient } from './components/board';
31
+ export { type CameraClient } from './components/camera';
32
+ export { type MotorClient } from './components/motor';
28
33
  export { type MovementSensor, MovementSensorClient, } from './components/movementsensor';
29
34
  export { type Sensor, SensorClient } from './components/sensor';
30
35
  export { type Stream, StreamClient } from './extra/stream';
package/dist/main.es.js CHANGED
@@ -215289,6 +215289,18 @@ class Client {
215289
215289
  }
215290
215290
  }
215291
215291
  }
215292
+ const Base = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
215293
+ __proto__: null
215294
+ }, Symbol.toStringTag, { value: "Module" })), Board = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
215295
+ __proto__: null
215296
+ }, Symbol.toStringTag, { value: "Module" }));
215297
+ var MimeType = /* @__PURE__ */ ((o) => (o.VIAM_RGBA = "image/vnd.viam.rgba", o.JPEG = "image/jpeg", o.PNG = "image/png", o.PCD = "pointcloud/pcd", o.UNSUPPORTED = "unsupported", o))(MimeType || {});
215298
+ const Camera = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
215299
+ __proto__: null,
215300
+ MimeType
215301
+ }, Symbol.toStringTag, { value: "Module" })), Motor = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
215302
+ __proto__: null
215303
+ }, Symbol.toStringTag, { value: "Module" }));
215292
215304
  var commonjsGlobal$l = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, arm_pb = {}, googleProtobuf$m = {};
215293
215305
  (function(exports) {
215294
215306
  var $jscomp = $jscomp || {};
@@ -419123,118 +419135,7 @@ class ArmClient {
419123
419135
  )).getIsMoving();
419124
419136
  }
419125
419137
  }
419126
- class BaseClient {
419127
- client;
419128
- name;
419129
- options;
419130
- constructor(e, r, p = {}) {
419131
- this.client = e.createServiceClient(BaseServiceClient_1), this.name = r, this.options = p;
419132
- }
419133
- get baseService() {
419134
- return this.client;
419135
- }
419136
- async moveStraight(e, r, p = {}) {
419137
- const t = this.baseService, n = new base_pb.MoveStraightRequest();
419138
- n.setName(this.name), n.setMmPerSec(r), n.setDistanceMm(e), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419139
- t.moveStraight.bind(t),
419140
- n
419141
- );
419142
- }
419143
- async spin(e, r, p = {}) {
419144
- const t = this.baseService, n = new base_pb.SpinRequest();
419145
- n.setName(this.name), n.setAngleDeg(e), n.setDegsPerSec(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419146
- t.spin.bind(t),
419147
- n
419148
- );
419149
- }
419150
- async setPower(e, r, p = {}) {
419151
- const t = this.baseService, n = new base_pb.SetPowerRequest();
419152
- n.setName(this.name), n.setLinear(e), n.setAngular(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419153
- t.setPower.bind(t),
419154
- n
419155
- );
419156
- }
419157
- async setVelocity(e, r, p = {}) {
419158
- const t = this.baseService, n = new base_pb.SetVelocityRequest();
419159
- n.setName(this.name), n.setLinear(e), n.setAngular(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419160
- t.setVelocity.bind(t),
419161
- n
419162
- );
419163
- }
419164
- async stop(e = {}) {
419165
- const r = this.baseService, p = new base_pb.StopRequest();
419166
- p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
419167
- r.stop.bind(r),
419168
- p
419169
- );
419170
- }
419171
- }
419172
- class BoardClient {
419173
- client;
419174
- name;
419175
- options;
419176
- constructor(e, r, p = {}) {
419177
- this.client = e.createServiceClient(BoardServiceClient_1), this.name = r, this.options = p;
419178
- }
419179
- get boardService() {
419180
- return this.client;
419181
- }
419182
- async status(e = {}) {
419183
- const r = this.boardService, p = new board_pb.StatusRequest();
419184
- return p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
419185
- r.status.bind(r),
419186
- p
419187
- );
419188
- }
419189
- async setGPIO(e, r, p = {}) {
419190
- const t = this.boardService, n = new board_pb.SetGPIORequest();
419191
- n.setName(this.name), n.setPin(e), n.setHigh(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419192
- t.setGPIO.bind(t),
419193
- n
419194
- );
419195
- }
419196
- async getGPIO(e, r = {}) {
419197
- const p = this.boardService, t = new board_pb.GetGPIORequest();
419198
- return t.setName(this.name), t.setPin(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), (await promisify(
419199
- p.getGPIO.bind(p),
419200
- t
419201
- )).getHigh();
419202
- }
419203
- async getPWM(e, r = {}) {
419204
- const p = this.boardService, t = new board_pb.PWMRequest();
419205
- return t.setName(this.name), t.setPin(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), (await promisify(
419206
- p.pWM.bind(p),
419207
- t
419208
- )).getDutyCyclePct();
419209
- }
419210
- async setPWM(e, r, p = {}) {
419211
- const t = this.boardService, n = new board_pb.SetPWMRequest();
419212
- n.setName(this.name), n.setPin(e), n.setDutyCyclePct(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419213
- t.setPWM.bind(t),
419214
- n
419215
- );
419216
- }
419217
- async getPWMFrequency(e, r = {}) {
419218
- const p = this.boardService, t = new board_pb.PWMFrequencyRequest();
419219
- return t.setName(this.name), t.setPin(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), (await promisify(p.pWMFrequency.bind(p), t)).getFrequencyHz();
419220
- }
419221
- async setPWMFrequency(e, r, p = {}) {
419222
- const t = this.boardService, n = new board_pb.SetPWMFrequencyRequest();
419223
- n.setName(this.name), n.setPin(e), n.setFrequencyHz(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419224
- t.setPWMFrequency.bind(t),
419225
- n
419226
- );
419227
- }
419228
- async readAnalogReader(e, r, p = {}) {
419229
- const t = this.boardService, n = new board_pb.ReadAnalogReaderRequest();
419230
- return n.setBoardName(e), n.setAnalogReaderName(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), (await promisify(t.readAnalogReader.bind(t), n)).getValue();
419231
- }
419232
- async getDigitalInterruptValue(e, r, p = {}) {
419233
- const t = this.boardService, n = new board_pb.GetDigitalInterruptValueRequest();
419234
- return n.setBoardName(e), n.setDigitalInterruptName(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), (await promisify(t.getDigitalInterruptValue.bind(t), n)).getValue();
419235
- }
419236
- }
419237
- var MimeType = /* @__PURE__ */ ((o) => (o.VIAM_RGBA = "image/vnd.viam.rgba", o.JPEG = "image/jpeg", o.PNG = "image/png", o.PCD = "pointcloud/pcd", o.UNSUPPORTED = "unsupported", o))(MimeType || {}), commonjsGlobal$2 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, camera_pb = {}, googleProtobuf$2 = {};
419138
+ var commonjsGlobal$2 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, camera_pb = {}, googleProtobuf$2 = {};
419238
419139
  (function(exports) {
419239
419140
  var $jscomp = $jscomp || {};
419240
419141
  $jscomp.scope = {}, $jscomp.findInternal = function(o, e, r) {
@@ -431430,103 +431331,6 @@ CameraServiceClient.prototype.doCommand = function o(e, r, p) {
431430
431331
  }
431431
431332
  };
431432
431333
  };
431433
- var CameraServiceClient_1 = CameraServiceClient;
431434
- class CameraClient {
431435
- client;
431436
- name;
431437
- options;
431438
- constructor(e, r, p = {}) {
431439
- this.client = e.createServiceClient(CameraServiceClient_1), this.name = r, this.options = p;
431440
- }
431441
- get cameraService() {
431442
- return this.client;
431443
- }
431444
- async getImage(e) {
431445
- const r = this.cameraService, p = new camera_pb$1.GetImageRequest();
431446
- return p.setName(this.name), p.setMimeType(e), this.options.requestLogger?.(p), (await promisify(
431447
- r.getImage.bind(r),
431448
- p
431449
- )).getImage_asU8();
431450
- }
431451
- async renderFrame(e) {
431452
- const r = this.cameraService, p = new camera_pb$1.GetPointCloudRequest();
431453
- p.setName(this.name), p.setMimeType(e), this.options.requestLogger?.(p);
431454
- const t = await promisify(
431455
- r.renderFrame.bind(r),
431456
- p
431457
- );
431458
- return new Blob([t.getData_asU8()], { type: e });
431459
- }
431460
- async getPointCloud() {
431461
- const e = this.cameraService, r = new camera_pb$1.GetPointCloudRequest();
431462
- return r.setName(this.name), r.setMimeType(MimeType.PCD), this.options.requestLogger?.(r), (await promisify(e.getPointCloud.bind(e), r)).getPointCloud_asU8();
431463
- }
431464
- async getProperties() {
431465
- const e = this.cameraService, r = new camera_pb$1.GetPropertiesRequest();
431466
- return r.setName(this.name), this.options.requestLogger?.(r), (await promisify(e.getProperties.bind(e), r)).toObject();
431467
- }
431468
- }
431469
- class MotorClient {
431470
- client;
431471
- name;
431472
- options;
431473
- constructor(e, r, p = {}) {
431474
- this.client = e.createServiceClient(MotorServiceClient_1), this.name = r, this.options = p;
431475
- }
431476
- get motorService() {
431477
- return this.client;
431478
- }
431479
- async setPower(e, r = {}) {
431480
- const p = this.motorService, t = new motor_pb.SetPowerRequest();
431481
- t.setName(this.name), t.setPowerPct(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), await promisify(
431482
- p.setPower.bind(p),
431483
- t
431484
- );
431485
- }
431486
- async goFor(e, r, p = {}) {
431487
- const t = this.motorService, n = new motor_pb.GoForRequest();
431488
- n.setName(this.name), n.setRpm(e), n.setRevolutions(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
431489
- t.goFor.bind(t),
431490
- n
431491
- );
431492
- }
431493
- async goTo(e, r, p = {}) {
431494
- const t = this.motorService, n = new motor_pb.GoToRequest();
431495
- n.setName(this.name), n.setRpm(e), n.setPositionRevolutions(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
431496
- t.goTo.bind(t),
431497
- n
431498
- );
431499
- }
431500
- async resetZeroPosition(e, r = {}) {
431501
- const p = this.motorService, t = new motor_pb.ResetZeroPositionRequest();
431502
- t.setName(this.name), t.setOffset(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), await promisify(p.resetZeroPosition.bind(p), t);
431503
- }
431504
- async stop(e = {}) {
431505
- const r = this.motorService, p = new motor_pb.StopRequest();
431506
- p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
431507
- r.stop.bind(r),
431508
- p
431509
- );
431510
- }
431511
- /** @deprecated Use {@link MotorClient#stop} instead. */
431512
- motorStop(e = {}) {
431513
- return this.stop(e);
431514
- }
431515
- async getProperties(e = {}) {
431516
- const r = this.motorService, p = new motor_pb.GetPropertiesRequest();
431517
- return p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), { positionReporting: (await promisify(r.getProperties.bind(r), p)).getPositionReporting() };
431518
- }
431519
- async getPosition(e = {}) {
431520
- const r = this.motorService, p = new motor_pb.GetPositionRequest();
431521
- return p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), (await promisify(r.getPosition.bind(r), p)).getPosition();
431522
- }
431523
- async isPowered(e = {}) {
431524
- const r = this.motorService, p = new motor_pb.IsPoweredRequest();
431525
- p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p);
431526
- const t = await promisify(r.isPowered.bind(r), p);
431527
- return [t.getIsOn(), t.getPowerPct()];
431528
- }
431529
- }
431530
431334
  var commonjsGlobal$1 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, sensor_pb = {}, googleProtobuf$1 = {};
431531
431335
  (function(exports) {
431532
431336
  var $jscomp = $jscomp || {};
@@ -447964,11 +447768,11 @@ class StreamClient extends EventDispatcher {
447964
447768
  }
447965
447769
  export {
447966
447770
  ArmClient,
447967
- BaseClient,
447968
- BoardClient,
447969
- CameraClient,
447771
+ Base,
447772
+ Board,
447773
+ Camera,
447970
447774
  Client,
447971
- MotorClient,
447775
+ Motor,
447972
447776
  MovementSensorClient,
447973
447777
  RobotClient,
447974
447778
  SensorClient,