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#
A topic is an idomatic wrapper for a ROS topic, which is essentially a pub/sub queue. 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. |
|
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. |
|
A MapLayer represents a single input for a MapEncoding component. It can subscribe to a specific text topic. |
|
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.Topic#
Bases:
ros_sugar.io.Topic
A topic is an idomatic wrapper for a ROS topic, which is essentially a pub/sub queue. 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
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:
ros_sugar.config.BaseAttrs
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'])