@viamrobotics/sdk 0.0.19 → 0.0.20

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.
@@ -0,0 +1,39 @@
1
+ import type { Pose, WorldState } from '../../gen/common/v1/common_pb.esm';
2
+ import type { JointPositions } from '../../gen/component/arm/v1/arm_pb.esm';
3
+ import type { Extra } from '../../types';
4
+ export interface Arm {
5
+ /**
6
+ * Get the position of the end of the arm expressed as a pose
7
+ *
8
+ */
9
+ GetEndPosition: (extra?: Extra) => Promise<Pose>;
10
+ /**
11
+ * Move the end of the arm to the pose, avoiding obstacles in the worldstate
12
+ *
13
+ * @param pose - The destination pose for the arm
14
+ * @param world - The obstacles for the arm to avoid
15
+ */
16
+ MoveToPosition: (pose: Pose, world: WorldState, extra?: Extra) => Promise<void>;
17
+ /**
18
+ * Move each joint of the arm based on the angles on the joint poisitons
19
+ * parameter
20
+ *
21
+ * @param jointPositions - Destination joint positons
22
+ */
23
+ MoveToJointPositions: (jointPositions: JointPositions, extra?: Extra) => Promise<void>;
24
+ /**
25
+ * Gets the current position of each joint
26
+ *
27
+ */
28
+ GetJointPositions: (extra: Extra) => Promise<JointPositions>;
29
+ /**
30
+ * Stops the motion of the arm
31
+ *
32
+ */
33
+ Stop: (extra: Extra) => Promise<void>;
34
+ /**
35
+ * Get if the arm is currently moving
36
+ *
37
+ */
38
+ IsMoving: () => Promise<boolean>;
39
+ }
@@ -0,0 +1,18 @@
1
+ import type { Pose, WorldState } from '../../gen/common/v1/common_pb.esm';
2
+ import type Client from '../../Client';
3
+ import pb from '../../gen/component/arm/v1/arm_pb.esm';
4
+ import type { Options } from '../../types';
5
+ import type { Arm } from './Arm';
6
+ export declare class ArmClient implements Arm {
7
+ private client;
8
+ private readonly name;
9
+ private readonly options;
10
+ constructor(client: Client, name: string, options?: Options);
11
+ private get ArmService();
12
+ GetEndPosition(extra?: {}): Promise<import("../../gen/common/v1/common_pb").Pose>;
13
+ MoveToPosition(pose: Pose, world: WorldState, extra?: {}): Promise<void>;
14
+ MoveToJointPositions(jointPositions: pb.JointPositions, extra?: {}): Promise<void>;
15
+ GetJointPositions(extra?: {}): Promise<pb.JointPositions>;
16
+ Stop(extra?: {}): Promise<void>;
17
+ IsMoving(): Promise<boolean>;
18
+ }
@@ -0,0 +1,2 @@
1
+ export type { Arm } from './arm/Arm';
2
+ export { ArmClient } from './arm/Client';
package/dist/main.d.ts CHANGED
@@ -31,5 +31,6 @@ import slamApi from './gen/service/slam/v1/slam_pb.esm';
31
31
  import streamApi from './gen/proto/stream/v1/stream_pb.esm';
32
32
  import visionApi from './gen/service/vision/v1/vision_pb.esm';
33
33
  export { type Robot, RobotClient } from './components/robot';
34
+ export { type Arm, ArmClient } from "./components/arm";
34
35
  export { commonApi, armApi, baseApi, boardApi, cameraApi, gantryApi, genericApi, gripperApi, inputControllerApi, motorApi, motionApi, movementSensorApi, servoApi, navigationApi, robotApi, sensorApi, sensorsApi, slamApi, visionApi, streamApi, Camera, Motor, Base, Board, Sensor, BaseClient, BoardClient, CameraClient, Client, MotorClient, SensorClient, StreamClient, };
35
36
  export type { ResponseStream, ServiceError, } from './gen/robot/v1/robot_pb_service.esm';
package/dist/main.es.js CHANGED
@@ -401350,7 +401350,60 @@ class RobotClient {
401350
401350
  return t.setResourceNamesList(e), t.setEvery(r), (await promisify(p.streamStatus.bind(p), t)).getStatusList();
401351
401351
  }
401352
401352
  }
401353
+ class ArmClient {
401354
+ client;
401355
+ name;
401356
+ options;
401357
+ constructor(e, r, p = {}) {
401358
+ this.client = e.createServiceClient(ArmServiceClient_1), this.name = r, this.options = p;
401359
+ }
401360
+ get ArmService() {
401361
+ return this.client;
401362
+ }
401363
+ async GetEndPosition(e = {}) {
401364
+ const r = this.ArmService, p = new arm_pb.GetEndPositionRequest();
401365
+ p.setName(this.name), p.setExtra(struct_pb$B.Struct.fromJavaScript(e)), this.options.requestLogger?.(p);
401366
+ const n = (await promisify(r.getEndPosition.bind(r), p)).getPose();
401367
+ if (!n)
401368
+ throw new Error("no pose");
401369
+ return n;
401370
+ }
401371
+ async MoveToPosition(e, r, p = {}) {
401372
+ const t = this.ArmService, n = new arm_pb.MoveToPositionRequest();
401373
+ n.setTo(e), n.setWorldState(r), n.setExtra(struct_pb$B.Struct.fromJavaScript(p)), this.options.requestLogger?.(n), await promisify(
401374
+ t.moveToPosition.bind(t),
401375
+ n
401376
+ );
401377
+ }
401378
+ async MoveToJointPositions(e, r = {}) {
401379
+ const p = this.ArmService, t = new arm_pb.MoveToJointPositionsRequest();
401380
+ t.setName(this.name), t.setPositions(e), t.setExtra(struct_pb$B.Struct.fromJavaScript(r)), this.options.requestLogger?.(t), await promisify(p.moveToJointPositions.bind(p), t);
401381
+ }
401382
+ async GetJointPositions(e = {}) {
401383
+ const r = this.ArmService, p = new arm_pb.GetJointPositionsRequest();
401384
+ p.setName(this.name), p.setExtra(struct_pb$B.Struct.fromJavaScript(e)), this.options.requestLogger?.(p);
401385
+ const n = (await promisify(r.getJointPositions.bind(r), p)).getPositions();
401386
+ if (!n)
401387
+ throw new Error("no pose");
401388
+ return n;
401389
+ }
401390
+ async Stop(e = {}) {
401391
+ const r = this.ArmService, p = new arm_pb.StopRequest();
401392
+ p.setName(this.name), p.setExtra(struct_pb$B.Struct.fromJavaScript(e)), this.options.requestLogger?.(p), await promisify(
401393
+ r.getJointPositions.bind(r),
401394
+ p
401395
+ );
401396
+ }
401397
+ async IsMoving() {
401398
+ const e = this.ArmService, r = new arm_pb.IsMovingRequest();
401399
+ return this.options.requestLogger?.(r), (await promisify(
401400
+ e.isMoving.bind(e),
401401
+ r
401402
+ )).getIsMoving();
401403
+ }
401404
+ }
401353
401405
  export {
401406
+ ArmClient,
401354
401407
  Base,
401355
401408
  BaseClient,
401356
401409
  Board,