Skip to content
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
19 changes: 19 additions & 0 deletions lib/src/services/vision.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import '../resource/base.dart';
import '../robot/client.dart';
import '../utils.dart';

/// {@category Viam SDK}
/// The vision service's supported features and settings
typedef VisionProperties = GetPropertiesResponse;

/// {@category Services}
class VisionClient extends Resource implements ResourceRPCClient {
static const Subtype subtype = Subtype(resourceNamespaceRDK, resourceTypeService, 'vision');
Expand Down Expand Up @@ -100,6 +104,21 @@ class VisionClient extends Resource implements ResourceRPCClient {
return response.objects;
}

/// Get info about what vision methods the vision service provides.
/// Currently returns boolean values that state whether the service implements the
/// classification, detection, and/or 3D object segmentation methods.
///
/// ```
/// // Example:
/// var properties = await myVisionService.properties();
/// properties.detections_supported // returns true
/// properties.classifications_supported // returns false
/// ```
Future<VisionProperties> properties({Map<String, dynamic>? extra}) async {
final request = GetPropertiesRequest(name: name, extra: extra?.toStruct());
return await client.getProperties(request);
}

@override
Future<Map<String, dynamic>> doCommand(Map<String, dynamic> command) async {
final request = DoCommandRequest()
Expand Down
7 changes: 7 additions & 0 deletions test/unit_test/services/vision_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ void main() {
expect(response, equals(expected));
});

test('properties', () async {
final expected = GetPropertiesResponse(classificationsSupported: true);
when(serviceClient.getProperties(any)).thenAnswer((_) => MockResponseFuture.value(expected));
final response = await client.properties();
expect(response, equals(expected));
});

test('getObjectPointClouds', () async {
final expected = [
PointCloudObject(
Expand Down
Loading