> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PoseClient

> A Zenoh client for handling pose messages

```python theme={null}
from grid_sim_client.isaac import PoseClient
```

A Zenoh client for handling pose messages.

This class inherits from ZenohClient and provides functionality for publishing and
receiving pose messages over Zenoh topics.

## Fields

<ResponseField name="position" type="numpy.ndarray">
  Current position as \[x, y, z]
</ResponseField>

<ResponseField name="orientation" type="numpy.ndarray">
  Current orientation as quaternion \[x, y, z, w]
</ResponseField>

<ResponseField name="relative" type="bool">
  Whether poses are relative to current position
</ResponseField>

<ResponseField name="blocking" type="bool">
  Whether pose commands block until complete
</ResponseField>

## Constructor

```python Signature theme={null}
PoseClient(
    *,
    client_dict: dict,
    agent_dict: Optional[dict] = None,
    shared_session: Any = None,
)
```

Initialize the pose client.

<ParamField body="client_dict" type="dict" required>
  Configuration dictionary for the client
</ParamField>

<ParamField body="agent_dict" type="dict, optional">
  Dictionary of agent parameters. Defaults to None.
</ParamField>

<ParamField body="shared_session">
  Optional shared Zenoh session. Defaults to None.
</ParamField>

## Methods

### `getLatestMessage()`

```python Signature theme={null}
getLatestMessage() -> Any
```

Return the most recent message from the subscription queue.

Blocks for up to one second waiting for a message.

**Returns:**

The raw payload bytes of the latest message, or `None` if no
message was received within the timeout.

### `get_orientation()`

```python Signature theme={null}
get_orientation() -> Optional[np.ndarray]
```

Get the current orientation.

**Returns:**

numpy.ndarray: Current orientation as quaternion \[x, y, z, w]

### `get_pose()`

```python Signature theme={null}
get_pose() -> Optional[tuple]
```

Get the latest pose message.

**Returns:**

tuple: (position, orientation) as numpy arrays or None

### `get_position()`

```python Signature theme={null}
get_position() -> Optional[np.ndarray]
```

Get the current position.

### `msg_cb()`

```python Signature theme={null}
msg_cb(sample: Any) -> None
```

Handle an incoming Zenoh sample by storing its payload in the queue.

<ParamField body="sample" required>
  The Zenoh sample received from the subscription.
</ParamField>

### `process_latest_msg()`

```python Signature theme={null}
process_latest_msg() -> None
```

Process the latest received pose message.

### `publish()`

```python Signature theme={null}
publish(data: bytes) -> None
```

Publish data to the topic.

<ParamField body="data" required>
  Raw bytes to publish on the configured topic.
</ParamField>

### `publish_agent_pose()`

```python Signature theme={null}
publish_agent_pose() -> None
```

Publish the current pose of the connected agent.

### `publish_pose()`

```python Signature theme={null}
publish_pose(position: np.ndarray, orientation: np.ndarray) -> None
```

Publish a pose message.

<ParamField body="position" type="array-like" required>
  Position as \[x, y, z]
</ParamField>

<ParamField body="orientation" type="array-like" required>
  Orientation as quaternion \[x, y, z, w]
</ParamField>

### `run()`

```python Signature theme={null}
run() -> None
```

Start the client by declaring a subscriber or publisher on the session.

### `stop()`

```python Signature theme={null}
stop() -> None
```

Undeclare the subscriber and close the owned Zenoh session if any.


## Related topics

- [Overview](/simulation/isaac/teleoperation/overview.md)
- [Camera Calibration](/deployment/camera-calibration.md)
- [Customizing RL Training](/simulation/isaac/reinforcement-learning/customizing-training.md)
- [ROS2 Communication](/simulation/isaac/comms.md)
- [contact-graspnet](/models/cortex/contact-graspnet.md)
