RosAgent

Inherits from: Robot

A class to represent a ROS-based robot agent.

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

RosAgent

RosAgent(client_config: dict, agent_dict: dict | None)

Initialize a ROS agent with the given client configuration.

Arguments
client_config (dict)
required

Configuration dictionary specifying ROS clients and their parameters

agent_dict (dict | None), optional

defaults to None. Optional dictionary of agent-specific parameters. Defaults to None.

Returns

create_clients

RosAgent.create_clients(client_config: dict, agent_config: dict | None)

Create ROS clients based on configuration.

Arguments
client_config (dict)
required

Dictionary of client configurations

agent_config (dict | None)
required

Optional dictionary of agent parameters

getImage

RosAgent.getImage(name: str, image_type: str)

Get image from named image client.

Arguments
name (str), optional

Name of image client

image_type (str), optional

Unused

Returns

Image

Image object

getPosition

RosAgent.getPosition(name: str)

Get position from named pose client.

Arguments
name (str), optional

Name of pose client

Returns

Position | list: Position object or raw position data

getOrientation

RosAgent.getOrientation(name: str)

Get orientation from named pose client.

Arguments
name (str), optional

Name of pose client

Returns

Orientation

Orientation of agent as a quaternion

sendVelocity

RosAgent.sendVelocity(linear_vel: Velocity, angular_vel: Velocity, name: str)

Send velocity command to named velocity client.

Arguments
linear_vel (Velocity)
required

Velocity

Linear velocity components

angular_vel (Velocity)
required

Velocity

Angular velocity components

name (str), optional

Name of velocity client

sendPose

RosAgent.sendPose(position: Position, orientation: Orientation | None, name: str)

Send pose command to named pose client.

Arguments
position (Position)
required

Position

Target position

orientation (Orientation | None)
required

Target orientation (defaults to [0,0,0,1] if None)

name (str), optional

Name of pose client

publishMsg

RosAgent.publishMsg(msg: dict, name: str)

Publish a message to a named generic client.

Arguments
msg (dict)
required

Message to publish

name (str), optional

Name of the generic client

getMsg

RosAgent.getMsg(name: str)

Get a message from a named generic client.

Arguments
name (str), optional

Name of the generic client

run

RosAgent.run()

stop

RosAgent.stop()

Was this page helpful?