@viamrobotics/sdk 0.0.41 → 0.0.43

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.
@@ -6,6 +6,7 @@ import type { Duration } from 'google-protobuf/google/protobuf/duration_pb';
6
6
  import { ArmServiceClient } from '../gen/component/arm/v1/arm_pb_service';
7
7
  import { BaseServiceClient } from '../gen/component/base/v1/base_pb_service';
8
8
  import { BoardServiceClient } from '../gen/component/board/v1/board_pb_service';
9
+ import { EncoderServiceClient } from '../gen/component/encoder/v1/encoder_pb_service';
9
10
  import { GantryServiceClient } from '../gen/component/gantry/v1/gantry_pb_service';
10
11
  import { GenericServiceClient } from '../gen/component/generic/v1/generic_pb_service';
11
12
  import { GripperServiceClient } from '../gen/component/gripper/v1/gripper_pb_service';
@@ -54,6 +55,7 @@ export declare class RobotClient implements Robot {
54
55
  private armServiceClient;
55
56
  private baseServiceClient;
56
57
  private boardServiceClient;
58
+ private encoderServiceClient;
57
59
  private gantryServiceClient;
58
60
  private genericServiceClient;
59
61
  private gripperServiceClient;
@@ -73,6 +75,7 @@ export declare class RobotClient implements Robot {
73
75
  get armService(): ArmServiceClient;
74
76
  get baseService(): BaseServiceClient;
75
77
  get boardService(): BoardServiceClient;
78
+ get encoderService(): EncoderServiceClient;
76
79
  get gantryService(): GantryServiceClient;
77
80
  get genericService(): GenericServiceClient;
78
81
  get gripperService(): GripperServiceClient;
@@ -22,6 +22,21 @@ export interface DialWebRTCConf {
22
22
  signalingAddress: string;
23
23
  iceServers?: ICEServer[];
24
24
  }
25
- type Conf = DialDirectConf | DialWebRTCConf;
26
- export declare const createRobotClient: (conf: Conf) => Promise<RobotClient>;
25
+ /** Options required to dial a robot. */
26
+ export type DialConf = DialDirectConf | DialWebRTCConf;
27
+ /**
28
+ * Connect to a robot via WebRTC or gRPC and return a RobotClient after
29
+ * connecting successfully.
30
+ *
31
+ * The initial connection method is determined by whether a
32
+ * {@link DialWebRTCConf} or {@link DialDirectConf} is passed in as the first
33
+ * argument.
34
+ *
35
+ * If connecting via WebRTC fails, then this function will automatically
36
+ * re-attempt to connect via gRPC directly.
37
+ *
38
+ * @privateRemarks
39
+ * We should add an example that is not viam-specific.
40
+ */
41
+ export declare const createRobotClient: (conf: DialConf) => Promise<RobotClient>;
27
42
  export {};
package/dist/robot.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type { Robot } from './robot/Robot';
2
2
  export { RobotClient } from './robot/Client';
3
- export { type DialDirectConf, type DialWebRTCConf, createRobotClient, } from './robot/dial';
3
+ export { type DialConf, type DialDirectConf, type DialWebRTCConf, createRobotClient, } from './robot/dial';
@@ -0,0 +1,11 @@
1
+ import type { RobotClient } from '../../robot';
2
+ import type { Options } from '../../types';
3
+ import type { DataManager } from './datamanager';
4
+ export declare class DataManagerClient implements DataManager {
5
+ private client;
6
+ private readonly name;
7
+ private readonly options;
8
+ constructor(client: RobotClient, name: string, options?: Options);
9
+ private get datamanagerService();
10
+ Sync(extra?: {}): Promise<void>;
11
+ }
@@ -0,0 +1,4 @@
1
+ import type { Extra } from '../../types';
2
+ export interface DataManager {
3
+ Sync: (extra?: Extra) => Promise<void>;
4
+ }
@@ -0,0 +1,20 @@
1
+ import type { RobotClient } from '../../robot';
2
+ import type { Options, Pose, PoseInFrame, ResourceName, Transform, WorldState } from '../../types';
3
+ import { type MotionConstraints } from './types';
4
+ import type { Motion } from './Motion';
5
+ /**
6
+ * A gRPC-web client for a Motion service.
7
+ *
8
+ * @group Clients
9
+ */
10
+ export declare class MotionClient implements Motion {
11
+ private client;
12
+ private readonly name;
13
+ private readonly options;
14
+ constructor(client: RobotClient, name: string, options?: Options);
15
+ private get service();
16
+ move(destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, constraints?: MotionConstraints, extra?: {}): Promise<boolean>;
17
+ moveOnMap(destination: Pose, componentName: ResourceName, slamServiceName: ResourceName, extra?: {}): Promise<boolean>;
18
+ moveSingleComponent(destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, extra?: {}): Promise<boolean>;
19
+ getPose(componentName: ResourceName, destinationFrame: string, supplementalTransforms: Transform[], extra?: {}): Promise<import("../../gen/common/v1/common_pb").PoseInFrame.AsObject>;
20
+ }
@@ -0,0 +1,50 @@
1
+ import type { Extra, Pose, PoseInFrame, ResourceName, Transform, WorldState } from '../../types';
2
+ import type { MotionConstraints } from './types';
3
+ /**
4
+ * A service that coordinates motion planning across all of the components in a
5
+ * given robot.
6
+ */
7
+ export interface Motion {
8
+ /**
9
+ * Move any component on the robot to a specified destination which can be
10
+ * from the reference frame of any other component on the robot.
11
+ *
12
+ * @param destination - Destination to move to, which can a pose in the
13
+ * reference frame of any frame in the robot's frame system.
14
+ * @param componentName - Component on the robot to move to the specified
15
+ * destination.
16
+ * @param worldState - Avoid obstacles by specifying their geometries in the
17
+ * world state. Augment the frame system of the robot by specifying
18
+ * additional transforms to add to it for the duration of the Move.
19
+ * @param constraints - Constrain the way the robot will move.
20
+ */
21
+ move: (destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, constraints?: MotionConstraints, extra?: Extra) => Promise<boolean>;
22
+ /**
23
+ * @param destination - Specify a destination to, which can be any pose with
24
+ * respect to the SLAM map's origin.
25
+ * @param componentName - Component on the robot to move to the specified
26
+ * destination.
27
+ * @param slamServiceName - Name of the slam service from which the SLAM map
28
+ * is requested
29
+ */
30
+ moveOnMap: (destination: Pose, componentName: ResourceName, slamServiceName: ResourceName, extra?: Extra) => Promise<boolean>;
31
+ /**
32
+ * @param destination - Destination to move to, which can a pose in the
33
+ * reference frame of any frame in the robot's frame system.
34
+ * @param componentName - Component on the robot to move to the specified
35
+ * destination.
36
+ * @param worldState - Avoid obstacles by specifying their geometries in the
37
+ * world state. Augment the frame system of the robot by specifying
38
+ * additional transforms to add to it for the duration of the Move.
39
+ */
40
+ moveSingleComponent: (destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, extra?: Extra) => Promise<boolean>;
41
+ /**
42
+ * @param componentName - The component whose pose is being requested.
43
+ * @param destinationFrame - The reference frame in which the component's pose
44
+ * should be provided, if unset this defaults to the "world" reference
45
+ * frame.
46
+ * @param supplementalTransforms - Pose information on any additional
47
+ * reference frames that are needed to compute the component's pose.
48
+ */
49
+ getPose: (componentName: ResourceName, destinationFrame: string, supplementalTransforms: Transform[], extra?: Extra) => Promise<PoseInFrame>;
50
+ }
@@ -0,0 +1,4 @@
1
+ import pb from '../../gen/service/motion/v1/motion_pb';
2
+ export type MotionConstraints = pb.Constraints.AsObject;
3
+ /** Convert a Constraints object to a Protobuf Datatype. */
4
+ export declare const encodeConstraints: (obj: MotionConstraints) => pb.Constraints;
@@ -0,0 +1,3 @@
1
+ export type { Motion } from './motion/Motion';
2
+ export type { MotionConstraints } from './motion/types';
3
+ export { MotionClient } from './motion/Client';
@@ -0,0 +1,26 @@
1
+ import common from './gen/common/v1/common_pb';
2
+ export type Extra = Map<string, any>;
3
+ export interface Vector3D {
4
+ x: number;
5
+ y: number;
6
+ z: number;
7
+ }
8
+ export interface Orientation {
9
+ ox: number;
10
+ oy: number;
11
+ oz: number;
12
+ theta: number;
13
+ }
14
+ export interface Options {
15
+ requestLogger?: (req: unknown) => void;
16
+ }
17
+ export declare enum PositionType {
18
+ POSITION_TYPE_UNSPECIFIED = 0,
19
+ POSITION_TYPE_TICKS_COUNT = 1,
20
+ POSITION_TYPE_ANGLE_DEGREES = 2
21
+ }
22
+ export type ResourceName = common.ResourceName.AsObject;
23
+ export type Pose = common.Pose.AsObject;
24
+ export type PoseInFrame = common.PoseInFrame.AsObject;
25
+ export type Transform = common.Transform.AsObject;
26
+ export type WorldState = common.WorldState.AsObject;
@@ -0,0 +1,22 @@
1
+ import type { ServiceError } from './gen/robot/v1/robot_pb_service';
2
+ import { grpc } from '@improbable-eng/grpc-web';
3
+ import common from './gen/common/v1/common_pb';
4
+ import type { Vector3D } from './types';
5
+ type Callback<T> = (error: ServiceError | null, response: T | null) => void;
6
+ type ServiceFunc<Req, Resp> = (request: Req, metadata: grpc.Metadata, callback: Callback<Resp>) => void;
7
+ export declare const promisify: <Req, Resp>(func: ServiceFunc<Req, Resp>, request: Req) => Promise<Resp>;
8
+ /** Convert a 3D Vector POJO to a Protobuf Datatype */
9
+ export declare const encodeVector3D: (value: Vector3D) => common.Vector3;
10
+ /** Convert a 3D Vector Protobuf Datatype to a POJO */
11
+ export declare const decodeVector3D: (proto: common.Vector3) => Vector3D;
12
+ /** Convert a Pose object to a Protobuf Datatype. */
13
+ export declare const encodePose: (obj: common.Pose.AsObject) => common.Pose;
14
+ /** Convert a PoseInFrame object to a Protobuf Datatype. */
15
+ export declare const encodePoseInFrame: (obj: common.PoseInFrame.AsObject) => common.PoseInFrame;
16
+ /** Convert a ResourceName object to a Protobuf Datatype. */
17
+ export declare const encodeResourceName: (obj: common.ResourceName.AsObject) => common.ResourceName;
18
+ /** Convert a Transform object to a Protobuf Datatype. */
19
+ export declare const encodeTransform: (obj: common.Transform.AsObject) => common.Transform;
20
+ /** Convert a WorldState object to a Protobuf Datatype. */
21
+ export declare const encodeWorldState: (obj: common.WorldState.AsObject) => common.WorldState;
22
+ export {};
package/package.json CHANGED
@@ -1,19 +1,12 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",
7
7
  "types": "./dist/main.d.ts",
8
8
  "files": [
9
- "dist/robot.*",
10
- "dist/robot/**/*.d.ts",
11
- "dist/events.*",
12
- "dist/components/**/*.d.ts",
13
- "dist/extra/**/*.d.ts",
14
- "dist/main.*",
15
- "dist/gen/**/*.esm.d.ts",
16
- "dist/gen/**/*.d.ts"
9
+ "dist"
17
10
  ],
18
11
  "exports": {
19
12
  ".": {
@@ -22,17 +15,24 @@
22
15
  }
23
16
  },
24
17
  "scripts": {
25
- "build": "vite build && npm run copy-dts",
18
+ "build": "npm run build:bundle && npm run build:types && npm run build:copy-dts",
19
+ "build:bundle": "vite build",
20
+ "build:types": "tsc --project tsconfig.build.json",
21
+ "build:copy-dts": "copyfiles -u 1 \"src/gen/**/*.d.ts\" dist",
26
22
  "check": "npm-check --production",
27
- "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist",
28
23
  "doc": "typedoc",
29
24
  "doc:watch": "typedoc --watch",
30
- "format": "prettier --write './src/**/*.{ts,js}'",
31
- "lint:prettier": "prettier --check './src/**/*.{ts,js}'",
32
- "lint:eslint": "eslint './src/**/*.{ts,js}' --fix",
25
+ "format": "npm run _eslint -- --fix && npm run _prettier -- --write",
26
+ "lint": "concurrently -g npm:lint:*",
27
+ "lint:prettier": "npm run _prettier -- --check",
28
+ "lint:eslint": "npm run _eslint",
33
29
  "test": "vitest run",
34
30
  "test:watch": "vitest",
35
- "typecheck": "tsc --noEmit"
31
+ "typecheck": "concurrently -g npm:typecheck:*",
32
+ "typecheck:src": "tsc",
33
+ "typecheck:node": "tsc --project tsconfig.node.json",
34
+ "_eslint": "eslint '.*.cjs' '**/*.{ts,js,cjs}' --quiet",
35
+ "_prettier": "prettier '.*.cjs' '**/*.{ts,js,cjs}'"
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
@@ -51,10 +51,14 @@
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
52
52
  "@improbable-eng/grpc-web-fake-transport": "^0.15.0",
53
53
  "@types/google-protobuf": "^3.15.6",
54
- "@typescript-eslint/eslint-plugin": "^5.43.0",
55
- "@typescript-eslint/parser": "^5.43.0",
54
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
55
+ "@typescript-eslint/parser": "^5.57.1",
56
+ "@viamrobotics/eslint-config": "^0.0.3",
57
+ "@viamrobotics/prettier-config": "^0.0.1",
58
+ "@viamrobotics/typescript-config": "^0.0.3",
59
+ "concurrently": "^8.0.1",
56
60
  "copyfiles": "^2.4.1",
57
- "eslint": "^8.27.0",
61
+ "eslint": "^8.37.0",
58
62
  "eslint-config-prettier": "^8.5.0",
59
63
  "eslint-plugin-tsdoc": "^0.2.17",
60
64
  "google-protobuf": "^3.21.2",
@@ -64,11 +68,9 @@
64
68
  "prettier": "^2.8.1",
65
69
  "prettier-plugin-jsdoc": "^0.4.2",
66
70
  "ts-protoc-gen": "^0.15.0",
67
- "tslib": "^2.4.1",
68
- "typedoc": "^0.23.28",
71
+ "typedoc": "^0.24.1",
69
72
  "typescript": "^5.0.3",
70
73
  "vite": "^4.2.1",
71
- "vite-plugin-dts": "^2.1.0",
72
74
  "vitest": "^0.28.4"
73
75
  }
74
76
  }