@viamrobotics/sdk 0.2.4-rc.0 → 0.2.5-next.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.
- package/dist/gen/common/v1/common_pb.d.ts +12 -0
- package/dist/gen/component/powersensor/v1/powersensor_pb.d.ts +154 -0
- package/dist/gen/component/powersensor/v1/powersensor_pb_service.d.ts +121 -0
- package/dist/main.d.ts +2 -19
- package/dist/main.es.js +264 -64
- package/dist/main.umd.js +5 -3
- package/dist/robot/client.d.ts +12 -2
- package/dist/robot/dial.d.ts +4 -1
- package/dist/robot/grpc-connection-manager.d.ts +12 -0
- package/dist/services/motion/client.d.ts +2 -1
- package/dist/services/motion/motion.d.ts +32 -10
- package/dist/services/navigation/client.d.ts +25 -0
- package/dist/services/navigation/navigation.d.ts +36 -0
- package/dist/services/navigation/types.d.ts +3 -0
- package/dist/services/navigation.d.ts +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +4 -0
- package/package.json +1 -1
package/dist/robot/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Credentials } from '@viamrobotics/rpc/src/dial';
|
|
2
|
-
import
|
|
2
|
+
import { grpc } from '@improbable-eng/grpc-web';
|
|
3
3
|
import { EventDispatcher } from '../events';
|
|
4
4
|
import proto from '../gen/robot/v1/robot_pb';
|
|
5
5
|
import type { PoseInFrame, ResourceName, Transform } from '../gen/common/v1/common_pb';
|
|
@@ -30,6 +30,11 @@ interface WebRTCOptions {
|
|
|
30
30
|
reconnectMaxAttempts?: number;
|
|
31
31
|
reconnectMaxWait?: number;
|
|
32
32
|
}
|
|
33
|
+
interface DirectOptions {
|
|
34
|
+
noReconnect?: boolean;
|
|
35
|
+
reconnectMaxAttempts?: number;
|
|
36
|
+
reconnectMaxWait?: number;
|
|
37
|
+
}
|
|
33
38
|
interface SessionOptions {
|
|
34
39
|
disabled: boolean;
|
|
35
40
|
}
|
|
@@ -46,7 +51,9 @@ declare abstract class ServiceClient {
|
|
|
46
51
|
export declare class RobotClient extends EventDispatcher implements Robot {
|
|
47
52
|
private readonly serviceHost;
|
|
48
53
|
private readonly webrtcOptions;
|
|
54
|
+
private readonly directOptions;
|
|
49
55
|
private readonly sessionOptions;
|
|
56
|
+
private gRPCConnectionManager;
|
|
50
57
|
private sessionManager;
|
|
51
58
|
private peerConn;
|
|
52
59
|
private transportFactory;
|
|
@@ -71,7 +78,10 @@ export declare class RobotClient extends EventDispatcher implements Robot {
|
|
|
71
78
|
private sensorsServiceClient;
|
|
72
79
|
private servoServiceClient;
|
|
73
80
|
private slamServiceClient;
|
|
74
|
-
constructor(serviceHost: string, webrtcOptions?: WebRTCOptions, sessionOptions?: SessionOptions);
|
|
81
|
+
constructor(serviceHost: string, webrtcOptions?: WebRTCOptions, sessionOptions?: SessionOptions, directOptions?: DirectOptions);
|
|
82
|
+
private get noReconnect();
|
|
83
|
+
private get reconnectMaxAttempts();
|
|
84
|
+
private get reconnectMaxWait();
|
|
75
85
|
get sessionId(): string;
|
|
76
86
|
private static readonly notConnectedYetStr;
|
|
77
87
|
get robotService(): RobotServiceClient;
|
package/dist/robot/dial.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export interface DialDirectConf {
|
|
|
9
9
|
host: string;
|
|
10
10
|
credential?: Credential;
|
|
11
11
|
disableSessions?: boolean;
|
|
12
|
+
noReconnect?: boolean;
|
|
13
|
+
reconnectMaxAttempts?: number;
|
|
14
|
+
reconnectMaxWait?: number;
|
|
12
15
|
}
|
|
13
16
|
interface ICEServer {
|
|
14
17
|
urls: string;
|
|
@@ -27,11 +30,11 @@ export interface DialWebRTCConf {
|
|
|
27
30
|
host: string;
|
|
28
31
|
credential?: Credential;
|
|
29
32
|
disableSessions?: boolean;
|
|
33
|
+
noReconnect?: boolean;
|
|
30
34
|
reconnectMaxAttempts?: number;
|
|
31
35
|
reconnectMaxWait?: number;
|
|
32
36
|
signalingAddress: string;
|
|
33
37
|
iceServers?: ICEServer[];
|
|
34
|
-
noReconnect?: boolean;
|
|
35
38
|
}
|
|
36
39
|
/** Options required to dial a robot. */
|
|
37
40
|
export type DialConf = DialDirectConf | DialWebRTCConf;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { grpc } from '@improbable-eng/grpc-web';
|
|
2
|
+
export default class GRPCConnectionManager {
|
|
3
|
+
private innerTransportFactory;
|
|
4
|
+
private client;
|
|
5
|
+
private heartbeatIntervalMs;
|
|
6
|
+
connecting: Promise<void> | undefined;
|
|
7
|
+
private connectResolve;
|
|
8
|
+
private connectReject;
|
|
9
|
+
constructor(serviceHost: string, transportFactory: grpc.TransportFactory);
|
|
10
|
+
heartbeat(): void;
|
|
11
|
+
start(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RobotClient } from '../../robot';
|
|
2
|
-
import type { Options, Pose, PoseInFrame, ResourceName, StructType, Transform, WorldState } from '../../types';
|
|
2
|
+
import type { GeoObstacle, GeoPoint, Options, Pose, PoseInFrame, ResourceName, StructType, Transform, WorldState } from '../../types';
|
|
3
3
|
import { type Constraints } from './types';
|
|
4
4
|
import type { Motion } from './motion';
|
|
5
5
|
/**
|
|
@@ -15,6 +15,7 @@ export declare class MotionClient implements Motion {
|
|
|
15
15
|
private get service();
|
|
16
16
|
move(destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, constraints?: Constraints, extra?: {}): Promise<boolean>;
|
|
17
17
|
moveOnMap(destination: Pose, componentName: ResourceName, slamServiceName: ResourceName, extra?: {}): Promise<boolean>;
|
|
18
|
+
moveOnGlobe(destination: GeoPoint, componentName: ResourceName, movementSensorName: ResourceName, heading?: number, obstaclesList?: GeoObstacle[], linearMetersPerSec?: number, angularDegPerSec?: number, extra?: {}): Promise<boolean>;
|
|
18
19
|
moveSingleComponent(destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, extra?: {}): Promise<boolean>;
|
|
19
20
|
getPose(componentName: ResourceName, destinationFrame: string, supplementalTransforms: Transform[], extra?: {}): Promise<import("../../gen/common/v1/common_pb").PoseInFrame.AsObject>;
|
|
20
21
|
doCommand(command: StructType): Promise<StructType>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Pose, PoseInFrame, Resource, ResourceName, StructType, Transform, WorldState } from '../../types';
|
|
1
|
+
import type { GeoObstacle, GeoPoint, Pose, PoseInFrame, Resource, ResourceName, StructType, Transform, WorldState } from '../../types';
|
|
2
2
|
import type { Constraints } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* A service that coordinates motion planning across all of the components in a
|
|
@@ -20,31 +20,53 @@ export interface Motion extends Resource {
|
|
|
20
20
|
*/
|
|
21
21
|
move: (destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, constraints?: Constraints, extra?: StructType) => Promise<boolean>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Move a component to a `Pose` in respect to the origin of the SLAM map.
|
|
24
|
+
*
|
|
25
|
+
* @param destination - Specify a destination to, which can be any `Pose` with
|
|
24
26
|
* respect to the SLAM map's origin.
|
|
25
27
|
* @param componentName - Component on the robot to move to the specified
|
|
26
28
|
* destination.
|
|
27
|
-
* @param slamServiceName - Name of the
|
|
29
|
+
* @param slamServiceName - Name of the `SLAM` service from which the SLAM map
|
|
28
30
|
* is requested
|
|
29
31
|
*/
|
|
30
32
|
moveOnMap: (destination: Pose, componentName: ResourceName, slamServiceName: ResourceName, extra?: StructType) => Promise<boolean>;
|
|
31
33
|
/**
|
|
34
|
+
* Move a component to a specific latitude and longitude, using a `Movement
|
|
35
|
+
* Sensor` to determine the location.
|
|
36
|
+
*
|
|
37
|
+
* @param destination - Destination for the component to move to, represented
|
|
38
|
+
* as a `GeoPoint`.
|
|
39
|
+
* @param componentName - The name of the component to move.
|
|
40
|
+
* @param movementSensorName - The name of the `Movement Sensor` used to check
|
|
41
|
+
* the robot's location.
|
|
42
|
+
* @param obstaclesList - Obstacles to consider when planning the motion of
|
|
43
|
+
* the component.
|
|
44
|
+
* @param heading - Compass heading, in degrees, to achieve at destination
|
|
45
|
+
* @param linearMetersPerSec - Linear velocity to target when moving.
|
|
46
|
+
* @param angularDegPerSec - Angular velocity to target when moving.
|
|
47
|
+
*/
|
|
48
|
+
moveOnGlobe: (destination: GeoPoint, componentName: ResourceName, movementSensorName: ResourceName, heading?: number, obstaclesList?: GeoObstacle[], linearMetersPerSec?: number, angularDegPerSec?: number, extra?: StructType) => Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Move a single component.
|
|
51
|
+
*
|
|
32
52
|
* @param destination - Destination to move to, which can a pose in the
|
|
33
53
|
* reference frame of any frame in the robot's frame system.
|
|
34
54
|
* @param componentName - Component on the robot to move to the specified
|
|
35
55
|
* destination.
|
|
36
56
|
* @param worldState - Avoid obstacles by specifying their geometries in the
|
|
37
|
-
*
|
|
57
|
+
* `WorldState`. Augment the frame system of the robot by specifying
|
|
38
58
|
* additional transforms to add to it for the duration of the Move.
|
|
39
59
|
*/
|
|
40
60
|
moveSingleComponent: (destination: PoseInFrame, componentName: ResourceName, worldState?: WorldState, extra?: StructType) => Promise<boolean>;
|
|
41
61
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* reference
|
|
62
|
+
* Get the current location and orientation of a component.
|
|
63
|
+
*
|
|
64
|
+
* @param componentName - The component whose `Pose` is being requested.
|
|
65
|
+
* @param destinationFrame - The reference frame in which the component's
|
|
66
|
+
* `Pose` should be provided, if unset this defaults to the "world"
|
|
67
|
+
* reference frame.
|
|
68
|
+
* @param supplementalTransforms - `Pose` information on any additional
|
|
69
|
+
* reference frames that are needed to compute the component's `Pose`.
|
|
48
70
|
*/
|
|
49
71
|
getPose: (componentName: ResourceName, destinationFrame: string, supplementalTransforms: Transform[], extra?: StructType) => Promise<PoseInFrame>;
|
|
50
72
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pb from '../../gen/service/navigation/v1/navigation_pb';
|
|
2
|
+
import { RobotClient } from '../../robot';
|
|
3
|
+
import type { GeoPoint, Options, StructType } from '../../types';
|
|
4
|
+
import type { ModeMap } from './types';
|
|
5
|
+
import type { Navigation } from './navigation';
|
|
6
|
+
/**
|
|
7
|
+
* A gRPC-web client for a Navigation service.
|
|
8
|
+
*
|
|
9
|
+
* @group Clients
|
|
10
|
+
*/
|
|
11
|
+
export declare class NavigationClient implements Navigation {
|
|
12
|
+
private client;
|
|
13
|
+
private readonly name;
|
|
14
|
+
private readonly options;
|
|
15
|
+
constructor(client: RobotClient, name: string, options?: Options);
|
|
16
|
+
private get service();
|
|
17
|
+
getMode(extra?: {}): Promise<0 | 2 | 1>;
|
|
18
|
+
setMode(mode: ModeMap[keyof ModeMap], extra?: {}): Promise<void>;
|
|
19
|
+
getLocation(extra?: {}): Promise<import("../../gen/common/v1/common_pb").GeoPoint.AsObject>;
|
|
20
|
+
getWayPoints(extra?: {}): Promise<pb.Waypoint.AsObject[]>;
|
|
21
|
+
addWayPoint(location: GeoPoint, extra?: {}): Promise<void>;
|
|
22
|
+
removeWayPoint(id: string, extra?: {}): Promise<void>;
|
|
23
|
+
getObstacles(extra?: {}): Promise<import("../../gen/common/v1/common_pb").GeoObstacle.AsObject[]>;
|
|
24
|
+
doCommand(command: StructType): Promise<StructType>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GeoObstacle, GeoPoint, Resource, StructType } from '../../types';
|
|
2
|
+
import type { ModeMap, Waypoint } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A service that uses GPS to automatically navigate a robot to user defined
|
|
5
|
+
* endpoints.
|
|
6
|
+
*/
|
|
7
|
+
export interface Navigation extends Resource {
|
|
8
|
+
/** Get the mode the robot is operating in. */
|
|
9
|
+
getMode: (extra?: StructType) => Promise<ModeMap[keyof ModeMap]>;
|
|
10
|
+
/**
|
|
11
|
+
* Set the mode the robot is operating in.
|
|
12
|
+
*
|
|
13
|
+
* @param mode -
|
|
14
|
+
*/
|
|
15
|
+
setMode: (mode: ModeMap[keyof ModeMap], extra?: StructType) => Promise<void>;
|
|
16
|
+
/** Get the current location of the robot. */
|
|
17
|
+
getLocation: (extra?: StructType) => Promise<GeoPoint>;
|
|
18
|
+
/** Get an array of waypoints currently in the service's data storage. */
|
|
19
|
+
getWayPoints: (extra?: StructType) => Promise<Array<Waypoint>>;
|
|
20
|
+
/**
|
|
21
|
+
* Add a waypoint to the service's data storage.
|
|
22
|
+
*
|
|
23
|
+
* @param location - The current location of the robot n the navigation
|
|
24
|
+
* service with latitude and longitude values.
|
|
25
|
+
*/
|
|
26
|
+
addWayPoint: (location: GeoPoint, extra?: StructType) => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Remove a waypoint from the service's data storage.
|
|
29
|
+
*
|
|
30
|
+
* @param id - The MongoDB ObjectID of the waypoint to remove from the
|
|
31
|
+
* service's data storage.
|
|
32
|
+
*/
|
|
33
|
+
removeWayPoint: (id: string, extra?: StructType) => Promise<void>;
|
|
34
|
+
/** Get a list of obstacles. */
|
|
35
|
+
getObstacles: (extra?: StructType) => Promise<Array<GeoObstacle>>;
|
|
36
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -13,6 +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
17
|
export type GeoPoint = common.GeoPoint.AsObject;
|
|
17
18
|
export type Vector3 = common.Vector3.AsObject;
|
|
18
19
|
export type Orientation = common.Orientation.AsObject;
|
package/dist/utils.d.ts
CHANGED
|
@@ -22,4 +22,8 @@ export declare const encodeResourceName: (obj: common.ResourceName.AsObject) =>
|
|
|
22
22
|
export declare const encodeTransform: (obj: common.Transform.AsObject) => common.Transform;
|
|
23
23
|
/** Convert a WorldState object to a Protobuf Datatype. */
|
|
24
24
|
export declare const encodeWorldState: (obj: common.WorldState.AsObject) => common.WorldState;
|
|
25
|
+
/** Convert a GeoPoint object to a Protobuf Datatype */
|
|
26
|
+
export declare const encodeGeoPoint: (obj: common.GeoPoint.AsObject) => common.GeoPoint;
|
|
27
|
+
/** Convert a GeoObstacle object to a Protobuf Datatype */
|
|
28
|
+
export declare const encodeGeoObstacle: (obj: common.GeoObstacle.AsObject) => common.GeoObstacle;
|
|
25
29
|
export {};
|