@viamrobotics/sdk 0.38.1 → 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.
Files changed (37) hide show
  1. package/dist/api-version.d.ts +1 -1
  2. package/dist/app/app-client.d.ts +651 -12
  3. package/dist/app/billing-client.d.ts +54 -0
  4. package/dist/app/data-client.d.ts +336 -10
  5. package/dist/app/ml-training-client.d.ts +94 -0
  6. package/dist/components/arm/arm.d.ts +82 -7
  7. package/dist/components/base/base.d.ts +106 -4
  8. package/dist/components/board/board.d.ts +119 -2
  9. package/dist/components/button/button.d.ts +12 -1
  10. package/dist/components/camera/camera.d.ts +51 -2
  11. package/dist/components/encoder/encoder.d.ts +36 -2
  12. package/dist/components/gantry/gantry.d.ts +84 -6
  13. package/dist/components/generic/generic.d.ts +16 -1
  14. package/dist/components/gripper/gripper.d.ts +62 -5
  15. package/dist/components/input-controller/input-controller.d.ts +36 -2
  16. package/dist/components/motor/motor.d.ts +108 -4
  17. package/dist/components/movement-sensor/movement-sensor.d.ts +114 -10
  18. package/dist/components/power-sensor/power-sensor.d.ts +54 -4
  19. package/dist/components/sensor/sensor.d.ts +12 -1
  20. package/dist/components/servo/servo.d.ts +54 -4
  21. package/dist/components/switch/switch.d.ts +49 -3
  22. package/dist/gen/app/data/v1/data_pb.d.ts +81 -0
  23. package/dist/gen/app/v1/app_pb.d.ts +45 -0
  24. package/dist/gen/app/v1/billing_connect.d.ts +23 -1
  25. package/dist/gen/app/v1/billing_pb.d.ts +91 -0
  26. package/dist/main.d.ts +1 -0
  27. package/dist/main.es.js +5940 -4409
  28. package/dist/main.umd.js +7 -7
  29. package/dist/robot/client.d.ts +28 -2
  30. package/dist/robot/robot.d.ts +80 -8
  31. package/dist/services/data-manager/client.d.ts +32 -0
  32. package/dist/services/ml-model/client.d.ts +13 -0
  33. package/dist/services/ml-model/index.d.ts +2 -0
  34. package/dist/services/ml-model/ml-model.d.ts +7 -0
  35. package/dist/services/vision/vision.d.ts +77 -0
  36. package/dist/types.d.ts +9 -0
  37. package/package.json +1 -1
@@ -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
- /** Get the geometries of the component in their current configuration */
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
- /** @returns The current position of each axis. */
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
- /** @returns The lengths of the axes of the gantry in millimeters. */
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
- /** Stops the motion of the gantry. */
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
- /** Get if the gantry is currently moving. */
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
- /** Get the geometries of the component in their current configuration */
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
- /** Get the geometries of the component in their current configuration */
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
- /** Open a gripper of the underlying robot. */
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
- /** Request a gripper of the underlying robot to grab. */
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
- /** Stop a robot's gripper. */
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
- /** Report if the gripper is in motion. */
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
- /** Returns a list of events representing the last event on each control. */
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
  }
@@ -9,6 +9,15 @@ export interface Motor extends Resource {
9
9
  /**
10
10
  * Set the percentage of the motor's total power that should be employed.
11
11
  *
12
+ * @example
13
+ *
14
+ * ```ts
15
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
16
+ *
17
+ * // Set the power to 40% forwards
18
+ * await motor.setPower(0.4);
19
+ * ```
20
+ *
12
21
  * @param power - A value between -1 and 1 where negative values indicate a
13
22
  * backwards direction and positive values a forward direction.
14
23
  */
@@ -18,6 +27,15 @@ export interface Motor extends Resource {
18
27
  * revolutions or indefinitely. Raise an error if position reporting is not
19
28
  * supported.
20
29
  *
30
+ * @example
31
+ *
32
+ * ```ts
33
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
34
+ *
35
+ * // Turn the motor 7.2 revolutions at 60 RPM
36
+ * await motor.goFor(60, 7.2);
37
+ * ```
38
+ *
21
39
  * @param rpm - Speed in revolutions per minute.
22
40
  * @param revolutions - Number of revolutions relative to the motor's starting
23
41
  * position. If this value is 0, this will run the motor at the given rpm
@@ -29,6 +47,15 @@ export interface Motor extends Resource {
29
47
  * Move the motor to a specific position relative to its home position at a
30
48
  * specified speed. Raise an error if position reporting is not supported.
31
49
  *
50
+ * @example
51
+ *
52
+ * ```ts
53
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
54
+ *
55
+ * // Turn the motor to 8.3 revolutions from home at 75 RPM
56
+ * await motor.goTo(75, 8.3);
57
+ * ```
58
+ *
32
59
  * @param rpm - Speed in revolutions per minute.
33
60
  * @param positionRevolutions - Number of revolutions relative to the motor's
34
61
  * home position.
@@ -38,6 +65,15 @@ export interface Motor extends Resource {
38
65
  * Move the motor indefinitely at a specified speed. Raise an error if
39
66
  * position reporting is not supported.
40
67
  *
68
+ * @example
69
+ *
70
+ * ```ts
71
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
72
+ *
73
+ * // Spin the motor at 75 RPM
74
+ * await motor.setRPM(75);
75
+ * ```
76
+ *
41
77
  * @param rpm - Speed in revolutions per minute.
42
78
  */
43
79
  setRPM(rpm: number, extra?: Struct): Promise<void>;
@@ -45,20 +81,88 @@ export interface Motor extends Resource {
45
81
  * Set the current position of the motor as the new zero position, offset by a
46
82
  * given position. Raise an error if position reporting is not supported.
47
83
  *
84
+ * @example
85
+ *
86
+ * ```ts
87
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
88
+ *
89
+ * // Set the current position as the new home position with no offset
90
+ * await motor.resetZeroPosition(0.0);
91
+ * ```
92
+ *
48
93
  * @param offset - Position from which to offset the current position.
49
94
  */
50
95
  resetZeroPosition(offset: number, extra?: Struct): Promise<void>;
51
- /** Turn the motor off. */
96
+ /**
97
+ * Turn the motor off.
98
+ *
99
+ * @example
100
+ *
101
+ * ```ts
102
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
103
+ *
104
+ * // Stop the motor
105
+ * await motor.stop();
106
+ * ```
107
+ */
52
108
  stop(extra?: Struct): Promise<void>;
53
- /** Return the motor's properties. */
109
+ /**
110
+ * Return the motor's properties.
111
+ *
112
+ * @example
113
+ *
114
+ * ```ts
115
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
116
+ *
117
+ * // Report a dictionary mapping optional properties to whether it is supported by
118
+ * // this motor
119
+ * const properties = await motor.getProperties();
120
+ * console.log('Properties:', properties);
121
+ * ```
122
+ */
54
123
  getProperties(extra?: Struct): Promise<Properties>;
55
124
  /**
56
125
  * Return the position of the motor relative to its zero position. Raise an
57
126
  * error if position reporting is not supported.
127
+ *
128
+ * @example
129
+ *
130
+ * ```ts
131
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
132
+ *
133
+ * // Get the current position of the motor
134
+ * const position = await motor.getPosition();
135
+ * console.log('Position:', position);
136
+ * ```
58
137
  */
59
138
  getPosition(extra?: Struct): Promise<number>;
60
- /** Return true if the motor is on. */
139
+ /**
140
+ * Return true if the motor is on.
141
+ *
142
+ * @example
143
+ *
144
+ * ```ts
145
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
146
+ *
147
+ * // Check whether the motor is currently running
148
+ * const [isPowered, powerPct] = await motor.isPowered();
149
+ * console.log('Powered:', isPowered);
150
+ * console.log('Power percentage:', powerPct);
151
+ * ```
152
+ */
61
153
  isPowered(extra?: Struct): Promise<readonly [boolean, number]>;
62
- /** Return true if the motor is in motion. */
154
+ /**
155
+ * Return true if the motor is in motion.
156
+ *
157
+ * @example
158
+ *
159
+ * ```ts
160
+ * const motor = new VIAM.MotorClient(machine, 'my_motor');
161
+ *
162
+ * // Check whether the motor is currently moving
163
+ * const moving = await motor.isMoving();
164
+ * console.log('Moving:', moving);
165
+ * ```
166
+ */
63
167
  isMoving(): Promise<boolean>;
64
168
  }
@@ -10,28 +10,132 @@ export declare const MovementSensorAccuracy: typeof sensorApi.GetAccuracyRespons
10
10
  * position, and/or speed.
11
11
  */
12
12
  export interface MovementSensor extends Resource {
13
- /** Get linear velocity across x/y/z axes */
13
+ /**
14
+ * Get linear velocity across x/y/z axes.
15
+ *
16
+ * @example
17
+ *
18
+ * ```ts
19
+ * const movementSensor = new VIAM.MovementSensorClient(
20
+ * machine,
21
+ * 'my_movement_sensor'
22
+ * );
23
+ * const linearVelocity = await movementSensor.getLinearVelocity();
24
+ * ```
25
+ */
14
26
  getLinearVelocity(extra?: Struct): Promise<Vector3>;
15
- /** Get the angular velocity across x/y/z axes */
27
+ /**
28
+ * Get the angular velocity across x/y/z axes.
29
+ *
30
+ * @example
31
+ *
32
+ * ```ts
33
+ * const movementSensor = new VIAM.MovementSensorClient(
34
+ * machine,
35
+ * 'my_movement_sensor'
36
+ * );
37
+ * const angularVelocity = await movementSensor.getAngularVelocity();
38
+ * ```
39
+ */
16
40
  getAngularVelocity(extra?: Struct): Promise<Vector3>;
17
41
  /**
18
42
  * Get the compass heading, which is a number from 0-359 where 0 is North, 90
19
- * is East, 180 is South, and 270 is West
43
+ * is East, 180 is South, and 270 is West.
44
+ *
45
+ * @example
46
+ *
47
+ * ```ts
48
+ * const movementSensor = new VIAM.MovementSensorClient(
49
+ * machine,
50
+ * 'my_movement_sensor'
51
+ * );
52
+ * const compassHeading = await movementSensor.getCompassHeading();
53
+ * ```
20
54
  */
21
55
  getCompassHeading(extra?: Struct): Promise<number>;
22
56
  /**
23
- * Get the compass heading, which is a number from 0-359 where 0 is North, 90
24
- * is East, 180 is South, and 270 is West
57
+ * Get the current orientation of the sensor.
58
+ *
59
+ * @example
60
+ *
61
+ * ```ts
62
+ * const movementSensor = new VIAM.MovementSensorClient(
63
+ * machine,
64
+ * 'my_movement_sensor'
65
+ * );
66
+ * const orientation = await movementSensor.getOrientation();
67
+ * ```
25
68
  */
26
69
  getOrientation(extra?: Struct): Promise<Orientation>;
27
- /** Get the current position latitude, longitude, and altitude */
70
+ /**
71
+ * Get the current position latitude, longitude, and altitude.
72
+ *
73
+ * @example
74
+ *
75
+ * ```ts
76
+ * const movementSensor = new VIAM.MovementSensorClient(
77
+ * machine,
78
+ * 'my_movement_sensor'
79
+ * );
80
+ * const position = await movementSensor.getPosition();
81
+ * ```
82
+ */
28
83
  getPosition(extra?: Struct): Promise<MovementSensorPosition>;
29
- /** Get the properties of this movement sensor */
84
+ /**
85
+ * Get the properties of this movement sensor.
86
+ *
87
+ * @example
88
+ *
89
+ * ```ts
90
+ * const movementSensor = new VIAM.MovementSensorClient(
91
+ * machine,
92
+ * 'my_movement_sensor'
93
+ * );
94
+ * const properties = await movementSensor.getProperties();
95
+ * ```
96
+ */
30
97
  getProperties(extra?: Struct): Promise<MovementSensorProperties>;
31
- /** Get the accuracy of various sensors */
98
+ /**
99
+ * Get the accuracy of various sensors.
100
+ *
101
+ * @example
102
+ *
103
+ * ```ts
104
+ * const movementSensor = new VIAM.MovementSensorClient(
105
+ * machine,
106
+ * 'my_movement_sensor'
107
+ * );
108
+ * const accuracy = await movementSensor.getAccuracy();
109
+ * ```
110
+ */
32
111
  getAccuracy(extra?: Struct): Promise<MovementSensorAccuracy>;
33
- /** Get linear acceleration across x/y/z axes */
112
+ /**
113
+ * Get linear acceleration across x/y/z axes.
114
+ *
115
+ * @example
116
+ *
117
+ * ```ts
118
+ * const movementSensor = new VIAM.MovementSensorClient(
119
+ * machine,
120
+ * 'my_movement_sensor'
121
+ * );
122
+ * const linearAcceleration =
123
+ * await movementSensor.getLinearAcceleration();
124
+ * ```
125
+ */
34
126
  getLinearAcceleration(extra?: Struct): Promise<Vector3>;
35
- /** Return the readings of a sensor. */
127
+ /**
128
+ * Return the readings of a sensor.
129
+ *
130
+ * @example
131
+ *
132
+ * ```ts
133
+ * const movementSensor = new VIAM.MovementSensorClient(
134
+ * machine,
135
+ * 'my_movement_sensor'
136
+ * );
137
+ * const readings = await movementSensor.getReadings();
138
+ * ```
139
+ */
36
140
  getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
37
141
  }
@@ -2,12 +2,62 @@ import type { JsonValue, Struct } from '@bufbuild/protobuf';
2
2
  import type { Sensor } from '../sensor';
3
3
  /** Represents any sensor that reports voltage, current, and/or power */
4
4
  export interface PowerSensor extends Sensor {
5
- /** Get Voltage in volts and a boolean that returns true if AC */
5
+ /**
6
+ * Get voltage in volts and a boolean indicating whether the voltage is AC
7
+ * (true) or DC (false).
8
+ *
9
+ * @example
10
+ *
11
+ * ```ts
12
+ * const powerSensor = new VIAM.PowerSensorClient(
13
+ * machine,
14
+ * 'my_power_sensor'
15
+ * );
16
+ * const [voltage, isAc] = await powerSensor.getVoltage();
17
+ * ```
18
+ */
6
19
  getVoltage(extra?: Struct): Promise<readonly [number, boolean]>;
7
- /** Get Current in amps and a boolean that returns true if AC */
20
+ /**
21
+ * Get Current in amps and a boolean indicating whether the voltage is AC
22
+ * (true) or DC (false).
23
+ *
24
+ * @example
25
+ *
26
+ * ```ts
27
+ * const powerSensor = new VIAM.PowerSensorClient(
28
+ * machine,
29
+ * 'my_power_sensor'
30
+ * );
31
+ * const [current, isAc] = await powerSensor.getCurrent();
32
+ * ```
33
+ */
8
34
  getCurrent(extra?: Struct): Promise<readonly [number, boolean]>;
9
- /** Get Power in watts */
35
+ /**
36
+ * Get power in watts.
37
+ *
38
+ * @example
39
+ *
40
+ * ```ts
41
+ * const powerSensor = new VIAM.PowerSensorClient(
42
+ * machine,
43
+ * 'my_power_sensor'
44
+ * );
45
+ * const power = await powerSensor.getPower();
46
+ * ```
47
+ */
10
48
  getPower(extra?: Struct): Promise<number>;
11
- /** Return the readings of a sensor. */
49
+ /**
50
+ * Return the readings of a sensor.
51
+ *
52
+ * @example
53
+ *
54
+ * ```ts
55
+ * const powerSensor = new VIAM.PowerSensorClient(
56
+ * machine,
57
+ * 'my_power_sensor'
58
+ * );
59
+ * const readings = await powerSensor.getReadings();
60
+ * ```
61
+ */
12
62
  getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
13
63
  }
@@ -2,6 +2,17 @@ import type { JsonValue, Struct } from '@bufbuild/protobuf';
2
2
  import type { Resource } from '../../types';
3
3
  /** Represents a physical sensing device that can provide measurement readings. */
4
4
  export interface Sensor extends Resource {
5
- /** Return the readings of a sensor. */
5
+ /**
6
+ * Return the readings of a sensor.
7
+ *
8
+ * @example
9
+ *
10
+ * ```ts
11
+ * const sensor = new VIAM.SensorClient(machine, 'my_sensor');
12
+ *
13
+ * // Get the readings of a sensor.
14
+ * const readings = await sensor.getReadings();
15
+ * ```
16
+ */
6
17
  getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
7
18
  }