@viamrobotics/sdk 0.0.13 → 0.0.14
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/README.md +13 -1
- package/dist/Client.d.ts +0 -3
- package/dist/components/robot/Client.d.ts +22 -0
- package/dist/components/robot/Robot.d.ts +129 -0
- package/dist/components/robot.d.ts +3 -0
- package/dist/main.d.ts +3 -3
- package/dist/main.es.js +7875 -7775
- package/dist/main.umd.js +14 -14
- package/package.json +15 -5
package/README.md
CHANGED
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
> **Warning**
|
|
6
6
|
> This is an alpha release of the Viam TypeScript SDK. Stability is not guaranteed. Breaking changes are likely to occur, and occur often.
|
|
7
7
|
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
### Installation
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm install --save @viamrobotics/sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Examples
|
|
17
|
+
|
|
18
|
+
[The examples directory](examples) contains small apps that demonstrate how to use this SDK to operate a robot running Viam.
|
|
19
|
+
|
|
8
20
|
## License
|
|
9
21
|
Copyright 2022 Viam Inc.
|
|
10
22
|
|
|
11
|
-
Apache 2.0 - See [LICENSE](
|
|
23
|
+
Apache 2.0 - See [LICENSE](LICENSE) file
|
package/dist/Client.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { MotionServiceClient } from './gen/service/motion/v1/motion_pb_service.e
|
|
|
10
10
|
import { MotorServiceClient } from './gen/component/motor/v1/motor_pb_service.esm';
|
|
11
11
|
import { MovementSensorServiceClient } from './gen/component/movementsensor/v1/movementsensor_pb_service.esm';
|
|
12
12
|
import { NavigationServiceClient } from './gen/service/navigation/v1/navigation_pb_service.esm';
|
|
13
|
-
import { RobotServiceClient } from './gen/robot/v1/robot_pb_service.esm';
|
|
14
13
|
import { SLAMServiceClient } from './gen/service/slam/v1/slam_pb_service.esm';
|
|
15
14
|
import { SensorsServiceClient } from './gen/service/sensors/v1/sensors_pb_service.esm';
|
|
16
15
|
import { ServoServiceClient } from './gen/component/servo/v1/servo_pb_service.esm';
|
|
@@ -41,7 +40,6 @@ export default class Client {
|
|
|
41
40
|
private connectResolve;
|
|
42
41
|
private savedAuthEntity;
|
|
43
42
|
private savedCreds;
|
|
44
|
-
private robotServiceClient;
|
|
45
43
|
private armServiceClient;
|
|
46
44
|
private baseServiceClient;
|
|
47
45
|
private boardServiceClient;
|
|
@@ -60,7 +58,6 @@ export default class Client {
|
|
|
60
58
|
constructor(serviceHost: string, webrtcOptions?: WebRTCOptions, sessionOptions?: SessionOptions);
|
|
61
59
|
get sessionId(): string;
|
|
62
60
|
private static readonly notConnectedYetStr;
|
|
63
|
-
get robotService(): RobotServiceClient;
|
|
64
61
|
get armService(): ArmServiceClient;
|
|
65
62
|
get baseService(): BaseServiceClient;
|
|
66
63
|
get boardService(): BoardServiceClient;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PoseInFrame, ResourceName, Transform } from '../../gen/common/v1/common_pb.esm';
|
|
2
|
+
import type Client from '../../Client';
|
|
3
|
+
import type { Duration } from 'google-protobuf/google/protobuf/duration_pb';
|
|
4
|
+
import type { Robot } from './Robot';
|
|
5
|
+
import proto from '../../gen/robot/v1/robot_pb.esm';
|
|
6
|
+
export declare class RobotClient implements Robot {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: Client);
|
|
9
|
+
private get robotService();
|
|
10
|
+
getOperations(): Promise<proto.Operation[]>;
|
|
11
|
+
cancelOperation(id: string): Promise<void>;
|
|
12
|
+
blockForOperation(id: string): Promise<void>;
|
|
13
|
+
stopAll(): Promise<void>;
|
|
14
|
+
frameSystemConfig(transforms: Transform[]): Promise<proto.FrameSystemConfig[]>;
|
|
15
|
+
transformPose(source: PoseInFrame, destination: string, supplementalTransforms: Transform[]): Promise<import("../../gen/common/v1/common_pb").PoseInFrame>;
|
|
16
|
+
transformPCD(pointCloudPCD: Uint8Array, source: string, destination: string): Promise<Uint8Array>;
|
|
17
|
+
discoverComponents(queries: proto.DiscoveryQuery[]): Promise<proto.Discovery[]>;
|
|
18
|
+
resourceNames(): Promise<import("../../gen/common/v1/common_pb").ResourceName[]>;
|
|
19
|
+
resourceRPCSubtypes(): Promise<proto.ResourceRPCSubtype[]>;
|
|
20
|
+
getStatus(resourceNames: ResourceName[]): Promise<proto.Status[]>;
|
|
21
|
+
streamStatus(resourceNames: ResourceName[], duration: Duration): Promise<proto.Status[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { PoseInFrame, ResourceName, Transform } from '../../gen/common/v1/common_pb.esm';
|
|
2
|
+
import type { Duration } from 'google-protobuf/google/protobuf/duration_pb';
|
|
3
|
+
import type { Extra } from '../../types';
|
|
4
|
+
import type proto from '../../gen/robot/v1/robot_pb.esm';
|
|
5
|
+
export interface Robot {
|
|
6
|
+
/**
|
|
7
|
+
* Get the list of operations currently running on the robot.
|
|
8
|
+
*
|
|
9
|
+
* @privateRemarks
|
|
10
|
+
* TODO: this function should return an more idiomatic type instead of just
|
|
11
|
+
* passing along a proto type.
|
|
12
|
+
* @group Operations
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
getOperations(): Promise<proto.Operation[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Cancels the specified operation on the robot.
|
|
18
|
+
*
|
|
19
|
+
* @param id - ID of operation to kill.
|
|
20
|
+
* @group Operations
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
cancelOperation(id: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Blocks on the specified operation on the robot. This function will only
|
|
26
|
+
* return when the specific operation has finished or has been cancelled.
|
|
27
|
+
*
|
|
28
|
+
* @param id (str) - ID of operation to block on.
|
|
29
|
+
* @group Operations
|
|
30
|
+
* @alpha
|
|
31
|
+
*/
|
|
32
|
+
blockForOperation(id: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Cancel all current and outstanding operations for the robot and stop all
|
|
35
|
+
* actuators and movement.
|
|
36
|
+
*
|
|
37
|
+
* @param extra - Any extra parameters to pass to the components' `stop`
|
|
38
|
+
* methods, keyed on the component's resource name.
|
|
39
|
+
* @group Operations
|
|
40
|
+
* @alpha
|
|
41
|
+
*/
|
|
42
|
+
stopAll(extra?: Map<string, Extra>): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Get the configuration of the frame system of a given robot.
|
|
45
|
+
*
|
|
46
|
+
* @privateRemarks
|
|
47
|
+
* TODO: this function should return an more idiomatic type instead of just
|
|
48
|
+
* passing along a proto type.
|
|
49
|
+
* @group Frame System
|
|
50
|
+
* @alpha
|
|
51
|
+
*/
|
|
52
|
+
frameSystemConfig(transform: Transform[]): Promise<proto.FrameSystemConfig[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Transform a given source Pose from the reference frame to a new specified
|
|
55
|
+
* destination which is a reference frame.
|
|
56
|
+
*
|
|
57
|
+
* @privateRemarks
|
|
58
|
+
* TODO: this function should return an more idiomatic type instead of just
|
|
59
|
+
* passing along a proto type.
|
|
60
|
+
* @param query - The pose that should be transformed
|
|
61
|
+
* @param destination - The name of the reference frame to transform the given
|
|
62
|
+
* @param supplementalTransforms - Pose information on any additional
|
|
63
|
+
* reference frames that are needed to perform the transform
|
|
64
|
+
* @group Frame System
|
|
65
|
+
* @alpha
|
|
66
|
+
*/
|
|
67
|
+
transformPose(source: PoseInFrame, destination: string, supplementalTransforms: Transform[]): Promise<PoseInFrame>;
|
|
68
|
+
/**
|
|
69
|
+
* Transform a given source point cloud from the reference frame to a new
|
|
70
|
+
* specified destination which is a reference frame.
|
|
71
|
+
*
|
|
72
|
+
* @param pointCloudPCD - The point clouds to transform. This should be in the
|
|
73
|
+
* PCD format encoded into bytes:
|
|
74
|
+
* https://pointclouds.org/documentation/tutorials/pcd_file_format.html
|
|
75
|
+
* @param source - The reference frame of the point cloud.
|
|
76
|
+
* @param destination - The reference frame into which the source data should
|
|
77
|
+
* be transformed, if unset this defaults to the "world" reference frame. Do
|
|
78
|
+
* not move the robot between the generation of the initial pointcloud and
|
|
79
|
+
* the receipt of the transformed pointcloud because that will make the
|
|
80
|
+
* transformations inaccurate.
|
|
81
|
+
* @group Frame System
|
|
82
|
+
* @alpha
|
|
83
|
+
*/
|
|
84
|
+
transformPCD(pointCloudPCD: Uint8Array, source: string, destination: string): Promise<Uint8Array>;
|
|
85
|
+
/**
|
|
86
|
+
* Get the list of discovered component configurations.
|
|
87
|
+
*
|
|
88
|
+
* @privateRemarks
|
|
89
|
+
* TODO: this function should return an more idiomatic type instead of just
|
|
90
|
+
* passing along a proto type.
|
|
91
|
+
* @param queries - The list of component models to discovery.
|
|
92
|
+
* @group Discovery
|
|
93
|
+
* @alpha
|
|
94
|
+
*/
|
|
95
|
+
discoverComponents(queries: proto.DiscoveryQuery[]): Promise<proto.Discovery[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Get a list of all resources on the robot.
|
|
98
|
+
*
|
|
99
|
+
* @group Resources
|
|
100
|
+
* @alpha
|
|
101
|
+
*/
|
|
102
|
+
resourceNames(): Promise<ResourceName[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Get a list of all resource types.
|
|
105
|
+
*
|
|
106
|
+
* @group Resources
|
|
107
|
+
* @alpha
|
|
108
|
+
*/
|
|
109
|
+
resourceRPCSubtypes(): Promise<proto.ResourceRPCSubtype[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Get a list of all statuses requested. An empty request signifies all
|
|
112
|
+
* resources.
|
|
113
|
+
*
|
|
114
|
+
* @param resourceNames - The list of resources for which to receive statuses.
|
|
115
|
+
* @group Status
|
|
116
|
+
* @alpha
|
|
117
|
+
*/
|
|
118
|
+
getStatus(resourceNames: ResourceName[]): Promise<proto.Status[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Periodically receive the status of all statuses requested. An empty request
|
|
121
|
+
* signifies all resources.
|
|
122
|
+
*
|
|
123
|
+
* @param resourceNames - The list of resources for which to receive statuses.
|
|
124
|
+
* @param duration - How often to send a new status.
|
|
125
|
+
* @group Status
|
|
126
|
+
* @alpha
|
|
127
|
+
*/
|
|
128
|
+
streamStatus(resourceNames: ResourceName[], duration: Duration): Promise<proto.Status[]>;
|
|
129
|
+
}
|
package/dist/main.d.ts
CHANGED
|
@@ -23,12 +23,12 @@ import motionApi from './gen/service/motion/v1/motion_pb.esm';
|
|
|
23
23
|
import motorApi from './gen/component/motor/v1/motor_pb.esm';
|
|
24
24
|
import movementSensorApi from './gen/component/movementsensor/v1/movementsensor_pb.esm';
|
|
25
25
|
import navigationApi from './gen/service/navigation/v1/navigation_pb.esm';
|
|
26
|
-
import robotApi from './gen/robot/v1/robot_pb.esm';
|
|
27
26
|
import sensorApi from './gen/component/sensor/v1/sensor_pb.esm';
|
|
28
27
|
import sensorsApi from './gen/service/sensors/v1/sensors_pb.esm';
|
|
29
28
|
import servoApi from './gen/component/servo/v1/servo_pb.esm';
|
|
30
29
|
import slamApi from './gen/service/slam/v1/slam_pb.esm';
|
|
31
30
|
import streamApi from './gen/proto/stream/v1/stream_pb.esm';
|
|
32
31
|
import visionApi from './gen/service/vision/v1/vision_pb.esm';
|
|
33
|
-
export {
|
|
34
|
-
export
|
|
32
|
+
export { type Robot, RobotClient, robotApi } from './components/robot';
|
|
33
|
+
export { commonApi, armApi, baseApi, boardApi, cameraApi, gantryApi, genericApi, gripperApi, inputControllerApi, motorApi, motionApi, movementSensorApi, servoApi, navigationApi, sensorApi, sensorsApi, slamApi, visionApi, streamApi, Camera, Motor, Base, Board, Sensor, BaseClient, BoardClient, CameraClient, Client, MotorClient, SensorClient, StreamClient, };
|
|
34
|
+
export type { ResponseStream, ServiceError, } from './gen/robot/v1/robot_pb_service.esm';
|