agents.ros#

The following classes provide wrappers for data being transmitted via ROS topics. These classes form the inputs and outputs of Components.

Module Contents#

Classes#

StreamingString

Wraps the automatika_embodied_agents.msg.StreamingString message type.

Video

Wraps the automatika_embodied_agents.msg.Video message type.

Detections

Wraps the automatika_embodied_agents.msg.Detections2D message type.

DetectionsMultiSource

Wraps the automatika_embodied_agents.msg.Detections2DMultiSource message type.

PointsOfInterest

Wraps the automatika_embodied_agents.msg.PointsOfInterest message type.

Trackings

Wraps the automatika_embodied_agents.msg.Trackings message type.

TrackingsMultiSource

Wraps the automatika_embodied_agents.msg.TrackingsMultiSource message type.

RGBD

Wraps the realsense2_camera_msgs.msg.RGBD message type.

JointTrajectoryPoint

Wraps the trajectory_msgs.msg.JointTrajectoryPoint message type.

JointTrajectory

Wraps the trajectory_msgs.msg.JointTrajectory message type.

JointJog

Wraps the control_msgs.msg.JointJog message type.

JointState

Wraps the sensor_msgs.msg.JointState message type.

Topic

A topic is an idomatic wrapper for a ROS2 topic, Topics can be given as inputs or outputs to components. When given as inputs, components automatically create listeners for the topics upon their activation. And when given as outputs, components create publishers for publishing to the topic.

FixedInput

A FixedInput can be provided to components as input and is similar to a Topic except components do not create a subscriber to it and whenever they read it, they always get the same data. The nature of the data depends on the msg_type specified.

MapLayer

A MapLayer represents a single input for a MapEncoding component. It can subscribe to a specific text topic.

Route

A Route defines a topic to be routed to by the SemanticRouter, along with samples of similar text that the input must match to for the route to be used.

API#

class agents.ros.StreamingString#

Bases: ros_sugar.supported_types.SupportedType

Wraps the automatika_embodied_agents.msg.StreamingString message type.

This type represents a string that is being streamed (e.g., token by token from an LLM). It contains fields to indicate if the stream is active and if the transmission is complete.

ROS2 Message Type: automatika_embodied_agents/msg/StreamingString

classmethod convert(output: str, stream: bool = False, done: bool = True, **_) automatika_embodied_agents.msg.StreamingString#

Takes a string and streaming info to return a streaming string custom msg

Returns:

ROSStreamingString

class agents.ros.Video#

Bases: ros_sugar.supported_types.SupportedType

Wraps the automatika_embodied_agents.msg.Video message type.

This type represents a sequence of images (frames). It can handle both raw images and compressed images, bundling them into a single video message structure.

ROS2 Message Type: automatika_embodied_agents/msg/Video

classmethod convert(output: Union[List[ros_sugar.supported_types.ROSImage], List[ros_sugar.supported_types.ROSCompressedImage], List[numpy.ndarray]], **_) automatika_embodied_agents.msg.Video#

Takes an list of images and returns a video message (Image Array)

Returns:

Video

class agents.ros.Detections#

Bases: ros_sugar.supported_types.SupportedType

Wraps the automatika_embodied_agents.msg.Detections2D message type.

This type represents 2D object detections, including bounding boxes, labels, and confidence scores. It can optionally bundle the source image (RGB or RGBD) associated with the detections.

ROS2 Message Type: automatika_embodied_agents/msg/Detections2D

classmethod convert(output: Union[Dict, List[Dict]], images: Union[ros_sugar.supported_types.ROSImage, ros_sugar.supported_types.ROSCompressedImage, numpy.ndarray, List[ros_sugar.supported_types.ROSImage], List[ros_sugar.supported_types.ROSCompressedImage], List[numpy.ndarray]], **_) automatika_embodied_agents.msg.Detections2D#

Takes object detection data and converts it into a ROS message of type Detection2D

Returns:

Detection2D

class agents.ros.DetectionsMultiSource#

Bases: ros_sugar.supported_types.SupportedType

Wraps the automatika_embodied_agents.msg.Detections2DMultiSource message type.

This type handles a list of Detections2D messages, typically used when receiving detection data from multiple cameras or sources simultaneously.

ROS2 Message Type: automatika_embodied_agents/msg/Detections2DMultiSource

classmethod convert(output: List, images: List, **_) automatika_embodied_agents.msg.Detections2DMultiSource#

Takes object detections data and converts it into a ROS message of type Detections2D

Returns:

Detections2D

class agents.ros.PointsOfInterest#

Bases: ros_sugar.supported_types.SupportedType

Wraps the automatika_embodied_agents.msg.PointsOfInterest message type.

This type represents a set of 2D coordinates (x, y) on an image that are of interest, bundled with the source image or depth map.

ROS2 Message Type: automatika_embodied_agents/msg/PointsOfInterest

classmethod convert(output: List[Tuple[int, int]], img: Union[ros_sugar.supported_types.ROSImage, ros_sugar.supported_types.ROSCompressedImage, numpy.ndarray], **_) automatika_embodied_agents.msg.PointsOfInterest#

Takes points of interest on an image and converts it into a ROS message of type PointsOfInterest

Returns:

PointsOfInterest

class agents.ros.Trackings#

Bases: ros_sugar.supported_types.SupportedType

Wraps the automatika_embodied_agents.msg.Trackings message type.

This type represents tracked objects over time. It includes object IDs, tracked labels, bounding boxes, centroids, and estimated velocities, along with the source image.

ROS2 Message Type: automatika_embodied_agents/msg/Trackings

classmethod convert(output: Union[Dict, List[Dict]], images: Union[ros_sugar.supported_types.ROSImage, ros_sugar.supported_types.ROSCompressedImage, numpy.ndarray, List[ros_sugar.supported_types.ROSImage], List[ros_sugar.supported_types.ROSCompressedImage], List[numpy.ndarray]]) automatika_embodied_agents.msg.Trackings#

Takes tracking data and converts it into a ROS message of type Tracking

Returns:

ROSTracking

class agents.ros.TrackingsMultiSource#

Bases: ros_sugar.supported_types.SupportedType

Wraps the automatika_embodied_agents.msg.TrackingsMultiSource message type.

This type handles a list of Trackings messages, typically used for multi-camera tracking scenarios.

ROS2 Message Type: automatika_embodied_agents/msg/TrackingsMultiSource

classmethod convert(output: List, images: List, **_) automatika_embodied_agents.msg.TrackingsMultiSource#

Takes trackings data and converts it into a ROS message of type ROSTrackings

Returns:

ROSTrackings

class agents.ros.RGBD#

Bases: ros_sugar.supported_types.SupportedType

Wraps the realsense2_camera_msgs.msg.RGBD message type.

This type represents aligned RGB and Depth images typically produced by RealSense cameras. It requires the realsense2_camera_msgs package to be installed.

ROS2 Message Type: realsense2_camera_msgs/msg/RGBD

class agents.ros.JointTrajectoryPoint#

Bases: ros_sugar.supported_types.SupportedType

Wraps the trajectory_msgs.msg.JointTrajectoryPoint message type.

This type represents a single point in a joint trajectory, including positions, velocities, accelerations, and effort for a specific point in time.

ROS2 Message Type: trajectory_msgs/msg/JointTrajectoryPoint

classmethod convert(output: agents.utils.actions.JointsData, index: Optional[int] = None, **_) Any#

Takes joint state data and converts it into a ROS message of type JointTrajectoryPoint

Returns:

JointTrajectory

class agents.ros.JointTrajectory#

Bases: ros_sugar.supported_types.SupportedType

Wraps the trajectory_msgs.msg.JointTrajectory message type.

This type represents a full joint trajectory, containing a list of JointTrajectoryPoints and the names of the joints being controlled.

ROS2 Message Type: trajectory_msgs/msg/JointTrajectory

classmethod convert(output: agents.utils.actions.JointsData, **_) Any#

Takes joint state data and converts it into a ROS message of type JointTrajectory

Returns:

JointTrajectory

class agents.ros.JointJog#

Bases: ros_sugar.supported_types.SupportedType

Wraps the control_msgs.msg.JointJog message type.

This type represents a command to jog joints, specifying displacements, velocities, or duration for immediate execution.

ROS2 Message Type: control_msgs/msg/JointJog

classmethod convert(output: agents.utils.actions.JointsData, **_) Any#

Takes joint state data and converts it into a ROS message of type JointJog

Returns:

JointJog

class agents.ros.JointState#

Bases: ros_sugar.supported_types.SupportedType

Wraps the sensor_msgs.msg.JointState message type.

This type represents the current state of a set of joints, including their names, positions, velocities, and efforts.

ROS2 Message Type: sensor_msgs/msg/JointState

classmethod convert(output: agents.utils.actions.JointsData, **_) sensor_msgs.msg.JointState#

Takes joint state data and converts it into a ROS message of type JointState

Returns:

JointState

class agents.ros.Topic#

Bases: ros_sugar.io.topic.Topic

A topic is an idomatic wrapper for a ROS2 topic, Topics can be given as inputs or outputs to components. When given as inputs, components automatically create listeners for the topics upon their activation. And when given as outputs, components create publishers for publishing to the topic.

Parameters:
  • name (str) – Name of the topic

  • msg_type (Union[type[supported_types.SupportedType], str]) – One of the SupportedTypes. This parameter can be set by passing the SupportedType data-type name as a string. See a list of supported types here

  • qos_profile (QoSConfig) – QoS profile for the topic

Example usage:

position = Topic(name="odom", msg_type="Odometry")
map_meta_data = Topic(name="map_meta_data", msg_type="MapMetaData")
class agents.ros.FixedInput#

Bases: agents.ros.Topic

A FixedInput can be provided to components as input and is similar to a Topic except components do not create a subscriber to it and whenever they read it, they always get the same data. The nature of the data depends on the msg_type specified.

Parameters:
  • name (str) – Name of the topic

  • msg_type (Union[type[supported_types.SupportedType], str]) – One of the SupportedTypes. This parameter can be set by passing the SupportedType data-type name as a string

  • fixed (str | Path) – Fixed input string or path to a file. Various SupportedTypes implement FixedInput processing differently.

Example usage:

text0 = FixedInput(
    name="text2",
    msg_type="String",
    fixed="What kind of a room is this? Is it an office, a bedroom or a kitchen? Give a one word answer, out of the given choices")
class agents.ros.MapLayer#

Bases: ros_sugar.config.BaseAttrs

A MapLayer represents a single input for a MapEncoding component. It can subscribe to a specific text topic.

Parameters:
  • subscribes_to (Topic) – The topic that this map layer is subscribed to.

  • temporal_change (bool) – Indicates whether the map should store changes over time for the same position. Defaults to False.

  • resolution_multiple (int) – A positive multiplication factor for the base resolution of the map grid, for fine or coarse graining the map. Defaults to 1.

  • pre_defined (list[tuple[np.ndarray, str]]) – An optional list of pre-defined data points in the layer. Each datapoint is a tuple of [position, text], where position is a numpy array of coordinates.

Example of usage:

my_map_layer = MapLayer(subscribes_to='my_topic', temporal_change=True)
class agents.ros.Route#

Bases: ros_sugar.config.BaseAttrs

A Route defines a topic to be routed to by the SemanticRouter, along with samples of similar text that the input must match to for the route to be used.

Parameters:
  • routes_to (Topic) – The topic that the input to the SemanticRouter is routed to.

  • samples (list[str]) – A list of sample text strings associated with this route.

Example of usage:

goto_route = Route(routes_to='goto', samples=['Go to the door', 'Go to the kitchen'])