Skip to content

Add getKinematics to gripper #397

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 2 commits into from
Jun 16, 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
9 changes: 9 additions & 0 deletions lib/src/components/gripper/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,13 @@ class GripperClient extends Gripper with RPCDebugLoggerMixin implements Resource
final response = await client.doCommand(request, options: callOptions);
return response.result.toMap();
}

@override
Future<Kinematics> getKinematics({Map<String, dynamic>? extra}) async {
final request = GetKinematicsRequest()
..name = name
..extra = extra?.toStruct() ?? Struct();
final response = await client.getKinematics(request, options: callOptions);
return Kinematics.fromProto(response);
}
}
21 changes: 21 additions & 0 deletions lib/src/components/gripper/gripper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ import '../../gen/common/v1/common.pb.dart';
import '../../resource/base.dart';
import '../../robot/client.dart';

/// {@category Viam SDK}
class Kinematics {
KinematicsFileFormat format;
List<int> raw;

Kinematics(this.format, this.raw);

factory Kinematics.fromProto(GetKinematicsResponse gkResponse) {
return Kinematics(gkResponse.format, gkResponse.kinematicsData);
}
}

/// {@category Components}
/// Gripper represents a physical Gripper which can open and close.
///
Expand Down Expand Up @@ -45,6 +57,15 @@ abstract class Gripper extends Resource {
/// For more information, see [Gripper component](https://docs.viam.com/dev/reference/apis/components/gripper/#ismoving).
Future<bool> isMoving();

/// Get the kinematics data associated with the [Gripper]
///
/// ```
/// var kinematics = await myGripper.getKinematics();
/// ```
///
/// For more information, see [Gripper component](https://docs.viam.com/dev/reference/apis/components/gripper/#getkinematics).
Future<Kinematics> getKinematics({Map<String, dynamic>? extra});

/// Get the [ResourceName] for the [Gripper] with the given [name]
///
/// ```
Expand Down
9 changes: 9 additions & 0 deletions lib/src/components/gripper/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ class GripperService extends GripperServiceBase {
await gripper.stop(extra: request.extra.toMap());
return StopResponse();
}

@override
Future<GetKinematicsResponse> getKinematics(ServiceCall call, GetKinematicsRequest request) async {
final gripper = _fromManager(request.name);
final response = await gripper.getKinematics(extra: request.extra.toMap());
return GetKinematicsResponse()
..format = response.format
..kinematicsData = response.raw;
}
}
15 changes: 15 additions & 0 deletions lib/src/gen/app/datapipelines/v1/data_pipelines.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ class CreateDataPipelineRequest extends $pb.GeneratedMessage {
$core.String? name,
$core.Iterable<$core.List<$core.int>>? mqlBinary,
$core.String? schedule,
$core.bool? enableBackfill,
}) {
final $result = create();
if (organizationId != null) {
Expand All @@ -391,6 +392,9 @@ class CreateDataPipelineRequest extends $pb.GeneratedMessage {
if (schedule != null) {
$result.schedule = schedule;
}
if (enableBackfill != null) {
$result.enableBackfill = enableBackfill;
}
return $result;
}
CreateDataPipelineRequest._() : super();
Expand All @@ -402,6 +406,7 @@ class CreateDataPipelineRequest extends $pb.GeneratedMessage {
..aOS(2, _omitFieldNames ? '' : 'name')
..p<$core.List<$core.int>>(3, _omitFieldNames ? '' : 'mqlBinary', $pb.PbFieldType.PY)
..aOS(4, _omitFieldNames ? '' : 'schedule')
..aOB(5, _omitFieldNames ? '' : 'enableBackfill')
..hasRequiredFields = false
;

Expand Down Expand Up @@ -461,6 +466,16 @@ class CreateDataPipelineRequest extends $pb.GeneratedMessage {
$core.bool hasSchedule() => $_has(3);
@$pb.TagNumber(4)
void clearSchedule() => clearField(4);

/// When true, pipeline runs will be scheduled for the organization's past data.
@$pb.TagNumber(5)
$core.bool get enableBackfill => $_getBF(4);
@$pb.TagNumber(5)
set enableBackfill($core.bool v) { $_setBool(4, v); }
@$pb.TagNumber(5)
$core.bool hasEnableBackfill() => $_has(4);
@$pb.TagNumber(5)
void clearEnableBackfill() => clearField(5);
}

class CreateDataPipelineResponse extends $pb.GeneratedMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,19 @@ const CreateDataPipelineRequest$json = {
{'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
{'1': 'mql_binary', '3': 3, '4': 3, '5': 12, '10': 'mqlBinary'},
{'1': 'schedule', '3': 4, '4': 1, '5': 9, '10': 'schedule'},
{'1': 'enable_backfill', '3': 5, '4': 1, '5': 8, '9': 0, '10': 'enableBackfill', '17': true},
],
'8': [
{'1': '_enable_backfill'},
],
};

/// Descriptor for `CreateDataPipelineRequest`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List createDataPipelineRequestDescriptor = $convert.base64Decode(
'ChlDcmVhdGVEYXRhUGlwZWxpbmVSZXF1ZXN0EicKD29yZ2FuaXphdGlvbl9pZBgBIAEoCVIOb3'
'JnYW5pemF0aW9uSWQSEgoEbmFtZRgCIAEoCVIEbmFtZRIdCgptcWxfYmluYXJ5GAMgAygMUglt'
'cWxCaW5hcnkSGgoIc2NoZWR1bGUYBCABKAlSCHNjaGVkdWxl');
'cWxCaW5hcnkSGgoIc2NoZWR1bGUYBCABKAlSCHNjaGVkdWxlEiwKD2VuYWJsZV9iYWNrZmlsbB'
'gFIAEoCEgAUg5lbmFibGVCYWNrZmlsbIgBAUISChBfZW5hYmxlX2JhY2tmaWxs');

@$core.Deprecated('Use createDataPipelineResponseDescriptor instead')
const CreateDataPipelineResponse$json = {
Expand Down
141 changes: 141 additions & 0 deletions lib/src/gen/app/v1/app.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,7 @@ class ResendOrganizationInviteRequest extends $pb.GeneratedMessage {
factory ResendOrganizationInviteRequest({
$core.String? organizationId,
$core.String? email,
$core.bool? sendEmailInvite,
}) {
final $result = create();
if (organizationId != null) {
Expand All @@ -2313,6 +2314,9 @@ class ResendOrganizationInviteRequest extends $pb.GeneratedMessage {
if (email != null) {
$result.email = email;
}
if (sendEmailInvite != null) {
$result.sendEmailInvite = sendEmailInvite;
}
return $result;
}
ResendOrganizationInviteRequest._() : super();
Expand All @@ -2322,6 +2326,7 @@ class ResendOrganizationInviteRequest extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ResendOrganizationInviteRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.app.v1'), createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'organizationId')
..aOS(2, _omitFieldNames ? '' : 'email')
..aOB(3, _omitFieldNames ? '' : 'sendEmailInvite')
..hasRequiredFields = false
;

Expand Down Expand Up @@ -2363,6 +2368,17 @@ class ResendOrganizationInviteRequest extends $pb.GeneratedMessage {
$core.bool hasEmail() => $_has(1);
@$pb.TagNumber(2)
void clearEmail() => clearField(2);

/// Set to true (the default) to send an email to the recipient of an invite. The user must accept the email to be added to the associated authorizations.
/// When set to false, the user automatically receives the associated authorization on the next login of the user with the associated email address.
@$pb.TagNumber(3)
$core.bool get sendEmailInvite => $_getBF(2);
@$pb.TagNumber(3)
set sendEmailInvite($core.bool v) { $_setBool(2, v); }
@$pb.TagNumber(3)
$core.bool hasSendEmailInvite() => $_has(2);
@$pb.TagNumber(3)
void clearSendEmailInvite() => clearField(3);
}

class ResendOrganizationInviteResponse extends $pb.GeneratedMessage {
Expand Down Expand Up @@ -5643,6 +5659,122 @@ class GetRobotPartResponse extends $pb.GeneratedMessage {
void clearConfigJson() => clearField(2);
}

class GetRobotPartByNameAndLocationRequest extends $pb.GeneratedMessage {
factory GetRobotPartByNameAndLocationRequest({
$core.String? name,
$core.String? locationId,
}) {
final $result = create();
if (name != null) {
$result.name = name;
}
if (locationId != null) {
$result.locationId = locationId;
}
return $result;
}
GetRobotPartByNameAndLocationRequest._() : super();
factory GetRobotPartByNameAndLocationRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GetRobotPartByNameAndLocationRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetRobotPartByNameAndLocationRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.app.v1'), createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'name')
..aOS(2, _omitFieldNames ? '' : 'locationId')
..hasRequiredFields = false
;

@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GetRobotPartByNameAndLocationRequest clone() => GetRobotPartByNameAndLocationRequest()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GetRobotPartByNameAndLocationRequest copyWith(void Function(GetRobotPartByNameAndLocationRequest) updates) => super.copyWith((message) => updates(message as GetRobotPartByNameAndLocationRequest)) as GetRobotPartByNameAndLocationRequest;

$pb.BuilderInfo get info_ => _i;

@$core.pragma('dart2js:noInline')
static GetRobotPartByNameAndLocationRequest create() => GetRobotPartByNameAndLocationRequest._();
GetRobotPartByNameAndLocationRequest createEmptyInstance() => create();
static $pb.PbList<GetRobotPartByNameAndLocationRequest> createRepeated() => $pb.PbList<GetRobotPartByNameAndLocationRequest>();
@$core.pragma('dart2js:noInline')
static GetRobotPartByNameAndLocationRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GetRobotPartByNameAndLocationRequest>(create);
static GetRobotPartByNameAndLocationRequest? _defaultInstance;

@$pb.TagNumber(1)
$core.String get name => $_getSZ(0);
@$pb.TagNumber(1)
set name($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasName() => $_has(0);
@$pb.TagNumber(1)
void clearName() => clearField(1);

@$pb.TagNumber(2)
$core.String get locationId => $_getSZ(1);
@$pb.TagNumber(2)
set locationId($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasLocationId() => $_has(1);
@$pb.TagNumber(2)
void clearLocationId() => clearField(2);
}

class GetRobotPartByNameAndLocationResponse extends $pb.GeneratedMessage {
factory GetRobotPartByNameAndLocationResponse({
RobotPart? part,
}) {
final $result = create();
if (part != null) {
$result.part = part;
}
return $result;
}
GetRobotPartByNameAndLocationResponse._() : super();
factory GetRobotPartByNameAndLocationResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GetRobotPartByNameAndLocationResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetRobotPartByNameAndLocationResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.app.v1'), createEmptyInstance: create)
..aOM<RobotPart>(1, _omitFieldNames ? '' : 'part', subBuilder: RobotPart.create)
..hasRequiredFields = false
;

@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GetRobotPartByNameAndLocationResponse clone() => GetRobotPartByNameAndLocationResponse()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GetRobotPartByNameAndLocationResponse copyWith(void Function(GetRobotPartByNameAndLocationResponse) updates) => super.copyWith((message) => updates(message as GetRobotPartByNameAndLocationResponse)) as GetRobotPartByNameAndLocationResponse;

$pb.BuilderInfo get info_ => _i;

@$core.pragma('dart2js:noInline')
static GetRobotPartByNameAndLocationResponse create() => GetRobotPartByNameAndLocationResponse._();
GetRobotPartByNameAndLocationResponse createEmptyInstance() => create();
static $pb.PbList<GetRobotPartByNameAndLocationResponse> createRepeated() => $pb.PbList<GetRobotPartByNameAndLocationResponse>();
@$core.pragma('dart2js:noInline')
static GetRobotPartByNameAndLocationResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GetRobotPartByNameAndLocationResponse>(create);
static GetRobotPartByNameAndLocationResponse? _defaultInstance;

@$pb.TagNumber(1)
RobotPart get part => $_getN(0);
@$pb.TagNumber(1)
set part(RobotPart v) { setField(1, v); }
@$pb.TagNumber(1)
$core.bool hasPart() => $_has(0);
@$pb.TagNumber(1)
void clearPart() => clearField(1);
@$pb.TagNumber(1)
RobotPart ensurePart() => $_ensure(0);
}

class GetRobotPartLogsRequest extends $pb.GeneratedMessage {
factory GetRobotPartLogsRequest({
$core.String? id,
Expand Down Expand Up @@ -9085,11 +9217,15 @@ class ListMachineFragmentsResponse extends $pb.GeneratedMessage {
class ListMachineSummariesRequest extends $pb.GeneratedMessage {
factory ListMachineSummariesRequest({
$core.String? organizationId,
$core.Iterable<$core.String>? fragmentIds,
}) {
final $result = create();
if (organizationId != null) {
$result.organizationId = organizationId;
}
if (fragmentIds != null) {
$result.fragmentIds.addAll(fragmentIds);
}
return $result;
}
ListMachineSummariesRequest._() : super();
Expand All @@ -9098,6 +9234,7 @@ class ListMachineSummariesRequest extends $pb.GeneratedMessage {

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'ListMachineSummariesRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.app.v1'), createEmptyInstance: create)
..aOS(1, _omitFieldNames ? '' : 'organizationId')
..pPS(2, _omitFieldNames ? '' : 'fragmentIds')
..hasRequiredFields = false
;

Expand Down Expand Up @@ -9130,6 +9267,10 @@ class ListMachineSummariesRequest extends $pb.GeneratedMessage {
$core.bool hasOrganizationId() => $_has(0);
@$pb.TagNumber(1)
void clearOrganizationId() => clearField(1);

/// Optional list of fragment IDs to filter machines that use any of these fragments
@$pb.TagNumber(2)
$core.List<$core.String> get fragmentIds => $_getList(1);
}

class ListMachineSummariesResponse extends $pb.GeneratedMessage {
Expand Down
20 changes: 20 additions & 0 deletions lib/src/gen/app/v1/app.pbgrpc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ class AppServiceClient extends $grpc.Client {
'/viam.app.v1.AppService/GetRobotPart',
($11.GetRobotPartRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $11.GetRobotPartResponse.fromBuffer(value));
static final _$getRobotPartByNameAndLocation = $grpc.ClientMethod<$11.GetRobotPartByNameAndLocationRequest, $11.GetRobotPartByNameAndLocationResponse>(
'/viam.app.v1.AppService/GetRobotPartByNameAndLocation',
($11.GetRobotPartByNameAndLocationRequest value) => value.writeToBuffer(),
($core.List<$core.int> value) => $11.GetRobotPartByNameAndLocationResponse.fromBuffer(value));
static final _$getRobotPartLogs = $grpc.ClientMethod<$11.GetRobotPartLogsRequest, $11.GetRobotPartLogsResponse>(
'/viam.app.v1.AppService/GetRobotPartLogs',
($11.GetRobotPartLogsRequest value) => value.writeToBuffer(),
Expand Down Expand Up @@ -656,6 +660,10 @@ class AppServiceClient extends $grpc.Client {
return $createUnaryCall(_$getRobotPart, request, options: options);
}

$grpc.ResponseFuture<$11.GetRobotPartByNameAndLocationResponse> getRobotPartByNameAndLocation($11.GetRobotPartByNameAndLocationRequest request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$getRobotPartByNameAndLocation, request, options: options);
}

$grpc.ResponseFuture<$11.GetRobotPartLogsResponse> getRobotPartLogs($11.GetRobotPartLogsRequest request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$getRobotPartLogs, request, options: options);
}
Expand Down Expand Up @@ -1238,6 +1246,13 @@ abstract class AppServiceBase extends $grpc.Service {
false,
($core.List<$core.int> value) => $11.GetRobotPartRequest.fromBuffer(value),
($11.GetRobotPartResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$11.GetRobotPartByNameAndLocationRequest, $11.GetRobotPartByNameAndLocationResponse>(
'GetRobotPartByNameAndLocation',
getRobotPartByNameAndLocation_Pre,
false,
false,
($core.List<$core.int> value) => $11.GetRobotPartByNameAndLocationRequest.fromBuffer(value),
($11.GetRobotPartByNameAndLocationResponse value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$11.GetRobotPartLogsRequest, $11.GetRobotPartLogsResponse>(
'GetRobotPartLogs',
getRobotPartLogs_Pre,
Expand Down Expand Up @@ -1819,6 +1834,10 @@ abstract class AppServiceBase extends $grpc.Service {
return getRobotPart(call, await request);
}

$async.Future<$11.GetRobotPartByNameAndLocationResponse> getRobotPartByNameAndLocation_Pre($grpc.ServiceCall call, $async.Future<$11.GetRobotPartByNameAndLocationRequest> request) async {
return getRobotPartByNameAndLocation(call, await request);
}

$async.Future<$11.GetRobotPartLogsResponse> getRobotPartLogs_Pre($grpc.ServiceCall call, $async.Future<$11.GetRobotPartLogsRequest> request) async {
return getRobotPartLogs(call, await request);
}
Expand Down Expand Up @@ -2079,6 +2098,7 @@ abstract class AppServiceBase extends $grpc.Service {
$async.Future<$11.GetRoverRentalRobotsResponse> getRoverRentalRobots($grpc.ServiceCall call, $11.GetRoverRentalRobotsRequest request);
$async.Future<$11.GetRobotPartsResponse> getRobotParts($grpc.ServiceCall call, $11.GetRobotPartsRequest request);
$async.Future<$11.GetRobotPartResponse> getRobotPart($grpc.ServiceCall call, $11.GetRobotPartRequest request);
$async.Future<$11.GetRobotPartByNameAndLocationResponse> getRobotPartByNameAndLocation($grpc.ServiceCall call, $11.GetRobotPartByNameAndLocationRequest request);
$async.Future<$11.GetRobotPartLogsResponse> getRobotPartLogs($grpc.ServiceCall call, $11.GetRobotPartLogsRequest request);
$async.Stream<$11.TailRobotPartLogsResponse> tailRobotPartLogs($grpc.ServiceCall call, $11.TailRobotPartLogsRequest request);
$async.Future<$11.GetRobotPartHistoryResponse> getRobotPartHistory($grpc.ServiceCall call, $11.GetRobotPartHistoryRequest request);
Expand Down
Loading