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

# ZenohAgent

## ZenohAgent

Inherits from: [`Robot`](/robot-api/reference/base/robot/robot/Robot)

A class to represent a Zenoh-based robot agent.

This class inherits from Robot and implements Zenoh-specific functionality for
communicating with and controlling a robot through Zenoh topics.

Attributes:
config (dict): Configuration dictionary for Zenoh clients. Please see our Zenoh documentation for more details.
clients (dict): Dictionary of Zenoh client objects

### Inherited methods

* From [`Robot`](/robot-api/reference/base/robot/robot/Robot): `addSensor`, `getState`, `moveByVelocity`, `cleanup`

### **init**

```python theme={null}
ZenohAgent.__init__(client_config: dict, agent_dict: Optional[dict] = None)
```

Initialize a Zenoh agent with the given client configuration.

<ResponseField name="Arguments">
  <ParamField query="client_config (dict)" type="dict" required>
    Configuration dictionary specifying Zenoh clients and their parameters
  </ParamField>

  <ParamField query="agent_dict (Optional[dict])" type="Optional[dict]">
    Optional dictionary of agent-specific parameters. Defaults to None.
  </ParamField>
</ResponseField>

### create\_clients

```python theme={null}
ZenohAgent.create_clients(client_config: dict, agent_config: Optional[dict] = None)
```

Create Zenoh clients based on configuration.

<ResponseField name="Arguments">
  <ParamField query="client_config (dict)" type="dict" required>
    Dictionary of client configurations
  </ParamField>

  <ParamField query="agent_config (Optional[dict])" type="Optional[dict]">
    Optional dictionary of agent parameters
  </ParamField>
</ResponseField>

### getForce

```python theme={null}
ZenohAgent.getForce(name: str = '') -> Force
```

Get force from named wrench client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    Name of wrench client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Force" />
</ResponseField>

### getTorque

```python theme={null}
ZenohAgent.getTorque(name: str = '') -> Torque
```

Get torque from named wrench client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    Name of wrench client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Torque" />
</ResponseField>

### getImage

```python theme={null}
ZenohAgent.getImage(camera_name: str = '', image_type: Optional[str] = '') -> Image
```

Get image from named image client.

<ResponseField name="Arguments">
  <ParamField query="camera_name (str)" type="str">
    Name of image client
  </ParamField>

  <ParamField query="image_type (Optional[str])" type="Optional[str]">
    Type of image ("rgb" or "depth"). Defaults to "rgb".
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="Image" type="Image">
    Image object
  </ResponseField>
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not an ImageClient
  </ParamField>
</ResponseField>

### getPosition

```python theme={null}
ZenohAgent.getPosition(name: str = 'robot_pose') -> Optional[Position]
```

Get position from named pose client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    Name of pose client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Optional[Position]" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not a PoseClient
  </ParamField>
</ResponseField>

### getOrientation

```python theme={null}
ZenohAgent.getOrientation(name: str = 'robot_pose') -> Orientation
```

Get orientation from named pose client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    Name of pose client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="Orientation" type="Orientation">
    Orientation of agent as a quaternion
  </ResponseField>
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not a PoseClient
  </ParamField>
</ResponseField>

### sendVelocity

```python theme={null}
ZenohAgent.sendVelocity(linear_vel: Velocity, angular_vel: Velocity, name: str = 'cmd_vel') -> None
```

Send velocity command to named velocity client.

<ResponseField name="Arguments">
  <ParamField query="linear_vel (Velocity)" type="Velocity" required>
    Linear velocity components
  </ParamField>

  <ParamField query="angular_vel (Velocity)" type="Velocity" required>
    Angular velocity components
  </ParamField>

  <ParamField query="name (str)" type="str">
    Name of velocity client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not a VelocityClient
  </ParamField>

  <ParamField query="ValueError" type="">
    If client is not in talker mode
  </ParamField>
</ResponseField>

### sendPose

```python theme={null}
ZenohAgent.sendPose(position: Position, orientation: Optional[Orientation] = None, name: str = 'cmd_delta_pose') -> None
```

Send pose command to named pose client.

<ResponseField name="Arguments">
  <ParamField query="position (Position)" type="Position" required>
    Target position
  </ParamField>

  <ParamField query="orientation (Optional[Orientation])" type="Optional[Orientation]">
    Target orientation (defaults to \[0,0,0,1] if None)
  </ParamField>

  <ParamField query="name (str)" type="str">
    Name of pose client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not a PoseClient
  </ParamField>

  <ParamField query="ValueError" type="">
    If client is not in talker mode
  </ParamField>
</ResponseField>

### publishMsg

```python theme={null}
ZenohAgent.publishMsg(msg: dict, name: str) -> None
```

Publish a message to a named generic client.

<ResponseField name="Arguments">
  <ParamField query="msg (dict)" type="dict" required>
    Message to publish
  </ParamField>

  <ParamField query="name (str)" type="str" required>
    Name of the generic client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### getMsg

```python theme={null}
ZenohAgent.getMsg(name: str) -> dict
```

Get a message from a named generic client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str" required>
    Name of the generic client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="dict" />
</ResponseField>

### getJointAngles

```python theme={null}
ZenohAgent.getJointAngles(name: str = 'joint_states') -> Optional[list]
```

Get joint angles from named joint angle client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    Name of joint angle client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Optional[list]" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not a JointAngleClient
  </ParamField>
</ResponseField>

### setJointAngles

```python theme={null}
ZenohAgent.setJointAngles(angles: list, blocking: bool = False, moving_time: Optional[float] = None, accel_time: Optional[float] = None, name: str = 'joint_cmd') -> None
```

Send joint angle command to named joint angle client.

<ResponseField name="Arguments">
  <ParamField query="angles (list)" type="list" required>
    List of target joint angles in radians
  </ParamField>

  <ParamField query="blocking (bool)" type="bool">
    Wait for movement to complete (default False)
  </ParamField>

  <ParamField query="moving_time (Optional[float])" type="Optional[float]">
    Time to complete the movement in seconds
  </ParamField>

  <ParamField query="accel_time (Optional[float])" type="Optional[float]">
    Time to accelerate/decelerate in seconds
  </ParamField>

  <ParamField query="name (str)" type="str">
    Name of joint angle client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not a JointAngleClient
  </ParamField>

  <ParamField query="ValueError" type="">
    If client is not in talker mode
  </ParamField>
</ResponseField>

### getJointVelocities

```python theme={null}
ZenohAgent.getJointVelocities(name: str = 'joint_states') -> Optional[list]
```

Get joint velocities from named joint angle client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    Name of joint angle client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Optional[list]" />
</ResponseField>

### getJointStates

```python theme={null}
ZenohAgent.getJointStates(name: str = 'joint_states') -> Optional[dict]
```

Get complete joint states from named joint angle client.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    Name of joint angle client
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Optional[dict]" />
</ResponseField>

<ResponseField name="Raises">
  <ParamField query="TypeError" type="">
    If client is not a JointAngleClient
  </ParamField>
</ResponseField>

### getObjectPose

```python theme={null}
ZenohAgent.getObjectPose(name: str = 'get_object_pose') -> Optional[Tuple[Position, Orientation]]
```

*No docstring provided.*

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    *No description provided.*
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="Optional[Tuple[Position, Orientation]]" />
</ResponseField>

### setObjectPose

```python theme={null}
ZenohAgent.setObjectPose(position: Position, orientation: Optional[Orientation] = None, name: str = 'set_object_pose') -> None
```

*No docstring provided.*

<ResponseField name="Arguments">
  <ParamField query="position (Position)" type="Position" required>
    *No description provided.*
  </ParamField>

  <ParamField query="orientation (Optional[Orientation])" type="Optional[Orientation]">
    *No description provided.*
  </ParamField>

  <ParamField query="name (str)" type="str">
    *No description provided.*
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### run

```python theme={null}
ZenohAgent.run()
```

Run all Zenoh clients

### stop

```python theme={null}
ZenohAgent.stop()
```

Stop all clients and close Zenoh session

### prompt

```python theme={null}
ZenohAgent.prompt()
```

*No docstring provided.*

### reset

```python theme={null}
ZenohAgent.reset(name: str = 'reset')
```

*No docstring provided.*

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str">
    *No description provided.*
  </ParamField>
</ResponseField>
