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

# WrenchClient

## WrenchClient

Inherits from: [`ZenohClient`](/robot-api/reference/sim/zenoh/base_client/ZenohClient)

A Zenoh client for publishing and receiving wrench messages over Zenoh topics.

Wrenches are commonly received from contact sensors,
and published to end effectors that need to apply a force or torque.

Attributes:
force (numpy.ndarray): Current force as \[x, y, z]
torque (numpy.ndarray): Current torque as \[x, y, z]
relative (bool): Whether wrenches are relative to current position
blocking (bool): Whether wrench commands block until complete

### Inherited methods

* From [`ZenohClient`](/robot-api/reference/sim/zenoh/base_client/ZenohClient): `getLatestMessage`, `msg_cb`, `run`, `publish`, `stop`

### **init**

```python theme={null}
WrenchClient.__init__(client_dict, agent_dict = None, shared_session = None)
```

Initialize the wrench client.

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

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

  <ParamField query="shared_session" type="">
    Optional shared Zenoh session. Defaults to None.
  </ParamField>
</ResponseField>

### publish\_wrench

```python theme={null}
WrenchClient.publish_wrench(force, torque)
```

Publish a wrench message.

<ResponseField name="Arguments">
  <ParamField query="force (array-like)" type="array-like" required>
    Force as \[x, y, z]
  </ParamField>

  <ParamField query="torque (array-like)" type="array-like" required>
    Torque as \[x, y, z]
  </ParamField>
</ResponseField>

### get\_wrench

```python theme={null}
WrenchClient.get_wrench() -> Optional[tuple]
```

Get the latest wrench message.

<ResponseField name="Returns">
  <ResponseField name="tuple" type="Optional[tuple]">
    (force, torque) as numpy arrays or None
  </ResponseField>
</ResponseField>

### process\_latest\_msg

```python theme={null}
WrenchClient.process_latest_msg()
```

Process the latest received wrench message.

### get\_force

```python theme={null}
WrenchClient.get_force()
```

Get the current force.

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

### get\_torque

```python theme={null}
WrenchClient.get_torque()
```

Get the current torque.

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