@viamrobotics/sdk 0.39.0 → 0.40.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/api-version.d.ts +1 -1
- package/dist/app/app-client.d.ts +642 -11
- package/dist/app/data-client.d.ts +326 -0
- package/dist/components/arm/arm.d.ts +82 -7
- package/dist/components/base/base.d.ts +106 -4
- package/dist/components/board/board.d.ts +119 -2
- package/dist/components/button/button.d.ts +12 -1
- package/dist/components/encoder/encoder.d.ts +36 -2
- package/dist/components/gantry/gantry.d.ts +84 -6
- package/dist/components/generic/generic.d.ts +16 -1
- package/dist/components/gripper/gripper.d.ts +62 -5
- package/dist/components/input-controller/input-controller.d.ts +36 -2
- package/dist/components/motor/motor.d.ts +108 -4
- package/dist/components/servo/servo.d.ts +54 -4
- package/dist/components/switch/switch.d.ts +49 -3
- package/dist/gen/app/data/v1/data_pb.d.ts +77 -4
- package/dist/gen/app/v1/app_pb.d.ts +45 -0
- package/dist/gen/app/v1/billing_connect.d.ts +23 -1
- package/dist/gen/app/v1/billing_pb.d.ts +91 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.es.js +4714 -3421
- package/dist/main.umd.js +7 -7
- package/dist/robot/client.d.ts +28 -2
- package/dist/robot/robot.d.ts +80 -8
- package/dist/services/ml-model/client.d.ts +13 -0
- package/dist/services/ml-model/index.d.ts +2 -0
- package/dist/services/ml-model/ml-model.d.ts +7 -0
- package/dist/services/vision/vision.d.ts +77 -0
- package/package.json +1 -1
|
@@ -5,12 +5,33 @@ export type BaseProperties = baseApi.GetPropertiesResponse;
|
|
|
5
5
|
export declare const BaseProperties: typeof baseApi.GetPropertiesResponse;
|
|
6
6
|
/** Represents a physical base of a robot. */
|
|
7
7
|
export interface Base extends Resource {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Get the geometries of the component in their current configuration
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
15
|
+
* const geometries = await base.getGeometries();
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
9
18
|
getGeometries: (extra?: Struct) => Promise<Geometry[]>;
|
|
10
19
|
/**
|
|
11
20
|
* Move a base in a straight line by a given distance at a given speed. This
|
|
12
21
|
* method blocks until completed or cancelled.
|
|
13
22
|
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
27
|
+
*
|
|
28
|
+
* // Move forward 40mm at 90mm/s
|
|
29
|
+
* await base.moveStraight(40, 90);
|
|
30
|
+
*
|
|
31
|
+
* // Move backward 40mm at -90mm/s (backwards)
|
|
32
|
+
* await base.moveStraight(40, -90);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
14
35
|
* @param distanceMm - Distance to move, in millimeters.
|
|
15
36
|
* @param mmPerSec - Movement speed, in millimeters per second.
|
|
16
37
|
*/
|
|
@@ -19,6 +40,18 @@ export interface Base extends Resource {
|
|
|
19
40
|
* Spin a base by a given angle at a given angular speed. This method blocks
|
|
20
41
|
* until completed or cancelled.
|
|
21
42
|
*
|
|
43
|
+
* @example
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
47
|
+
*
|
|
48
|
+
* // Spin 10 degrees clockwise at 15 degrees per second
|
|
49
|
+
* await base.spin(10, 15);
|
|
50
|
+
*
|
|
51
|
+
* // Spin 180 degrees counter-clockwise at 20 degrees per second
|
|
52
|
+
* await base.spin(-180, 20);
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
22
55
|
* @param angleDeg - Degrees to spin.
|
|
23
56
|
* @param degsPerSec - Angular speed, in degrees per second.
|
|
24
57
|
*/
|
|
@@ -27,6 +60,36 @@ export interface Base extends Resource {
|
|
|
27
60
|
* Set the linear and angular power of a base from -1 to 1 in terms of power
|
|
28
61
|
* for each direction.
|
|
29
62
|
*
|
|
63
|
+
* @example
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
67
|
+
*
|
|
68
|
+
* // Move forward at 75% power
|
|
69
|
+
* await base.setPower(
|
|
70
|
+
* { x: 0, y: 0.75, z: 0 }, // linear power
|
|
71
|
+
* { x: 0, y: 0, z: 0 } // no rotation
|
|
72
|
+
* );
|
|
73
|
+
*
|
|
74
|
+
* // Move straight back at 100% power
|
|
75
|
+
* await base.setPower(
|
|
76
|
+
* { x: 0, y: -1, z: 0 }, // linear power
|
|
77
|
+
* { x: 0, y: 0, z: 0 } // no rotation
|
|
78
|
+
* );
|
|
79
|
+
*
|
|
80
|
+
* // Turn counter-clockwise at 50% power
|
|
81
|
+
* await base.setPower(
|
|
82
|
+
* { x: 0, y: 0, z: 0 }, // no linear movement
|
|
83
|
+
* { x: 0, y: 0, z: 0.5 } // rotate around z-axis
|
|
84
|
+
* );
|
|
85
|
+
*
|
|
86
|
+
* // Turn clockwise at 60% power
|
|
87
|
+
* await base.setPower(
|
|
88
|
+
* { x: 0, y: 0, z: 0 }, // no linear movement
|
|
89
|
+
* { x: 0, y: 0, z: -0.6 } // rotate around z-axis
|
|
90
|
+
* );
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
30
93
|
* @param linear - Desired linear power percentage from -1 to 1.
|
|
31
94
|
* @param angular - Desired angular power percentage from -1 to 1.
|
|
32
95
|
*/
|
|
@@ -34,14 +97,53 @@ export interface Base extends Resource {
|
|
|
34
97
|
/**
|
|
35
98
|
* Set the linear and angular velocity of a base.
|
|
36
99
|
*
|
|
100
|
+
* @example
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
104
|
+
*
|
|
105
|
+
* // Move forward at 50mm/s while spinning 15 degrees per second to the left
|
|
106
|
+
* await base.setVelocity(
|
|
107
|
+
* { x: 0, y: 50, z: 0 }, // linear velocity in mm/s
|
|
108
|
+
* { x: 0, y: 0, z: 15 } // 15 degrees per second counter-clockwise
|
|
109
|
+
* );
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
37
112
|
* @param linear - Desired linear velocity in millimeters per second.
|
|
38
113
|
* @param angular - Desired angular velocity in degrees per second.
|
|
39
114
|
*/
|
|
40
115
|
setVelocity(linear: Vector3, angular: Vector3, extra?: Struct): Promise<void>;
|
|
41
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Stop a base
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
*
|
|
121
|
+
* ```ts
|
|
122
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
123
|
+
* await base.stop();
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
42
126
|
stop(extra?: Struct): Promise<void>;
|
|
43
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Return true if the base is in motion.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
134
|
+
* const moving = await base.isMoving();
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
44
137
|
isMoving(): Promise<boolean>;
|
|
45
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Return the base's properties.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
*
|
|
143
|
+
* ```ts
|
|
144
|
+
* const base = new VIAM.BaseClient(machine, 'my_base');
|
|
145
|
+
* const properties = await base.getProperties();
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
46
148
|
getProperties(extra?: Struct): Promise<BaseProperties>;
|
|
47
149
|
}
|
|
@@ -14,11 +14,34 @@ export interface Tick {
|
|
|
14
14
|
* components such as analog readers, and digital interrupts.
|
|
15
15
|
*/
|
|
16
16
|
export interface Board extends Resource {
|
|
17
|
+
/**
|
|
18
|
+
* Get the high/low state of the given pin.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
24
|
+
*
|
|
25
|
+
* // Get if it is true or false that the state of the pin is high.
|
|
26
|
+
* const high = await board.getGPIO('15');
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param pin - The pin number.
|
|
30
|
+
*/
|
|
17
31
|
getGPIO(pin: string, extra?: Struct): Promise<boolean>;
|
|
18
32
|
/**
|
|
19
33
|
* Set the high/low state of the given pin of a board.
|
|
20
34
|
*
|
|
21
|
-
* @
|
|
35
|
+
* @example
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
39
|
+
*
|
|
40
|
+
* // Set the pin to high.
|
|
41
|
+
* await board.setGPIO('15', true);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param pin - The pin number.
|
|
22
45
|
* @param high - When true, set the given pin to high. When false, set the
|
|
23
46
|
* given pin to low.
|
|
24
47
|
*/
|
|
@@ -26,13 +49,32 @@ export interface Board extends Resource {
|
|
|
26
49
|
/**
|
|
27
50
|
* Get the duty cycle of the given pin of a board.
|
|
28
51
|
*
|
|
29
|
-
* @
|
|
52
|
+
* @example
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
56
|
+
*
|
|
57
|
+
* // Get the duty cycle of this pin.
|
|
58
|
+
* const dutyCycle = await board.getPWM('15');
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @param pin - The pin number.
|
|
30
62
|
* @returns The duty cycle, which is a value from 0 to 1.
|
|
31
63
|
*/
|
|
32
64
|
getPWM(pin: string, extra?: Struct): Promise<number>;
|
|
33
65
|
/**
|
|
34
66
|
* Set the duty cycle of the given pin of a board.
|
|
35
67
|
*
|
|
68
|
+
* @example
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
72
|
+
*
|
|
73
|
+
* // Set the duty cycle to 0.6, meaning that this pin will be in the high state for
|
|
74
|
+
* // 60% of the duration of the PWM interval period.
|
|
75
|
+
* await board.setPWM('15', 0.6);
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
36
78
|
* @param pin - The pin.
|
|
37
79
|
* @param dutyCyclePct - A value from 0 to 1.
|
|
38
80
|
*/
|
|
@@ -40,12 +82,30 @@ export interface Board extends Resource {
|
|
|
40
82
|
/**
|
|
41
83
|
* Get the PWM frequency of the given pin of a board.
|
|
42
84
|
*
|
|
85
|
+
* @example
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
89
|
+
*
|
|
90
|
+
* // Get the PWM frequency of this pin.
|
|
91
|
+
* const freq = await board.getPWMFrequency('15');
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
43
94
|
* @param pin - The pin.
|
|
44
95
|
*/
|
|
45
96
|
getPWMFrequency(pin: string, extra?: Struct): Promise<number>;
|
|
46
97
|
/**
|
|
47
98
|
* Set the PWM frequency of the given pin of a board.
|
|
48
99
|
*
|
|
100
|
+
* @example
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
104
|
+
*
|
|
105
|
+
* // Set the PWM frequency of this pin to 1600 Hz.
|
|
106
|
+
* await board.setPWMFrequency('15', 1600);
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
49
109
|
* @param pin - The pin.
|
|
50
110
|
* @param frequencyHz - The PWM frequency, in hertz. 0 will use the board's
|
|
51
111
|
* default PWM frequency.
|
|
@@ -54,12 +114,33 @@ export interface Board extends Resource {
|
|
|
54
114
|
/**
|
|
55
115
|
* Read the current value of an analog reader of a board.
|
|
56
116
|
*
|
|
117
|
+
* @example
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
121
|
+
*
|
|
122
|
+
* // Get the value of the analog signal "my_example_analog_reader" has most
|
|
123
|
+
* // recently measured.
|
|
124
|
+
* const reading = await board.readAnalogReader(
|
|
125
|
+
* 'my_example_analog_reader'
|
|
126
|
+
* );
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
57
129
|
* @param analogReader - The name of the analog reader.
|
|
58
130
|
*/
|
|
59
131
|
readAnalogReader(analogReader: string, extra?: Struct): Promise<AnalogValue>;
|
|
60
132
|
/**
|
|
61
133
|
* Write an analog value to a pin on the board.
|
|
62
134
|
*
|
|
135
|
+
* @example
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
139
|
+
*
|
|
140
|
+
* // Write the value 42 to "my_example_analog_writer".
|
|
141
|
+
* await board.writeAnalog('my_example_analog_writer', 42);
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
63
144
|
* @param pin - The pin name.
|
|
64
145
|
* @param value - An integer value to write.
|
|
65
146
|
*/
|
|
@@ -68,12 +149,38 @@ export interface Board extends Resource {
|
|
|
68
149
|
* Return the current value of the interrupt which is based on the type of
|
|
69
150
|
* interrupt.
|
|
70
151
|
*
|
|
152
|
+
* @example
|
|
153
|
+
*
|
|
154
|
+
* ```ts
|
|
155
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
156
|
+
*
|
|
157
|
+
* // Get the number of times this DigitalInterrupt has been interrupted with a tick.
|
|
158
|
+
* const count = await board.getDigitalInterruptValue(
|
|
159
|
+
* 'my_example_digital_interrupt'
|
|
160
|
+
* );
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
71
163
|
* @param digitalInterruptName - The name of the digital interrupt.
|
|
72
164
|
*/
|
|
73
165
|
getDigitalInterruptValue(digitalInterruptName: string, extra?: Struct): Promise<number>;
|
|
74
166
|
/**
|
|
75
167
|
* Stream digital interrupt ticks on the board.
|
|
76
168
|
*
|
|
169
|
+
* @example
|
|
170
|
+
*
|
|
171
|
+
* ```ts
|
|
172
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
173
|
+
*
|
|
174
|
+
* // Stream ticks from pins 8 and 11.
|
|
175
|
+
* const ticks = await board.streamTicks(['8', '11']);
|
|
176
|
+
*
|
|
177
|
+
* for await (const tick of ticks) {
|
|
178
|
+
* console.log(
|
|
179
|
+
* `Pin ${tick.pinName} changed to ${tick.high ? 'high' : 'low'} at ${tick.time}`
|
|
180
|
+
* );
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
77
184
|
* @param interrupts - Names of the interrupts to stream.
|
|
78
185
|
* @param queue - Array to put the ticks in.
|
|
79
186
|
*/
|
|
@@ -81,6 +188,16 @@ export interface Board extends Resource {
|
|
|
81
188
|
/**
|
|
82
189
|
* Set power mode of the board.
|
|
83
190
|
*
|
|
191
|
+
* @example
|
|
192
|
+
*
|
|
193
|
+
* ```ts
|
|
194
|
+
* const board = new VIAM.BoardClient(machine, 'my_board');
|
|
195
|
+
*
|
|
196
|
+
* // Set the power mode of the board to OFFLINE_DEEP.
|
|
197
|
+
* const duration = new VIAM.Duration({ seconds: 10n });
|
|
198
|
+
* await board.setPowerMode(VIAM.PowerMode.OFFLINE_DEEP, duration);
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
84
201
|
* @param powerMode - The requested power mode.
|
|
85
202
|
* @param duration - The requested duration to stay in power mode.
|
|
86
203
|
*/
|
|
@@ -2,6 +2,17 @@ import type { Struct } from '@bufbuild/protobuf';
|
|
|
2
2
|
import type { Resource } from '../../types';
|
|
3
3
|
/** Represents a physical button. */
|
|
4
4
|
export interface Button extends Resource {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Push the button.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* const button = new VIAM.ButtonClient(machine, 'my_button');
|
|
12
|
+
*
|
|
13
|
+
* // Push the button
|
|
14
|
+
* await button.push();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
push: (extra?: Struct) => Promise<void>;
|
|
7
18
|
}
|
|
@@ -6,14 +6,48 @@ export type EncoderPositionType = encoderApi.PositionType;
|
|
|
6
6
|
export declare const EncoderProperties: typeof encoderApi.GetPropertiesResponse, EncoderPositionType: typeof encoderApi.PositionType;
|
|
7
7
|
/** Represents a physical encoder. */
|
|
8
8
|
export interface Encoder extends Resource {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Set the current position of the encoder as the new zero position.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const encoder = new VIAM.EncoderClient(machine, 'my_encoder');
|
|
16
|
+
*
|
|
17
|
+
* // Reset the zero position of the encoder
|
|
18
|
+
* await encoder.resetPosition();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
10
21
|
resetPosition(extra?: Struct): Promise<void>;
|
|
11
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Return the encoder's properties.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* const encoder = new VIAM.EncoderClient(machine, 'my_encoder');
|
|
29
|
+
*
|
|
30
|
+
* // Get whether the encoder returns position in ticks or degrees
|
|
31
|
+
* const properties = await encoder.getProperties();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
12
34
|
getProperties(extra?: Struct): Promise<EncoderProperties>;
|
|
13
35
|
/**
|
|
14
36
|
* Return the current position either in relative units (ticks away from a
|
|
15
37
|
* zero position) or absolute units (degrees along a circle).
|
|
16
38
|
*
|
|
39
|
+
* @example
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* const encoder = new VIAM.EncoderClient(machine, 'my_encoder');
|
|
43
|
+
*
|
|
44
|
+
* // Get the position of the encoder in ticks
|
|
45
|
+
* const [position, posType] = await encoder.getPosition(
|
|
46
|
+
* EncoderPositionType.POSITION_TYPE_TICKS_COUNT
|
|
47
|
+
* );
|
|
48
|
+
* console.log('The encoder position is currently', position, posType);
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
17
51
|
* @param positionType - The type of position the encoder returns (ticks or
|
|
18
52
|
* degrees)
|
|
19
53
|
*/
|
|
@@ -3,31 +3,109 @@ import type { Resource } from '../../types';
|
|
|
3
3
|
import type { Geometry } from '../../gen/common/v1/common_pb';
|
|
4
4
|
/** Represents a physical gantry that exists in three-dimensional space. */
|
|
5
5
|
export interface Gantry extends Resource {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Get the geometries of the component in their current configuration.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
|
|
13
|
+
*
|
|
14
|
+
* // Get the geometries of this component
|
|
15
|
+
* const geometries = await gantry.getGeometries();
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
7
18
|
getGeometries: (extra?: Struct) => Promise<Geometry[]>;
|
|
8
19
|
/**
|
|
9
20
|
* Move each axis of the gantry to the positionsMm at the speeds in
|
|
10
|
-
* speedsMmPerSec
|
|
21
|
+
* speedsMmPerSec.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
|
|
27
|
+
*
|
|
28
|
+
* // Create positions for a 3-axis gantry
|
|
29
|
+
* const positions = [1, 2, 3];
|
|
30
|
+
* const speeds = [3, 9, 12];
|
|
31
|
+
*
|
|
32
|
+
* // Move the axes to the specified positions
|
|
33
|
+
* await gantry.moveToPosition(positions, speeds);
|
|
34
|
+
* ```
|
|
11
35
|
*
|
|
12
36
|
* @param positionsMm - The goal positions for each axis of the gantry.
|
|
13
37
|
* @param speedsMmPerSec - The desired speed for each axis to move to the
|
|
14
38
|
* respective position in positionsMm.
|
|
15
39
|
*/
|
|
16
40
|
moveToPosition: (positionsMm: number[], speedsMmPerSec: number[], extra?: Struct) => Promise<void>;
|
|
17
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Get the current position of each axis.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
|
|
48
|
+
*
|
|
49
|
+
* // Get the current positions of the axes in millimeters
|
|
50
|
+
* const positions = await gantry.getPosition();
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
18
53
|
getPosition: (extra?: Struct) => Promise<number[]>;
|
|
19
54
|
/**
|
|
20
55
|
* Runs the homing sequence to find the start and end positions of the gantry
|
|
21
56
|
* axis.
|
|
22
57
|
*
|
|
58
|
+
* @example
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
|
|
62
|
+
*
|
|
63
|
+
* // Run the homing sequence
|
|
64
|
+
* const success = await gantry.home();
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
23
67
|
* @returns A bool representing whether the gantry has run the homing sequence
|
|
24
68
|
* successfully.
|
|
25
69
|
*/
|
|
26
70
|
home: (extra?: Struct) => Promise<boolean>;
|
|
27
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Get the lengths of the axes of the gantry in millimeters.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
|
|
78
|
+
*
|
|
79
|
+
* // Get the lengths of the axes in millimeters
|
|
80
|
+
* const lengths = await gantry.getLengths();
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
28
83
|
getLengths: (extra?: Struct) => Promise<number[]>;
|
|
29
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Stop the motion of the gantry.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
|
|
91
|
+
*
|
|
92
|
+
* // Stop all motion of the gantry
|
|
93
|
+
* await gantry.stop();
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
30
96
|
stop: (extra?: Struct) => Promise<void>;
|
|
31
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Get if the gantry is currently moving.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* const gantry = new VIAM.GantryClient(machine, 'my_gantry');
|
|
104
|
+
*
|
|
105
|
+
* // Check if the gantry is moving
|
|
106
|
+
* const moving = await gantry.isMoving();
|
|
107
|
+
* console.log('Moving:', moving);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
32
110
|
isMoving: () => Promise<boolean>;
|
|
33
111
|
}
|
|
@@ -2,6 +2,21 @@ import type { Geometry } from '../../gen/common/v1/common_pb';
|
|
|
2
2
|
import type { Struct, Resource } from '../../types';
|
|
3
3
|
/** Represents a generic component. */
|
|
4
4
|
export interface Generic extends Resource {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Get the geometries of the component in their current configuration.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* const generic = new VIAM.GenericComponentClient(
|
|
12
|
+
* machine,
|
|
13
|
+
* 'my_generic_component'
|
|
14
|
+
* );
|
|
15
|
+
*
|
|
16
|
+
* // Get the geometries of this component
|
|
17
|
+
* const geometries = await generic.getGeometries();
|
|
18
|
+
* console.log('Geometries:', geometries);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
6
21
|
getGeometries: (extra?: Struct) => Promise<Geometry[]>;
|
|
7
22
|
}
|
|
@@ -3,14 +3,71 @@ import type { Resource } from '../../types';
|
|
|
3
3
|
import type { Geometry } from '../../gen/common/v1/common_pb';
|
|
4
4
|
/** Represents a physical robotic gripper. */
|
|
5
5
|
export interface Gripper extends Resource {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Get the geometries of the component in their current configuration.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const gripper = new VIAM.GripperClient(machine, 'my_gripper');
|
|
13
|
+
*
|
|
14
|
+
* // Get the geometries of this component
|
|
15
|
+
* const geometries = await gripper.getGeometries();
|
|
16
|
+
* console.log('Geometries:', geometries);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
7
19
|
getGeometries: (extra?: Struct) => Promise<Geometry[]>;
|
|
8
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Open a gripper of the underlying robot.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const gripper = new VIAM.GripperClient(machine, 'my_gripper');
|
|
27
|
+
*
|
|
28
|
+
* // Open the gripper
|
|
29
|
+
* await gripper.open();
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
9
32
|
open: (extra?: Struct) => Promise<void>;
|
|
10
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Request a gripper of the underlying robot to grab.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* const gripper = new VIAM.GripperClient(machine, 'my_gripper');
|
|
40
|
+
*
|
|
41
|
+
* // Close the gripper to grab
|
|
42
|
+
* await gripper.grab();
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
11
45
|
grab: (extra?: Struct) => Promise<void>;
|
|
12
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Stop a robot's gripper.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* const gripper = new VIAM.GripperClient(machine, 'my_gripper');
|
|
53
|
+
*
|
|
54
|
+
* // Stop the gripper's current motion
|
|
55
|
+
* await gripper.stop();
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
13
58
|
stop: (extra?: Struct) => Promise<void>;
|
|
14
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Report if the gripper is in motion.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* const gripper = new VIAM.GripperClient(machine, 'my_gripper');
|
|
66
|
+
*
|
|
67
|
+
* // Check if the gripper is currently moving
|
|
68
|
+
* const moving = await gripper.isMoving();
|
|
69
|
+
* console.log('Gripper is moving:', moving);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
15
72
|
isMoving: () => Promise<boolean>;
|
|
16
73
|
}
|
|
@@ -8,12 +8,46 @@ export declare const InputControllerEvent: typeof pb.Event;
|
|
|
8
8
|
* events for controls.
|
|
9
9
|
*/
|
|
10
10
|
export interface InputController extends Resource {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Returns a list of events representing the last event on each control.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const controller = new VIAM.InputControllerClient(
|
|
18
|
+
* machine,
|
|
19
|
+
* 'my_controller'
|
|
20
|
+
* );
|
|
21
|
+
*
|
|
22
|
+
* // Get the most recent Event for each Control
|
|
23
|
+
* const recentEvents = await controller.getEvents();
|
|
24
|
+
* console.log('Recent events:', recentEvents);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
12
27
|
getEvents(extra?: Struct): Promise<InputControllerEvent[]>;
|
|
13
28
|
/**
|
|
14
29
|
* TriggerEvent, where supported, injects an InputControllerEvent into an
|
|
15
30
|
* input controller to (virtually) generate events like button presses or axis
|
|
16
|
-
* movements
|
|
31
|
+
* movements.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* const controller = new VIAM.InputControllerClient(
|
|
37
|
+
* machine,
|
|
38
|
+
* 'my_controller'
|
|
39
|
+
* );
|
|
40
|
+
*
|
|
41
|
+
* // Create a "Button is Pressed" event for the control BUTTON_START
|
|
42
|
+
* const buttonPressEvent = new VIAM.InputControllerEvent({
|
|
43
|
+
* time: { seconds: BigInt(Math.floor(Date.now() / 1000)) },
|
|
44
|
+
* event: 'ButtonPress',
|
|
45
|
+
* control: 'ButtonStart',
|
|
46
|
+
* value: 1.0,
|
|
47
|
+
* });
|
|
48
|
+
* // Trigger the event
|
|
49
|
+
* await controller.triggerEvent(buttonPressEvent);
|
|
50
|
+
* ```
|
|
17
51
|
*/
|
|
18
52
|
triggerEvent(event: InputControllerEvent, extra?: Struct): Promise<void>;
|
|
19
53
|
}
|