Skip to main content

ZenohAgent

Inherits from: 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: addSensor, getState, moveByVelocity, cleanup

init

ZenohAgent.__init__(client_config: dict, agent_dict: Optional[dict] = None)
Initialize a Zenoh agent with the given client configuration.
Arguments
client_config (dict)
dict
required
Configuration dictionary specifying Zenoh clients and their parameters
agent_dict (Optional[dict])
Optional[dict]
Optional dictionary of agent-specific parameters. Defaults to None.

create_clients

ZenohAgent.create_clients(client_config: dict, agent_config: Optional[dict] = None)
Create Zenoh clients based on configuration.
Arguments
client_config (dict)
dict
required
Dictionary of client configurations
agent_config (Optional[dict])
Optional[dict]
Optional dictionary of agent parameters

getForce

ZenohAgent.getForce(name: str = '') -> Force
Get force from named wrench client.
Arguments
name (str)
str
Name of wrench client
Returns
returns
Force

getTorque

ZenohAgent.getTorque(name: str = '') -> Torque
Get torque from named wrench client.
Arguments
name (str)
str
Name of wrench client
Returns
returns
Torque

getImage

ZenohAgent.getImage(camera_name: str = '', image_type: Optional[str] = '') -> Image
Get image from named image client.
Arguments
camera_name (str)
str
Name of image client
image_type (Optional[str])
Optional[str]
Type of image (“rgb” or “depth”). Defaults to “rgb”.
Returns
Image
Image
Image object
Raises
TypeError
If client is not an ImageClient

getPosition

ZenohAgent.getPosition(name: str = 'robot_pose') -> Optional[Position]
Get position from named pose client.
Arguments
name (str)
str
Name of pose client
Returns
returns
Optional[Position]
Raises
TypeError
If client is not a PoseClient

getOrientation

ZenohAgent.getOrientation(name: str = 'robot_pose') -> Orientation
Get orientation from named pose client.
Arguments
name (str)
str
Name of pose client
Returns
Orientation
Orientation
Orientation of agent as a quaternion
Raises
TypeError
If client is not a PoseClient

sendVelocity

ZenohAgent.sendVelocity(linear_vel: Velocity, angular_vel: Velocity, name: str = 'cmd_vel') -> None
Send velocity command to named velocity client.
Arguments
linear_vel (Velocity)
Velocity
required
Linear velocity components
angular_vel (Velocity)
Velocity
required
Angular velocity components
name (str)
str
Name of velocity client
Returns
returns
None
Raises
TypeError
If client is not a VelocityClient
ValueError
If client is not in talker mode

sendPose

ZenohAgent.sendPose(position: Position, orientation: Optional[Orientation] = None, name: str = 'cmd_delta_pose') -> None
Send pose command to named pose client.
Arguments
position (Position)
Position
required
Target position
orientation (Optional[Orientation])
Optional[Orientation]
Target orientation (defaults to [0,0,0,1] if None)
name (str)
str
Name of pose client
Returns
returns
None
Raises
TypeError
If client is not a PoseClient
ValueError
If client is not in talker mode

publishMsg

ZenohAgent.publishMsg(msg: dict, name: str) -> None
Publish a message to a named generic client.
Arguments
msg (dict)
dict
required
Message to publish
name (str)
str
required
Name of the generic client
Returns
returns
None

getMsg

ZenohAgent.getMsg(name: str) -> dict
Get a message from a named generic client.
Arguments
name (str)
str
required
Name of the generic client
Returns
returns
dict

getJointAngles

ZenohAgent.getJointAngles(name: str = 'joint_states') -> Optional[list]
Get joint angles from named joint angle client.
Arguments
name (str)
str
Name of joint angle client
Returns
returns
Optional[list]
Raises
TypeError
If client is not a JointAngleClient

setJointAngles

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.
Arguments
angles (list)
list
required
List of target joint angles in radians
blocking (bool)
bool
Wait for movement to complete (default False)
moving_time (Optional[float])
Optional[float]
Time to complete the movement in seconds
accel_time (Optional[float])
Optional[float]
Time to accelerate/decelerate in seconds
name (str)
str
Name of joint angle client
Returns
returns
None
Raises
TypeError
If client is not a JointAngleClient
ValueError
If client is not in talker mode

getJointVelocities

ZenohAgent.getJointVelocities(name: str = 'joint_states') -> Optional[list]
Get joint velocities from named joint angle client.
Arguments
name (str)
str
Name of joint angle client
Returns
returns
Optional[list]

getJointStates

ZenohAgent.getJointStates(name: str = 'joint_states') -> Optional[dict]
Get complete joint states from named joint angle client.
Arguments
name (str)
str
Name of joint angle client
Returns
returns
Optional[dict]
Raises
TypeError
If client is not a JointAngleClient

getObjectPose

ZenohAgent.getObjectPose(name: str = 'get_object_pose') -> Optional[Tuple[Position, Orientation]]
No docstring provided.
Arguments
name (str)
str
No description provided.
Returns
returns
Optional[Tuple[Position, Orientation]]

setObjectPose

ZenohAgent.setObjectPose(position: Position, orientation: Optional[Orientation] = None, name: str = 'set_object_pose') -> None
No docstring provided.
Arguments
position (Position)
Position
required
No description provided.
orientation (Optional[Orientation])
Optional[Orientation]
No description provided.
name (str)
str
No description provided.
Returns
returns
None

run

ZenohAgent.run()
Run all Zenoh clients

stop

ZenohAgent.stop()
Stop all clients and close Zenoh session

prompt

ZenohAgent.prompt()
No docstring provided.

reset

ZenohAgent.reset(name: str = 'reset')
No docstring provided.
Arguments
name (str)
str
No description provided.