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

# JointAngleClient

## JointAngleClient

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

A Zenoh client for handling joint state messages.

This class inherits from ZenohClient and provides functionality for publishing and
receiving joint state messages over Zenoh topics using sensor\_msgs/JointState.

Attributes:
joint\_names (list): Names of the joints
joint\_positions (numpy.ndarray): Current joint positions (angles)
joint\_velocities (numpy.ndarray): Current joint velocities
joint\_efforts (numpy.ndarray): Current joint efforts/torques

### Inherited methods

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

### **init**

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

Initialize the joint angle 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\_joint\_state

```python theme={null}
JointAngleClient.publish_joint_state(joint_names: List[str], joint_positions: List[float], joint_velocities: Optional[List[float]] = None, joint_efforts: Optional[List[float]] = None)
```

Publish a joint state message.

<ResponseField name="Arguments">
  <ParamField query="joint_names (List[str])" type="List[str]" required>
    Names of the joints
  </ParamField>

  <ParamField query="joint_positions (List[float])" type="List[float]" required>
    Joint positions/angles
  </ParamField>

  <ParamField query="joint_velocities (Optional[List[float]])" type="Optional[List[float]]">
    Joint velocities. Defaults to None.
  </ParamField>

  <ParamField query="joint_efforts (Optional[List[float]])" type="Optional[List[float]]">
    Joint efforts/torques. Defaults to None.
  </ParamField>
</ResponseField>

### get\_joint\_state

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

Get the latest joint state message.

<ResponseField name="Returns">
  <ResponseField name="tuple" type="Optional[tuple]">
    (joint\_names, joint\_positions, joint\_velocities, joint\_efforts) or None
  </ResponseField>
</ResponseField>

### process\_latest\_msg

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

Process the latest received joint state message.

Gets the latest message and updates the stored joint states. If an agent is
connected, calls setJointAngles with the new positions.

### get\_joint\_names

```python theme={null}
JointAngleClient.get_joint_names()
```

Get the current joint names.

<ResponseField name="Returns">
  <ResponseField name="list" type="">
    Current joint names
  </ResponseField>
</ResponseField>

### get\_joint\_positions

```python theme={null}
JointAngleClient.get_joint_positions()
```

Get the current joint positions.

<ResponseField name="Returns">
  <ResponseField name="numpy.ndarray" type="">
    Current joint positions/angles
  </ResponseField>
</ResponseField>

### get\_joint\_velocities

```python theme={null}
JointAngleClient.get_joint_velocities()
```

Get the current joint velocities.

<ResponseField name="Returns">
  <ResponseField name="numpy.ndarray" type="">
    Current joint velocities
  </ResponseField>
</ResponseField>

### get\_joint\_efforts

```python theme={null}
JointAngleClient.get_joint_efforts()
```

Get the current joint efforts.

<ResponseField name="Returns">
  <ResponseField name="numpy.ndarray" type="">
    Current joint efforts/torques
  </ResponseField>
</ResponseField>

### publish\_agent\_joint\_state

```python theme={null}
JointAngleClient.publish_agent_joint_state()
```

Publish the current joint state of the connected agent.
