@viamrobotics/sdk 0.9.2 → 0.9.3

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.
@@ -1,4 +1,4 @@
1
- import type { Credentials } from '@viamrobotics/rpc/src/dial';
1
+ import { type Credentials } from '@viamrobotics/rpc';
2
2
  import { grpc } from '@improbable-eng/grpc-web';
3
3
  import { EventDispatcher } from '../events';
4
4
  import proto from '../gen/robot/v1/robot_pb';
@@ -43,6 +43,7 @@ export interface ConnectOptions {
43
43
  authEntity?: string;
44
44
  creds?: Credentials;
45
45
  priority?: number;
46
+ dialTimeout?: number;
46
47
  }
47
48
  declare abstract class ServiceClient {
48
49
  serviceHost: string;
@@ -113,7 +114,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
113
114
  get peerConnection(): RTCPeerConnection | undefined;
114
115
  disconnect(): Promise<void>;
115
116
  isConnected(): boolean;
116
- connect({ authEntity, creds, priority, }?: ConnectOptions): Promise<void>;
117
+ connect({ authEntity, creds, priority, dialTimeout, }?: ConnectOptions): Promise<void>;
117
118
  getOperations(): Promise<proto.Operation[]>;
118
119
  cancelOperation(id: string): Promise<void>;
119
120
  blockForOperation(id: string): Promise<void>;
@@ -12,6 +12,7 @@ export interface DialDirectConf {
12
12
  noReconnect?: boolean;
13
13
  reconnectMaxAttempts?: number;
14
14
  reconnectMaxWait?: number;
15
+ dialTimeout?: number;
15
16
  }
16
17
  interface ICEServer {
17
18
  urls: string;
@@ -36,6 +37,7 @@ export interface DialWebRTCConf {
36
37
  signalingAddress: string;
37
38
  iceServers?: ICEServer[];
38
39
  priority?: number;
40
+ dialTimeout?: number;
39
41
  }
40
42
  /** Options required to dial a robot. */
41
43
  export type DialConf = DialDirectConf | DialWebRTCConf;
@@ -16,7 +16,6 @@ export declare class SlamClient implements Slam {
16
16
  getPosition(): Promise<pb.GetPositionResponse.AsObject>;
17
17
  getPointCloudMap: () => Promise<Uint8Array>;
18
18
  getInternalState: () => Promise<Uint8Array>;
19
- getLatestMapInfo(): Promise<Date>;
20
19
  getProperties(): Promise<pb.GetPropertiesResponse.AsObject>;
21
20
  doCommand(command: StructType): Promise<StructType>;
22
21
  }
@@ -17,8 +17,6 @@ export interface Slam extends Resource {
17
17
  * mapping/localization.
18
18
  */
19
19
  getInternalState: () => Promise<Uint8Array>;
20
- /** Get the timestamp of the last update to the point cloud SLAM map. */
21
- getLatestMapInfo: () => Promise<Date>;
22
20
  /** Gets information on the properties of the current SLAM service. */
23
21
  getProperties: () => Promise<SlamProperties>;
24
22
  }
@@ -0,0 +1,23 @@
1
+ import pb from '../../gen/service/vision/v1/vision_pb';
2
+ import type { MimeType } from '../../main';
3
+ import type { RobotClient } from '../../robot';
4
+ import type { Options, StructType } from '../../types';
5
+ import type { Vision } from './vision';
6
+ /**
7
+ * A gRPC-web client for a Vision service.
8
+ *
9
+ * @group Clients
10
+ */
11
+ export declare class VisionClient implements Vision {
12
+ private client;
13
+ private readonly name;
14
+ private readonly options;
15
+ constructor(client: RobotClient, name: string, options?: Options);
16
+ private get service();
17
+ getDetectionsFromCamera(cameraName: string, extra?: StructType): Promise<pb.Detection.AsObject[]>;
18
+ getDetections(image: Uint8Array, width: number, height: number, mimeType: MimeType, extra?: StructType): Promise<pb.Detection.AsObject[]>;
19
+ getClassificationsFromCamera(cameraName: string, count: number, extra?: StructType): Promise<pb.Classification.AsObject[]>;
20
+ getClassifications(image: Uint8Array, width: number, height: number, mimeType: MimeType, count: number, extra?: StructType): Promise<pb.Classification.AsObject[]>;
21
+ getObjectPointClouds(cameraName: string, extra?: StructType): Promise<import("../../gen/common/v1/common_pb").PointCloudObject.AsObject[]>;
22
+ doCommand(command: StructType): Promise<StructType>;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import pb from '../../gen/service/vision/v1/vision_pb';
2
+ import commonPB from '../../gen/common/v1/common_pb';
3
+ export type Detection = pb.Detection.AsObject;
4
+ export type Classification = pb.Classification.AsObject;
5
+ export type PointCloudObject = commonPB.PointCloudObject.AsObject;
@@ -0,0 +1,50 @@
1
+ import type { MimeType } from '../../main';
2
+ import type { Resource, StructType } from '../../types';
3
+ import type { Classification, Detection, PointCloudObject } from './types';
4
+ /** A service that enables various computer vision algorithms */
5
+ export interface Vision extends Resource {
6
+ /**
7
+ * Get a list of detections in the next image given a camera.
8
+ *
9
+ * @param cameraName - The name of the camera to use for detection.
10
+ * @returns - The list of Detections.
11
+ */
12
+ getDetectionsFromCamera: (cameraName: string, extra?: StructType) => Promise<Detection[]>;
13
+ /**
14
+ * Get a list of detections in the given image.
15
+ *
16
+ * @param image - The image from which to get detections.
17
+ * @param width - The width of the image.
18
+ * @param height - The height of the image.
19
+ * @param mimeType - The MimeType of the image.
20
+ * @returns - The list of Detections.
21
+ */
22
+ getDetections: (image: Uint8Array, width: number, height: number, mimeType: MimeType, extra?: StructType) => Promise<Detection[]>;
23
+ /**
24
+ * Get a list of classifications in the next image given a camera.
25
+ *
26
+ * @param cameraName - The name of the camera to use for classification.
27
+ * @param count - The number of Classifications requested.
28
+ * @returns - The list of Classifications.
29
+ */
30
+ getClassificationsFromCamera: (cameraName: string, count: number, extra?: StructType) => Promise<Classification[]>;
31
+ /**
32
+ * Get a list of classifications in the given image.
33
+ *
34
+ * @param image - The image from which to get classifications.
35
+ * @param width - The width of the image.
36
+ * @param height - The height of the image.
37
+ * @param mimeType - The MimeType of the image.
38
+ * @param count - The number of Classifications requested.
39
+ * @returns - The list of Classifications.
40
+ */
41
+ getClassifications: (image: Uint8Array, width: number, height: number, mimeType: MimeType, count: number, extra?: StructType) => Promise<Classification[]>;
42
+ /**
43
+ * Returns a list of the 3D point cloud objects and associated metadata in the
44
+ * latest picture obtained from the specified 3D camera.
45
+ *
46
+ * @param cameraName - The name of the camera.
47
+ * @returns - The list of PointCloudObjects
48
+ */
49
+ getObjectPointClouds: (cameraName: string, extra?: StructType) => Promise<PointCloudObject[]>;
50
+ }
@@ -0,0 +1,3 @@
1
+ export type { Vision } from './vision/vision';
2
+ export type { Detection, Classification, PointCloudObject, } from './vision/types';
3
+ export { VisionClient } from './vision/client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/viamrobotics/viam-typescript-sdk#readme",
47
47
  "dependencies": {
48
- "@viamrobotics/rpc": "^0.1.39",
48
+ "@viamrobotics/rpc": "^0.2.3",
49
49
  "exponential-backoff": "^3.1.1"
50
50
  },
51
51
  "devDependencies": {
@@ -53,9 +53,10 @@
53
53
  "@improbable-eng/grpc-web": "^0.15.0",
54
54
  "@improbable-eng/grpc-web-fake-transport": "^0.15.0",
55
55
  "@types/google-protobuf": "^3.15.6",
56
+ "@types/node": "^20.11.10",
56
57
  "@typescript-eslint/eslint-plugin": "^6.17.0",
57
58
  "@typescript-eslint/parser": "^6.17.0",
58
- "@viamrobotics/eslint-config": "^0.3.0",
59
+ "@viamrobotics/eslint-config": "^0.4.0",
59
60
  "@viamrobotics/prettier-config": "^0.3.4",
60
61
  "@viamrobotics/typescript-config": "^0.1.0",
61
62
  "concurrently": "^8.0.1",
@@ -63,6 +64,7 @@
63
64
  "eslint": "^8.56.0",
64
65
  "eslint-config-prettier": "^9.1.0",
65
66
  "eslint-plugin-tsdoc": "^0.2.17",
67
+ "eslint-plugin-vitest": "^0.3.20",
66
68
  "google-protobuf": "^3.21.2",
67
69
  "grpc-web": "^1.4.2",
68
70
  "happy-dom": "^8.2.6",