> For AI agents: guidance on navigating Viam documentation is available at https://docs.viam.com/llms.txt.

# Pose tracker API

Get the poses of the bodies a pose tracker component tracks, such as AprilTags, calibration boards, or grasp candidates.
> Source: https://docs.viam.com/reference/apis/components/pose-tracker/


The pose tracker API allows you to get the poses of the bodies that a pose tracker component tracks.

A _body_ is any named thing that a pose tracker reports a pose for.
What counts as a body depends on the model: an AprilTag, a calibration board, a tracked controller, or a candidate grasp for an object.
For example, the `viam:apriltag:pose_tracker` model names each body by its tag ID, such as `"0"` or `"7"`.

Each pose is a `PoseInFrame`: a position and orientation, plus the name of the [reference frame](/reference/services/frame-system/) the pose is relative to.
Each model chooses that frame.
For example, `viam:apriltag:pose_tracker` reports poses in the frame of its camera, and `viam-labs:grasp-pose:top-down` reports poses in the world frame.

## Pose tracker models

The following public models in the [Viam registry](https://app.viam.com/registry) implement the pose tracker API:

<!-- prettier-ignore -->
| Model | Bodies |
| ----- | ------ |
| [`viam:apriltag:pose_tracker`](https://app.viam.com/module/viam/apriltag) | AprilTags a camera sees |
| [`viam:camera-calibration:charuco`](https://app.viam.com/module/viam/camera-calibration) | A ChArUco calibration board |
| [`viam:opencv:charuco`](https://app.viam.com/module/viam/opencv) | A ChArUco calibration board |
| [`viam:opencv:chessboard`](https://app.viam.com/module/viam/opencv) | A chessboard calibration pattern |
| [`viam-labs:grasp-pose:top-down`](https://app.viam.com/module/viam-labs/grasp-pose) | Ranked top-down grasp poses for the objects a vision service detects |
| [`viam-labs:teach-frames:pose-tracker`](https://app.viam.com/module/viam-labs/teach-frames) | Workcell frames you teach by moving an arm |

## Methods

The pose tracker component supports the following methods:

<!-- prettier-ignore -->
| Method Name | Description |
| ----------- | ----------- |
| [`GetPoses`](/reference/apis/components/pose-tracker/#getposes) | Get the current pose of each body the pose tracker tracks, as a map from body name to a pose in a reference frame. |
| [`GetGeometries`](/reference/apis/components/pose-tracker/#getgeometries) | Get all the geometries associated with the pose tracker in its current configuration, in the frame of the pose tracker. |
| [`Reconfigure`](/reference/apis/components/pose-tracker/#reconfigure) | Reconfigure this resource. |
| [`DoCommand`](/reference/apis/components/pose-tracker/#docommand) | Execute model-specific commands that are not otherwise defined by the component API. |
| [`GetStatus`](/reference/apis/components/pose-tracker/#getstatus) | Get the current status of the pose tracker as a map of key-value pairs describing its state. |
| [`GetResourceName`](/reference/apis/components/pose-tracker/#getresourcename) | Get the `ResourceName` for this pose tracker. |
| [`Close`](/reference/apis/components/pose-tracker/#close) | Safely shut down the resource and prevent further use. |


## API

### GetPoses

Get the current pose of each body the pose tracker tracks, as a map from body name to a pose in a reference frame.
Pass a list of body names to get only those bodies, or an empty list to get every body the pose tracker can currently report.
Each model chooses the reference frame of its poses, so check the reference frame of each returned pose.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `body_names` (List[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)]) (required): Names of the bodies whose poses are being requested. In the event this parameter is not supplied or is an empty list, all available poses are returned.
- `extra` (Mapping[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), Any]) (optional): Extra options to pass to the underlying RPC call.
- `timeout` ([float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

**Returns:**

- (Dict[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), [viam.proto.common.PoseInFrame](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.PoseInFrame)])

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/pose_tracker/client/index.html#viam.components.pose_tracker.client.PoseTrackerClient.get_poses).

{{% /tab %}}
{{% tab name="Go" %}}

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `bodyNames` [([]string)](https://pkg.go.dev/builtin#string)
- `extra` [(map[string]interface{})](https://go.dev/blog/maps): Extra options to pass to the underlying RPC call.

**Returns:**

- [(referenceframe.FrameSystemPoses)](https://pkg.go.dev/go.viam.com/rdk/referenceframe#FrameSystemPoses)
- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/components/posetracker#PoseTracker).

{{% /tab %}}
{{% tab name="Flutter" %}}

**Parameters:**

- `bodyNames` [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html)> (required)
- `extra` [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? (optional)

**Returns:**

- [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), [PoseInFrame](https://flutter.viam.dev/viam_sdk/PoseInFrame-class.html)>\>

**Example:**

```dart {class="line-numbers linkable-line-numbers"}
// Get the poses of specific bodies
var poses = await myPoseTracker.poses(['left_hand', 'right_hand']);
var leftHand = poses['left_hand'];

// Get the poses of every tracked body
var allPoses = await myPoseTracker.poses([]);
```

For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_sdk/PoseTracker/poses.html).

{{% /tab %}}
{{< /tabs >}}

### GetGeometries

Get all the geometries associated with the pose tracker in its current configuration, in the [frame](/reference/services/frame-system/) of the pose tracker.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `extra` (Mapping[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), Any]) (optional): Extra options to pass to the underlying RPC call.
- `timeout` ([float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

**Returns:**

- (List[[viam.proto.common.Geometry](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.Geometry)]): The geometries associated with the Component.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
my_pose_tracker = PoseTracker.from_robot(robot=machine, name="my_pose_tracker")
geometries = await my_pose_tracker.get_geometries()

if geometries:
    # Get the center of the first geometry
    print(f"Pose of the first geometry's centerpoint: {geometries[0].center}")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/pose_tracker/client/index.html#viam.components.pose_tracker.client.PoseTrackerClient.get_geometries).

{{% /tab %}}
{{% tab name="TypeScript" %}}

**Parameters:**

- `extra` ({}) (optional)
- `callOptions` (CallOptions) (optional)

**Returns:**

- (Promise\<[commonApi](https://ts.viam.dev/modules/commonApi.html).[Geometry](https://ts.viam.dev/classes/commonApi.Geometry.html)[]>)

**Example:**

```ts {class="line-numbers linkable-line-numbers"}
const generic = new VIAM.GenericComponentClient(machine, 'my_generic_component');

// Get the geometries of this component
const geometries = await generic.getGeometries();
console.log('Geometries:', geometries);
```

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/PoseTrackerClient.html#getgeometries).

{{% /tab %}}
{{% tab name="Flutter" %}}

**Parameters:**

- `extra` [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>? (optional)

**Returns:**

- [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Geometry](https://flutter.viam.dev/viam_protos.common.common/Geometry-class.html)>\>

**Example:**

```dart {class="line-numbers linkable-line-numbers"}
final geometries = await myPoseTracker.getGeometries();
```

For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_sdk/PoseTracker/getGeometries.html).

{{% /tab %}}
{{< /tabs >}}

### Reconfigure

Reconfigure this resource.
Reconfigure must reconfigure the resource atomically and in place.

{{< tabs >}}
{{% tab name="Go" %}}

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `deps` [(Dependencies)](https://pkg.go.dev/go.viam.com/rdk/resource#Dependencies): The resource dependencies.
- `conf` [(Config)](https://pkg.go.dev/go.viam.com/rdk/resource#Config): The resource configuration.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

{{% /tab %}}
{{< /tabs >}}

### DoCommand

Execute model-specific commands that are not otherwise defined by the component API.
Most models do not implement `DoCommand`.
Any available model-specific commands should be covered in the model's documentation.
If you are implementing your own pose tracker and want to add features that have no corresponding built-in API method, you can implement them with [`DoCommand`](/reference/sdks/docommand/).

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `command` (Mapping[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), [ValueTypes](https://python.viam.dev/autoapi/viam/utils/index.html#viam.utils.ValueTypes)]) (required): The command to execute.
- `timeout` ([float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

**Returns:**

- (Mapping[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), [viam.utils.ValueTypes](https://python.viam.dev/autoapi/viam/utils/index.html#viam.utils.ValueTypes)]): Result of the executed command.

**Raises:**

- (NotImplementedError): Raised if the Resource does not support arbitrary commands.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
my_pose_tracker = PoseTracker.from_robot(robot=machine, name="my_pose_tracker")
command = {"cmd": "test", "data1": 500}
result = await my_pose_tracker.do_command(command)
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/pose_tracker/client/index.html#viam.components.pose_tracker.client.PoseTrackerClient.do_command).

{{% /tab %}}
{{% tab name="Go" %}}

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `cmd` [(map[string]interface{})](https://go.dev/blog/maps): The command to execute.

**Returns:**

- [(map[string]interface{})](https://pkg.go.dev/builtin#string): The command response.
- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

**Example:**

```go {class="line-numbers linkable-line-numbers"}
myPoseTracker, err := pose_tracker.FromProvider(machine, "my_pose_tracker")

command := map[string]interface{}{"cmd": "test", "data1": 500}
result, err := myPoseTracker.DoCommand(context.Background(), command)
```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

{{% /tab %}}
{{% tab name="TypeScript" %}}

**Parameters:**

- `command` ([Struct](https://ts.viam.dev/classes/Struct.html) | Record\<string, [JsonValue](https://ts.viam.dev/types/JsonValue.html)>) (required): The command to execute. Accepts either a [`Struct`](https://ts.viam.dev/classes/Struct.html) or a plain object,
  which will be converted automatically.
- `callOptions` (CallOptions) (optional)

**Returns:**

- (Promise\<[JsonValue](https://ts.viam.dev/types/JsonValue.html)>)

**Example:**

```ts {class="line-numbers linkable-line-numbers"}
// Plain object (recommended)
const result = await resource.doCommand({
  myCommand: { key: 'value' },
});

// Struct (still supported)
import { Struct } from '@viamrobotics/sdk';

const result = await resource.doCommand(Struct.fromJson({ myCommand: { key: 'value' } }));
```

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/PoseTrackerClient.html#docommand).

{{% /tab %}}
{{% tab name="Flutter" %}}

**Parameters:**

- `command` [Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic> (required)

**Returns:**

- [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>\>

**Example:**

```dart {class="line-numbers linkable-line-numbers"}
// Example using doCommand with an arm component
const command = {'cmd': 'test', 'data1': 500};
var result = myArm.doCommand(command);
```

For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_sdk/Resource/doCommand.html).

{{% /tab %}}
{{< /tabs >}}

### GetStatus

Get the current status of the pose tracker as a map of key-value pairs describing its state.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `timeout` ([float](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

**Returns:**

- (Mapping[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), [viam.utils.ValueTypes](https://python.viam.dev/autoapi/viam/utils/index.html#viam.utils.ValueTypes)]): The status of the component.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
status = await component.get_status()
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/pose_tracker/client/index.html#viam.components.pose_tracker.client.PoseTrackerClient.get_status).

{{% /tab %}}
{{% tab name="Go" %}}

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.

**Returns:**

- [(map[string]interface{})](https://pkg.go.dev/builtin#string)
- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

**Example:**

```go {class="line-numbers linkable-line-numbers"}
myPoseTracker, err := posetracker.FromProvider(machine, "my_pose_tracker")

status, err := myPoseTracker.Status(context.Background())
```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

{{% /tab %}}
{{% tab name="TypeScript" %}}

**Parameters:**

- `callOptions` (CallOptions) (optional)

**Returns:**

- (Promise\<[JsonValue](https://ts.viam.dev/types/JsonValue.html)>)

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/PoseTrackerClient.html#getstatus).

{{% /tab %}}
{{% tab name="Flutter" %}}

**Parameters:**

- None.

**Returns:**

- [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)<[Map](https://api.flutter.dev/flutter/dart-core/Map-class.html)<[String](https://api.flutter.dev/flutter/dart-core/String-class.html), dynamic>\>

For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_sdk/Resource/getStatus.html).

{{% /tab %}}
{{< /tabs >}}

### GetResourceName

Get the `ResourceName` for this pose tracker.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `name` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The name of the Resource.

**Returns:**

- ([viam.proto.common.ResourceName](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.ResourceName)): The ResourceName of this Resource.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
my_pose_tracker_name = PoseTracker.get_resource_name("my_pose_tracker")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/pose_tracker/client/index.html#viam.components.pose_tracker.client.PoseTrackerClient.get_resource_name).

{{% /tab %}}
{{% tab name="Go" %}}

**Parameters:**

- None.

**Returns:**

- [(Name)](https://pkg.go.dev/go.viam.com/rdk@v0.89.0/resource#Name)

**Example:**

```go {class="line-numbers linkable-line-numbers"}
myPoseTracker, err := posetracker.FromProvider(machine, "my_pose_tracker")

err = myPoseTracker.Name()
```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

{{% /tab %}}
{{% tab name="TypeScript" %}}

**Parameters:**

- None.

**Returns:**

- (string): The name of the resource.

**Example:**

```ts {class="line-numbers linkable-line-numbers"}
pose_tracker.name
```

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/PoseTrackerClient.html#name).

{{% /tab %}}
{{% tab name="Flutter" %}}

**Parameters:**

- `name` [String](https://api.flutter.dev/flutter/dart-core/String-class.html) (required)

**Returns:**

- [ResourceName](https://flutter.viam.dev/viam_sdk/ResourceName-class.html)

**Example:**

```dart {class="line-numbers linkable-line-numbers"}
final myPoseTrackerResourceName = myPoseTracker.getResourceName("my_pose_tracker");
```

For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_sdk/PoseTracker/getResourceName.html).

{{% /tab %}}
{{< /tabs >}}

### Close

Safely shut down the resource and prevent further use.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- None.

**Returns:**

- None.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
my_pose_tracker = PoseTracker.from_robot(robot=machine, name="my_pose_tracker")
await my_pose_tracker.close()
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/pose_tracker/client/index.html#viam.components.pose_tracker.client.PoseTrackerClient.close).

{{% /tab %}}
{{% tab name="Go" %}}

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

**Example:**

```go {class="line-numbers linkable-line-numbers"}
myPoseTracker, err := posetracker.FromProvider(machine, "my_pose_tracker")

err = myPoseTracker.Close(context.Background())
```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

{{% /tab %}}
{{< /tabs >}}


