From 10f759fd5468c327185943a189473a9cb1722a04 Mon Sep 17 00:00:00 2001 From: JessamyT Date: Fri, 10 Jan 2025 10:46:40 -0800 Subject: [PATCH] DOCS-3354: Add links for vision service methods --- lib/src/services/vision.dart | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/src/services/vision.dart b/lib/src/services/vision.dart index 099bc086e0a..b50a3c0b7ff 100644 --- a/lib/src/services/vision.dart +++ b/lib/src/services/vision.dart @@ -33,6 +33,8 @@ class VisionClient extends Resource implements ResourceRPCClient { /// // Example: /// var detections = await myVisionService.detectionsFromCamera('myWebcam'); /// ``` + /// + /// For more information, see the [vision service docs](https://docs.viam.com/dev/reference/apis/services/vision/#getdetectionsfromcamera). Future> detectionsFromCamera(String cameraName, {Map? extra}) async { final request = GetDetectionsFromCameraRequest(name: name, cameraName: cameraName, extra: extra?.toStruct()); final response = await client.getDetectionsFromCamera(request); @@ -46,6 +48,7 @@ class VisionClient extends Resource implements ResourceRPCClient { /// var latestImage = await myWebcam.image(); /// var detections = await myVisionService.detections(latestImage); /// ``` + /// For more information, see the [vision service docs](https://docs.viam.com/dev/reference/apis/services/vision/#getdetections). Future> detections(ViamImage image, {Map? extra}) async { final request = GetDetectionsRequest( name: name, @@ -65,6 +68,8 @@ class VisionClient extends Resource implements ResourceRPCClient { /// // Example: /// var classifications = await myVisionService.classificationsFromCamera('myWebcam', 2); /// ``` + /// + /// For more information, see the [vision service docs](https://docs.viam.com/dev/reference/apis/services/vision/#getclassificationsfromcamera). Future> classificationsFromCamera(String cameraName, int count, {Map? extra}) async { final request = GetClassificationsFromCameraRequest(name: name, cameraName: cameraName, n: count, extra: extra?.toStruct()); final response = await client.getClassificationsFromCamera(request); @@ -79,6 +84,8 @@ class VisionClient extends Resource implements ResourceRPCClient { /// var latestImage = await myWebcam.image(); /// var classifications = await myVisionService.classifications(latestImage, 2); /// ``` + /// + /// For more information, see the [vision service docs](https://docs.viam.com/dev/reference/apis/services/vision/#getclassifications). Future> classifications(ViamImage image, int count, {Map? extra}) async { final request = GetClassificationsRequest( name: name, @@ -98,6 +105,8 @@ class VisionClient extends Resource implements ResourceRPCClient { /// // Example: /// var ptCloud = await myVisionService.objectPointClouds('myCamera'); /// ``` + /// + /// For more information, see the [vision service docs](https://docs.viam.com/dev/reference/apis/services/vision/#getobjectpointclouds). Future> objectPointClouds(String cameraName, {Map? extra}) async { final request = GetObjectPointCloudsRequest(name: name, cameraName: cameraName, mimeType: MimeType.pcd.name, extra: extra?.toStruct()); final response = await client.getObjectPointClouds(request); @@ -114,6 +123,8 @@ class VisionClient extends Resource implements ResourceRPCClient { /// properties.detections_supported // returns true /// properties.classifications_supported // returns false /// ``` + /// + /// For more information, see the [vision service docs](https://docs.viam.com/dev/reference/apis/services/vision/#getproperties). Future properties({Map? extra}) async { final request = GetPropertiesRequest(name: name, extra: extra?.toStruct()); return await client.getProperties(request); @@ -129,11 +140,22 @@ class VisionClient extends Resource implements ResourceRPCClient { } /// Get the [ResourceName] for this [VisionClient] with the given [name] + /// + /// ``` + /// final myVisionServiceResourceName = myVisionService.getResourceName("my_vision_service"); + /// ``` + /// + /// For more information, see the [vision service docs](https://docs.viam.com/dev/reference/apis/services/vision/#getresourcename). static ResourceName getResourceName(String name) { return VisionClient.subtype.getResourceName(name); } /// Get the [VisionClient] named [name] from the provided robot. + /// + /// ``` + /// final myVisionService = VisionService.fromRobot(myRobotClient, "my_vision_service"); + /// ``` + /// static VisionClient fromRobot(RobotClient robot, String name) { return robot.getResource(VisionClient.getResourceName(name)); }