> ## Documentation Index
> Fetch the complete documentation index at: https://scaledfoundations-rebrand.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Generic Client

## GenericClient

Inherits from: [ROSClient](/robot-api/grid/comm/ros/base_client#rosclient)

A generic ROS client that can handle arbitrary message types and processing functions.

This class inherits from ROSClient and provides functionality for publishing and
processing generic ROS messages with optional custom processing functions.

<ResponseField name="Attributes">
  <ParamField query="msg" type="">
    The most recently published/received message
  </ParamField>
</ResponseField>

### GenericClient

```python
GenericClient(client_dict, agent_dict)
```

Initialize the generic client.

<Note>
  For generic client, you also need to include the following keys:

  * "msg\_type": The ROS message type
  * "fn": The function to process the message
</Note>

<ResponseField name="Arguments">
  <ParamField query="client_dict (dict)" type="" required>
    Configuration dictionary for the client
  </ParamField>

  <ParamField query="agent_dict (dict), optional" type="">
    defaults to None.
    Dictionary of agent parameters. Defaults to None.
  </ParamField>
</ResponseField>

### publish\_msg

```python
GenericClient.publish_msg(msg)
```

Publish a message to the configured topic.
If a processing function is defined, it will be called before publishing.

<ResponseField name="Arguments">
  <ParamField query="msg" type="" required>
    The message to publish
  </ParamField>
</ResponseField>

### get\_msg

```python
GenericClient.get_msg()
```

Get the most recent message.

<ResponseField name="Returns">
  The most recently published/received message
</ResponseField>
