@viamrobotics/sdk 0.48.0 → 0.49.1

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.
@@ -5,11 +5,55 @@ import { EventDispatcher } from '../events';
5
5
  import type { PoseInFrame, Transform } from '../gen/common/v1/common_pb';
6
6
  import { GetModelsFromModulesRequest, RestartModuleRequest, TransformPCDRequest, TransformPoseRequest } from '../gen/robot/v1/robot_pb';
7
7
  import type { Robot } from './robot';
8
+ import type { AccessToken, Credential } from '../main';
9
+ interface ICEServer {
10
+ urls: string;
11
+ username?: string;
12
+ credential?: string;
13
+ }
14
+ /** Options required to dial a robot via WebRTC. */
15
+ export interface DialWebRTCConf {
16
+ host: string;
17
+ credentials?: Credential | AccessToken;
18
+ disableSessions?: boolean;
19
+ noReconnect?: boolean;
20
+ /** @default 10. */
21
+ reconnectMaxAttempts?: number;
22
+ /** @default Number.POSITIVE_INFINITY */
23
+ reconnectMaxWait?: number;
24
+ reconnectAbortSignal?: {
25
+ abort: boolean;
26
+ };
27
+ serviceHost?: string;
28
+ signalingAddress: string;
29
+ iceServers?: ICEServer[];
30
+ priority?: number;
31
+ /**
32
+ * Set timeout in milliseconds for dialing. Default is defined by
33
+ * DIAL_TIMEOUT. A value of 0 disables the timeout.
34
+ */
35
+ dialTimeout?: number;
36
+ }
37
+ /** Options required to dial a robot via gRPC. */
38
+ export interface DialDirectConf {
39
+ host: string;
40
+ credentials?: Credential | AccessToken;
41
+ disableSessions?: boolean;
42
+ noReconnect?: boolean;
43
+ reconnectMaxAttempts?: number;
44
+ reconnectMaxWait?: number;
45
+ reconnectAbortSignal?: {
46
+ abort: boolean;
47
+ };
48
+ dialTimeout?: number;
49
+ }
50
+ /** Options required to dial a robot. */
51
+ export type DialConf = DialDirectConf | DialWebRTCConf;
8
52
  interface WebRTCOptions {
9
53
  enabled: boolean;
10
54
  host: string;
11
55
  signalingAddress: string;
12
- rtcConfig: RTCConfiguration | undefined;
56
+ rtcConfig: RTCConfiguration;
13
57
  noReconnect?: boolean;
14
58
  reconnectMaxAttempts?: number;
15
59
  reconnectMaxWait?: number;
@@ -27,13 +71,19 @@ export interface ConnectOptions {
27
71
  priority?: number;
28
72
  dialTimeout?: number;
29
73
  }
74
+ export declare const isDialWebRTCConf: (value: DialConf) => value is DialWebRTCConf;
75
+ /**
76
+ * Validates a DialConf passed to createRobotClient. Throws an error for invalid
77
+ * configs.
78
+ */
79
+ export declare const validateDialConf: (conf: DialConf) => void;
30
80
  /**
31
81
  * A gRPC-web client for a Robot.
32
82
  *
33
83
  * @group Clients
34
84
  */
35
85
  export declare class RobotClient extends EventDispatcher implements Robot {
36
- private readonly serviceHost;
86
+ private serviceHost;
37
87
  private readonly webrtcOptions;
38
88
  private readonly directOptions;
39
89
  private readonly sessionOptions;
@@ -64,7 +114,8 @@ export declare class RobotClient extends EventDispatcher implements Robot {
64
114
  private visionServiceClient;
65
115
  private servoServiceClient;
66
116
  private slamServiceClient;
67
- constructor(serviceHost: string, webrtcOptions?: WebRTCOptions, sessionOptions?: SessionOptions, directOptions?: DirectOptions);
117
+ private currentRetryAttempt;
118
+ constructor(serviceHost?: string, webrtcOptions?: WebRTCOptions, sessionOptions?: SessionOptions, directOptions?: DirectOptions);
68
119
  private onDisconnect;
69
120
  private get noReconnect();
70
121
  private get reconnectMaxAttempts();
@@ -94,6 +145,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
94
145
  };
95
146
  readonly resourceRPCSubtypes: {
96
147
  readonly name: "ResourceRPCSubtypes";
148
+ /** @default Number.POSITIVE_INFINITY */
97
149
  readonly I: typeof import("../gen/robot/v1/robot_pb").ResourceRPCSubtypesRequest;
98
150
  readonly O: typeof import("../gen/robot/v1/robot_pb").ResourceRPCSubtypesResponse;
99
151
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
@@ -243,7 +295,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
243
295
  };
244
296
  readonly moveToJointPositions: {
245
297
  readonly name: "MoveToJointPositions";
246
- readonly I: typeof import("../gen/component/arm/v1/arm_pb").MoveToJointPositionsRequest;
298
+ readonly I: typeof import("../gen/component/arm/v1/arm_pb").MoveToJointPositionsRequest; /** @default Number.POSITIVE_INFINITY */
247
299
  readonly O: typeof import("../gen/component/arm/v1/arm_pb").MoveToJointPositionsResponse;
248
300
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
249
301
  };
@@ -494,7 +546,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
494
546
  readonly I: typeof import("../gen/component/gantry/v1/gantry_pb").StopRequest;
495
547
  readonly O: typeof import("../gen/component/gantry/v1/gantry_pb").StopResponse;
496
548
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
497
- };
549
+ }; /** @default 10. */
498
550
  readonly isMoving: {
499
551
  readonly name: "IsMoving";
500
552
  readonly I: typeof import("../gen/component/gantry/v1/gantry_pb").IsMovingRequest;
@@ -508,6 +560,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
508
560
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
509
561
  };
510
562
  readonly getGeometries: {
563
+ /** Options required to dial a robot. */
511
564
  readonly name: "GetGeometries";
512
565
  readonly I: typeof import("../gen/common/v1/common_pb").GetGeometriesRequest;
513
566
  readonly O: typeof import("../gen/common/v1/common_pb").GetGeometriesResponse;
@@ -705,7 +758,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
705
758
  readonly I: typeof import("../gen/common/v1/common_pb").DoCommandRequest;
706
759
  readonly O: typeof import("../gen/common/v1/common_pb").DoCommandResponse;
707
760
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
708
- };
761
+ }; /** @default 10. */
709
762
  };
710
763
  }>;
711
764
  get inputControllerService(): PromiseClient<{
@@ -738,11 +791,11 @@ export declare class RobotClient extends EventDispatcher implements Robot {
738
791
  readonly doCommand: {
739
792
  readonly name: "DoCommand";
740
793
  readonly I: typeof import("../gen/common/v1/common_pb").DoCommandRequest;
741
- readonly O: typeof import("../gen/common/v1/common_pb").DoCommandResponse; /**
742
- * A gRPC-web client for a Robot.
743
- *
744
- * @group Clients
794
+ /**
795
+ * Set timeout in milliseconds for dialing. Default is defined by
796
+ * DIAL_TIMEOUT. A value of 0 disables the timeout.
745
797
  */
798
+ readonly O: typeof import("../gen/common/v1/common_pb").DoCommandResponse;
746
799
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
747
800
  };
748
801
  readonly getGeometries: {
@@ -772,15 +825,11 @@ export declare class RobotClient extends EventDispatcher implements Robot {
772
825
  readonly name: "GoTo";
773
826
  readonly I: typeof import("../gen/component/motor/v1/motor_pb").GoToRequest;
774
827
  readonly O: typeof import("../gen/component/motor/v1/motor_pb").GoToResponse;
775
- readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
828
+ readonly kind: import("@bufbuild/protobuf").MethodKind.Unary; /** @default Number.POSITIVE_INFINITY */
776
829
  };
777
830
  readonly setRPM: {
778
831
  readonly name: "SetRPM";
779
- readonly I: typeof import("../gen/component/motor/v1/motor_pb").SetRPMRequest; /**
780
- * A gRPC-web client for a Robot.
781
- *
782
- * @group Clients
783
- */
832
+ readonly I: typeof import("../gen/component/motor/v1/motor_pb").SetRPMRequest;
784
833
  readonly O: typeof import("../gen/component/motor/v1/motor_pb").SetRPMResponse;
785
834
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
786
835
  };
@@ -951,6 +1000,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
951
1000
  };
952
1001
  readonly listPlanStatuses: {
953
1002
  readonly name: "ListPlanStatuses";
1003
+ /** Options required to dial a robot via gRPC. */
954
1004
  readonly I: typeof import("../gen/service/motion/v1/motion_pb").ListPlanStatusesRequest;
955
1005
  readonly O: typeof import("../gen/service/motion/v1/motion_pb").ListPlanStatusesResponse;
956
1006
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
@@ -1087,7 +1137,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
1087
1137
  readonly getProperties: {
1088
1138
  readonly name: "GetProperties";
1089
1139
  readonly I: typeof import("../gen/service/slam/v1/slam_pb").GetPropertiesRequest;
1090
- readonly O: typeof import("../gen/service/slam/v1/slam_pb").GetPropertiesResponse;
1140
+ readonly O: typeof import("../gen/service/slam/v1/slam_pb").GetPropertiesResponse; /** @default Number.POSITIVE_INFINITY */
1091
1141
  readonly kind: import("@bufbuild/protobuf").MethodKind.Unary;
1092
1142
  };
1093
1143
  readonly doCommand: {
@@ -1102,6 +1152,9 @@ export declare class RobotClient extends EventDispatcher implements Robot {
1102
1152
  get peerConnection(): RTCPeerConnection | undefined;
1103
1153
  disconnect(): Promise<void>;
1104
1154
  isConnected(): boolean;
1155
+ private dialWebRTC;
1156
+ private dialDirect;
1157
+ dial(conf: DialConf): Promise<this>;
1105
1158
  connect({ creds, priority, dialTimeout, }?: ConnectOptions): Promise<void>;
1106
1159
  getSessions(): Promise<import("../gen/robot/v1/robot_pb").Session[]>;
1107
1160
  getOperations(): Promise<import("../gen/robot/v1/robot_pb").Operation[]>;
@@ -1,48 +1,4 @@
1
- import type { AccessToken, Credential } from '../main';
2
- import { RobotClient } from './client';
3
- /** Options required to dial a robot via gRPC. */
4
- export interface DialDirectConf {
5
- host: string;
6
- credentials?: Credential | AccessToken;
7
- disableSessions?: boolean;
8
- noReconnect?: boolean;
9
- reconnectMaxAttempts?: number;
10
- reconnectMaxWait?: number;
11
- reconnectAbortSignal?: {
12
- abort: boolean;
13
- };
14
- dialTimeout?: number;
15
- }
16
- interface ICEServer {
17
- urls: string;
18
- username?: string;
19
- credential?: string;
20
- }
21
- /**
22
- * Options required to dial a robot via WebRTC.
23
- *
24
- * - `reconnectMaxAttempts` value should be a positive int; default is 10.
25
- * - `reconnectMaxWait` value should be a positive int; default is positive
26
- * infinity.
27
- */
28
- export interface DialWebRTCConf {
29
- host: string;
30
- credentials?: Credential | AccessToken;
31
- disableSessions?: boolean;
32
- noReconnect?: boolean;
33
- reconnectMaxAttempts?: number;
34
- reconnectMaxWait?: number;
35
- reconnectAbortSignal?: {
36
- abort: boolean;
37
- };
38
- serviceHost?: string;
39
- signalingAddress: string;
40
- iceServers?: ICEServer[];
41
- priority?: number;
42
- dialTimeout?: number;
43
- }
44
- /** Options required to dial a robot. */
45
- export type DialConf = DialDirectConf | DialWebRTCConf;
1
+ import { RobotClient, type DialConf } from './client';
46
2
  /**
47
3
  * Connect to a robot via WebRTC or gRPC and return a RobotClient after
48
4
  * connecting successfully.
@@ -59,4 +15,3 @@ export type DialConf = DialDirectConf | DialWebRTCConf;
59
15
  * function will automatically re-attempt to connect via gRPC directly.
60
16
  */
61
17
  export declare const createRobotClient: (conf: DialConf) => Promise<RobotClient>;
62
- export {};
@@ -107,8 +107,7 @@ export interface Robot {
107
107
  * specified destination which is a reference frame.
108
108
  *
109
109
  * @param pointCloudPCD - The point clouds to transform. This should be in the
110
- * PCD format encoded into bytes:
111
- * https://pointclouds.org/documentation/tutorials/pcd_file_format.html
110
+ * {@link https://pointclouds.org/documentation/tutorials/pcd_file_format.html PCD format encoded into bytes}
112
111
  * @param source - The reference frame of the point cloud.
113
112
  * @param destination - The reference frame into which the source data should
114
113
  * be transformed, if unset this defaults to the "world" reference frame. Do
@@ -9,8 +9,9 @@ export default class SessionManager {
9
9
  private host;
10
10
  private starting;
11
11
  private get client();
12
- constructor(host: string, deferredTransport: () => Transport);
12
+ constructor(host: string | undefined, deferredTransport: () => Transport);
13
13
  get sessionID(): string;
14
+ setHost(host: string): void;
14
15
  private getSessionMetadataInner;
15
16
  reset(): void;
16
17
  private readonly backgroundHeartbeat;
package/dist/robot.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { RobotClient } from './robot/client';
2
- export { createRobotClient, type DialConf, type DialDirectConf, type DialWebRTCConf, } from './robot/dial';
1
+ export { RobotClient, type DialConf, type DialDirectConf, type DialWebRTCConf, } from './robot/client';
2
+ export { createRobotClient } from './robot/dial';
3
3
  export type { CloudMetadata, Robot } from './robot/robot';
@@ -1,5 +1,6 @@
1
1
  import { Struct, type JsonValue } from '@bufbuild/protobuf';
2
2
  import type { CallOptions } from '@connectrpc/connect';
3
+ import { MimeType } from '../../gen/app/datasync/v1/data_sync_pb.js';
3
4
  import type { RobotClient } from '../../robot';
4
5
  import type { Options } from '../../types';
5
6
  import type { DataManager } from './data-manager';
@@ -49,4 +50,30 @@ export declare class DataManagerClient implements DataManager {
49
50
  * @param callOptions - Call options for the command.
50
51
  */
51
52
  doCommand(command: Struct, callOptions?: CallOptions): Promise<JsonValue>;
53
+ /**
54
+ * Uploads binary data to specified datasets.
55
+ *
56
+ * @example
57
+ *
58
+ * ```ts
59
+ * const dataManager = new VIAM.DataManagerClient(
60
+ * machine,
61
+ * 'my_data_manager'
62
+ * );
63
+ * await dataManager.uploadBinaryDataToDatasets(
64
+ * new Uint8Array([1, 2, 3]),
65
+ * ['tag1', 'tag2'],
66
+ * ['datasetId1', 'datasetId2'],
67
+ * MimeType.MIME_TYPE_JPEG
68
+ * );
69
+ * ```
70
+ *
71
+ * @param binaryData - The binary data to upload.
72
+ * @param tags - Tags to associate with the binary data.
73
+ * @param datasetIds - IDs of the datasets to associate the binary data with.
74
+ * @param mimeType - The MIME type of the binary data.
75
+ * @param extra - Extra arguments to pass to the upload request.
76
+ * @param callOptions - Call options for the upload request.
77
+ */
78
+ uploadBinaryDataToDatasets(binaryData: Uint8Array, tags: string[], datasetIds: string[], mimeType: MimeType, extra?: {}, callOptions?: CallOptions): Promise<void>;
52
79
  }
@@ -1,5 +1,7 @@
1
1
  import type { Struct } from '@bufbuild/protobuf';
2
+ import { MimeType } from '../../gen/app/datasync/v1/data_sync_pb.js';
2
3
  import type { Resource } from '../../types';
3
4
  export interface DataManager extends Resource {
4
5
  sync: (extra?: Struct) => Promise<void>;
6
+ uploadBinaryDataToDatasets: (binaryData: Uint8Array, tags: string[], datasetIds: string[], mimeType: MimeType, extra?: Struct) => Promise<void>;
5
7
  }
@@ -4,9 +4,10 @@ export type CollisionSpecification = PlainMessage<motionApi.CollisionSpecificati
4
4
  export type Constraints = PlainMessage<motionApi.Constraints>;
5
5
  export type GetPlanResponse = motionApi.GetPlanResponse;
6
6
  export type LinearConstraint = PlainMessage<motionApi.LinearConstraint>;
7
+ export type PseudolinearConstraint = PlainMessage<motionApi.PseudolinearConstraint>;
7
8
  export type ListPlanStatusesResponse = motionApi.ListPlanStatusesResponse;
8
9
  export type MotionConfiguration = PlainMessage<motionApi.MotionConfiguration>;
9
10
  export type ObstacleDetector = PlainMessage<motionApi.ObstacleDetector>;
10
11
  export type OrientationConstraint = PlainMessage<motionApi.OrientationConstraint>;
11
12
  export type PlanState = motionApi.PlanState;
12
- export declare const CollisionSpecification: typeof motionApi.CollisionSpecification, Constraints: typeof motionApi.Constraints, GetPlanResponse: typeof motionApi.GetPlanResponse, LinearConstraint: typeof motionApi.LinearConstraint, ListPlanStatusesResponse: typeof motionApi.ListPlanStatusesResponse, MotionConfiguration: typeof motionApi.MotionConfiguration, ObstacleDetector: typeof motionApi.ObstacleDetector, OrientationConstraint: typeof motionApi.OrientationConstraint, PlanState: typeof motionApi.PlanState;
13
+ export declare const CollisionSpecification: typeof motionApi.CollisionSpecification, Constraints: typeof motionApi.Constraints, GetPlanResponse: typeof motionApi.GetPlanResponse, LinearConstraint: typeof motionApi.LinearConstraint, PseudolinearConstraint: typeof motionApi.PseudolinearConstraint, ListPlanStatusesResponse: typeof motionApi.ListPlanStatusesResponse, MotionConfiguration: typeof motionApi.MotionConfiguration, ObstacleDetector: typeof motionApi.ObstacleDetector, OrientationConstraint: typeof motionApi.OrientationConstraint, PlanState: typeof motionApi.PlanState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.48.0",
3
+ "version": "0.49.1",
4
4
  "description": "",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",