@viamrobotics/sdk 0.16.0-rc.0 → 0.17.0-rc.0

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.
@@ -87,6 +87,7 @@ export declare class RobotClient extends EventDispatcher implements Robot {
87
87
  private servoServiceClient;
88
88
  private slamServiceClient;
89
89
  constructor(serviceHost: string, webrtcOptions?: WebRTCOptions, sessionOptions?: SessionOptions, directOptions?: DirectOptions);
90
+ private onDisconnect;
90
91
  private get noReconnect();
91
92
  private get reconnectMaxAttempts();
92
93
  private get reconnectMaxWait();
@@ -49,8 +49,12 @@ export type DialConf = DialDirectConf | DialWebRTCConf;
49
49
  * {@link DialWebRTCConf} or {@link DialDirectConf} is passed in as the first
50
50
  * argument.
51
51
  *
52
- * If connecting via WebRTC fails, then this function will automatically
53
- * re-attempt to connect via gRPC directly.
52
+ * Reconnect is enabled by default and disabled with `noReconnect`. When
53
+ * enabled, this function will re-attempt to reconnect if initial connection is
54
+ * unsuccessful using backoff.
55
+ *
56
+ * If `noReconnect` is specified and connecting via WebRTC fails, then this
57
+ * function will automatically re-attempt to connect via gRPC directly.
54
58
  */
55
59
  export declare const createRobotClient: (conf: DialConf) => Promise<RobotClient>;
56
60
  export {};
@@ -6,7 +6,8 @@ export default class GRPCConnectionManager {
6
6
  connecting: Promise<void> | undefined;
7
7
  private connectResolve;
8
8
  private connectReject;
9
- constructor(serviceHost: string, transportFactory: grpc.TransportFactory, heartbeatIntervalMs?: number);
9
+ private onDisconnect;
10
+ constructor(serviceHost: string, transportFactory: grpc.TransportFactory, onDisconnect: () => void, heartbeatIntervalMs?: number);
10
11
  heartbeat(): void;
11
12
  start(): Promise<void>;
12
13
  }
@@ -120,16 +120,19 @@ export interface Robot {
120
120
  */
121
121
  streamStatus(resourceNames?: ResourceName.AsObject[], durationMs?: number): RobotStatusStream;
122
122
  /**
123
- * Call a function when an event of either 'reconnected' or 'disconnected' is
124
- * triggered. Note that these events will only be triggered on WebRTC
125
- * connections.
123
+ * Call a function when a connection event occurs.
126
124
  *
127
- * @param type - The event ('reconnected' or 'disconnected') that was
128
- * triggered.
125
+ * Note that direct gRPC connections that disconnect will not emit a
126
+ * disconnect event. WebRTC connections that disconnect will emit a disconnect
127
+ * event. All connections emit events during manual calls of `connect` and
128
+ * `disconnect`.
129
+ *
130
+ * @param type - The event MachineConnectionEvent that was triggered, or all
131
+ * connection events with 'connectionstatechange'.
129
132
  * @param listener - The function to call
130
133
  * @alpha
131
134
  */
132
- on: (type: MachineConnectionEvent, listener: Callback) => void;
135
+ on: (type: MachineConnectionEvent | 'connectionstatechange', listener: Callback) => void;
133
136
  /**
134
137
  * Get app-related information about the robot.
135
138
  *
@@ -1,6 +1,6 @@
1
1
  import pb from '../../gen/service/motion/v1/motion_pb';
2
2
  import type { RobotClient } from '../../robot';
3
- import type { GeoObstacle, GeoPoint, Geometry, Options, Pose, PoseInFrame, ResourceName, StructType, Transform, WorldState } from '../../types';
3
+ import type { GeoGeometry, GeoPoint, Geometry, Options, Pose, PoseInFrame, ResourceName, StructType, Transform, WorldState } from '../../types';
4
4
  import { type Constraints, type MotionConfiguration } from './types';
5
5
  import type { Motion } from './motion';
6
6
  /**
@@ -16,7 +16,7 @@ export declare class MotionClient implements Motion {
16
16
  private get service();
17
17
  move(destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, constraints?: Constraints, extra?: {}): Promise<boolean>;
18
18
  moveOnMap(destination: Pose, componentName: ResourceName, slamServiceName: ResourceName, motionConfig?: MotionConfiguration, obstacles?: Geometry[], extra?: {}): Promise<string>;
19
- moveOnGlobe(destination: GeoPoint, componentName: ResourceName, movementSensorName: ResourceName, heading?: number, obstaclesList?: GeoObstacle[], motionConfig?: MotionConfiguration, extra?: {}): Promise<string>;
19
+ moveOnGlobe(destination: GeoPoint, componentName: ResourceName, movementSensorName: ResourceName, heading?: number, obstaclesList?: GeoGeometry[], motionConfig?: MotionConfiguration, boundingRegionsList?: GeoGeometry[], extra?: {}): Promise<string>;
20
20
  stopPlan(componentName: ResourceName, extra?: {}): Promise<null>;
21
21
  getPlan(componentName: ResourceName, lastPlanOnly?: boolean, executionId?: string, extra?: {}): Promise<pb.GetPlanResponse.AsObject>;
22
22
  listPlanStatuses(onlyActivePlans?: boolean, extra?: {}): Promise<pb.ListPlanStatusesResponse.AsObject>;
@@ -1,4 +1,4 @@
1
- import type { GeoObstacle, Geometry, GeoPoint, Pose, PoseInFrame, Resource, ResourceName, StructType, Transform, WorldState } from '../../types';
1
+ import type { GeoGeometry, Geometry, GeoPoint, Pose, PoseInFrame, Resource, ResourceName, StructType, Transform, WorldState } from '../../types';
2
2
  import type { Constraints, MotionConfiguration, GetPlanResponse, ListPlanStatusesResponse } from './types';
3
3
  /**
4
4
  * A service that coordinates motion planning across all of the components in a
@@ -56,8 +56,10 @@ export interface Motion extends Resource {
56
56
  * the component.
57
57
  * @param heading - Compass heading, in degrees, to achieve at destination.
58
58
  * @param motionConfiguration - Optional motion configuration options.
59
+ * @param boundingRegion - Set of obstacles which the robot must remain within
60
+ * while navigating
59
61
  */
60
- moveOnGlobe: (destination: GeoPoint, componentName: ResourceName, movementSensorName: ResourceName, heading?: number, obstaclesList?: GeoObstacle[], motionConfiguration?: MotionConfiguration, extra?: StructType) => Promise<string>;
62
+ moveOnGlobe: (destination: GeoPoint, componentName: ResourceName, movementSensorName: ResourceName, heading?: number, obstaclesList?: GeoGeometry[], motionConfiguration?: MotionConfiguration, boundingRegion?: GeoGeometry[], extra?: StructType) => Promise<string>;
61
63
  /**
62
64
  * Stop a component being moved by an in progress `moveOnGlobe()` or
63
65
  * `moveOnMap()` call.
@@ -20,7 +20,7 @@ export declare class NavigationClient implements Navigation {
20
20
  getWayPoints(extra?: {}): Promise<pb.Waypoint.AsObject[]>;
21
21
  addWayPoint(location: GeoPoint, extra?: {}): Promise<void>;
22
22
  removeWayPoint(id: string, extra?: {}): Promise<void>;
23
- getObstacles(extra?: {}): Promise<import("../../gen/common/v1/common_pb").GeoObstacle.AsObject[]>;
23
+ getObstacles(extra?: {}): Promise<import("../../gen/common/v1/common_pb").GeoGeometry.AsObject[]>;
24
24
  getPaths(extra?: {}): Promise<pb.Path.AsObject[]>;
25
25
  getProperties(): Promise<pb.GetPropertiesResponse.AsObject>;
26
26
  doCommand(command: StructType): Promise<StructType>;
@@ -1,4 +1,4 @@
1
- import type { GeoObstacle, GeoPoint, Resource, StructType } from '../../types';
1
+ import type { GeoGeometry, GeoPoint, Resource, StructType } from '../../types';
2
2
  import type { ModeMap, Waypoint, NavigationPosition, NavigationProperties, Path } from './types';
3
3
  /**
4
4
  * A service that uses GPS to automatically navigate a robot to user defined
@@ -32,7 +32,7 @@ export interface Navigation extends Resource {
32
32
  */
33
33
  removeWayPoint: (id: string, extra?: StructType) => Promise<void>;
34
34
  /** Get a list of obstacles. */
35
- getObstacles: (extra?: StructType) => Promise<GeoObstacle[]>;
35
+ getObstacles: (extra?: StructType) => Promise<GeoGeometry[]>;
36
36
  /** Gets the list of paths known to the navigation service. */
37
37
  getPaths: (extra?: StructType) => Promise<Path[]>;
38
38
  /** Gets information on the properties of the current navigation service. */
package/dist/types.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface Resource {
13
13
  doCommand: (command: StructType) => Promise<StructType>;
14
14
  }
15
15
  export type ResourceName = common.ResourceName.AsObject;
16
- export type GeoObstacle = common.GeoObstacle.AsObject;
16
+ export type GeoGeometry = common.GeoGeometry.AsObject;
17
17
  export type GeoPoint = common.GeoPoint.AsObject;
18
18
  export declare const isValidGeoPoint: (value: GeoPoint) => boolean;
19
19
  export type Vector3 = common.Vector3.AsObject;
package/dist/utils.d.ts CHANGED
@@ -25,6 +25,6 @@ export declare const encodeTransform: (obj: common.Transform.AsObject) => common
25
25
  export declare const encodeWorldState: (obj: common.WorldState.AsObject) => common.WorldState;
26
26
  /** Convert a GeoPoint object to a Protobuf Datatype */
27
27
  export declare const encodeGeoPoint: (obj: common.GeoPoint.AsObject) => common.GeoPoint;
28
- /** Convert a GeoObstacle object to a Protobuf Datatype */
29
- export declare const encodeGeoObstacle: (obj: common.GeoObstacle.AsObject) => common.GeoObstacle;
28
+ /** Convert a GeoGeometry object to a Protobuf Datatype */
29
+ export declare const encodeGeoGeometry: (obj: common.GeoGeometry.AsObject) => common.GeoGeometry;
30
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.16.0-rc.0",
3
+ "version": "0.17.0-rc.0",
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.2.4",
48
+ "@viamrobotics/rpc": "^0.2.5",
49
49
  "exponential-backoff": "^3.1.1"
50
50
  },
51
51
  "devDependencies": {