Lifecycle and System Modes

Table of contents

Introduction and Goal

Modern robotic software architectures often follow a layered approach. The layer with the core algorithms for SLAM, vision-based object recognition, motion planning, etc. is often referred to as skill layer or functional layer. To perform a complex task, these skills are orchestrated by one or more upper layers named executive layer and planning layer. Other common names are task and mission layer or deliberation layer(s). In the following, we used the latter term.

We observed three different but closely interwoven aspects to be handled on the deliberation layer:

  1. Task Handling: Orchestration of the actual task, the straight-forward, error-free flow.
  2. Contingency Handling: Handling of task-specific contingencies, e.g., expectable retries and failure attempts, obstacles, low battery.
  3. System Error Handling: Handling of exceptions, e.g., sensor/actuator failures.

The mechanisms being used to orchestrate the skills are service and action calls, re-parameterizations, set values, activating/deactivating of components, etc. We distinguish between function-oriented calls to a running skill component (set values, action queries, etc.) and system-oriented calls to individual or multiple components (switching between component modes, restart, shutdown, etc.).

Interaction between skill and deliberation layer

Analogously, we distinguish between function-oriented notifications from the skill layer in form a feedback on long-running service calls, messages on relevant events in the environment, etc. and system-oriented notifications about component failures, hardware errors, etc.

Our observation is that interweaving of task handling, contingency handling, and system error handling generally leads to a high complexity of the control flow on the deliberation layer. Yet, we hypothesize that this complexity can be reduced by introducing appropriate abstractions for system-oriented calls and notifications.

Therefore, our goal within this work is to provide suitable abstractions and framework functions for (1.) system runtime configuration and (2.) system error and contingency diagnosis, to reduce the effort for the application developer of designing and implementing the task, contingency and error handling.

This goal is illustrated in the following example architecture, which is described and managed based on a model file:

High-level Architecture

The main features of the approach are (detailed in the remainder):

  1. Extended Lifecycle: Extensible concept to specify the runtime states of components, i.e ROS 2 lifecycle nodes.
  2. System Hierarchy and Modes: Modeling approach for specifying a ROS system in terms of its system hierarchy and system modes, i.e. different (sub-)system configurations.
  3. Mode Manager: A module to manage and change the system runtime configuration.
  4. Mode Inference: A module for deriving the entire system state and mode from observable system information, i.e. states, modes, and parameters of its components.
  5. Diagnostics: Diagnosis module for deriving relevant information from the operating systems, the hardware and the functional components.

Requirements

The list of requirements is maintained in the doc folder of the micro-ROS system modes repository, at: https://github.com/micro-ROS/system_modes/blob/master/system_modes/doc/requirements.md

Background: ROS 2 Lifecycle

Our approach is based on the ROS 2 Lifecycle. The primary goal of the ROS 2 lifecycle is to allows greater control over the state of a ROS system. It allows consistent initialization, restart and/or replacing of system parts during runtime. It provides a default lifecycle for managed ROS 2 nodes and a matching set of tools for managing lifecycle nodes.

The description of the concept can be found at: http://design.ros2.org/articles/node_lifecycle.html
The implementation of the Lifecycle Node is described at:
https://index.ros.org/doc/ros2/Managed-Nodes/.

Main Features

Extended Lifecycle

In micro-ROS, we extend the ROS 2 lifecycle by allowing to specify modes, i.e. substates, specializing the active *state based on the standard ROS 2 parameters mechanism. We implemented this concept based on rcl and rclcpp for ROS 2 and micro-ROS.

Documentation and code can be found at:
github.com:system_modes/README.md#lifecycle

System Hierarchy and Modes

We provide a modeling concept for specifying the hierarchical composition of systems recursively from nodes and for specifying the states and modes of systems and (sub-)systems with the extended lifecycle, analogously to nodes. This system modes and hierarchy (SMH) model also includes an application-specific the mapping of the states and modes along the system hierarchy down to nodes.

The description of this model can be found at:
github.com:system_modes/README.md#system-modes
A simple example is provided at:
github.com:system_modes_examples/README.md#example-mode-file

Mode Inference

The mode inference infers the entire system states (and modes) based on the lifecycle states, modes, and parameter configuration of its components, i.e. the ROS 2 lifecyle nodes. It parses the SMH model and subscribes to lifecycle/mode change requests, lifecycle/mode changes, and parameter events.

Based on the lifecycle change events it knows the actual lifecycle state of all nodes. Based on parameter change events it knows the actual parameter values of all nodes, which allows inference of the modes of all nodes based on the SMH model. Based on the SMH model and the inferred states and modes of all nodes, states and modes of all (sub-)systems can be inferred bottom-up along the system hierarchy. This can be compared to the latest requested states and modes to detect a deviation.

The documentation and code can be found at:
github.com:system_modes/README.md#mode-inference
The mode inference can be best observed in the mode monitor, a console-based debugging tool, see:
github.com:system_modes/README.md#mode-monitor

Mode Manager

Building upon the Mode Inference mechanism, the mode manager provides additional services and topics to manage and adapt system states and modes according to the specification in the SMH model.

The documentation and code can be found at:
github.com:system_modes/README.md#mode-manager
A simple example is provided at:
github.com:system_modes_examples/README.md#setup

Roadmap

2018

  • Extended lifecycle concept and implementation for ROS 2 and micro-ROS.
  • Modeling concept to specify system hierarchy as well as system modes of systems, subsystems, and their mapping along the system hierarchy down to nodes.
  • Mode inference and mode manager in C++ for ROS 2.

2019

  • Specific implementation of mode manager for micro-ROS as may be necessary.
  • Diagnostics framework for micro-ROS, interoperating with ROS 2 diagnostics.
  • MCU-specific diagnostics functions for resource usage on RTOS layer, latencies, statistics from middleware, etc.
  • Integration of mode manager with real-time executor and/or roslaunch.

2020

  • Lightweight concept for specifying error propagations between nodes and subsystems.

Note: The extension of the ACTIVE state by modes (substates) was originally planned for 2020 but brought forward in 2018.

Acknowledgments

This activity has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement n° 780785).