Components
In the AICA application framework, components are the building blocks of advanced robot behaviors.
AICA components are wrappers for ROS 2 nodes and lifecycle nodes using dynamic composition with additional abstractions for enhanced modularity and developer convenience.
Components process data in a periodic step function, are configured using parameters and transfer data as signals to other components and hardware interfaces. Key component states are published as predicates. Components may also expose specific services.
Periodic behavior
A key design concept for AICA components is the idea of periodic behavior.
In ROS, nodes are generally driven through callbacks, triggered either by a subscription, parameter change event, or service request. Nodes that wish to publish data continuously normally configure an internal timer to trigger a callback function at regular intervals.
This periodic execution is built in to AICA components by default. Components have an execution rate defined by
a rate
parameter (the frequency in Hertz for the number of execution steps per second), and automatically publish data
attributes and predicates periodically.
Components can implement specific calculations to occur on step.
Lifecycle components only execute the periodic step function when they are in the ACTIVE
lifecycle state.
Parameters
Components support the standard ROS 2 parameter interface types.
- Boolean (true / false)
- Integer (whole numbers)
- Double (floating point numbers)
- String (plain text)
They can additionally be an array (list) of multiple values of the same type:
- Boolean array
- Integer array
- Double array
- String array
Signals
Components define signals as inputs (subscribers) and outputs (publishers). Refer to Signals for more information.
By default, lifecycle components only publish outputs when they are in the ACTIVE
lifecycle state.
Predicates
Components declare and broadcast key internal states as predicate messages, which are used by the Dynamic State Engine to trigger events. Refer to Events for more information.
Lifecycle predicates
Lifecycle components are based on lifecycle nodes and have additional predicates for each lifecycle state:
is_unconfigured
is_inactive
is_active
is_finalized
Auto lifecycle events
When a lifecycle components is loaded, it starts in the unconfigured state and normally requires an external trigger to transition into different states.
In the AICA framework, lifecycle components can auto-configure and auto-activate themselves. Associating
the is_unconfigured
predicate with a lifecycle: configure
event enables the component to automatically configure
itself. Equivalently, the is_inactive
predicate can be used to trigger a lifecycle: activate
event.
Services
Components can provide service endpoints to trigger specific behaviors on demand. For compatibility with the application syntax and the Dynamic State Engine, the component service are limited to one of two request types:
- Service request with no payload
- Service request with a string payload
The service response object for both types contains an execution status and message and is automatically handled by the Dynamic State Engine.