Skip to content
Draft
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
16 changes: 16 additions & 0 deletions src/components/pose-tracker/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Options } from '../../types';
import { doCommandFromClient } from '../../utils';
import type { PoseTracker } from './pose-tracker';
import { GetGeometriesRequest } from '../../gen/common/v1/common_pb';
import { GetPosesRequest } from '../../gen/component/posetracker/v1/pose_tracker_pb';

/**
* A gRPC-web client for the Generic component.
Expand Down Expand Up @@ -46,4 +47,19 @@ export class PoseTrackerClient implements PoseTracker {
callOptions
);
}

async getPoses(
bodyNames?: string[],
extra = {},
callOptions = this.callOptions
) {
const request = new GetPosesRequest({
name: this.name,
bodyNames,
extra: Struct.fromJson(extra),
});

const response = await this.client.getPoses(request, callOptions);
return response.bodyPoses;
}
}
7 changes: 6 additions & 1 deletion src/components/pose-tracker/pose-tracker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Geometry } from '../../gen/common/v1/common_pb';
import type { Geometry, PoseInFrame } from '../../gen/common/v1/common_pb';
import type { Struct, Resource } from '../../types';

/** Represents a generic component. */
Expand All @@ -23,4 +23,9 @@ export interface PoseTracker extends Resource {
* API](https://docs.viam.com/dev/reference/apis/components/generic/#getgeometries).
*/
getGeometries: (extra?: Struct) => Promise<Geometry[]>;

getPoses: (
bodyNames?: string[],
extra?: Struct
) => Promise<Record<string, PoseInFrame>>;
}