Skip to content

open-rmf/crossflow

style ci_linux ci_windows ci_web Crates.io Version

Important

For the ROS 2 integration feature, check out the ros2 branch.

That feature is kept separate for now because it requires additional non-Rust setup. It will be merged into main after dynamic message introspection is finished.

Reactive Programming and Workflow Engine in Bevy

This library provides sophisticated reactive programming for the bevy ECS. In addition to supporting one-shot chains of async operations, it can support reusable workflows with parallel branches, synchronization, races, and cycles. These workflows can be hierarchical, so a workflow can be used as a building block by other workflows.

This library can serve two different but related roles:

  • Implementing one or more complex async state machines inside of a Bevy application
  • General workflow execution

If you are a bevy developer, then you may be interested in that first role, because crossflow is deeply integrated with bevy's ECS and integrates seamlessly into typical applications that are implemented with bevy. If you just want something that can execute a graphical description of a workflow, then you will be interested in that second role, in which case bevy is just an implementation detail which might or might not matter to you.

sense-think-act workflow

Why use crossflow?

There are several different categories of problems that crossflow sets out to solve. If any one of these use-cases is relevant to you, it's worth considering crossflow as a solution:

  • Coordinating async activities (e.g. filesystem i/o, network i/o, or long-running calculations) with regular bevy systems
  • Calling one-shot systems on an ad hoc basis, where the systems require an input value and produce an output value that you need to use
  • Defining a procedure to be followed by your application or by an agent or pipeline within your application
  • Designing a complex state machine that gradually switches between different modes or behaviors while interacting with the world
  • Managing many parallel threads of activities that need to be synchronized or raced against each other

Helpful Links

Middleware Support

Crossflow has out-of-the box support for several message-passing middlewares, and we intend to keep growing this list:

  • gRPC with protobuf messages (feature = "grpc")
  • zenoh with protobuf or json messages (feature = "zenoh")
  • ROS 2 via rclrs (ros2 branch, feature = "ros2")

Support for each of these middlewares is feature-gated so that the dependencies are not forced on users who do not need them. To activate all available middleware support at once, use the maximal feature.

Bevy Compatibility

Crossflow may be supported across several releases of Bevy in the future, although we only have one for the time being:

bevy crossflow
0.16 0.0.x

The main branch currently targets bevy version 0.16 (crossflow 0.0.x). We will try to keep main up to date with the latest release of bevy, but you can expect a few months of delay.

Dependencies

This is a Rust project that often uses the latest language features. We recommend installing rustup and cargo using the installation instructions from the Rust website: https://www.rust-lang.org/tools/install

Ubuntu Dependencies

For Ubuntu specifically you can run these commands to get the dependencies you need:

  • To install rustup and cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Make sure you have basic compilation tools installed
sudo apt-get install build-essential

Build

Once dependencies are installed you can run the tests:

cargo test

You can find some illustrative examples for building workflows out of diagrams:

To use crossflow in your own Rust project, you can run

cargo add crossflow

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6

Languages