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.
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.
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
- Introduction to workflows
- JSON Diagram Format
- Crossflow Docs
- Bevy Engine
- Bevy Cheat Book
- Rust Book
- Install Rust
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.
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.
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
For Ubuntu specifically you can run these commands to get the dependencies you need:
- To install
rustup
andcargo
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
Once dependencies are installed you can run the tests:
cargo test
You can find some illustrative examples for building workflows out of diagrams:
- Calculator
- Door manager that uses zenoh and protobuf
- Mock navigation system using ROS
To use crossflow
in your own Rust project, you can run
cargo add crossflow