Skip to content

DOCS-3790: Add docs backlinks for input controller-switch and vision #537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/input-controller/input-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export interface InputController extends Resource {
* const recentEvents = await controller.getEvents();
* console.log('Recent events:', recentEvents);
* ```
*
* For more information, see [Input Controller
* API](https://docs.viam.com/dev/reference/apis/components/input-controller/#getevents).
*/
getEvents(extra?: Struct): Promise<InputControllerEvent[]>;

Expand All @@ -51,6 +54,9 @@ export interface InputController extends Resource {
* // Trigger the event
* await controller.triggerEvent(buttonPressEvent);
* ```
*
* For more information, see [Input Controller
* API](https://docs.viam.com/dev/reference/apis/components/input-controller/#triggerevent).
*/
triggerEvent(event: InputControllerEvent, extra?: Struct): Promise<void>;
}
30 changes: 30 additions & 0 deletions src/components/motor/motor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export interface Motor extends Resource {
* await motor.setPower(0.4);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#setpower).
*
* @param power - A value between -1 and 1 where negative values indicate a
* backwards direction and positive values a forward direction.
*/
Expand All @@ -39,6 +42,9 @@ export interface Motor extends Resource {
* await motor.goFor(60, 7.2);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#gofor).
*
* @param rpm - Speed in revolutions per minute.
* @param revolutions - Number of revolutions relative to the motor's starting
* position. If this value is 0, this will run the motor at the given rpm
Expand All @@ -60,6 +66,9 @@ export interface Motor extends Resource {
* await motor.goTo(75, 8.3);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#goto).
*
* @param rpm - Speed in revolutions per minute.
* @param positionRevolutions - Number of revolutions relative to the motor's
* home position.
Expand All @@ -79,6 +88,9 @@ export interface Motor extends Resource {
* await motor.setRPM(75);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#setrpm).
*
* @param rpm - Speed in revolutions per minute.
*/
setRPM(rpm: number, extra?: Struct): Promise<void>;
Expand All @@ -96,6 +108,9 @@ export interface Motor extends Resource {
* await motor.resetZeroPosition(0.0);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#resetzeroposition).
*
* @param offset - Position from which to offset the current position.
*/
resetZeroPosition(offset: number, extra?: Struct): Promise<void>;
Expand All @@ -111,6 +126,9 @@ export interface Motor extends Resource {
* // Stop the motor
* await motor.stop();
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#stop).
*/
stop(extra?: Struct): Promise<void>;

Expand All @@ -127,6 +145,9 @@ export interface Motor extends Resource {
* const properties = await motor.getProperties();
* console.log('Properties:', properties);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#getproperties).
*/
getProperties(extra?: Struct): Promise<Properties>;

Expand All @@ -143,6 +164,9 @@ export interface Motor extends Resource {
* const position = await motor.getPosition();
* console.log('Position:', position);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#getposition).
*/
getPosition(extra?: Struct): Promise<number>;

Expand All @@ -159,6 +183,9 @@ export interface Motor extends Resource {
* console.log('Powered:', isPowered);
* console.log('Power percentage:', powerPct);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#ispowered).
*/
isPowered(extra?: Struct): Promise<readonly [boolean, number]>;

Expand All @@ -174,6 +201,9 @@ export interface Motor extends Resource {
* const moving = await motor.isMoving();
* console.log('Moving:', moving);
* ```
*
* For more information, see [Motor
* API](https://docs.viam.com/dev/reference/apis/components/motor/#ismoving).
*/
isMoving(): Promise<boolean>;
}
27 changes: 27 additions & 0 deletions src/components/movement-sensor/movement-sensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export interface MovementSensor extends Resource {
* );
* const linearVelocity = await movementSensor.getLinearVelocity();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getlinearvelocity).
*/
getLinearVelocity(extra?: Struct): Promise<Vector3>;

Expand All @@ -45,6 +48,9 @@ export interface MovementSensor extends Resource {
* );
* const angularVelocity = await movementSensor.getAngularVelocity();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getangularvelocity).
*/
getAngularVelocity(extra?: Struct): Promise<Vector3>;

Expand All @@ -61,6 +67,9 @@ export interface MovementSensor extends Resource {
* );
* const compassHeading = await movementSensor.getCompassHeading();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getcompassheading).
*/
getCompassHeading(extra?: Struct): Promise<number>;

Expand All @@ -76,6 +85,9 @@ export interface MovementSensor extends Resource {
* );
* const orientation = await movementSensor.getOrientation();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getorientation).
*/
getOrientation(extra?: Struct): Promise<Orientation>;

Expand All @@ -91,6 +103,9 @@ export interface MovementSensor extends Resource {
* );
* const position = await movementSensor.getPosition();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getposition).
*/
getPosition(extra?: Struct): Promise<MovementSensorPosition>;

Expand All @@ -106,6 +121,9 @@ export interface MovementSensor extends Resource {
* );
* const properties = await movementSensor.getProperties();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getproperties).
*/
getProperties(extra?: Struct): Promise<MovementSensorProperties>;

Expand All @@ -121,6 +139,9 @@ export interface MovementSensor extends Resource {
* );
* const accuracy = await movementSensor.getAccuracy();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getaccuracy).
*/
getAccuracy(extra?: Struct): Promise<MovementSensorAccuracy>;

Expand All @@ -137,6 +158,9 @@ export interface MovementSensor extends Resource {
* const linearAcceleration =
* await movementSensor.getLinearAcceleration();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getlinearacceleration).
*/
getLinearAcceleration(extra?: Struct): Promise<Vector3>;

Expand All @@ -152,6 +176,9 @@ export interface MovementSensor extends Resource {
* );
* const readings = await movementSensor.getReadings();
* ```
*
* For more information, see [Movement Sensor
* API](https://docs.viam.com/dev/reference/apis/components/movement-sensor/#getreadings).
*/
getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
}
12 changes: 12 additions & 0 deletions src/components/power-sensor/power-sensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export interface PowerSensor extends Sensor {
* );
* const [voltage, isAc] = await powerSensor.getVoltage();
* ```
*
* For more information, see [Power Sensor
* API](https://docs.viam.com/dev/reference/apis/components/power-sensor/#getvoltage).
*/
getVoltage(extra?: Struct): Promise<readonly [number, boolean]>;
/**
Expand All @@ -31,6 +34,9 @@ export interface PowerSensor extends Sensor {
* );
* const [current, isAc] = await powerSensor.getCurrent();
* ```
*
* For more information, see [Power Sensor
* API](https://docs.viam.com/dev/reference/apis/components/power-sensor/#getcurrent).
*/
getCurrent(extra?: Struct): Promise<readonly [number, boolean]>;
/**
Expand All @@ -45,6 +51,9 @@ export interface PowerSensor extends Sensor {
* );
* const power = await powerSensor.getPower();
* ```
*
* For more information, see [Power Sensor
* API](https://docs.viam.com/dev/reference/apis/components/power-sensor/#getpower).
*/
getPower(extra?: Struct): Promise<number>;
/**
Expand All @@ -59,6 +68,9 @@ export interface PowerSensor extends Sensor {
* );
* const readings = await powerSensor.getReadings();
* ```
*
* For more information, see [Power Sensor
* API](https://docs.viam.com/dev/reference/apis/components/power-sensor/#getreadings).
*/
getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
}
3 changes: 3 additions & 0 deletions src/components/sensor/sensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export interface Sensor extends Resource {
* // Get the readings of a sensor.
* const readings = await sensor.getReadings();
* ```
*
* For more information, see [Sensor
* API](https://docs.viam.com/dev/reference/apis/components/sensor/#getreadings).
*/
getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
}
12 changes: 12 additions & 0 deletions src/components/servo/servo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export interface Servo extends Resource {
* // Move the servo from its origin to the desired angle of 90 degrees
* await servo.move(90);
* ```
*
* For more information, see [Servo
* API](https://docs.viam.com/dev/reference/apis/components/servo/#move).
*/
move(angleDeg: number, extra?: Struct): Promise<void>;

Expand All @@ -31,6 +34,9 @@ export interface Servo extends Resource {
* // Get the current set angle of the servo
* const pos = await servo.getPosition();
* ```
*
* For more information, see [Servo
* API](https://docs.viam.com/dev/reference/apis/components/servo/#getposition).
*/
getPosition(extra?: Struct): Promise<number>;

Expand All @@ -48,6 +54,9 @@ export interface Servo extends Resource {
* // Stop the servo. It is assumed that the servo stops moving immediately
* await servo.stop();
* ```
*
* For more information, see [Servo
* API](https://docs.viam.com/dev/reference/apis/components/servo/#stop).
*/
stop(extra?: Struct): Promise<void>;

Expand All @@ -62,6 +71,9 @@ export interface Servo extends Resource {
* const moving = await servo.isMoving();
* console.log('Moving:', moving);
* ```
*
* For more information, see [Servo
* API](https://docs.viam.com/dev/reference/apis/components/servo/#ismoving).
*/
isMoving(): Promise<boolean>;
}
9 changes: 9 additions & 0 deletions src/components/switch/switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export interface Switch extends Resource {
* // Update the switch from its current position to position 0
* await mySwitch.setPosition(0);
* ```
*
* For more information, see [Switch
* API](https://docs.viam.com/dev/reference/apis/components/switch/#setposition).
*/
setPosition: (position: number, extra?: Struct) => Promise<void>;

Expand All @@ -40,6 +43,9 @@ export interface Switch extends Resource {
* // Get the current set position
* const pos2 = await mySwitch.getPosition();
* ```
*
* For more information, see [Switch
* API](https://docs.viam.com/dev/reference/apis/components/switch/#getposition).
*/
getPosition: (extra?: Struct) => Promise<number>;

Expand All @@ -55,6 +61,9 @@ export interface Switch extends Resource {
* const numPositions = await mySwitch.getNumberOfPositions();
* console.log('Number of positions:', numPositions);
* ```
*
* For more information, see [Switch
* API](https://docs.viam.com/dev/reference/apis/components/switch/#getnumberofpositions).
*/
getNumberOfPositions: (extra?: Struct) => Promise<number>;
}
21 changes: 21 additions & 0 deletions src/services/vision/vision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export interface Vision extends Resource {
* const detections = await vision.getDetectionsFromCamera('my_camera');
* ```
*
* For more information, see [Vision
* API](https://docs.viam.com/dev/reference/apis/services/vision/#getdetectionsfromcamera).
*
* @param cameraName - The name of the camera to use for detection.
* @returns - The list of Detections.
*/
Expand Down Expand Up @@ -49,6 +52,9 @@ export interface Vision extends Resource {
* );
* ```
*
* For more information, see [Vision
* API](https://docs.viam.com/dev/reference/apis/services/vision/#getdetections).
*
* @param image - The image from which to get detections.
* @param width - The width of the image.
* @param height - The height of the image.
Expand Down Expand Up @@ -76,6 +82,9 @@ export interface Vision extends Resource {
* );
* ```
*
* For more information, see [Vision
* API](https://docs.viam.com/dev/reference/apis/services/vision/#getclassificationsfromcamera).
*
* @param cameraName - The name of the camera to use for classification.
* @param count - The number of Classifications requested.
* @returns - The list of Classifications.
Expand Down Expand Up @@ -106,6 +115,9 @@ export interface Vision extends Resource {
* );
* ```
*
* For more information, see [Vision
* API](https://docs.viam.com/dev/reference/apis/services/vision/#getclassifications).
*
* @param image - The image from which to get classifications.
* @param width - The width of the image.
* @param height - The height of the image.
Expand Down Expand Up @@ -134,6 +146,9 @@ export interface Vision extends Resource {
* await vision.getObjectPointClouds('my_camera');
* ```
*
* For more information, see [Vision
* API](https://docs.viam.com/dev/reference/apis/services/vision/#getobjectpointclouds).
*
* @param cameraName - The name of the camera.
* @returns - The list of PointCloudObjects
*/
Expand All @@ -154,6 +169,9 @@ export interface Vision extends Resource {
* const properties = await vision.getProperties();
* ```
*
* For more information, see [Vision
* API](https://docs.viam.com/dev/reference/apis/services/vision/#getproperties).
*
* @returns - The properties of the vision service
*/
getProperties: (extra?: Struct) => Promise<Properties>;
Expand All @@ -174,6 +192,9 @@ export interface Vision extends Resource {
* });
* ```
*
* For more information, see [Vision
* API](https://docs.viam.com/dev/reference/apis/services/vision/#captureallfromcamera).
*
* @param cameraName - The name of the camera to use for classification,
* detection, and segmentation.
* @param opts - The fields desired in the response.
Expand Down