FlexBE / flexbe_webui

ROS 2 Web-based user interface (editor + runtime control) for the FlexBE behavior engine.
Apache License 2.0
4 stars 3 forks source link
behavior flexbe gui robotics ros ros2 statemachine

FlexBE WebUI

FlexBE WebUI provides a user interface to FlexBE - The Flexible Behavior Engine.

The tool provides a graphical editor for design Hierarchical Finite State Machines (HFSM) for execution by the onboard Flexible Behavior Engine. During runtime, the UI enables the operator to supervise the execution of the onboard behavior, provide input where necessary, and take control if needed in what we term "collaborative autonomy".

This UI uses native Python and FastAPI along with a JavaScript-based web browser interface to interface with the Flexible Behavior Engine.

For detailed information on FlexBE see the documentation.

This version supersedes the 4.0.0 version of the flexbe_app interface. The flexbe_webui has the look of the classic flexbe_app with some notable improvements:

Note: This version 4.0.0 of flexbe_webui is designed to work with version 4.0+ of the flexbe_behavior_engine. If using an earlier 3.x.x version of flexbe_behavior_engine, use either the flexbe_app or the "beta-enhanced" branch of flexbe_webui (preferred).

Installation

Clone the following repos into your ROS workspace (e.g. $WORKSPACE_ROOT/src or ros2_ws/src):

Make sure that the branches are appropriate for your version (e.g. git checkout ros2-devel, iron, or jazzy as appropriate)

Note: This UI is designed for improved handling of concurrent state execution and is compatible with the ROS 2 version 4.+ of the flexbe_app; it will not work with older versions such as galactic or humble of the flexbe_behavior_engine . It is likely that the iron or ros2-devel versions of flexbe_behavior_engine should work on those older ROS 2 systems if you build from source.

Install any required dependencies.

The flexbe_webui requires consistent versions of several Python dependencies; these are specified in the install_requires field of the setup.py and the requires.txt file.

The system has currently been tested on Ubuntu 22.04 with the following Python packages pip installed locally via the requires.txt:

On Ubuntu 24.04 (i.e., for ROS 2 Jazzy), the system installs for sudo apt install python3-websockets python3-pydantic python3-fastapi are sufficient and can be installed via rosdep from the package.xml dependencies.

Unfortunately, PySide6 is not in the current Ubuntu 24.04 binaries. In 24.04 you are required to set up a virtual environment and cannot do a local install.

The following has been tested under 24.04. First go to your WORKSPACE_ROOT (e.g. ros2_ws) and run the following commands.

virtualenv -p python3 --system-site-packages ./venv
source ./venv/bin/activate
touch ./venv/COLCON_IGNORE
cd src/

This creates a venv folder that we will COLCON_IGNORE during builds.

NOTE: In this set up, we are choosing to use all the standard system dependencies (e.g. numpy as required by ROS message handling.) This approach is NOT strictly segregating your Python environment - "Caveat Emptor" for this new development.

Now colcon build from this environment.

If the Python files are not installed automatically, you can directly go to the $WORKSPACE_ROOT/src/flexbe_webui folder and :

This should install the required PySide6 in this activated virtual environment under $WORKSPACE_ROOT/venv/lib/python3.12/site-packages.

To run, just add this site-packages path to your PYTHONPATH using:


Running the FlexBE Web-based User Interface.

To execute the runtime Operator Control Station (OCS) on one machine, you may choose one of either:

To assist in debugging development, or to run the UI on separate machine, we can start the webui_client separately

To run the full OCS nodes individually use

To run the full FlexBE system, including the onboard behavior engine and the OCS, on one desktop in one terminal

FlexBE State and Behavior Discovery

The system explores the ROS workspace searching for specific tags in the package.xml files.

State packages

A package is a state package for FlexBE if its package.xml declares the export of flexbe_states:

<package>
...
  <export>
    <flexbe_states />
  </export>
...
</package>

It is then expected to provide Python class definitions as described in Developing Basic States.

Example: flexbe_states

Behavior packages

A behavior package contains the code and manifest files generated by the FlexBE user interface.

Usually, you do not need to modify it manually. Again, a behavior package is identified by an export statement in its package.xml:

<package>
...
  <export>
    <flexbe_behaviors />
  </export>
...
</package>

A behavior package is expected to provide a manifest folder which contains the manifests for all provided behaviors. The behaviors are located in a Python module named like the package and contained in the src folder.

Publications

Please use the following publications for reference when using FlexBE and the FlexBE WebUI


Known issues