> ## 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.

# ImageClient

> ImageClient

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

## Constructor

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

## 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_image()`

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

### `msg_cb()`

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

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

**sample** *required*

The Zenoh sample received from the subscription.

### `process_latest_msg()`

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

Process the latest message from the queue. Override in subclasses.

### `publish()`

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

Publish data to the topic.

**data** *required*

Raw bytes to publish on the configured topic.

### `publish_image()`

```python Signature theme={null}
publish_image(
    data: np.ndarray,
    encoding: str = 'rgb8',
    compressed: bool = True,
    format: str = 'jpeg',
    quality: int = 85,
) -> None
```

Publish an image to the topic.

**data** *required*

Image data as numpy array

**encoding** (default: 'rgb8')

Image encoding (e.g., "rgb8", "32FC1")

**compressed** (default: True)

Whether to use compressed image format (default: True)

**format** (default: 'jpeg')

Compression format ("jpeg" or "png"), only used if compressed=True

**quality** (default: 85)

JPEG quality (0-100), only used for JPEG compression

### `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

- [IsaacBimanual](https://docs.generalrobotics.dev/v2.0/python-api/isaac-robots/isaacbimanual.md)
- [IsaacHumanoid](https://docs.generalrobotics.dev/v2.0/python-api/isaac-robots/isaachumanoid.md)
- [IsaacLocomotion](https://docs.generalrobotics.dev/v2.0/python-api/isaac-robots/isaaclocomotion.md)
- [Isaac scene](https://docs.generalrobotics.dev/v2.0/python-api/isaac-scene/overview.md)
- [GRID Cortex Client](https://docs.generalrobotics.dev/v2.0/models/cortex.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.