@viamrobotics/sdk 0.40.0 → 0.40.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.
@@ -10,6 +10,37 @@ export interface Motion extends Resource {
10
10
  * Move any component on the robot to a specified destination which can be
11
11
  * from the reference frame of any other component on the robot.
12
12
  *
13
+ * @example
14
+ *
15
+ * ```ts
16
+ * const motion = new VIAM.MotionClient(machine, 'builtin');
17
+ *
18
+ * // Assumes a gripper configured with name "my_gripper"
19
+ * const gripperName = new VIAM.ResourceName({
20
+ * name: 'my_gripper',
21
+ * namespace: 'rdk',
22
+ * type: 'component',
23
+ * subtype: 'gripper',
24
+ * });
25
+ *
26
+ * const goalPose: VIAM.Pose = {
27
+ * x: -817,
28
+ * y: -230,
29
+ * z: 62,
30
+ * oX: -1,
31
+ * oY: 0,
32
+ * oZ: 0,
33
+ * theta: 90,
34
+ * };
35
+ * const goalPoseInFrame = new VIAM.PoseInFrame({
36
+ * referenceFrame: 'world',
37
+ * pose: goalPose,
38
+ * });
39
+ *
40
+ * // Move the gripper
41
+ * const moved = await motion.move(goalPoseInFrame, gripperName);
42
+ * ```
43
+ *
13
44
  * @param destination - Destination to move to, which can a pose in the
14
45
  * reference frame of any frame in the robot's frame system.
15
46
  * @param componentName - Component on the robot to move to the specified
@@ -29,6 +60,43 @@ export interface Motion extends Resource {
29
60
  * the`moveOnMap()`call. You can monitor the progress of the`moveOnMap()`call
30
61
  * by querying`getPlan()`and`listPlanStatuses()`.
31
62
  *
63
+ * @example
64
+ *
65
+ * ```ts
66
+ * const motion = new VIAM.MotionClient(machine, 'builtin');
67
+ *
68
+ * // Define destination pose with respect to map origin
69
+ * const myPose: VIAM.Pose = {
70
+ * x: 0,
71
+ * y: 10,
72
+ * z: 0,
73
+ * oX: 0,
74
+ * oY: 0,
75
+ * oZ: 0,
76
+ * theta: 0,
77
+ * };
78
+ *
79
+ * const baseName = new VIAM.ResourceName({
80
+ * name: 'my_base',
81
+ * namespace: 'rdk',
82
+ * type: 'component',
83
+ * subtype: 'base',
84
+ * });
85
+ * const slamServiceName = new VIAM.ResourceName({
86
+ * name: 'my_slam_service',
87
+ * namespace: 'rdk',
88
+ * type: 'service',
89
+ * subtype: 'slam',
90
+ * });
91
+ *
92
+ * // Move the base to Y=10 (location of 0,10,0) relative to map origin
93
+ * const executionId = await motion.moveOnMap(
94
+ * myPose,
95
+ * baseName,
96
+ * slamServiceName
97
+ * );
98
+ * ```
99
+ *
32
100
  * @param destination - Specify a destination to, which can be any `Pose` with
33
101
  * respect to the SLAM map's origin.
34
102
  * @param componentName - Component on the robot to move to the specified
@@ -48,6 +116,38 @@ export interface Motion extends Resource {
48
116
  * generated durring the `moveOnGlobe()` call. You can monitor the progress of
49
117
  * the `moveOnGlobe()` call by querying `getPlan()` and `listPlanStatuses()`.
50
118
  *
119
+ * @example
120
+ *
121
+ * ```ts
122
+ * const motion = new VIAM.MotionClient(machine, 'builtin');
123
+ *
124
+ * // Define destination at GPS coordinates [0,0]
125
+ * const destination: VIAM.GeoPoint = {
126
+ * latitude: 40.7,
127
+ * longitude: -73.98,
128
+ * };
129
+ *
130
+ * const baseName = new VIAM.ResourceName({
131
+ * name: 'my_base',
132
+ * namespace: 'rdk',
133
+ * type: 'component',
134
+ * subtype: 'base',
135
+ * });
136
+ * const movementSensorName = new VIAM.ResourceName({
137
+ * name: 'my_movement_sensor',
138
+ * namespace: 'rdk',
139
+ * type: 'component',
140
+ * subtype: 'movement_sensor',
141
+ * });
142
+ *
143
+ * // Move the base to the geographic location
144
+ * const globeExecutionId = await motion.moveOnGlobe(
145
+ * destination,
146
+ * baseName,
147
+ * movementSensorName
148
+ * );
149
+ * ```
150
+ *
51
151
  * @param destination - Destination for the component to move to, represented
52
152
  * as a `GeoPoint`.
53
153
  * @param componentName - The name of the component to move.
@@ -65,6 +165,21 @@ export interface Motion extends Resource {
65
165
  * Stop a component being moved by an in progress `moveOnGlobe()` or
66
166
  * `moveOnMap()` call.
67
167
  *
168
+ * @example
169
+ *
170
+ * ```ts
171
+ * const motion = new VIAM.MotionClient(machine, 'builtin');
172
+ * const baseName = new VIAM.ResourceName({
173
+ * name: 'my_base',
174
+ * namespace: 'rdk',
175
+ * type: 'component',
176
+ * subtype: 'base',
177
+ * });
178
+ *
179
+ * // Stop the base component which was instructed to move
180
+ * await motion.stopPlan(baseName);
181
+ * ```
182
+ *
68
183
  * @param componentName - The component to stop
69
184
  */
70
185
  stopPlan: (componentName: ResourceName, extra?: Struct) => Promise<null>;
@@ -82,6 +197,21 @@ export interface Motion extends Resource {
82
197
  * ExecutionID of the previously executing plan. All repeated fields are in
83
198
  * chronological order.
84
199
  *
200
+ * @example
201
+ *
202
+ * ```ts
203
+ * const motion = new VIAM.MotionClient(machine, 'builtin');
204
+ * const baseName = new VIAM.ResourceName({
205
+ * name: 'my_base',
206
+ * namespace: 'rdk',
207
+ * type: 'component',
208
+ * subtype: 'base',
209
+ * });
210
+ *
211
+ * // Get the plan(s) of the base component
212
+ * const response = await motion.getPlan(baseName);
213
+ * ```
214
+ *
85
215
  * @param componentName - The component to query
86
216
  * @param destinationFrame - The reference frame in which the component's
87
217
  * `Pose` should be provided, if unset this defaults to the "world"
@@ -95,11 +225,20 @@ export interface Motion extends Resource {
95
225
  * least one of the following conditions since the motion service
96
226
  * initialized:
97
227
  *
98
- * - The plan’s status is in progress
99
- * - The plan’s status changed state within the last 24 hours
228
+ * - The plan's status is in progress
229
+ * - The plan's status changed state within the last 24 hours
100
230
  *
101
231
  * All repeated fields are in chronological order.
102
232
  *
233
+ * @example
234
+ *
235
+ * ```ts
236
+ * const motion = new VIAM.MotionClient(machine, 'builtin');
237
+ *
238
+ * // List plan statuses within the TTL
239
+ * const response = await motion.listPlanStatuses();
240
+ * ```
241
+ *
103
242
  * @param onlyActivePlans - If true, the response will only return plans which
104
243
  * are executing.
105
244
  */
@@ -107,6 +246,26 @@ export interface Motion extends Resource {
107
246
  /**
108
247
  * Get the current location and orientation of a component.
109
248
  *
249
+ * @example
250
+ *
251
+ * ```ts
252
+ * const motion = new VIAM.MotionClient(machine, 'builtin');
253
+ *
254
+ * const gripperName = new VIAM.ResourceName({
255
+ * name: 'my_gripper',
256
+ * namespace: 'rdk',
257
+ * type: 'component',
258
+ * subtype: 'gripper',
259
+ * });
260
+ *
261
+ * // Get the gripper's pose in world coordinates
262
+ * const gripperPoseInWorld = await motion.getPose(
263
+ * gripperName,
264
+ * 'world',
265
+ * []
266
+ * );
267
+ * ```
268
+ *
110
269
  * @param componentName - The component whose `Pose` is being requested.
111
270
  * @param destinationFrame - The reference frame in which the component's
112
271
  * `Pose` should be provided, if unset this defaults to the "world"
@@ -8,15 +8,60 @@ export interface Slam extends Resource {
8
8
  /**
9
9
  * Get the current position of the specified source component in the point
10
10
  * cloud SLAM map.
11
+ *
12
+ * @example
13
+ *
14
+ * ```ts
15
+ * const slam = new VIAM.SlamClient(machine, 'my_slam');
16
+ *
17
+ * // Get the current position of the robot in the SLAM map
18
+ * const position = await slam.getPosition();
19
+ * console.log('Current position:', position);
20
+ * ```
11
21
  */
12
22
  getPosition: () => Promise<SlamPosition>;
13
- /** Get the point cloud SLAM map. */
23
+ /**
24
+ * Get the point cloud SLAM map.
25
+ *
26
+ * @example
27
+ *
28
+ * ```ts
29
+ * const slam = new VIAM.SlamClient(machine, 'my_slam');
30
+ *
31
+ * // Get the point cloud map
32
+ * const pointCloudMap = await slam.getPointCloudMap();
33
+ *
34
+ * // Get the edited point cloud map
35
+ * const editedMap = await slam.getPointCloudMap(true);
36
+ * ```
37
+ */
14
38
  getPointCloudMap: (returnEditedMap?: boolean) => Promise<Uint8Array>;
15
39
  /**
16
40
  * Get the internal state of the SLAM algorithm required to continue
17
41
  * mapping/localization.
42
+ *
43
+ * @example
44
+ *
45
+ * ```ts
46
+ * const slam = new VIAM.SlamClient(machine, 'my_slam');
47
+ *
48
+ * // Get the internal state of the SLAM algorithm
49
+ * const internalState = await slam.getInternalState();
50
+ * ```
18
51
  */
19
52
  getInternalState: () => Promise<Uint8Array>;
20
- /** Gets information on the properties of the current SLAM service. */
53
+ /**
54
+ * Get information on the properties of the current SLAM service.
55
+ *
56
+ * @example
57
+ *
58
+ * ```ts
59
+ * const slam = new VIAM.SlamClient(machine, 'my_slam');
60
+ *
61
+ * // Get the properties of the SLAM service
62
+ * const properties = await slam.getProperties();
63
+ * console.log('SLAM properties:', properties);
64
+ * ```
65
+ */
21
66
  getProperties: () => Promise<SlamProperties>;
22
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/sdk",
3
- "version": "0.40.0",
3
+ "version": "0.40.1",
4
4
  "description": "",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",