Skip to content

Commit 3b73dc7

Browse files
committed
get poses
1 parent 77c30d9 commit 3b73dc7

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/components/pose-tracker/client.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { type JsonValue, Struct } from '@bufbuild/protobuf';
22
import type { CallOptions, PromiseClient } from '@connectrpc/connect';
33
import { PoseTrackerService } from '../../gen/component/posetracker/v1/pose_tracker_connect';
44
import type { RobotClient } from '../../robot';
5-
import type { Options } from '../../types';
5+
import type { Options, PoseInFrame } from '../../types';
66
import { doCommandFromClient } from '../../utils';
77
import type { PoseTracker } from './pose-tracker';
88
import { GetGeometriesRequest } from '../../gen/common/v1/common_pb';
9+
import { GetPosesRequest } from '../../gen/component/posetracker/v1/pose_tracker_pb';
910

1011
/**
1112
* A gRPC-web client for the Generic component.
@@ -46,4 +47,19 @@ export class PoseTrackerClient implements PoseTracker {
4647
callOptions
4748
);
4849
}
50+
51+
async getPoses(
52+
bodyNames?: string[],
53+
extra = {},
54+
callOptions = this.callOptions
55+
) {
56+
const request = new GetPosesRequest({
57+
name: this.name,
58+
bodyNames,
59+
extra: Struct.fromJson(extra),
60+
});
61+
62+
const response = await this.client.getPoses(request, callOptions);
63+
return response.bodyPoses;
64+
}
4965
}

src/components/pose-tracker/pose-tracker.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Geometry } from '../../gen/common/v1/common_pb';
1+
import type { Geometry, PoseInFrame } from '../../gen/common/v1/common_pb';
22
import type { Struct, Resource } from '../../types';
33

44
/** Represents a generic component. */
@@ -23,4 +23,9 @@ export interface PoseTracker extends Resource {
2323
* API](https://docs.viam.com/dev/reference/apis/components/generic/#getgeometries).
2424
*/
2525
getGeometries: (extra?: Struct) => Promise<Geometry[]>;
26+
27+
getPoses: (
28+
bodyNames?: string[],
29+
extra?: Struct
30+
) => Promise<Record<string, PoseInFrame>>;
2631
}

0 commit comments

Comments
 (0)