@viamrobotics/sdk 0.0.23 → 0.0.24

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
@@ -26,10 +26,10 @@ import streamApi from './gen/proto/stream/v1/stream_pb.esm';
26
26
  import visionApi from './gen/service/vision/v1/vision_pb.esm';
27
27
  export { type Robot, RobotClient } from './components/robot';
28
28
  export { type Arm, ArmClient } from './components/arm';
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';
29
+ export { BaseClient } from './components/base';
30
+ export { BoardClient } from './components/board';
31
+ export { CameraClient } from './components/camera';
32
+ export { MotorClient } from './components/motor';
33
33
  export { type MovementSensor, MovementSensorClient, } from './components/movementsensor';
34
34
  export { type Sensor, SensorClient } from './components/sensor';
35
35
  export { type Stream, StreamClient } from './extra/stream';
package/dist/main.es.js CHANGED
@@ -419135,6 +419135,117 @@ class ArmClient {
419135
419135
  )).getIsMoving();
419136
419136
  }
419137
419137
  }
419138
+ class BaseClient {
419139
+ client;
419140
+ name;
419141
+ options;
419142
+ constructor(e, r, p = {}) {
419143
+ this.client = e.createServiceClient(BaseServiceClient_1), this.name = r, this.options = p;
419144
+ }
419145
+ get baseService() {
419146
+ return this.client;
419147
+ }
419148
+ async moveStraight(e, r, p = {}) {
419149
+ const t = this.baseService, n = new base_pb.MoveStraightRequest();
419150
+ n.setName(this.name), n.setMmPerSec(r), n.setDistanceMm(e), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419151
+ t.moveStraight.bind(t),
419152
+ n
419153
+ );
419154
+ }
419155
+ async spin(e, r, p = {}) {
419156
+ const t = this.baseService, n = new base_pb.SpinRequest();
419157
+ n.setName(this.name), n.setAngleDeg(e), n.setDegsPerSec(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419158
+ t.spin.bind(t),
419159
+ n
419160
+ );
419161
+ }
419162
+ async setPower(e, r, p = {}) {
419163
+ const t = this.baseService, n = new base_pb.SetPowerRequest();
419164
+ n.setName(this.name), n.setLinear(e), n.setAngular(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419165
+ t.setPower.bind(t),
419166
+ n
419167
+ );
419168
+ }
419169
+ async setVelocity(e, r, p = {}) {
419170
+ const t = this.baseService, n = new base_pb.SetVelocityRequest();
419171
+ n.setName(this.name), n.setLinear(e), n.setAngular(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419172
+ t.setVelocity.bind(t),
419173
+ n
419174
+ );
419175
+ }
419176
+ async stop(e = {}) {
419177
+ const r = this.baseService, p = new base_pb.StopRequest();
419178
+ p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
419179
+ r.stop.bind(r),
419180
+ p
419181
+ );
419182
+ }
419183
+ }
419184
+ class BoardClient {
419185
+ client;
419186
+ name;
419187
+ options;
419188
+ constructor(e, r, p = {}) {
419189
+ this.client = e.createServiceClient(BoardServiceClient_1), this.name = r, this.options = p;
419190
+ }
419191
+ get boardService() {
419192
+ return this.client;
419193
+ }
419194
+ async status(e = {}) {
419195
+ const r = this.boardService, p = new board_pb.StatusRequest();
419196
+ return p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
419197
+ r.status.bind(r),
419198
+ p
419199
+ );
419200
+ }
419201
+ async setGPIO(e, r, p = {}) {
419202
+ const t = this.boardService, n = new board_pb.SetGPIORequest();
419203
+ n.setName(this.name), n.setPin(e), n.setHigh(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419204
+ t.setGPIO.bind(t),
419205
+ n
419206
+ );
419207
+ }
419208
+ async getGPIO(e, r = {}) {
419209
+ const p = this.boardService, t = new board_pb.GetGPIORequest();
419210
+ return t.setName(this.name), t.setPin(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), (await promisify(
419211
+ p.getGPIO.bind(p),
419212
+ t
419213
+ )).getHigh();
419214
+ }
419215
+ async getPWM(e, r = {}) {
419216
+ const p = this.boardService, t = new board_pb.PWMRequest();
419217
+ return t.setName(this.name), t.setPin(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), (await promisify(
419218
+ p.pWM.bind(p),
419219
+ t
419220
+ )).getDutyCyclePct();
419221
+ }
419222
+ async setPWM(e, r, p = {}) {
419223
+ const t = this.boardService, n = new board_pb.SetPWMRequest();
419224
+ n.setName(this.name), n.setPin(e), n.setDutyCyclePct(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419225
+ t.setPWM.bind(t),
419226
+ n
419227
+ );
419228
+ }
419229
+ async getPWMFrequency(e, r = {}) {
419230
+ const p = this.boardService, t = new board_pb.PWMFrequencyRequest();
419231
+ 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();
419232
+ }
419233
+ async setPWMFrequency(e, r, p = {}) {
419234
+ const t = this.boardService, n = new board_pb.SetPWMFrequencyRequest();
419235
+ n.setName(this.name), n.setPin(e), n.setFrequencyHz(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
419236
+ t.setPWMFrequency.bind(t),
419237
+ n
419238
+ );
419239
+ }
419240
+ async readAnalogReader(e, r, p = {}) {
419241
+ const t = this.boardService, n = new board_pb.ReadAnalogReaderRequest();
419242
+ 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();
419243
+ }
419244
+ async getDigitalInterruptValue(e, r, p = {}) {
419245
+ const t = this.boardService, n = new board_pb.GetDigitalInterruptValueRequest();
419246
+ 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();
419247
+ }
419248
+ }
419138
419249
  var commonjsGlobal$2 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, camera_pb = {}, googleProtobuf$2 = {};
419139
419250
  (function(exports) {
419140
419251
  var $jscomp = $jscomp || {};
@@ -431331,6 +431442,103 @@ CameraServiceClient.prototype.doCommand = function o(e, r, p) {
431331
431442
  }
431332
431443
  };
431333
431444
  };
431445
+ var CameraServiceClient_1 = CameraServiceClient;
431446
+ class CameraClient {
431447
+ client;
431448
+ name;
431449
+ options;
431450
+ constructor(e, r, p = {}) {
431451
+ this.client = e.createServiceClient(CameraServiceClient_1), this.name = r, this.options = p;
431452
+ }
431453
+ get cameraService() {
431454
+ return this.client;
431455
+ }
431456
+ async getImage(e) {
431457
+ const r = this.cameraService, p = new camera_pb$1.GetImageRequest();
431458
+ return p.setName(this.name), p.setMimeType(e), this.options.requestLogger?.(p), (await promisify(
431459
+ r.getImage.bind(r),
431460
+ p
431461
+ )).getImage_asU8();
431462
+ }
431463
+ async renderFrame(e) {
431464
+ const r = this.cameraService, p = new camera_pb$1.GetPointCloudRequest();
431465
+ p.setName(this.name), p.setMimeType(e), this.options.requestLogger?.(p);
431466
+ const t = await promisify(
431467
+ r.renderFrame.bind(r),
431468
+ p
431469
+ );
431470
+ return new Blob([t.getData_asU8()], { type: e });
431471
+ }
431472
+ async getPointCloud() {
431473
+ const e = this.cameraService, r = new camera_pb$1.GetPointCloudRequest();
431474
+ return r.setName(this.name), r.setMimeType(MimeType.PCD), this.options.requestLogger?.(r), (await promisify(e.getPointCloud.bind(e), r)).getPointCloud_asU8();
431475
+ }
431476
+ async getProperties() {
431477
+ const e = this.cameraService, r = new camera_pb$1.GetPropertiesRequest();
431478
+ return r.setName(this.name), this.options.requestLogger?.(r), (await promisify(e.getProperties.bind(e), r)).toObject();
431479
+ }
431480
+ }
431481
+ class MotorClient {
431482
+ client;
431483
+ name;
431484
+ options;
431485
+ constructor(e, r, p = {}) {
431486
+ this.client = e.createServiceClient(MotorServiceClient_1), this.name = r, this.options = p;
431487
+ }
431488
+ get motorService() {
431489
+ return this.client;
431490
+ }
431491
+ async setPower(e, r = {}) {
431492
+ const p = this.motorService, t = new motor_pb.SetPowerRequest();
431493
+ t.setName(this.name), t.setPowerPct(e), t.setExtra(struct_pb$2.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), await promisify(
431494
+ p.setPower.bind(p),
431495
+ t
431496
+ );
431497
+ }
431498
+ async goFor(e, r, p = {}) {
431499
+ const t = this.motorService, n = new motor_pb.GoForRequest();
431500
+ n.setName(this.name), n.setRpm(e), n.setRevolutions(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
431501
+ t.goFor.bind(t),
431502
+ n
431503
+ );
431504
+ }
431505
+ async goTo(e, r, p = {}) {
431506
+ const t = this.motorService, n = new motor_pb.GoToRequest();
431507
+ n.setName(this.name), n.setRpm(e), n.setPositionRevolutions(r), n.setExtra(struct_pb$2.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
431508
+ t.goTo.bind(t),
431509
+ n
431510
+ );
431511
+ }
431512
+ async resetZeroPosition(e, r = {}) {
431513
+ const p = this.motorService, t = new motor_pb.ResetZeroPositionRequest();
431514
+ 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);
431515
+ }
431516
+ async stop(e = {}) {
431517
+ const r = this.motorService, p = new motor_pb.StopRequest();
431518
+ p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
431519
+ r.stop.bind(r),
431520
+ p
431521
+ );
431522
+ }
431523
+ /** @deprecated Use {@link MotorClient#stop} instead. */
431524
+ motorStop(e = {}) {
431525
+ return this.stop(e);
431526
+ }
431527
+ async getProperties(e = {}) {
431528
+ const r = this.motorService, p = new motor_pb.GetPropertiesRequest();
431529
+ 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() };
431530
+ }
431531
+ async getPosition(e = {}) {
431532
+ const r = this.motorService, p = new motor_pb.GetPositionRequest();
431533
+ 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();
431534
+ }
431535
+ async isPowered(e = {}) {
431536
+ const r = this.motorService, p = new motor_pb.IsPoweredRequest();
431537
+ p.setName(this.name), p.setExtra(struct_pb$2.Struct.fromJavaScript(e)), this.options.requestLogger?.(p);
431538
+ const t = await promisify(r.isPowered.bind(r), p);
431539
+ return [t.getIsOn(), t.getPowerPct()];
431540
+ }
431541
+ }
431334
431542
  var commonjsGlobal$1 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, sensor_pb = {}, googleProtobuf$1 = {};
431335
431543
  (function(exports) {
431336
431544
  var $jscomp = $jscomp || {};
@@ -447769,10 +447977,14 @@ class StreamClient extends EventDispatcher {
447769
447977
  export {
447770
447978
  ArmClient,
447771
447979
  Base,
447980
+ BaseClient,
447772
447981
  Board,
447982
+ BoardClient,
447773
447983
  Camera,
447984
+ CameraClient,
447774
447985
  Client,
447775
447986
  Motor,
447987
+ MotorClient,
447776
447988
  MovementSensorClient,
447777
447989
  RobotClient,
447778
447990
  SensorClient,