diff --git a/.github/workflows/ci_linux.yaml b/.github/workflows/ci_linux.yaml index 31df8328..dbd8670a 100644 --- a/.github/workflows/ci_linux.yaml +++ b/.github/workflows/ci_linux.yaml @@ -29,7 +29,7 @@ jobs: run: sudo apt-get update - name: Get apt dependencies - run: sudo apt-get install protobuf-compiler + run: sudo apt-get install protobuf-compiler libgtk-3-dev libasound2-dev libudev-dev - name: Setup rust run: rustup default ${{ matrix.rust-version }} diff --git a/Cargo.toml b/Cargo.toml index 5a07d20e..9fc8d6ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,7 @@ features = ["maximal"] [workspace.dependencies] anyhow = "1.0" axum = { version = "0.8.4", default-features = false } +bevy = "0.16" bevy_app = "0.16" bevy_derive = "0.16" bevy_diagnostic = "0.16" @@ -54,6 +55,7 @@ tonic-prost = "0.14" tonic-prost-build = "0.14" prost-build = "0.14" prost-reflect = "0.16" +rand = "0.9.0" tracing = "0.1.41" tracing-subscriber = "0.3.19" futures = "0.3.31" @@ -184,6 +186,8 @@ members = [ "examples/diagram/calculator_ops_catalog", "examples/native", "examples/handbook_snippets", + "examples/diagram/traffic_app", + "examples/diagram/traffic_ops_catalog", ] [[bin]] diff --git a/diagram-editor/Cargo.toml b/diagram-editor/Cargo.toml index 6b405142..b2ebecd7 100644 --- a/diagram-editor/Cargo.toml +++ b/diagram-editor/Cargo.toml @@ -27,6 +27,7 @@ path = "server/lib.rs" [dependencies] axum = { workspace = true, features = ["json"], default-features = false } +bevy = { workspace = true } bevy_app = { workspace = true } bevy_ecs = { workspace = true } crossflow = { version = "0.0.7", path = "..", features = ["diagram", "trace"] } diff --git a/diagram-editor/server/basic_executor.rs b/diagram-editor/server/basic_executor.rs index 9c8fb00f..dce2cba5 100644 --- a/diagram-editor/server/basic_executor.rs +++ b/diagram-editor/server/basic_executor.rs @@ -16,10 +16,12 @@ */ use crate::{ServerOptions, new_router}; +use bevy::winit::WinitPlugin; use bevy_app::App; use clap::Parser; use crossflow::{ - CrossflowExecutorApp, Diagram, DiagramError, Outcome, RequestExt, RunCommandsOnWorldExt, + CrossflowExecutorApp, CrossflowPlugin, Diagram, DiagramError, Outcome, RequestExt, + RunCommandsOnWorldExt, }; use std::thread; use std::{fs::File, str::FromStr}; @@ -111,6 +113,39 @@ pub async fn serve( app.run() }); + axum_serve(router_receiver, args).await +} + +pub fn custom_serve( + args: ServeArgs, + setup: impl FnOnce() -> BasicExecutorSetup + 'static, +) -> Result<(), Box> { + println!("Serving diagram editor at http://localhost:{}", args.port); + + let BasicExecutorSetup { mut app, registry } = setup(); + // If WinitPlugin is added, add CrossflowPlugin instead of + // CrossflowExecutorApp to prevent overlapping plugins + if app.is_plugin_added::() { + app.add_plugins(CrossflowPlugin::default()); + } else { + app.add_plugins(CrossflowExecutorApp::default()); + } + + let (router_sender, router_receiver) = tokio::sync::oneshot::channel(); + thread::spawn(move || { + let rt = tokio::runtime::Runtime::new().unwrap(); + let _ = rt.block_on(axum_serve(router_receiver, args)); + }); + let router = new_router(&mut app, registry, ServerOptions::default()); + let _ = router_sender.send(router); + app.run(); + Ok(()) +} + +pub async fn axum_serve( + router_receiver: tokio::sync::oneshot::Receiver, + args: ServeArgs, +) -> Result<(), Box> { let router = router_receiver.await?; let listener = tokio::net::TcpListener::bind(("localhost", args.port)) @@ -189,19 +224,19 @@ pub fn run_custom_setup( args: Option, setup: impl FnOnce() -> BasicExecutorSetup + Send + 'static, ) -> Result<(), Box> { - let rt = tokio::runtime::Runtime::new().unwrap(); - rt.block_on(run_custom_setup_async(args, setup)) + let args = args.unwrap_or_else(|| Args::parse()); + match args.command { + Commands::Run(args) => { + let rt = tokio::runtime::Runtime::new().unwrap(); + rt.block_on(async_headless(args, setup)) + } + Commands::Serve(args) => custom_serve(args, setup), + } } -/// Run a custom setup of a basic executor asynchronously. For more information, -/// see [`run_custom_setup`]. -pub async fn run_custom_setup_async( - args: Option, +pub async fn async_headless( + args: RunArgs, setup: impl FnOnce() -> BasicExecutorSetup + Send + 'static, ) -> Result<(), Box> { - let args = args.unwrap_or_else(|| Args::parse()); - match args.command { - Commands::Run(args) => headless(args, setup), - Commands::Serve(args) => serve(args, setup).await, - } + headless(args, setup) } diff --git a/examples/diagram/traffic_app/Cargo.toml b/examples/diagram/traffic_app/Cargo.toml new file mode 100644 index 00000000..0363ef15 --- /dev/null +++ b/examples/diagram/traffic_app/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "traffic_app" +version = "0.1.0" +edition = "2024" + +[lib] +name = "traffic_app" + +[[bin]] +path = "src/main.rs" +name = "traffic_app" + +[dependencies] +bevy = { workspace = true } +bevy_ecs = { workspace = true } +crossflow = { version = "0.0.7", path = "../../..", features = ["diagram"] } +crossflow_diagram_editor = { path = "../../../diagram-editor", features = ["basic_executor"] } +rand = { workspace = true } +traffic_ops_catalog = { path = "../traffic_ops_catalog" } diff --git a/examples/diagram/traffic_app/README.md b/examples/diagram/traffic_app/README.md new file mode 100644 index 00000000..0a82d5bc --- /dev/null +++ b/examples/diagram/traffic_app/README.md @@ -0,0 +1,68 @@ +# Traffic app example + +This is an example that enables users to build workflows via the diagram editor +and watch how their node connections result in different behaviors in a simple +traffic simulator. It is designed to support and demonstrate various `crossflow` +operations via the diagram editor. + +## Basic workflow + +Basic/utility nodes to get started: + +| Node | Use case | Input | Output | +| ------ |------------ | ------- | -------- | +| `start_engine` | Takes in a float representing the requested trip distance, and toggles the engine on and sets the distance to destination in `VehicleState`. | `f32` | `Result<(), TripRequestError>` | +| `detect_kinematics` | A continuous service node that monitors the current vehicle velocity and acceleration via query, and streams them out. | - | - | +| `process_kinematics` | This node pulls the newest `Kinematics` message in the buffer to determine the distance travelled by the vehicle in the last time step. It outputs a `(f32, f32)` representing the distance travelled and velocity in the y-direction. It requires a key to access the `Kinematics` buffer. | `((), BufferKey)` | `Result<(f32, f32), ()>` | +| `update_vehicle_state` | Takes in kinematics data in the last cycle by the vehicle and updates the `VehicleState` resource. | `(f32, f32)` | - | +| `move_vehicle` | Given the input `MoveVehicle` command, attempt to move the simulated vehicle accordingly. | `MoveVehicle` | - | +| `wait_for_destination_reached` | A continuous service that checks the current `VehicleState` and responds when the vehicle has completed travelling the requested distance. | - | - | +| `abandon_trip` | A continuous service with an EventReader for `AbandonTrip` events to end the workflow. | - | - | +| `stop_engine` | Stops the vehicle, turns its engine off, and reset state parameters. | - | - | +| `trip_error` | A logger node that prints out trip errors. | `TripRequestError` | - | + +### Example + +Try loading `base_workflow.json` into the diagram editor and observe the vehicle travel the requested distance. Note that in this workflow, the vehicle ignores its environment (e.g. traffic signal, obstacles, etc.) and simply moves forward at the default speed. + + +## Intermediate workflows + +You may wish to create a more complex workflow that accounts for other factors, e.g. +- Respect traffic signals and only move forward when the traffic light is green +- Slow down or stop the vehicle when there are pedestrians/obstacles in front of the vehicle +- Any combination of the above + +The example application comes with some additional nodes to experiment with: + +| Node | Use case | Input | Output | +| ------ |------------ | ------- | -------- | +| `begin_vehicle_check` | Outputs the vehicle's current state checklist in the form of a HashMap. This can be connected to a [Split](https://open-rmf.github.io/crossflow-handbook/parallelism.html#split) operation that sends the HashMap's elements down different branches. | - | `HashMap` | +| `vehicle_check_ready` | Takes in the current `ReadyState` of a single vehicle checklist element, and outputs `ReadyState::Ready`. This node is currently used to represent conducting checks on each checklist item. | `ReadyState` | `ReadyState` | +| `validate_vehicle_check` | Takes in a collection of `ReadyState`, and checks that all the checklist items are ready. This can be preceded by a [Join](https://open-rmf.github.io/crossflow-handbook/join.html) operation to demonstrate combining and synchronizing outputs of various nodes. | `Vec` | `Result<(), TripRequestError>` | +| `detect_traffic_signal` | A continuous service node that monitors the upcoming traffic signal via events, and streams them out. In more complex workflows, the stream out can be connected to a [Buffer](https://open-rmf.github.io/crossflow-handbook/buffers.html) node to manage data being received at different rates. | - | - | +| `process_traffic_signal` | This node checks the newest `TrafficSignal` message in the buffer to determine the best vehicle move. It only cares about the latest signal. It requires a key to access the `TrafficSignal` buffer. | `((), BufferKey)` | `Result` | +| `configure_obstacles_thresholds` | This node takes in an optional config for users to configure `ObstacleLimits` which affects whether obstacles surrounding the vehicle is considered to be close enough. The configured values are updated to the `WorldLimits` resource, and will be reset in the `stop_engine` node. | - | - | +| `detect_obstacles` | A continuous service node that monitors the current obstacles around the vehicle via query, and streams them out. In more complex workflows, the stream out can be connected to a [Buffer](https://open-rmf.github.io/crossflow-handbook/buffers.html) node to manage data being received at different rates. | - | - | +| `process_obstacles` | This node pulls the newest `Obstacles` message in the buffer to determine the best vehicle move. It only cares about the latest detected obstacles. It requires a key to access the `Obstacles` buffer. | `((), BufferKey)` | `Result` | +| `filter_arriving` | This node takes in an optional config for users to configure the distance-to-intersection threshold for `ApproachingIntersection` messages. | `ApproachingIntersection` | `Result` | +| `approaching_intersection` | A continuous service node that calculates the main vehicle's distance to the next intersection, and streams out `ApproachingIntersection` messages when the vehicle is arriving at the intersection line. | - | - | +| `check_change_lane` | This node takes in the best vehicle move determined by the previous node, and checks for adjacent obstacles to decide whether the vehicle should attempt at changing lane. This only takes effect if the `allow_change_lane` feature is enabled via the simulator UI. | `(MoveVehicle, BufferKey)` | `MoveVehicle` | +| `follow_speed_limit` | This node checks the current speed limit and slows down the vehicle if the current speed or commanded speed has exceeded the limit. | `MoveVehicle` | `MoveVehicle` | +| `join_traffic_signal_and_obstacles` | This node checks the input `TrafficSignalWithObstacles` constructed by a preceding [Join](https://open-rmf.github.io/crossflow-handbook/join.html) operation to determine the best vehicle move. It accounts for both `TrafficSignal` and `Obstacles` data, and chooses the best move based on both factors. | `TrafficSignalWithObstacles` | `Result` | +| `listen_traffic_signal_and_obstacles` | This node checks the latest `TrafficSignal` and/or `Obstacles` buffers via a preceding [Listen](https://open-rmf.github.io/crossflow-handbook/listen.html) operation to determine the best vehicle move. Since Listen operations are activated when any of the connected buffers are modified, if either buffer is empty, it will calculate the best move based on the other buffer. If both buffers contain messages, it will choose the best move based on both factors. It requires keys to both `TrafficSignal` and `Obstacles` buffers. | `TrafficSignalWithObstaclesAccessor` | `Result` | + +### Examples + +You may consider starting with the ready-made JSON workflows in `traffic_app/diagrams/` and observe how the vehicle behaves differently between them. Try experimenting with the various settings, such as buffer sizes and fetch types (clone vs. pull) to see how they affect the workflows. + + +## Try it out! + +From the current directory, run + +```bash +cargo run -- serve +``` + +Then open http://localhost:3000 to run the diagram editor app from your web browser. diff --git a/examples/diagram/traffic_app/assets/fonts/FiraSans-SemiBold.ttf b/examples/diagram/traffic_app/assets/fonts/FiraSans-SemiBold.ttf new file mode 100644 index 00000000..821a43d7 Binary files /dev/null and b/examples/diagram/traffic_app/assets/fonts/FiraSans-SemiBold.ttf differ diff --git a/examples/diagram/traffic_app/assets/sprites/License.txt b/examples/diagram/traffic_app/assets/sprites/License.txt new file mode 100644 index 00000000..be00c90a --- /dev/null +++ b/examples/diagram/traffic_app/assets/sprites/License.txt @@ -0,0 +1,21 @@ + + + Foliage Pack + + by Kenney Vleugels (Kenney.nl) + + ------------------------------ + + License (Creative Commons Zero, CC0) + http://creativecommons.org/publicdomain/zero/1.0/ + + You may use these assets in personal and commercial projects. + Credit (Kenney or www.kenney.nl) would be nice but is not mandatory. + + ------------------------------ + + Donate: http://support.kenney.nl + Request: http://request.kenney.nl + + Follow on Twitter for updates: + @KenneyNL \ No newline at end of file diff --git a/examples/diagram/traffic_app/assets/sprites/cars/car_blue_1.png b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_1.png new file mode 100644 index 00000000..cb802c65 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_1.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/cars/car_blue_2.png b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_2.png new file mode 100644 index 00000000..9cd37891 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_2.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/cars/car_blue_3.png b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_3.png new file mode 100644 index 00000000..ca044208 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_3.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/cars/car_blue_4.png b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_4.png new file mode 100644 index 00000000..077f191a Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_4.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/cars/car_blue_5.png b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_5.png new file mode 100644 index 00000000..2f9ac933 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/cars/car_blue_5.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_001.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_001.png new file mode 100644 index 00000000..73c5c089 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_001.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_002.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_002.png new file mode 100644 index 00000000..ee7a257e Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_002.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_003.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_003.png new file mode 100644 index 00000000..73bd5d0c Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_003.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_004.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_004.png new file mode 100644 index 00000000..735cbef2 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_004.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_005.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_005.png new file mode 100644 index 00000000..b7b82e54 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_005.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_006.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_006.png new file mode 100644 index 00000000..dd7fc909 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_006.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_007.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_007.png new file mode 100644 index 00000000..81ab8e7b Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_007.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_008.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_008.png new file mode 100644 index 00000000..26f34d23 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_008.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_009.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_009.png new file mode 100644 index 00000000..5625aa86 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_009.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_010.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_010.png new file mode 100644 index 00000000..5a83771f Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_010.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_011.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_011.png new file mode 100644 index 00000000..bb878547 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_011.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_012.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_012.png new file mode 100644 index 00000000..650b613d Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_012.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_013.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_013.png new file mode 100644 index 00000000..74edf9a3 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_013.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_014.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_014.png new file mode 100644 index 00000000..61189131 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_014.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_015.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_015.png new file mode 100644 index 00000000..6976a22c Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_015.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_016.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_016.png new file mode 100644 index 00000000..c00497b3 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_016.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_017.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_017.png new file mode 100644 index 00000000..64b84493 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_017.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_018.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_018.png new file mode 100644 index 00000000..39054003 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_018.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_019.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_019.png new file mode 100644 index 00000000..d259d4c0 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_019.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_020.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_020.png new file mode 100644 index 00000000..a23c7657 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_020.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_021.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_021.png new file mode 100644 index 00000000..c4defbeb Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_021.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_022.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_022.png new file mode 100644 index 00000000..c647564a Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_022.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_023.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_023.png new file mode 100644 index 00000000..a007f1ea Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_023.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_024.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_024.png new file mode 100644 index 00000000..149bc7da Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_024.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_025.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_025.png new file mode 100644 index 00000000..5f31fe0c Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_025.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_026.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_026.png new file mode 100644 index 00000000..92af9cda Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_026.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_027.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_027.png new file mode 100644 index 00000000..f23c167d Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_027.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_028.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_028.png new file mode 100644 index 00000000..4d2c2179 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_028.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_029.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_029.png new file mode 100644 index 00000000..fde81ae3 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_029.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_030.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_030.png new file mode 100644 index 00000000..01630c36 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_030.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_031.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_031.png new file mode 100644 index 00000000..08d6d064 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_031.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_032.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_032.png new file mode 100644 index 00000000..36e573bf Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_032.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_033.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_033.png new file mode 100644 index 00000000..762fb46e Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_033.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_034.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_034.png new file mode 100644 index 00000000..804370ec Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_034.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_035.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_035.png new file mode 100644 index 00000000..d1d361e1 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_035.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_036.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_036.png new file mode 100644 index 00000000..90289ff7 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_036.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_037.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_037.png new file mode 100644 index 00000000..1e006801 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_037.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_038.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_038.png new file mode 100644 index 00000000..f1327a6c Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_038.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_039.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_039.png new file mode 100644 index 00000000..108bd4ba Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_039.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_040.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_040.png new file mode 100644 index 00000000..f642c67c Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_040.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_041.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_041.png new file mode 100644 index 00000000..9a00860c Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_041.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_042.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_042.png new file mode 100644 index 00000000..89e56790 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_042.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_043.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_043.png new file mode 100644 index 00000000..e399a1fd Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_043.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_044.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_044.png new file mode 100644 index 00000000..df8f4dd8 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_044.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_045.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_045.png new file mode 100644 index 00000000..d24b53f4 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_045.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_046.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_046.png new file mode 100644 index 00000000..5e1abe5c Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_046.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_047.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_047.png new file mode 100644 index 00000000..c7d81b48 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_047.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_048.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_048.png new file mode 100644 index 00000000..9b38e8a2 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_048.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_049.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_049.png new file mode 100644 index 00000000..d8e9a9e4 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_049.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_050.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_050.png new file mode 100644 index 00000000..0a781bd7 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_050.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_051.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_051.png new file mode 100644 index 00000000..3140ca70 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_051.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_052.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_052.png new file mode 100644 index 00000000..6c98dcdf Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_052.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_053.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_053.png new file mode 100644 index 00000000..03b32c3d Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_053.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_054.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_054.png new file mode 100644 index 00000000..1887c803 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_054.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_055.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_055.png new file mode 100644 index 00000000..2b365864 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_055.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_056.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_056.png new file mode 100644 index 00000000..962a7635 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_056.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_057.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_057.png new file mode 100644 index 00000000..97ac4237 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_057.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_058.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_058.png new file mode 100644 index 00000000..0729c864 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_058.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_059.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_059.png new file mode 100644 index 00000000..5d89ebfb Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_059.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_060.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_060.png new file mode 100644 index 00000000..cdff4f4f Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_060.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_061.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_061.png new file mode 100644 index 00000000..855aab9d Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_061.png differ diff --git a/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_062.png b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_062.png new file mode 100644 index 00000000..0c5bc292 Binary files /dev/null and b/examples/diagram/traffic_app/assets/sprites/foliage/foliagePack_062.png differ diff --git a/examples/diagram/traffic_app/diagrams/base_workflow.json b/examples/diagram/traffic_app/diagrams/base_workflow.json new file mode 100644 index 00000000..1b40db47 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/base_workflow.json @@ -0,0 +1,757 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "detect_kinematics", + "wait_for_destination_reached", + "abandon_trip" + ] + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "description": "Basic workflow that moves the vehicle forward until it travelled the requested distance. All traffic factors will be ignored.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "00601a8e42226dbfe059fddedd0bf82dacf110b8", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 350, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 350, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "5850f6e5-d48f-497b-b63b-f842c92b1d55", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "3d891894-2d97-43f1-b79a-9097141382ef", + "type": "fork_result", + "position": { + "x": 350, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "a0ffbab2-cb24-4b65-b2a1-3de63e5ef04e", + "type": "node", + "position": { + "x": 350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "c0d99733-528b-4010-8e94-72af1870625d", + "type": "node", + "position": { + "x": 350, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "6932c4f9-f387-491a-9827-80bb860abe2d", + "type": "node", + "position": { + "x": 600, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "3970b669-8e35-49ce-afdf-a602b958ba66", + "type": "node", + "position": { + "x": 850, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "756cba1a-d973-495e-8d31-daec68904dc7", + "type": "buffer", + "position": { + "x": 850, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "515b40ee-fec9-40f9-87bd-284f608b0d8c", + "type": "buffer_access", + "position": { + "x": 782.5, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "6b0fc076-851e-42d2-8ed0-794ec7a83150", + "type": "node", + "position": { + "x": 782.5, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "19f96a15-aafb-4039-afed-d778f631eec1", + "type": "node", + "position": { + "x": 782.5, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "37ed8a77-a189-460a-80dc-aba069db5acc", + "type": "fork_clone", + "position": { + "x": 600, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "detect_kinematics", + "wait_for_destination_reached", + "abandon_trip" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "8da9503c-c271-423d-95d7-50e755ad409f", + "type": "fork_result", + "position": { + "x": 782.5, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "25c3c257-8335-4ee5-93ae-11d259f1982b", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + } + ], + "edges": [ + { + "id": "c2ae56d9-2b6e-44c3-bd85-39d671f94a28", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "c0d99733-528b-4010-8e94-72af1870625d", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f53d4386-0216-406e-9c34-0e7dc4f343a1", + "source": "3d891894-2d97-43f1-b79a-9097141382ef", + "sourceHandle": "forkResultErr", + "target": "5850f6e5-d48f-497b-b63b-f842c92b1d55", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b6966eea-1eb9-496c-8f53-dccc005db263", + "source": "a0ffbab2-cb24-4b65-b2a1-3de63e5ef04e", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c6783513-b32a-40d2-98b6-9be5c56788e7", + "source": "c0d99733-528b-4010-8e94-72af1870625d", + "sourceHandle": null, + "target": "3d891894-2d97-43f1-b79a-9097141382ef", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "19a6c5e6-7fde-4c79-a6a9-84b02253b275", + "source": "6932c4f9-f387-491a-9827-80bb860abe2d", + "target": "a0ffbab2-cb24-4b65-b2a1-3de63e5ef04e", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f3c1b6ce-0b2a-4041-8ba3-fcfe303b3d6f", + "source": "756cba1a-d973-495e-8d31-daec68904dc7", + "target": "515b40ee-fec9-40f9-87bd-284f608b0d8c", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "0076f698-aec4-4248-ba0b-56f914a77981", + "source": "515b40ee-fec9-40f9-87bd-284f608b0d8c", + "target": "6b0fc076-851e-42d2-8ed0-794ec7a83150", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "6bffeabc-5f60-43fd-9f0f-9a51f9f565bf", + "source": "3970b669-8e35-49ce-afdf-a602b958ba66", + "sourceHandle": "dataStream", + "target": "756cba1a-d973-495e-8d31-daec68904dc7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7a0f1218-dd2e-49fa-ad6c-17eb9d65e220", + "source": "37ed8a77-a189-460a-80dc-aba069db5acc", + "target": "3970b669-8e35-49ce-afdf-a602b958ba66", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e4e0232b-cb92-43de-8b63-25c6fc982b34", + "source": "3d891894-2d97-43f1-b79a-9097141382ef", + "sourceHandle": "forkResultOk", + "target": "37ed8a77-a189-460a-80dc-aba069db5acc", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "807b8451-fafc-421d-89ef-0bb21050f076", + "source": "37ed8a77-a189-460a-80dc-aba069db5acc", + "target": "6932c4f9-f387-491a-9827-80bb860abe2d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "dd57ff53-8524-4d91-9090-f3ed8bdeaf2d", + "source": "6b0fc076-851e-42d2-8ed0-794ec7a83150", + "target": "8da9503c-c271-423d-95d7-50e755ad409f", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "be0e8027-1ed7-4056-bf2d-db5a31ee8eba", + "source": "8da9503c-c271-423d-95d7-50e755ad409f", + "sourceHandle": "forkResultOk", + "target": "19f96a15-aafb-4039-afed-d778f631eec1", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "6495e194-5541-4c12-b942-d16fc2036acc", + "source": "6932c4f9-f387-491a-9827-80bb860abe2d", + "sourceHandle": "dataStream", + "target": "515b40ee-fec9-40f9-87bd-284f608b0d8c", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "4088256b-881c-4d78-96a2-4b675a42e468", + "source": "37ed8a77-a189-460a-80dc-aba069db5acc", + "target": "25c3c257-8335-4ee5-93ae-11d259f1982b", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "069fcefa-d128-4f3b-88f2-07e48aa5358b", + "source": "25c3c257-8335-4ee5-93ae-11d259f1982b", + "target": "a0ffbab2-cb24-4b65-b2a1-3de63e5ef04e", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c3d4b05c-5b54-4151-827e-a936b81f73ee", + "source": "5850f6e5-d48f-497b-b63b-f842c92b1d55", + "target": "a0ffbab2-cb24-4b65-b2a1-3de63e5ef04e", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/change_lane.json b/examples/diagram/traffic_app/diagrams/change_lane.json new file mode 100644 index 00000000..b1f44da6 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/change_lane.json @@ -0,0 +1,1233 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "change_lane_buffer_access": { + "type": "buffer_access", + "buffers": [ + "obstacles_buffer" + ], + "next": "check_change_lane" + }, + "check_change_lane": { + "type": "node", + "builder": "check_change_lane", + "next": "accelerate_vehicle" + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "wait_for_destination_reached", + "detect_kinematics", + "abandon_trip" + ] + }, + "obstacles_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + }, + "obstacles_buffer_access": { + "type": "buffer_access", + "buffers": [ + "obstacles_buffer" + ], + "next": "process_obstacles" + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "process_obstacles_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "change_lane_buffer_access" + }, + "detect_obstacles": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + }, + "process_obstacles": { + "type": "node", + "builder": "process_obstacles", + "next": "process_obstacles_fork_result" + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + }, + "trigger_fork_clone": { + "type": "fork_clone", + "next": [ + "obstacles_buffer_access", + "kinematics_buffer_access" + ] + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance while avoiding obstacles, and allows the vehicle to switch lanes if the adjacent lane is clear.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "c219f9d2038d3ce0fb11c7f2b518ac6e4ed9cee9", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 975, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 860, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "851ed8c3-b172-47d5-9091-07e3efb4442c", + "type": "buffer_access", + "position": { + "x": 157.5, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "change_lane_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "obstacles_buffer" + ], + "next": "check_change_lane" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "cf2e467c-4b3f-4120-acd4-a46df5ec2393", + "type": "node", + "position": { + "x": 157.5, + "y": 1025 + }, + "data": { + "namespace": "", + "opId": "check_change_lane", + "op": { + "type": "node", + "builder": "check_change_lane", + "next": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "4db49ff8-4abe-4bf1-b75b-cba7cbc6a477", + "type": "fork_clone", + "position": { + "x": 725, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "wait_for_destination_reached", + "detect_kinematics", + "abandon_trip" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "a8818db5-3fa1-42f7-81c3-0126789da99e", + "type": "buffer", + "position": { + "x": 100, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "obstacles_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "02b308ea-b23e-4a21-9aaf-7efeb3fde1df", + "type": "buffer_access", + "position": { + "x": 272.5, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "obstacles_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "obstacles_buffer" + ], + "next": "process_obstacles" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "3e4fd35e-c5aa-408d-bb85-f4520bb55150", + "type": "node", + "position": { + "x": 975, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "1a7baa5d-9eaf-462d-bff1-bec1ba4a5919", + "type": "fork_result", + "position": { + "x": 975, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "66ab5150-0040-45d4-a339-57d7e6562b15", + "type": "node", + "position": { + "x": 157.5, + "y": 1125 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "7a56b1f8-7c80-4fa1-b96f-a58932624021", + "type": "node", + "position": { + "x": 860, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "1c38d93f-c626-4c81-b366-77a11d8fefde", + "type": "fork_result", + "position": { + "x": 272.5, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "process_obstacles_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "change_lane_buffer_access" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "7a2e0b9f-fcd6-4430-9c40-2d2d4b5e67f8", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_obstacles", + "op": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "87b332db-bb01-4aa9-b70e-da0c8ee8b138", + "type": "node", + "position": { + "x": 272.5, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_obstacles", + "op": { + "type": "node", + "builder": "process_obstacles", + "next": "process_obstacles_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "946ee162-be16-424d-aea0-c64842768c18", + "type": "node", + "position": { + "x": 360, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "df661588-17e9-40cb-89e9-6639bdacacd6", + "type": "node", + "position": { + "x": 610, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "bf11b51f-84c9-4638-987d-3b5a1e51389a", + "type": "buffer", + "position": { + "x": 610, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "5ca7b1d8-f390-476a-94e7-a8059007784d", + "type": "buffer_access", + "position": { + "x": 600, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "cfb10642-90e7-4565-adf7-f8306123c18b", + "type": "node", + "position": { + "x": 600, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "b8bbaaad-bc84-47bb-8548-1de81d1a1440", + "type": "fork_result", + "position": { + "x": 600, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "5269a5e7-790c-4643-9f91-8b3f62fef290", + "type": "node", + "position": { + "x": 600, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "717ef922-745a-47bc-8803-bd37440659c4", + "type": "fork_clone", + "position": { + "x": 360, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "trigger_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "obstacles_buffer_access", + "kinematics_buffer_access" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "b1e378b0-3012-420c-a368-5e39f0aeaec0", + "type": "node", + "position": { + "x": 860, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e3e90d71-f7b3-4b19-8453-d34350107410", + "type": "node", + "position": { + "x": 1110, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "a8dec761-3830-44d3-b26e-d6ddf533c305", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "3e4fd35e-c5aa-408d-bb85-f4520bb55150", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f7fd2ce5-03d4-4131-8b9f-197a4f3f2c50", + "source": "a8818db5-3fa1-42f7-81c3-0126789da99e", + "sourceHandle": null, + "target": "851ed8c3-b172-47d5-9091-07e3efb4442c", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "d62f0e91-3b93-4631-8b24-f1aa7deb02c2", + "source": "851ed8c3-b172-47d5-9091-07e3efb4442c", + "sourceHandle": null, + "target": "cf2e467c-4b3f-4120-acd4-a46df5ec2393", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "fc546e79-0070-4ed4-8a63-4d0a888eaea8", + "source": "cf2e467c-4b3f-4120-acd4-a46df5ec2393", + "sourceHandle": null, + "target": "66ab5150-0040-45d4-a339-57d7e6562b15", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "3d51fe6a-abb9-4055-a074-e0319e69b804", + "source": "4db49ff8-4abe-4bf1-b75b-cba7cbc6a477", + "sourceHandle": null, + "target": "7a2e0b9f-fcd6-4430-9c40-2d2d4b5e67f8", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "06d15f8b-bf0a-4553-ad70-88d300ba7bc4", + "source": "a8818db5-3fa1-42f7-81c3-0126789da99e", + "sourceHandle": null, + "target": "02b308ea-b23e-4a21-9aaf-7efeb3fde1df", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "26a3feca-bae0-4225-b09a-ad3010449c10", + "source": "02b308ea-b23e-4a21-9aaf-7efeb3fde1df", + "sourceHandle": null, + "target": "87b332db-bb01-4aa9-b70e-da0c8ee8b138", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "de688049-a1b5-4edc-862d-d7df12c63985", + "source": "3e4fd35e-c5aa-408d-bb85-f4520bb55150", + "sourceHandle": null, + "target": "1a7baa5d-9eaf-462d-bff1-bec1ba4a5919", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "a555cad9-8579-4ede-8ea9-3f37f8798601", + "source": "1a7baa5d-9eaf-462d-bff1-bec1ba4a5919", + "sourceHandle": "forkResultOk", + "target": "4db49ff8-4abe-4bf1-b75b-cba7cbc6a477", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "9ce59522-f5e6-4615-b028-5f2662785bd5", + "source": "7a56b1f8-7c80-4fa1-b96f-a58932624021", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "6aa005f5-34be-45b0-a2c8-c510fe32eec0", + "source": "1c38d93f-c626-4c81-b366-77a11d8fefde", + "sourceHandle": "forkResultOk", + "target": "851ed8c3-b172-47d5-9091-07e3efb4442c", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d81b4bcc-9b48-4639-b492-6757de3599fc", + "source": "7a2e0b9f-fcd6-4430-9c40-2d2d4b5e67f8", + "sourceHandle": "dataStream", + "target": "a8818db5-3fa1-42f7-81c3-0126789da99e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "obstacles" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "4802d784-84a4-4438-9be5-6744a3f3c4d6", + "source": "87b332db-bb01-4aa9-b70e-da0c8ee8b138", + "sourceHandle": null, + "target": "1c38d93f-c626-4c81-b366-77a11d8fefde", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d1b53ffb-16fc-4e48-85d3-d3631a2f0edb", + "source": "4db49ff8-4abe-4bf1-b75b-cba7cbc6a477", + "target": "946ee162-be16-424d-aea0-c64842768c18", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "240382a0-fa40-49cc-9730-055c4a220195", + "source": "946ee162-be16-424d-aea0-c64842768c18", + "target": "7a56b1f8-7c80-4fa1-b96f-a58932624021", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "7f7a6ff2-5349-4c23-b2b4-1a6cede50451", + "source": "4db49ff8-4abe-4bf1-b75b-cba7cbc6a477", + "target": "df661588-17e9-40cb-89e9-6639bdacacd6", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "06d1823b-0ff0-4f41-989e-355c84a9b14e", + "source": "df661588-17e9-40cb-89e9-6639bdacacd6", + "sourceHandle": "dataStream", + "target": "bf11b51f-84c9-4638-987d-3b5a1e51389a", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "dc4dd0d4-57b5-4449-ab0c-93f511d5be56", + "source": "bf11b51f-84c9-4638-987d-3b5a1e51389a", + "target": "5ca7b1d8-f390-476a-94e7-a8059007784d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "921e4829-0882-443f-aa14-a96c7d6fe4e9", + "source": "5ca7b1d8-f390-476a-94e7-a8059007784d", + "target": "cfb10642-90e7-4565-adf7-f8306123c18b", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "afe37935-d432-4a12-8e71-a08725da24be", + "source": "cfb10642-90e7-4565-adf7-f8306123c18b", + "target": "b8bbaaad-bc84-47bb-8548-1de81d1a1440", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c0c06e7a-6bf0-44f0-8668-44d59db5a3d9", + "source": "b8bbaaad-bc84-47bb-8548-1de81d1a1440", + "sourceHandle": "forkResultOk", + "target": "5269a5e7-790c-4643-9f91-8b3f62fef290", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b3c585dd-3777-4738-811b-2034d7a37fcc", + "source": "946ee162-be16-424d-aea0-c64842768c18", + "sourceHandle": "dataStream", + "target": "717ef922-745a-47bc-8803-bd37440659c4", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "4c3ac36b-6379-47d9-a996-8a82045e9cda", + "source": "717ef922-745a-47bc-8803-bd37440659c4", + "target": "02b308ea-b23e-4a21-9aaf-7efeb3fde1df", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "8d560e3e-961f-4062-b131-92c8320ce142", + "source": "717ef922-745a-47bc-8803-bd37440659c4", + "target": "5ca7b1d8-f390-476a-94e7-a8059007784d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "7850e50c-1763-4ea8-a25d-28e9d326cb12", + "source": "4db49ff8-4abe-4bf1-b75b-cba7cbc6a477", + "target": "b1e378b0-3012-420c-a368-5e39f0aeaec0", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c751b3a5-16cc-4493-8f69-8038bad57a8b", + "source": "b1e378b0-3012-420c-a368-5e39f0aeaec0", + "target": "7a56b1f8-7c80-4fa1-b96f-a58932624021", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "169a0ad2-84af-49c7-8be1-167ea59ffe6b", + "source": "1a7baa5d-9eaf-462d-bff1-bec1ba4a5919", + "sourceHandle": "forkResultErr", + "target": "e3e90d71-f7b3-4b19-8453-d34350107410", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "bf6a8b3b-a23d-4ebe-a001-b31376a184f0", + "source": "e3e90d71-f7b3-4b19-8453-d34350107410", + "target": "7a56b1f8-7c80-4fa1-b96f-a58932624021", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/join_signal_and_arriving.json b/examples/diagram/traffic_app/diagrams/join_signal_and_arriving.json new file mode 100644 index 00000000..53b76903 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/join_signal_and_arriving.json @@ -0,0 +1,1167 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "arriving_buffer": { + "type": "buffer" + }, + "approaching_intersection": { + "type": "node", + "builder": "approaching_intersection", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "arriving": "arriving_buffer" + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "detect_traffic_signal", + "approaching_intersection", + "wait_for_destination_reached", + "detect_kinematics", + "abandon_trip" + ] + }, + "detect_traffic_signal": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "join_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "traffic_signal_buffer": { + "type": "buffer" + }, + "join_traffic_signal_and_arriving": { + "type": "node", + "builder": "join_traffic_signal_and_arriving", + "next": "join_fork_result" + }, + "join": { + "type": "join", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "arriving": "arriving_buffer" + }, + "next": "join_traffic_signal_and_arriving" + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, with Join operation connected to traffic signal and arriving buffers.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "67e92fd7bb083781e2778ca9779db7ec86c4847b", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 975, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 1100, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "2e403280-ca80-40eb-9565-346c05ab8916", + "type": "buffer", + "position": { + "x": 350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "arriving_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "46e7cb03-270a-4c40-94f7-410f288e0999", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "approaching_intersection", + "op": { + "type": "node", + "builder": "approaching_intersection", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "arriving": "arriving_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "ffe56b2f-d482-41c0-8083-f5bda197d7e1", + "type": "fork_clone", + "position": { + "x": 600, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "detect_traffic_signal", + "approaching_intersection", + "wait_for_destination_reached", + "detect_kinematics", + "abandon_trip" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "58f2bab6-bb33-4e6f-bdf4-a30502f474d6", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_traffic_signal", + "op": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "a5b9714d-5723-47e1-96c1-175062226e4f", + "type": "node", + "position": { + "x": 975, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "48f14f03-3455-4578-9d77-377995014d47", + "type": "node", + "position": { + "x": 225, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "1edf2d97-9c66-4416-a31f-cb24acb45bad", + "type": "node", + "position": { + "x": 1100, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "f68e4135-950c-4853-8142-28913804380e", + "type": "fork_result", + "position": { + "x": 225, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "join_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "4e728153-fc84-4c16-a442-5f1d4949c419", + "type": "buffer", + "position": { + "x": 100, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "c47efaeb-21ce-493e-a805-f83bcece1b51", + "type": "node", + "position": { + "x": 225, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "join_traffic_signal_and_arriving", + "op": { + "type": "node", + "builder": "join_traffic_signal_and_arriving", + "next": "join_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "da6b3536-abc8-4495-a1f1-0fbf01917f6a", + "type": "join", + "position": { + "x": 225, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "join", + "op": { + "type": "join", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "arriving": "arriving_buffer" + }, + "next": "join_traffic_signal_and_arriving" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "e236d075-ef15-43a6-ab59-168d1e023a76", + "type": "fork_result", + "position": { + "x": 975, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "aa981af0-4f34-41b9-ab83-6e78edff12a5", + "type": "node", + "position": { + "x": 1350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "7628d7c9-c814-437c-8758-a7ad0d00e9af", + "type": "node", + "position": { + "x": 600, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "01350e21-f166-4942-9178-05bde96f1558", + "type": "node", + "position": { + "x": 850, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "99789e65-1bd9-4533-b5d1-f03105b6aa64", + "type": "buffer", + "position": { + "x": 850, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "d1fe9490-245c-423f-b30b-075f0f6c058d", + "type": "buffer_access", + "position": { + "x": 782.5, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "fff63b9d-fafa-4a1a-be6f-0e3d07f1aec1", + "type": "node", + "position": { + "x": 782.5, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "5d176731-3f1c-43fa-8b81-d00857e8859d", + "type": "fork_result", + "position": { + "x": 782.5, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "f8f63b97-7e7f-4eb3-86bc-c3d26acad860", + "type": "node", + "position": { + "x": 782.5, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "806ffb90-6585-4c67-b259-5badeec38c05", + "type": "node", + "position": { + "x": 1100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "6a43d18b-3bbf-49e5-b417-611c326374aa", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "a5b9714d-5723-47e1-96c1-175062226e4f", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "91edcec2-766d-4463-baeb-05618678fdd5", + "source": "46e7cb03-270a-4c40-94f7-410f288e0999", + "sourceHandle": "dataStream", + "target": "2e403280-ca80-40eb-9565-346c05ab8916", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "arriving" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "e12900b1-c211-480c-be72-98b2d8dc26f2", + "source": "ffe56b2f-d482-41c0-8083-f5bda197d7e1", + "sourceHandle": null, + "target": "58f2bab6-bb33-4e6f-bdf4-a30502f474d6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "7f58cc2c-d009-4d7f-90d6-e00ee19141eb", + "source": "ffe56b2f-d482-41c0-8083-f5bda197d7e1", + "sourceHandle": null, + "target": "46e7cb03-270a-4c40-94f7-410f288e0999", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "4f8c9b63-3320-4c21-b9d8-edee16d9ef12", + "source": "58f2bab6-bb33-4e6f-bdf4-a30502f474d6", + "sourceHandle": "dataStream", + "target": "4e728153-fc84-4c16-a442-5f1d4949c419", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "traffic_signal" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "1e7b0367-79e8-4a59-95f0-fac6efbb8610", + "source": "a5b9714d-5723-47e1-96c1-175062226e4f", + "sourceHandle": null, + "target": "e236d075-ef15-43a6-ab59-168d1e023a76", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "a1319941-c7dd-4cad-b5cc-4ea54db86338", + "source": "1edf2d97-9c66-4416-a31f-cb24acb45bad", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "63d43e09-b41b-495f-aa59-6b82ebf47bfe", + "source": "f68e4135-950c-4853-8142-28913804380e", + "sourceHandle": "forkResultOk", + "target": "48f14f03-3455-4578-9d77-377995014d47", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "92d7e96f-d5f3-4dad-aaa9-c418f2dbcf42", + "source": "c47efaeb-21ce-493e-a805-f83bcece1b51", + "sourceHandle": null, + "target": "f68e4135-950c-4853-8142-28913804380e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "18fe863f-dabb-45b0-b841-2368a5218a60", + "source": "4e728153-fc84-4c16-a442-5f1d4949c419", + "sourceHandle": null, + "target": "da6b3536-abc8-4495-a1f1-0fbf01917f6a", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "traffic_signal", + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "a8054267-1efa-469a-879f-d741647dc913", + "source": "2e403280-ca80-40eb-9565-346c05ab8916", + "sourceHandle": null, + "target": "da6b3536-abc8-4495-a1f1-0fbf01917f6a", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "arriving", + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "d19a0685-06c1-412a-80ae-c2563f457d99", + "source": "da6b3536-abc8-4495-a1f1-0fbf01917f6a", + "sourceHandle": null, + "target": "c47efaeb-21ce-493e-a805-f83bcece1b51", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "816c3a0e-8539-4c14-b063-6ce6602b9120", + "source": "e236d075-ef15-43a6-ab59-168d1e023a76", + "sourceHandle": "forkResultOk", + "target": "ffe56b2f-d482-41c0-8083-f5bda197d7e1", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "ceb3d639-9ac8-4b74-a225-1fc132f8d595", + "source": "e236d075-ef15-43a6-ab59-168d1e023a76", + "sourceHandle": "forkResultErr", + "target": "aa981af0-4f34-41b9-ab83-6e78edff12a5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b3c9985b-4f23-4f26-99ad-d51831f82cc7", + "source": "aa981af0-4f34-41b9-ab83-6e78edff12a5", + "sourceHandle": null, + "target": "1edf2d97-9c66-4416-a31f-cb24acb45bad", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e8436f86-0137-41da-bb26-a808ef49201d", + "source": "ffe56b2f-d482-41c0-8083-f5bda197d7e1", + "target": "7628d7c9-c814-437c-8758-a7ad0d00e9af", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "3fe0af38-7485-4c6f-b6fd-6bb975df0386", + "source": "7628d7c9-c814-437c-8758-a7ad0d00e9af", + "target": "1edf2d97-9c66-4416-a31f-cb24acb45bad", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "90f369d6-ec7b-4442-826a-da4c4437914d", + "source": "ffe56b2f-d482-41c0-8083-f5bda197d7e1", + "target": "01350e21-f166-4942-9178-05bde96f1558", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c582b7b6-1610-4e62-8968-e4eaca4d5922", + "source": "99789e65-1bd9-4533-b5d1-f03105b6aa64", + "target": "d1fe9490-245c-423f-b30b-075f0f6c058d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "3f5bbd55-4e26-42ae-83d3-0c8c4593bb95", + "source": "d1fe9490-245c-423f-b30b-075f0f6c058d", + "target": "fff63b9d-fafa-4a1a-be6f-0e3d07f1aec1", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "710c8079-b40f-4afe-ba36-2aeb3aa78c6f", + "source": "fff63b9d-fafa-4a1a-be6f-0e3d07f1aec1", + "target": "5d176731-3f1c-43fa-8b81-d00857e8859d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b6bdca1d-8b24-4927-8068-442d3ff0ce93", + "source": "5d176731-3f1c-43fa-8b81-d00857e8859d", + "sourceHandle": "forkResultOk", + "target": "f8f63b97-7e7f-4eb3-86bc-c3d26acad860", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b2783af2-a991-4565-b0fe-61e7d929b2ad", + "source": "01350e21-f166-4942-9178-05bde96f1558", + "sourceHandle": "dataStream", + "target": "99789e65-1bd9-4533-b5d1-f03105b6aa64", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "83733240-3c8f-4773-afba-2b293936ee10", + "source": "ffe56b2f-d482-41c0-8083-f5bda197d7e1", + "target": "806ffb90-6585-4c67-b259-5badeec38c05", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "33cda313-1dce-4ff7-874f-85a6ac978bd7", + "source": "806ffb90-6585-4c67-b259-5badeec38c05", + "target": "1edf2d97-9c66-4416-a31f-cb24acb45bad", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "44471657-a44d-4a15-a587-5d6d9fe1e0f4", + "source": "7628d7c9-c814-437c-8758-a7ad0d00e9af", + "sourceHandle": "dataStream", + "target": "d1fe9490-245c-423f-b30b-075f0f6c058d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/join_signal_and_obstacles.json b/examples/diagram/traffic_app/diagrams/join_signal_and_obstacles.json new file mode 100644 index 00000000..86a64689 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/join_signal_and_obstacles.json @@ -0,0 +1,1179 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "join": { + "type": "join", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "obstacles": "obstacles_buffer" + }, + "next": "join_traffic_signal_and_obstacles" + }, + "join_traffic_signal_and_obstacles": { + "type": "node", + "builder": "join_traffic_signal_and_obstacles", + "next": "join_fork_result" + }, + "traffic_signal_buffer": { + "type": "buffer" + }, + "detect_obstacles": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + }, + "join_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "detect_traffic_signal": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + }, + "obstacles_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "detect_traffic_signal", + "abandon_trip", + "detect_kinematics", + "wait_for_destination_reached" + ] + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, with Join operation connected to traffic signal and obstacles buffers.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "0d1184e25691eaa255e1b65e438e39badd07ae45", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 465, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 350, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "8c1e3373-5bef-444c-bf4d-c09b0489383e", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "c365f3db-f31e-4b67-b275-d2ef3501be50", + "type": "fork_result", + "position": { + "x": 465, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "83bd4f5a-e8bb-4324-9faf-c5231430e6f5", + "type": "join", + "position": { + "x": 1235, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "join", + "op": { + "type": "join", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "obstacles": "obstacles_buffer" + }, + "next": "join_traffic_signal_and_obstacles" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "cf718d0d-6185-47eb-90ed-689cde2e8243", + "type": "node", + "position": { + "x": 1235, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "join_traffic_signal_and_obstacles", + "op": { + "type": "node", + "builder": "join_traffic_signal_and_obstacles", + "next": "join_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "0e91d3ff-a887-4725-82b9-62f189e9dfa8", + "type": "buffer", + "position": { + "x": 1100, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "17edcefe-6958-4d50-8976-a9babaea543a", + "type": "node", + "position": { + "x": 1350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_obstacles", + "op": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "20960f6f-54f6-41c9-9294-cb9a89d3ab76", + "type": "fork_result", + "position": { + "x": 1235, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "join_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "a6e2a7d7-8996-4ad7-9c30-38fa066cc86a", + "type": "node", + "position": { + "x": 350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "04a5e6cd-d1f3-429d-98bf-da40250d1fd7", + "type": "node", + "position": { + "x": 1235, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "df381a69-56b4-4b62-af5a-66bf91e15245", + "type": "node", + "position": { + "x": 465, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "53039b2b-a4eb-4027-bad5-1af31ae616dd", + "type": "node", + "position": { + "x": 1100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_traffic_signal", + "op": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "85544990-e1fe-4cfc-88d8-2ea0d3179a0e", + "type": "buffer", + "position": { + "x": 1350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "obstacles_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "c0339281-a0f8-4ff6-9f9f-55958a9677ef", + "type": "fork_clone", + "position": { + "x": 840, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "detect_traffic_signal", + "abandon_trip", + "detect_kinematics", + "wait_for_destination_reached" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "9e7516e4-7df4-4dcc-98e8-c30992c95e66", + "type": "node", + "position": { + "x": 600, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "fcb9a499-14b0-4b41-b3e4-6130d0dac8d9", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "a1968433-4b9f-430d-94dc-918f22460102", + "type": "node", + "position": { + "x": 850, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "52f9df53-71e3-4546-98e8-6a081ce8e764", + "type": "buffer", + "position": { + "x": 647.5, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "f57ed47d-8cbe-470c-84fb-07e791edf7e7", + "type": "buffer_access", + "position": { + "x": 725, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "dcbab5ef-af92-487c-be83-5e7ed7b2e264", + "type": "node", + "position": { + "x": 725, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "571ea0fc-e194-453e-97d2-85ad72e3f612", + "type": "fork_result", + "position": { + "x": 725, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e37c80c4-1456-4438-aafa-536106942f96", + "type": "node", + "position": { + "x": 725, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "ee9f2d3f-33f9-4547-a320-cea641e6c0ca", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "df381a69-56b4-4b62-af5a-66bf91e15245", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "2709e316-45c4-422d-a290-a5f58d410a1a", + "source": "8c1e3373-5bef-444c-bf4d-c09b0489383e", + "sourceHandle": null, + "target": "a6e2a7d7-8996-4ad7-9c30-38fa066cc86a", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "85ed4792-0c59-40a1-bca5-7b47fed54363", + "source": "c365f3db-f31e-4b67-b275-d2ef3501be50", + "sourceHandle": "forkResultOk", + "target": "c0339281-a0f8-4ff6-9f9f-55958a9677ef", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "68fd1e84-7c7e-4ea0-b3c0-e1a28b873fd9", + "source": "c365f3db-f31e-4b67-b275-d2ef3501be50", + "sourceHandle": "forkResultErr", + "target": "8c1e3373-5bef-444c-bf4d-c09b0489383e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "43a2ae60-ca5d-4c9d-80a1-1a7f1a43e2f5", + "source": "0e91d3ff-a887-4725-82b9-62f189e9dfa8", + "sourceHandle": null, + "target": "83bd4f5a-e8bb-4324-9faf-c5231430e6f5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "traffic_signal", + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "977a1db1-6458-401b-b4db-01df5d68ae05", + "source": "85544990-e1fe-4cfc-88d8-2ea0d3179a0e", + "sourceHandle": null, + "target": "83bd4f5a-e8bb-4324-9faf-c5231430e6f5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "obstacles", + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "639a31a2-23a7-447a-a9ba-6635918627df", + "source": "83bd4f5a-e8bb-4324-9faf-c5231430e6f5", + "sourceHandle": null, + "target": "cf718d0d-6185-47eb-90ed-689cde2e8243", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "eb66e7ea-c035-4fd0-892a-1d8b08a012c2", + "source": "cf718d0d-6185-47eb-90ed-689cde2e8243", + "sourceHandle": null, + "target": "20960f6f-54f6-41c9-9294-cb9a89d3ab76", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d9a0d3af-003b-4517-8904-ade3c5b987f3", + "source": "17edcefe-6958-4d50-8976-a9babaea543a", + "sourceHandle": "dataStream", + "target": "85544990-e1fe-4cfc-88d8-2ea0d3179a0e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "obstacles" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "645844b5-cdb3-4382-be97-36bcaf8dd62d", + "source": "20960f6f-54f6-41c9-9294-cb9a89d3ab76", + "sourceHandle": "forkResultOk", + "target": "04a5e6cd-d1f3-429d-98bf-da40250d1fd7", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "89897226-31e7-4d1d-ae76-e452b993df3e", + "source": "a6e2a7d7-8996-4ad7-9c30-38fa066cc86a", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "47ea0b59-6688-4406-b2dc-15ec6ff7f0a5", + "source": "df381a69-56b4-4b62-af5a-66bf91e15245", + "sourceHandle": null, + "target": "c365f3db-f31e-4b67-b275-d2ef3501be50", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1e16f62a-c0eb-4ed0-94a4-1d2f068b669c", + "source": "53039b2b-a4eb-4027-bad5-1af31ae616dd", + "sourceHandle": "dataStream", + "target": "0e91d3ff-a887-4725-82b9-62f189e9dfa8", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "traffic_signal" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "41b1f247-2b62-4591-97f2-cd7c3118f39c", + "source": "c0339281-a0f8-4ff6-9f9f-55958a9677ef", + "sourceHandle": null, + "target": "17edcefe-6958-4d50-8976-a9babaea543a", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d6845d98-2eba-4ada-b32c-4e5f23642ded", + "source": "c0339281-a0f8-4ff6-9f9f-55958a9677ef", + "sourceHandle": null, + "target": "53039b2b-a4eb-4027-bad5-1af31ae616dd", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1c905594-5fc4-4a4d-89ab-cd353390782a", + "source": "9e7516e4-7df4-4dcc-98e8-c30992c95e66", + "target": "a6e2a7d7-8996-4ad7-9c30-38fa066cc86a", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "ae0534c6-4c15-48eb-9b05-7e15667886a0", + "source": "c0339281-a0f8-4ff6-9f9f-55958a9677ef", + "target": "fcb9a499-14b0-4b41-b3e4-6130d0dac8d9", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "8834d326-dc03-4c95-b024-ac3847c33743", + "source": "c0339281-a0f8-4ff6-9f9f-55958a9677ef", + "target": "a1968433-4b9f-430d-94dc-918f22460102", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d6843331-fbbe-4636-8ed1-eac2e2e452d4", + "source": "a1968433-4b9f-430d-94dc-918f22460102", + "sourceHandle": "dataStream", + "target": "52f9df53-71e3-4546-98e8-6a081ce8e764", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7cad00c1-7051-4cd0-8b17-501a0b4a6b14", + "source": "9e7516e4-7df4-4dcc-98e8-c30992c95e66", + "sourceHandle": "dataStream", + "target": "f57ed47d-8cbe-470c-84fb-07e791edf7e7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "3b5fcd4f-0203-4648-b78e-c0b1d6eb39aa", + "source": "52f9df53-71e3-4546-98e8-6a081ce8e764", + "target": "f57ed47d-8cbe-470c-84fb-07e791edf7e7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "c51fe44f-0557-40f4-8762-999b77f2865b", + "source": "f57ed47d-8cbe-470c-84fb-07e791edf7e7", + "target": "dcbab5ef-af92-487c-be83-5e7ed7b2e264", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "272bd218-5687-4093-9b1a-b715333a6444", + "source": "dcbab5ef-af92-487c-be83-5e7ed7b2e264", + "target": "571ea0fc-e194-453e-97d2-85ad72e3f612", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "a0db8cfd-49b8-40a0-bf7d-bb5ea4168bb3", + "source": "571ea0fc-e194-453e-97d2-85ad72e3f612", + "sourceHandle": "forkResultOk", + "target": "e37c80c4-1456-4438-aafa-536106942f96", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "8a818c43-d6f2-4c3c-9fde-d37a362083cd", + "source": "c0339281-a0f8-4ff6-9f9f-55958a9677ef", + "target": "9e7516e4-7df4-4dcc-98e8-c30992c95e66", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1a5f2b82-15fe-4cce-9cda-ef708c5a9613", + "source": "fcb9a499-14b0-4b41-b3e4-6130d0dac8d9", + "target": "a6e2a7d7-8996-4ad7-9c30-38fa066cc86a", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/listen_signal_and_arriving.json b/examples/diagram/traffic_app/diagrams/listen_signal_and_arriving.json new file mode 100644 index 00000000..aaa16fd1 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/listen_signal_and_arriving.json @@ -0,0 +1,1176 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "approaching_intersection", + "detect_traffic_signal", + "wait_for_destination_reached", + "detect_kinematics", + "abandon_trip" + ] + }, + "arriving_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + }, + "detect_traffic_signal": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "listen_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "approaching_intersection": { + "type": "node", + "builder": "approaching_intersection", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "arriving": "arriving_buffer" + } + }, + "traffic_signal_buffer": { + "type": "buffer" + }, + "listen": { + "type": "listen", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "arriving": "arriving_buffer" + }, + "next": "listen_traffic_signal_and_arriving" + }, + "listen_traffic_signal_and_arriving": { + "type": "node", + "builder": "listen_traffic_signal_and_arriving", + "next": "listen_fork_result" + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, with Listen operation connected to traffic signal and arriving buffers.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "1ae738b9116866447af99db3c642728b36c9efa4", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 975, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 1100, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "0a33ec3e-6ea7-45b6-8167-57eff0cc99b4", + "type": "fork_clone", + "position": { + "x": 600, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "approaching_intersection", + "detect_traffic_signal", + "wait_for_destination_reached", + "detect_kinematics", + "abandon_trip" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "fd60c84e-2053-440c-8844-77188c8301d6", + "type": "buffer", + "position": { + "x": 100, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "arriving_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "f31619d2-0773-4fce-b5cd-18a9078657ee", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_traffic_signal", + "op": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "48f9e3f6-7985-46ba-bf82-5b29e76eca32", + "type": "node", + "position": { + "x": 975, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "942eac0f-ae5b-4383-84fa-bf1a886f25ac", + "type": "fork_result", + "position": { + "x": 975, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "1709374a-992c-4be4-83bc-b83e38b4aa03", + "type": "node", + "position": { + "x": 225, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "f10166a3-c0d6-4d25-9079-36f34de470ba", + "type": "node", + "position": { + "x": 1100, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "3d339705-f6ee-4194-bd80-7383b66ca3c6", + "type": "fork_result", + "position": { + "x": 225, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "listen_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "0159fb7d-4642-4063-8d6c-725017b9f424", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "approaching_intersection", + "op": { + "type": "node", + "builder": "approaching_intersection", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "arriving": "arriving_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "6ff8add4-6ff6-4dfd-ada0-205acabd5bb3", + "type": "buffer", + "position": { + "x": 350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "4e4bd5be-360a-4298-8411-32bf291d43e6", + "type": "listen", + "position": { + "x": 225, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "listen", + "op": { + "type": "listen", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "arriving": "arriving_buffer" + }, + "next": "listen_traffic_signal_and_arriving" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "ee9a7c6c-e8cf-47e6-9821-7bf7dd58171d", + "type": "node", + "position": { + "x": 225, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "listen_traffic_signal_and_arriving", + "op": { + "type": "node", + "builder": "listen_traffic_signal_and_arriving", + "next": "listen_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "d3d6749d-38fb-4a1e-85b2-854705f76c25", + "type": "node", + "position": { + "x": 1350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "4f181232-1835-461b-9a39-87fca5d9f2ab", + "type": "node", + "position": { + "x": 600, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "61b8bc33-eace-4850-a5c7-306f08db9f8e", + "type": "node", + "position": { + "x": 850, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "0840fd71-f712-452d-98fb-3a80a4e4f2ec", + "type": "buffer", + "position": { + "x": 850, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "b9cb464d-4daa-4fb2-99a5-849bba67a5dc", + "type": "buffer_access", + "position": { + "x": 782.5, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "5899c277-0d17-4f63-9a46-871e4883183f", + "type": "node", + "position": { + "x": 782.5, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "b659f6f4-f3e5-4591-bd10-7f94446e64a8", + "type": "fork_result", + "position": { + "x": 782.5, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "a3d2b9f4-94bc-41ca-afff-508fe12b8107", + "type": "node", + "position": { + "x": 782.5, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "b45d76a4-9d6c-4e81-a1d4-f6ce95dac89b", + "type": "node", + "position": { + "x": 1100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "c2c00f14-2414-470a-a7c7-c256fd60e852", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "48f9e3f6-7985-46ba-bf82-5b29e76eca32", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1bab91aa-5f37-432e-a3c3-31872072f4c6", + "source": "0a33ec3e-6ea7-45b6-8167-57eff0cc99b4", + "sourceHandle": null, + "target": "0159fb7d-4642-4063-8d6c-725017b9f424", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "cebe466d-ea54-4c05-abc7-9e09040375e0", + "source": "0a33ec3e-6ea7-45b6-8167-57eff0cc99b4", + "sourceHandle": null, + "target": "f31619d2-0773-4fce-b5cd-18a9078657ee", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "dec8d439-771a-44fa-b6c9-b325f81657a5", + "source": "f31619d2-0773-4fce-b5cd-18a9078657ee", + "sourceHandle": "dataStream", + "target": "6ff8add4-6ff6-4dfd-ada0-205acabd5bb3", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "traffic_signal" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "0635e136-c879-4b15-bdb9-9f8144762848", + "source": "48f9e3f6-7985-46ba-bf82-5b29e76eca32", + "sourceHandle": null, + "target": "942eac0f-ae5b-4383-84fa-bf1a886f25ac", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "fc2b16d7-5e91-48b7-a7ab-aa9bbd64e613", + "source": "942eac0f-ae5b-4383-84fa-bf1a886f25ac", + "sourceHandle": "forkResultOk", + "target": "0a33ec3e-6ea7-45b6-8167-57eff0cc99b4", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "252b840e-7901-4172-a411-04a40e46c3f8", + "source": "942eac0f-ae5b-4383-84fa-bf1a886f25ac", + "sourceHandle": "forkResultErr", + "target": "d3d6749d-38fb-4a1e-85b2-854705f76c25", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "62b36a6d-927c-40e1-8e38-c299a51a7893", + "source": "f10166a3-c0d6-4d25-9079-36f34de470ba", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e672e38e-30b9-4495-a96d-d6f7fdd64b0f", + "source": "3d339705-f6ee-4194-bd80-7383b66ca3c6", + "sourceHandle": "forkResultOk", + "target": "1709374a-992c-4be4-83bc-b83e38b4aa03", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1328fcb6-331e-441c-bf43-1ad7af48318b", + "source": "0159fb7d-4642-4063-8d6c-725017b9f424", + "sourceHandle": "dataStream", + "target": "fd60c84e-2053-440c-8844-77188c8301d6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "arriving" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "392088d6-a476-4de2-9760-26ce06772063", + "source": "6ff8add4-6ff6-4dfd-ada0-205acabd5bb3", + "sourceHandle": null, + "target": "4e4bd5be-360a-4298-8411-32bf291d43e6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "traffic_signal" + } + }, + "style": {} + }, + { + "id": "288c3251-ace0-4d0e-aaf3-20f24b6678ec", + "source": "fd60c84e-2053-440c-8844-77188c8301d6", + "sourceHandle": null, + "target": "4e4bd5be-360a-4298-8411-32bf291d43e6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "arriving" + } + }, + "style": {} + }, + { + "id": "a4fe0bf2-8593-4f12-bcb5-c98e7cbd83d9", + "source": "4e4bd5be-360a-4298-8411-32bf291d43e6", + "sourceHandle": null, + "target": "ee9a7c6c-e8cf-47e6-9821-7bf7dd58171d", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "0625c30f-e47c-400c-adb9-75d8fe7267ee", + "source": "ee9a7c6c-e8cf-47e6-9821-7bf7dd58171d", + "sourceHandle": null, + "target": "3d339705-f6ee-4194-bd80-7383b66ca3c6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c1d58a40-ee5d-4bd0-ac1f-895363f83252", + "source": "d3d6749d-38fb-4a1e-85b2-854705f76c25", + "sourceHandle": null, + "target": "f10166a3-c0d6-4d25-9079-36f34de470ba", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "85b6d6ae-8b38-4ab4-9449-571846d64e1a", + "source": "0a33ec3e-6ea7-45b6-8167-57eff0cc99b4", + "target": "4f181232-1835-461b-9a39-87fca5d9f2ab", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "62dea625-3e14-40a3-93e2-5dbaebb7c5e9", + "source": "4f181232-1835-461b-9a39-87fca5d9f2ab", + "target": "f10166a3-c0d6-4d25-9079-36f34de470ba", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "339792f2-f483-4101-aaa2-de939c608da5", + "source": "0a33ec3e-6ea7-45b6-8167-57eff0cc99b4", + "target": "61b8bc33-eace-4850-a5c7-306f08db9f8e", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e4b6b289-f8a8-4a1c-8cbe-86ff23d578d6", + "source": "61b8bc33-eace-4850-a5c7-306f08db9f8e", + "sourceHandle": "dataStream", + "target": "0840fd71-f712-452d-98fb-3a80a4e4f2ec", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "3d8cb879-5cbc-4a61-8610-98dd66ed0a06", + "source": "0840fd71-f712-452d-98fb-3a80a4e4f2ec", + "target": "b9cb464d-4daa-4fb2-99a5-849bba67a5dc", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "c27602b4-938a-4ee7-b1d1-ffab5d696bfe", + "source": "b9cb464d-4daa-4fb2-99a5-849bba67a5dc", + "target": "5899c277-0d17-4f63-9a46-871e4883183f", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "22ce76e8-34f7-461c-ba4e-678d5b057edf", + "source": "5899c277-0d17-4f63-9a46-871e4883183f", + "target": "b659f6f4-f3e5-4591-bd10-7f94446e64a8", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "cc83589e-9140-4ce0-b342-ebe363ea62cb", + "source": "b659f6f4-f3e5-4591-bd10-7f94446e64a8", + "sourceHandle": "forkResultOk", + "target": "a3d2b9f4-94bc-41ca-afff-508fe12b8107", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e444a04d-13e0-40ac-9b20-fb060c736c08", + "source": "4f181232-1835-461b-9a39-87fca5d9f2ab", + "sourceHandle": "dataStream", + "target": "b9cb464d-4daa-4fb2-99a5-849bba67a5dc", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "d3ee2807-3ef9-4b2c-bdc9-389434a24dc9", + "source": "0a33ec3e-6ea7-45b6-8167-57eff0cc99b4", + "target": "b45d76a4-9d6c-4e81-a1d4-f6ce95dac89b", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e744443e-af7f-41da-99ec-d0cd442422c9", + "source": "b45d76a4-9d6c-4e81-a1d4-f6ce95dac89b", + "target": "f10166a3-c0d6-4d25-9079-36f34de470ba", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/listen_signal_and_obstacles.json b/examples/diagram/traffic_app/diagrams/listen_signal_and_obstacles.json new file mode 100644 index 00000000..b438badd --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/listen_signal_and_obstacles.json @@ -0,0 +1,1173 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + }, + "listen_traffic_signal_and_obstacles": { + "type": "node", + "builder": "listen_traffic_signal_and_obstacles", + "next": "listen_fork_result" + }, + "listen": { + "type": "listen", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "obstacles": "obstacles_buffer" + }, + "next": "listen_traffic_signal_and_obstacles" + }, + "traffic_signal_buffer": { + "type": "buffer" + }, + "detect_obstacles": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + }, + "listen_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "detect_traffic_signal": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + }, + "obstacles_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "detect_traffic_signal", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, with Listen operation connected to traffic signal and obstacles buffers.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "0497a9ff9121e01320853c83522e5f9120e97bc7", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 465, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 350, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "c5777ef8-f919-4844-b9ee-5c0b64426e87", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "0055d8dd-e1c5-413a-a5e2-b92ebc409695", + "type": "node", + "position": { + "x": 1235, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "listen_traffic_signal_and_obstacles", + "op": { + "type": "node", + "builder": "listen_traffic_signal_and_obstacles", + "next": "listen_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "e157c24f-fbd5-4469-97b6-c3c03bcea69e", + "type": "listen", + "position": { + "x": 1235, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "listen", + "op": { + "type": "listen", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "obstacles": "obstacles_buffer" + }, + "next": "listen_traffic_signal_and_obstacles" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "3cedf38c-63f3-406e-bd7e-91c352a4ff78", + "type": "buffer", + "position": { + "x": 1100, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "44b6e07e-76aa-40fd-a648-32edf6307855", + "type": "node", + "position": { + "x": 1350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_obstacles", + "op": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "eadfdfb7-e370-4218-8a6f-bf7b4c85c2c9", + "type": "fork_result", + "position": { + "x": 1235, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "listen_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "0ca1d643-2a09-4c56-ab74-a2c02ea333f7", + "type": "node", + "position": { + "x": 350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "3c829260-f3bc-4519-8d1d-82dd3b621854", + "type": "node", + "position": { + "x": 1235, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "ef5b7353-7629-4980-814c-eb29224b7e9b", + "type": "fork_result", + "position": { + "x": 465, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "c48598a9-762a-404d-b014-0a3a6bce11ce", + "type": "node", + "position": { + "x": 465, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "85f2832f-d788-4b6f-89a6-21b4a7b5d5f5", + "type": "node", + "position": { + "x": 1100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_traffic_signal", + "op": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "35583ec8-06e8-4fc7-9a72-1b254e314270", + "type": "buffer", + "position": { + "x": 1350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "obstacles_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "d0376f13-8777-42f9-a900-fbf4fd35d5d6", + "type": "fork_clone", + "position": { + "x": 840, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "detect_traffic_signal", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "b5c86326-7cda-4b73-b21b-de69cf26e58c", + "type": "node", + "position": { + "x": 600, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "ec1e1286-6187-4e30-8339-6c0792c25a45", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "6636c32d-9433-4b9d-9e54-cfec06760e1a", + "type": "node", + "position": { + "x": 850, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "6d79c57e-9113-4436-bfc4-7bcf9a9e7581", + "type": "buffer", + "position": { + "x": 647.5, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "69697829-58cd-40f2-bc11-058c72924a41", + "type": "buffer_access", + "position": { + "x": 725, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "145d874e-c842-4f29-8315-989241d53146", + "type": "node", + "position": { + "x": 725, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "9413b421-4cbd-47ec-b847-37cbffa6e0e7", + "type": "fork_result", + "position": { + "x": 725, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "c8ce2298-709c-48ca-a06c-7c6657b04f95", + "type": "node", + "position": { + "x": 725, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "96b3f994-1047-4306-931e-db07ebdffe95", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "c48598a9-762a-404d-b014-0a3a6bce11ce", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "61675e83-2f06-4440-b7af-73c807d199d5", + "source": "c5777ef8-f919-4844-b9ee-5c0b64426e87", + "sourceHandle": null, + "target": "0ca1d643-2a09-4c56-ab74-a2c02ea333f7", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "30b3f41d-1a74-41b9-90f5-6568e72dc339", + "source": "0055d8dd-e1c5-413a-a5e2-b92ebc409695", + "sourceHandle": null, + "target": "eadfdfb7-e370-4218-8a6f-bf7b4c85c2c9", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "5332cabb-8a02-4499-ba4a-5fa362472e9c", + "source": "3cedf38c-63f3-406e-bd7e-91c352a4ff78", + "sourceHandle": null, + "target": "e157c24f-fbd5-4469-97b6-c3c03bcea69e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "traffic_signal" + } + }, + "style": {} + }, + { + "id": "48a8aef5-7e29-45b8-ab0b-4afd4bd03703", + "source": "35583ec8-06e8-4fc7-9a72-1b254e314270", + "sourceHandle": null, + "target": "e157c24f-fbd5-4469-97b6-c3c03bcea69e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "obstacles" + } + }, + "style": {} + }, + { + "id": "e375c9f9-e228-4f1b-8fde-91ac49fbc77b", + "source": "e157c24f-fbd5-4469-97b6-c3c03bcea69e", + "sourceHandle": null, + "target": "0055d8dd-e1c5-413a-a5e2-b92ebc409695", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "6c520d95-75f9-4329-b1d4-72111ba48952", + "source": "44b6e07e-76aa-40fd-a648-32edf6307855", + "sourceHandle": "dataStream", + "target": "35583ec8-06e8-4fc7-9a72-1b254e314270", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "obstacles" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "e7da1f25-0207-4510-a1d3-1ba8b6637b20", + "source": "eadfdfb7-e370-4218-8a6f-bf7b4c85c2c9", + "sourceHandle": "forkResultOk", + "target": "3c829260-f3bc-4519-8d1d-82dd3b621854", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "cdcf900e-7d41-4e31-be93-02960c3c3908", + "source": "0ca1d643-2a09-4c56-ab74-a2c02ea333f7", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "dc704a05-43f2-4f27-b558-1ee6e7602386", + "source": "ef5b7353-7629-4980-814c-eb29224b7e9b", + "sourceHandle": "forkResultOk", + "target": "d0376f13-8777-42f9-a900-fbf4fd35d5d6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "fc625b90-c4aa-4ae3-ad6d-1bbbc6568f24", + "source": "ef5b7353-7629-4980-814c-eb29224b7e9b", + "sourceHandle": "forkResultErr", + "target": "c5777ef8-f919-4844-b9ee-5c0b64426e87", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e67f5550-5158-46ad-a72a-0e8c1f78b8d2", + "source": "c48598a9-762a-404d-b014-0a3a6bce11ce", + "sourceHandle": null, + "target": "ef5b7353-7629-4980-814c-eb29224b7e9b", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "ceed22ab-0a4b-49ce-a49d-2eb7978ba7ac", + "source": "85f2832f-d788-4b6f-89a6-21b4a7b5d5f5", + "sourceHandle": "dataStream", + "target": "3cedf38c-63f3-406e-bd7e-91c352a4ff78", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "traffic_signal" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "01eb58cf-88c1-4e9e-bed9-037ae6026b2d", + "source": "d0376f13-8777-42f9-a900-fbf4fd35d5d6", + "sourceHandle": null, + "target": "44b6e07e-76aa-40fd-a648-32edf6307855", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "2ffa5fd2-454b-44b5-90b6-c4be5a71ef81", + "source": "d0376f13-8777-42f9-a900-fbf4fd35d5d6", + "sourceHandle": null, + "target": "85f2832f-d788-4b6f-89a6-21b4a7b5d5f5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1dca7cf8-cf40-4efa-ba72-0791a90c65c9", + "source": "d0376f13-8777-42f9-a900-fbf4fd35d5d6", + "target": "b5c86326-7cda-4b73-b21b-de69cf26e58c", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "767116aa-7674-48ef-bfff-e6b3d0a7d9ce", + "source": "b5c86326-7cda-4b73-b21b-de69cf26e58c", + "target": "0ca1d643-2a09-4c56-ab74-a2c02ea333f7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "14dd29f8-873a-42a3-9f8f-351f327fe4cf", + "source": "d0376f13-8777-42f9-a900-fbf4fd35d5d6", + "target": "ec1e1286-6187-4e30-8339-6c0792c25a45", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "0a0f6c1a-eaeb-4a4c-88ea-ca66f76b9d9a", + "source": "ec1e1286-6187-4e30-8339-6c0792c25a45", + "target": "0ca1d643-2a09-4c56-ab74-a2c02ea333f7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "2b650960-dd4f-49bf-bb74-718d5f528c3e", + "source": "6d79c57e-9113-4436-bfc4-7bcf9a9e7581", + "target": "69697829-58cd-40f2-bc11-058c72924a41", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "ec38173d-07a2-47ca-af55-b269af3c68c8", + "source": "b5c86326-7cda-4b73-b21b-de69cf26e58c", + "sourceHandle": "dataStream", + "target": "69697829-58cd-40f2-bc11-058c72924a41", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "c9209b35-a5ae-4ecd-9adb-6e0fada6f7c4", + "source": "69697829-58cd-40f2-bc11-058c72924a41", + "target": "145d874e-c842-4f29-8315-989241d53146", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "6f3f05c3-876e-4896-a2c0-1ed8009ab191", + "source": "145d874e-c842-4f29-8315-989241d53146", + "target": "9413b421-4cbd-47ec-b847-37cbffa6e0e7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c227c39d-a6e8-430f-b2be-1380eae0ed05", + "source": "9413b421-4cbd-47ec-b847-37cbffa6e0e7", + "sourceHandle": "forkResultOk", + "target": "c8ce2298-709c-48ca-a06c-7c6657b04f95", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "60a66265-0eff-4e19-9fac-0497cb6dc348", + "source": "d0376f13-8777-42f9-a900-fbf4fd35d5d6", + "target": "6636c32d-9433-4b9d-9e54-cfec06760e1a", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "bb8a1685-895d-48c4-998d-c2f9f51e01c6", + "source": "6636c32d-9433-4b9d-9e54-cfec06760e1a", + "sourceHandle": "dataStream", + "target": "6d79c57e-9113-4436-bfc4-7bcf9a9e7581", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/listen_traffic_state.json b/examples/diagram/traffic_app/diagrams/listen_traffic_state.json new file mode 100644 index 00000000..da27bcc6 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/listen_traffic_state.json @@ -0,0 +1,1565 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "detect_obstacles": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + }, + "obstacles_buffer": { + "type": "buffer" + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "approaching_intersection", + "detect_traffic_signal", + "wait_for_destination_reached", + "check_speed_limit", + "configure_obstacles_thresholds", + "abandon_trip", + "detect_kinematics" + ] + }, + "arriving_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + }, + "detect_traffic_signal": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "listen_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "approaching_intersection": { + "type": "node", + "builder": "approaching_intersection", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "arriving": "filter_arriving" + } + }, + "traffic_signal_buffer": { + "type": "buffer" + }, + "listen": { + "type": "listen", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "arriving": "arriving_buffer", + "obstacles": "obstacles_buffer", + "speed_limit": "e31d6eb0-6042-4fa3-b9e1-554479e7b422" + }, + "next": "listen_traffic_state" + }, + "listen_traffic_state": { + "type": "node", + "builder": "listen_traffic_state", + "next": "listen_fork_result" + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + }, + "check_speed_limit": { + "type": "node", + "builder": "check_speed_limit", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "speed_limit": "e31d6eb0-6042-4fa3-b9e1-554479e7b422" + } + }, + "e31d6eb0-6042-4fa3-b9e1-554479e7b422": { + "type": "buffer" + }, + "filter_arriving": { + "type": "node", + "builder": "filter_arriving", + "next": "000166d3-14c1-430b-821f-375cd5f6e3a9" + }, + "000166d3-14c1-430b-821f-375cd5f6e3a9": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "arriving_buffer" + }, + "configure_obstacles_thresholds": { + "type": "node", + "builder": "configure_obstacles_thresholds", + "next": "detect_obstacles" + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, with Listen operation connected to traffic signal, obstacles, and arriving buffers.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "38c13b09643f55cc12135196b4e71990e622e3f9", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 542.5, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 177.5, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "bf04912e-de2b-4f11-a330-66c85940ae26", + "type": "node", + "position": { + "x": 1120, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "detect_obstacles", + "op": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "687f4a9e-1b03-4ca4-97b9-521d39408c90", + "type": "buffer", + "position": { + "x": 1120, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "obstacles_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "13a2cb93-d495-4b6b-8ddb-714418324958", + "type": "fork_clone", + "position": { + "x": 985, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "approaching_intersection", + "detect_traffic_signal", + "wait_for_destination_reached", + "check_speed_limit", + "configure_obstacles_thresholds", + "abandon_trip", + "detect_kinematics" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "856fa4df-da2b-4929-a47f-46d310daae83", + "type": "buffer", + "position": { + "x": 735, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "arriving_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "7b94dfec-f116-4e9b-b470-bfb203f8475b", + "type": "node", + "position": { + "x": 485, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "detect_traffic_signal", + "op": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "5cacf65a-60cd-4d58-a9ee-6c6413b8ed46", + "type": "node", + "position": { + "x": 542.5, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "08d2028b-9779-4271-bb1b-19945c74db35", + "type": "fork_result", + "position": { + "x": 542.5, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "be3becfa-685a-4387-94e7-05ceeef0c577", + "type": "node", + "position": { + "x": 927.5, + "y": 1125 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "636d978f-b569-4c23-bb47-d0b6b049930a", + "type": "node", + "position": { + "x": 177.5, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "5d18ab72-4b9f-4e12-80ea-71456eda60e1", + "type": "fork_result", + "position": { + "x": 927.5, + "y": 1025 + }, + "data": { + "namespace": "", + "opId": "listen_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "af28c278-0a9d-44f0-80f7-8fb7da79ce82", + "type": "node", + "position": { + "x": 735, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "approaching_intersection", + "op": { + "type": "node", + "builder": "approaching_intersection", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "arriving": "filter_arriving" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "5c683ca4-e88f-4a84-a6ef-d10ac71f6836", + "type": "buffer", + "position": { + "x": 485, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "87f5b155-1512-4192-b724-a02816035ff3", + "type": "listen", + "position": { + "x": 927.5, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "listen", + "op": { + "type": "listen", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "arriving": "arriving_buffer", + "obstacles": "obstacles_buffer", + "speed_limit": "e31d6eb0-6042-4fa3-b9e1-554479e7b422" + }, + "next": "listen_traffic_state" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "acf863d7-f3fe-4526-92ac-711d7c27074e", + "type": "node", + "position": { + "x": 927.5, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "listen_traffic_state", + "op": { + "type": "node", + "builder": "listen_traffic_state", + "next": "listen_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "33a39726-9b64-4586-b0a2-a2c4912e92d3", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "e0aeac4f-29f1-4c8d-a001-b9be9885fe00", + "type": "node", + "position": { + "x": 985, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "741c65ce-adf7-4a65-9497-6c3146a0933b", + "type": "node", + "position": { + "x": 1370, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "check_speed_limit", + "op": { + "type": "node", + "builder": "check_speed_limit", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "speed_limit": "e31d6eb0-6042-4fa3-b9e1-554479e7b422" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "27f62de9-8f2e-4237-9277-caf54921427b", + "type": "buffer", + "position": { + "x": 1370, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "e31d6eb0-6042-4fa3-b9e1-554479e7b422", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "f3bea8dc-6dde-40d7-aac5-3bd844a7390c", + "type": "node", + "position": { + "x": 735, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "filter_arriving", + "op": { + "type": "node", + "builder": "filter_arriving", + "next": "000166d3-14c1-430b-821f-375cd5f6e3a9" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "daad362d-aa24-432b-9730-d02e970a5953", + "type": "fork_result", + "position": { + "x": 735, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "000166d3-14c1-430b-821f-375cd5f6e3a9", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "arriving_buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "0d286eaf-5671-4157-b095-1f042399e229", + "type": "node", + "position": { + "x": 1120, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "configure_obstacles_thresholds", + "op": { + "type": "node", + "builder": "configure_obstacles_thresholds", + "next": "detect_obstacles" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "ba6af6bb-af84-4fce-9f1b-35f9180dacd9", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "b20b6979-f34e-40b1-a5f6-99be0b351ecc", + "type": "node", + "position": { + "x": 1562.5, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "d3015a12-9b44-4d07-b15e-487293b8e887", + "type": "buffer", + "position": { + "x": 1562.5, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "99693d85-f967-41e1-a2b3-f0aa93700fee", + "type": "buffer_access", + "position": { + "x": 1630, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "998af2f4-c5ec-4dc7-a16d-9bac1f383678", + "type": "node", + "position": { + "x": 1630, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "41023c06-aa22-4e49-a35e-54a2f07f066a", + "type": "fork_result", + "position": { + "x": 1630, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "fc882a5c-7ea2-4a7b-b8e1-f642bb148efc", + "type": "node", + "position": { + "x": 1630, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + } + ], + "edges": [ + { + "id": "f4409169-7b95-41c7-a5f8-87ee84643510", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "5cacf65a-60cd-4d58-a9ee-6c6413b8ed46", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "5f0e5de3-e412-411a-b4e0-767e34fa14e5", + "source": "bf04912e-de2b-4f11-a330-66c85940ae26", + "sourceHandle": "dataStream", + "target": "687f4a9e-1b03-4ca4-97b9-521d39408c90", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "obstacles" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "405c43fe-bed4-408d-95bc-8b36afe7243b", + "source": "13a2cb93-d495-4b6b-8ddb-714418324958", + "sourceHandle": null, + "target": "af28c278-0a9d-44f0-80f7-8fb7da79ce82", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "2c0f4a48-638a-4d47-876e-a87aaf4db2c2", + "source": "13a2cb93-d495-4b6b-8ddb-714418324958", + "sourceHandle": null, + "target": "7b94dfec-f116-4e9b-b470-bfb203f8475b", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d3efedde-0281-4122-962a-24daf45beaf1", + "source": "7b94dfec-f116-4e9b-b470-bfb203f8475b", + "sourceHandle": "dataStream", + "target": "5c683ca4-e88f-4a84-a6ef-d10ac71f6836", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "traffic_signal" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "4aab90a8-24ec-45af-9090-8ba260a1ff1d", + "source": "5cacf65a-60cd-4d58-a9ee-6c6413b8ed46", + "sourceHandle": null, + "target": "08d2028b-9779-4271-bb1b-19945c74db35", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "9ff1b717-df89-4b28-b051-4d5275585c2d", + "source": "08d2028b-9779-4271-bb1b-19945c74db35", + "sourceHandle": "forkResultOk", + "target": "13a2cb93-d495-4b6b-8ddb-714418324958", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "a8cecf7f-bbdd-4fe3-be5e-4603ce024d1f", + "source": "08d2028b-9779-4271-bb1b-19945c74db35", + "sourceHandle": "forkResultErr", + "target": "33a39726-9b64-4586-b0a2-a2c4912e92d3", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c735c2eb-0c47-4d41-ab7a-6976f9a63344", + "source": "636d978f-b569-4c23-bb47-d0b6b049930a", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e032a09b-5c6b-466d-989e-e00b6b81af59", + "source": "5d18ab72-4b9f-4e12-80ea-71456eda60e1", + "sourceHandle": "forkResultOk", + "target": "be3becfa-685a-4387-94e7-05ceeef0c577", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "88a82d61-b7d3-4dac-bafc-a52181e963eb", + "source": "5c683ca4-e88f-4a84-a6ef-d10ac71f6836", + "sourceHandle": null, + "target": "87f5b155-1512-4192-b724-a02816035ff3", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "traffic_signal" + } + }, + "style": {} + }, + { + "id": "0892a703-87b2-468d-88a1-2145c8fcdd9b", + "source": "856fa4df-da2b-4929-a47f-46d310daae83", + "sourceHandle": null, + "target": "87f5b155-1512-4192-b724-a02816035ff3", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "arriving" + } + }, + "style": {} + }, + { + "id": "ed042769-152e-41b7-ad6e-b6f3ada9ed52", + "source": "687f4a9e-1b03-4ca4-97b9-521d39408c90", + "sourceHandle": null, + "target": "87f5b155-1512-4192-b724-a02816035ff3", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "obstacles" + } + }, + "style": {} + }, + { + "id": "a722d8ce-e92b-45bb-bda2-08f0add59f1b", + "source": "87f5b155-1512-4192-b724-a02816035ff3", + "sourceHandle": null, + "target": "acf863d7-f3fe-4526-92ac-711d7c27074e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "04b803cf-f754-4a51-b2d9-44108c9c4376", + "source": "acf863d7-f3fe-4526-92ac-711d7c27074e", + "sourceHandle": null, + "target": "5d18ab72-4b9f-4e12-80ea-71456eda60e1", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "50ee8984-81ee-499e-8e69-cb3bc3948212", + "source": "33a39726-9b64-4586-b0a2-a2c4912e92d3", + "sourceHandle": null, + "target": "636d978f-b569-4c23-bb47-d0b6b049930a", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "726a635a-cf91-4b0e-880a-88baed2ecec0", + "source": "13a2cb93-d495-4b6b-8ddb-714418324958", + "target": "e0aeac4f-29f1-4c8d-a001-b9be9885fe00", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "718001a1-4690-4f7d-b9a5-40f5f588505b", + "source": "e0aeac4f-29f1-4c8d-a001-b9be9885fe00", + "target": "636d978f-b569-4c23-bb47-d0b6b049930a", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "fd00def1-cb0a-4703-b106-a75958d19379", + "source": "13a2cb93-d495-4b6b-8ddb-714418324958", + "target": "741c65ce-adf7-4a65-9497-6c3146a0933b", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b3280c7e-5aee-4cab-85e5-1e74ee74d4df", + "source": "741c65ce-adf7-4a65-9497-6c3146a0933b", + "sourceHandle": "dataStream", + "target": "27f62de9-8f2e-4237-9277-caf54921427b", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "speed_limit" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "61a9d822-cfc2-448a-8a64-155cdfa9a515", + "source": "27f62de9-8f2e-4237-9277-caf54921427b", + "target": "87f5b155-1512-4192-b724-a02816035ff3", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "speed_limit" + } + }, + "style": {}, + "selected": false + }, + { + "id": "2388d017-0399-4817-b8d6-e6e25700f855", + "source": "f3bea8dc-6dde-40d7-aac5-3bd844a7390c", + "target": "daad362d-aa24-432b-9730-d02e970a5953", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "source": "af28c278-0a9d-44f0-80f7-8fb7da79ce82", + "sourceHandle": "dataStream", + "target": "f3bea8dc-6dde-40d7-aac5-3bd844a7390c", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "arriving" + }, + "input": { + "type": "default" + } + }, + "selected": false, + "id": "xy-edge__af28c278-0a9d-44f0-80f7-8fb7da79ce82dataStream-f3bea8dc-6dde-40d7-aac5-3bd844a7390c" + }, + { + "id": "fbd036db-b370-45b0-b4d4-ff68a0660791", + "source": "daad362d-aa24-432b-9730-d02e970a5953", + "sourceHandle": "forkResultOk", + "target": "856fa4df-da2b-4929-a47f-46d310daae83", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "source": "13a2cb93-d495-4b6b-8ddb-714418324958", + "sourceHandle": null, + "target": "0d286eaf-5671-4157-b095-1f042399e229", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "id": "xy-edge__13a2cb93-d495-4b6b-8ddb-714418324958-0d286eaf-5671-4157-b095-1f042399e229" + }, + { + "id": "3a36197d-af65-4709-adea-fb0461cf872e", + "source": "0d286eaf-5671-4157-b095-1f042399e229", + "target": "bf04912e-de2b-4f11-a330-66c85940ae26", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "0e6bfa0e-56d2-420c-b92b-f112c4fca2c0", + "source": "13a2cb93-d495-4b6b-8ddb-714418324958", + "target": "ba6af6bb-af84-4fce-9f1b-35f9180dacd9", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "13e9c2ce-9f9f-4016-8c89-04a216462325", + "source": "ba6af6bb-af84-4fce-9f1b-35f9180dacd9", + "target": "636d978f-b569-4c23-bb47-d0b6b049930a", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "ca9e9e82-c1a1-416e-a2a7-a25b7d6abba0", + "source": "13a2cb93-d495-4b6b-8ddb-714418324958", + "target": "b20b6979-f34e-40b1-a5f6-99be0b351ecc", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "5aef61c4-aa8b-42a2-9f01-73c6c7244cb9", + "source": "b20b6979-f34e-40b1-a5f6-99be0b351ecc", + "sourceHandle": "dataStream", + "target": "d3015a12-9b44-4d07-b15e-487293b8e887", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "b283a586-9f27-457a-9fbd-11f09ef8996a", + "source": "d3015a12-9b44-4d07-b15e-487293b8e887", + "target": "99693d85-f967-41e1-a2b3-f0aa93700fee", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "9b884951-fb05-4f55-a8de-e448ac585886", + "source": "99693d85-f967-41e1-a2b3-f0aa93700fee", + "target": "998af2f4-c5ec-4dc7-a16d-9bac1f383678", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d279623d-6d7f-4bf8-aeea-01dae42abba6", + "source": "998af2f4-c5ec-4dc7-a16d-9bac1f383678", + "target": "41023c06-aa22-4e49-a35e-54a2f07f066a", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "0fe081e4-5edb-47b7-8a53-7f76063ef122", + "source": "41023c06-aa22-4e49-a35e-54a2f07f066a", + "sourceHandle": "forkResultOk", + "target": "fc882a5c-7ea2-4a7b-b8e1-f642bb148efc", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "516c7a62-59a6-48b0-a047-890f05fd0459", + "source": "e0aeac4f-29f1-4c8d-a001-b9be9885fe00", + "sourceHandle": "dataStream", + "target": "99693d85-f967-41e1-a2b3-f0aa93700fee", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/obstacles.json b/examples/diagram/traffic_app/diagrams/obstacles.json new file mode 100644 index 00000000..3a2110f7 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/obstacles.json @@ -0,0 +1,1185 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "process_traffic_signal_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "process_obstacles": { + "type": "node", + "builder": "process_obstacles", + "next": "process_traffic_signal_fork_result" + }, + "traffic_signal_buffer_access": { + "type": "buffer_access", + "buffers": [ + "traffic_signal_buffer" + ], + "next": "process_obstacles" + }, + "detect_obstacles": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "traffic_signal_buffer" + } + }, + "traffic_signal_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 1 + } + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "wait_for_destination_reached", + "configure_obstacles_thresholds", + "abandon_trip", + "detect_kinematics" + ] + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + }, + "configure_obstacles_thresholds": { + "type": "node", + "builder": "configure_obstacles_thresholds", + "next": "detect_obstacles" + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + }, + "trigger_fork_clone": { + "type": "fork_clone", + "next": [ + "traffic_signal_buffer_access", + "kinematics_buffer_access" + ] + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, while respecting the traffic light signals: go on Green, stop on Red, and slow down on Yellow.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "8bf129c7ea2835abf43a932277f2a07c76d72687", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 485, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 340, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "type": "fork_result", + "position": { + "x": 620, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "process_traffic_signal_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "da53b797-960e-490e-b24a-d3cccb562f92", + "type": "node", + "position": { + "x": 340, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "c887a4d3-b9cc-4653-9a11-8fea88fdf05d", + "type": "node", + "position": { + "x": 620, + "y": 1025 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "type": "fork_result", + "position": { + "x": 485, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "type": "node", + "position": { + "x": 485, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "type": "node", + "position": { + "x": 620, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "process_obstacles", + "op": { + "type": "node", + "builder": "process_obstacles", + "next": "process_traffic_signal_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "type": "buffer_access", + "position": { + "x": 620, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "traffic_signal_buffer" + ], + "next": "process_obstacles" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "type": "node", + "position": { + "x": 870, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "detect_obstacles", + "op": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "a8825063-f561-4c80-861f-61b3d721ebf5", + "type": "buffer", + "position": { + "x": 870, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 1 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "f75d8029-28c3-498c-96f8-e44026fc9678", + "type": "fork_clone", + "position": { + "x": 735, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "wait_for_destination_reached", + "configure_obstacles_thresholds", + "abandon_trip", + "detect_kinematics" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "00673ad8-773a-4a11-84b6-5390c0908951", + "type": "node", + "position": { + "x": 610, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "51e14d49-5760-4323-b72a-da72eb9e4d7d", + "type": "node", + "position": { + "x": 870, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "configure_obstacles_thresholds", + "op": { + "type": "node", + "builder": "configure_obstacles_thresholds", + "next": "detect_obstacles" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "9206e750-0c2d-4dcf-b825-3c71310f2c99", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "e9395358-7b60-4af8-bd3a-b49e8cfeee33", + "type": "node", + "position": { + "x": 1130, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "aad66622-e32d-45ed-ab6d-5272b658b763", + "type": "buffer", + "position": { + "x": 1130, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "7e848cb8-9e3c-4930-9f2d-0b5b2c475a00", + "type": "buffer_access", + "position": { + "x": 1120, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "05ac9d41-220d-4aa6-9c1a-e15f416531f5", + "type": "node", + "position": { + "x": 1120, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e3d430cc-cda6-4b12-8264-fd948c3a3ecd", + "type": "fork_result", + "position": { + "x": 1120, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "4fea18a4-a339-4101-b416-a413f589911c", + "type": "node", + "position": { + "x": 1120, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "1d894c77-dd9b-4851-9bf9-7686b345bb62", + "type": "fork_clone", + "position": { + "x": 620, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "trigger_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "traffic_signal_buffer_access", + "kinematics_buffer_access" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "de221614-b678-4d7a-bab6-8d80454eee4f", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "7713fb07-00eb-415d-be58-56ce8e4bacdf", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "9f9b8318-6797-49bd-95cd-46dfc30e49d0", + "source": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "sourceHandle": "forkResultOk", + "target": "c887a4d3-b9cc-4653-9a11-8fea88fdf05d", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "3d3f0646-4378-46cc-9ab7-847d1f58ed53", + "source": "da53b797-960e-490e-b24a-d3cccb562f92", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "ea17c617-01e7-4eb7-ac94-9394435de579", + "source": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "sourceHandle": "forkResultOk", + "target": "f75d8029-28c3-498c-96f8-e44026fc9678", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "ebb13a84-5795-43d8-b123-4cf85047f186", + "source": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "sourceHandle": null, + "target": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "400a9a8a-1318-4f39-9067-25d08c44c42a", + "source": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "sourceHandle": null, + "target": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "9a2f83c3-6bb7-44ff-9ff8-130edd80ab6f", + "source": "a8825063-f561-4c80-861f-61b3d721ebf5", + "sourceHandle": null, + "target": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {}, + "selected": false + }, + { + "id": "8e7db455-1728-47f7-85c3-26d56ba7cb5f", + "source": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "sourceHandle": null, + "target": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "a377a812-5761-4511-bf54-e5673976c76e", + "source": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "sourceHandle": "dataStream", + "target": "a8825063-f561-4c80-861f-61b3d721ebf5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "obstacles" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "2adeadd7-27c6-4e02-bd12-d9930a56a602", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "00673ad8-773a-4a11-84b6-5390c0908951", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7917b061-6e59-45f6-9727-3ad5237f7e99", + "source": "00673ad8-773a-4a11-84b6-5390c0908951", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "sourceHandle": null, + "target": "51e14d49-5760-4323-b72a-da72eb9e4d7d", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false, + "id": "xy-edge__f75d8029-28c3-498c-96f8-e44026fc9678-51e14d49-5760-4323-b72a-da72eb9e4d7d" + }, + { + "id": "eea540c9-3804-4f08-a3ae-10a0778ddc11", + "source": "51e14d49-5760-4323-b72a-da72eb9e4d7d", + "target": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "85398745-969e-483a-9a40-09213060aa26", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "9206e750-0c2d-4dcf-b825-3c71310f2c99", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e13bb989-b4fe-410e-b6a3-a234fdb44628", + "source": "9206e750-0c2d-4dcf-b825-3c71310f2c99", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "49f335ad-696a-4a9d-846d-ffa444288da6", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "e9395358-7b60-4af8-bd3a-b49e8cfeee33", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "3ec0491f-7541-4845-926b-a71264a94994", + "source": "e9395358-7b60-4af8-bd3a-b49e8cfeee33", + "sourceHandle": "dataStream", + "target": "aad66622-e32d-45ed-ab6d-5272b658b763", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "345d6f02-2668-4703-919d-fac38b7e9df9", + "source": "aad66622-e32d-45ed-ab6d-5272b658b763", + "target": "7e848cb8-9e3c-4930-9f2d-0b5b2c475a00", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "0eed45b7-aea7-4f93-a8d8-6ce50a380155", + "source": "7e848cb8-9e3c-4930-9f2d-0b5b2c475a00", + "target": "05ac9d41-220d-4aa6-9c1a-e15f416531f5", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f1c3679f-7d37-4101-b483-6d2b7cc3efc1", + "source": "05ac9d41-220d-4aa6-9c1a-e15f416531f5", + "target": "e3d430cc-cda6-4b12-8264-fd948c3a3ecd", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "222f0deb-61b2-4ae6-8764-a3e591bce08e", + "source": "e3d430cc-cda6-4b12-8264-fd948c3a3ecd", + "sourceHandle": "forkResultOk", + "target": "4fea18a4-a339-4101-b416-a413f589911c", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "2c12bc05-3395-4b5f-b510-c6fa4503c732", + "source": "00673ad8-773a-4a11-84b6-5390c0908951", + "sourceHandle": "dataStream", + "target": "1d894c77-dd9b-4851-9bf9-7686b345bb62", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "06c0ce95-125c-4d55-9166-9591b79f48db", + "source": "1d894c77-dd9b-4851-9bf9-7686b345bb62", + "target": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "aab8d64f-dd98-4a30-be93-27459ab65628", + "source": "1d894c77-dd9b-4851-9bf9-7686b345bb62", + "target": "7e848cb8-9e3c-4930-9f2d-0b5b2c475a00", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7fe4edca-7314-4a64-9227-46ba847765a8", + "source": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "sourceHandle": "forkResultErr", + "target": "de221614-b678-4d7a-bab6-8d80454eee4f", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "cd470572-77a6-4fc2-b0c2-76ac0fe793dc", + "source": "de221614-b678-4d7a-bab6-8d80454eee4f", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/speed_limit.json b/examples/diagram/traffic_app/diagrams/speed_limit.json new file mode 100644 index 00000000..75c5f6a3 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/speed_limit.json @@ -0,0 +1,1139 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "process_traffic_signal_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "follow_speed_limit": { + "type": "node", + "builder": "follow_speed_limit", + "next": "process_traffic_signal_fork_result" + }, + "traffic_signal_buffer_access": { + "type": "buffer_access", + "buffers": [ + "traffic_signal_buffer" + ], + "next": "follow_speed_limit" + }, + "check_speed_limit": { + "type": "node", + "builder": "check_speed_limit", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "speed_limit": "traffic_signal_buffer" + } + }, + "traffic_signal_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 1 + } + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "check_speed_limit", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + }, + "trigger_fork_clone": { + "type": "fork_clone", + "next": [ + "kinematics_buffer_access", + "traffic_signal_buffer_access" + ] + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, while respecting the traffic light signals: go on Green, stop on Red, and slow down on Yellow.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "8ffd232cb733402c2acffa571ce2abd4e9414b1b", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 485, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 350, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "type": "fork_result", + "position": { + "x": 620, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "process_traffic_signal_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "da53b797-960e-490e-b24a-d3cccb562f92", + "type": "node", + "position": { + "x": 350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "c887a4d3-b9cc-4653-9a11-8fea88fdf05d", + "type": "node", + "position": { + "x": 620, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "type": "fork_result", + "position": { + "x": 485, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "type": "node", + "position": { + "x": 485, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "type": "node", + "position": { + "x": 620, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "follow_speed_limit", + "op": { + "type": "node", + "builder": "follow_speed_limit", + "next": "process_traffic_signal_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "type": "buffer_access", + "position": { + "x": 620, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "traffic_signal_buffer" + ], + "next": "follow_speed_limit" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "type": "node", + "position": { + "x": 870, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "check_speed_limit", + "op": { + "type": "node", + "builder": "check_speed_limit", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "speed_limit": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "a8825063-f561-4c80-861f-61b3d721ebf5", + "type": "buffer", + "position": { + "x": 870, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 1 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "f75d8029-28c3-498c-96f8-e44026fc9678", + "type": "fork_clone", + "position": { + "x": 735, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "check_speed_limit", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "00673ad8-773a-4a11-84b6-5390c0908951", + "type": "node", + "position": { + "x": 610, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "ef7c2c5c-b8f6-4913-8b7d-45c35231e00b", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "cb4b7d28-e5ba-47b6-b290-9f754d60e6ad", + "type": "node", + "position": { + "x": 1120, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "9f110b42-b55d-4db0-83b8-b13e905943aa", + "type": "buffer", + "position": { + "x": 1120, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "c64167ed-33ed-4553-abdf-95acfae18fad", + "type": "buffer_access", + "position": { + "x": 1110, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "f105b773-6353-4f73-9e97-cc998b0a6971", + "type": "node", + "position": { + "x": 1110, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "c9e2f951-9430-46c7-a3b7-fd060bdb4be7", + "type": "fork_result", + "position": { + "x": 1110, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "61d58e78-c7c7-4a56-97c9-7cd3a7d7f424", + "type": "node", + "position": { + "x": 1110, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e2e790b3-c3a4-481c-a3e5-b5ec9ba94bf8", + "type": "fork_clone", + "position": { + "x": 620, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "trigger_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "kinematics_buffer_access", + "traffic_signal_buffer_access" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "c7569597-f3d6-4346-b50f-c27f728f90d0", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "7713fb07-00eb-415d-be58-56ce8e4bacdf", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "9f9b8318-6797-49bd-95cd-46dfc30e49d0", + "source": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "sourceHandle": "forkResultOk", + "target": "c887a4d3-b9cc-4653-9a11-8fea88fdf05d", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "3d3f0646-4378-46cc-9ab7-847d1f58ed53", + "source": "da53b797-960e-490e-b24a-d3cccb562f92", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "ea17c617-01e7-4eb7-ac94-9394435de579", + "source": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "sourceHandle": "forkResultOk", + "target": "f75d8029-28c3-498c-96f8-e44026fc9678", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "ebb13a84-5795-43d8-b123-4cf85047f186", + "source": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "sourceHandle": null, + "target": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "400a9a8a-1318-4f39-9067-25d08c44c42a", + "source": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "sourceHandle": null, + "target": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "9a2f83c3-6bb7-44ff-9ff8-130edd80ab6f", + "source": "a8825063-f561-4c80-861f-61b3d721ebf5", + "sourceHandle": null, + "target": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {}, + "selected": false + }, + { + "id": "8e7db455-1728-47f7-85c3-26d56ba7cb5f", + "source": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "sourceHandle": null, + "target": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "a377a812-5761-4511-bf54-e5673976c76e", + "source": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "sourceHandle": "dataStream", + "target": "a8825063-f561-4c80-861f-61b3d721ebf5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "speed_limit" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "1725f3f1-f765-4563-9920-83c17072a215", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "sourceHandle": null, + "target": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "2adeadd7-27c6-4e02-bd12-d9930a56a602", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "00673ad8-773a-4a11-84b6-5390c0908951", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7917b061-6e59-45f6-9727-3ad5237f7e99", + "source": "00673ad8-773a-4a11-84b6-5390c0908951", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "e675871b-f2ef-4f70-a326-f7f094c622b7", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "ef7c2c5c-b8f6-4913-8b7d-45c35231e00b", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b946721d-3076-4584-9513-9c7ca140de61", + "source": "ef7c2c5c-b8f6-4913-8b7d-45c35231e00b", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "bd073f45-d306-44b0-9dd8-6d94c706d035", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "cb4b7d28-e5ba-47b6-b290-9f754d60e6ad", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1822c3d1-bcb7-4d0f-b6d4-d4c11307fc8a", + "source": "cb4b7d28-e5ba-47b6-b290-9f754d60e6ad", + "sourceHandle": "dataStream", + "target": "9f110b42-b55d-4db0-83b8-b13e905943aa", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "1dcc308d-af1d-435c-8e7a-1a12719ec85b", + "source": "9f110b42-b55d-4db0-83b8-b13e905943aa", + "target": "c64167ed-33ed-4553-abdf-95acfae18fad", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "db2cd7cc-0b96-4d91-b60b-ff7f56fc2b51", + "source": "c64167ed-33ed-4553-abdf-95acfae18fad", + "target": "f105b773-6353-4f73-9e97-cc998b0a6971", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "0a47c1e8-ef62-4ffa-9807-054e740cb242", + "source": "f105b773-6353-4f73-9e97-cc998b0a6971", + "target": "c9e2f951-9430-46c7-a3b7-fd060bdb4be7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "a0bf9853-b567-4c1b-a07e-81a72f1923bf", + "source": "c9e2f951-9430-46c7-a3b7-fd060bdb4be7", + "sourceHandle": "forkResultOk", + "target": "61d58e78-c7c7-4a56-97c9-7cd3a7d7f424", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f069266c-a674-4f66-816e-0fd3ce6448cd", + "source": "00673ad8-773a-4a11-84b6-5390c0908951", + "sourceHandle": "dataStream", + "target": "e2e790b3-c3a4-481c-a3e5-b5ec9ba94bf8", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "13984f0f-c11d-4787-a33b-bbb8bbad96df", + "source": "e2e790b3-c3a4-481c-a3e5-b5ec9ba94bf8", + "target": "c64167ed-33ed-4553-abdf-95acfae18fad", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f6dc638a-9aa7-45f2-86fb-5eef0da28723", + "source": "e2e790b3-c3a4-481c-a3e5-b5ec9ba94bf8", + "target": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e4a625a2-e0e9-48f3-b772-7f0b288fb60b", + "source": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "sourceHandle": "forkResultErr", + "target": "c7569597-f3d6-4346-b50f-c27f728f90d0", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1b7905da-2c75-4801-93f3-02c9923dd6f1", + "source": "c7569597-f3d6-4346-b50f-c27f728f90d0", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/traffic_signal.json b/examples/diagram/traffic_app/diagrams/traffic_signal.json new file mode 100644 index 00000000..dc684943 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/traffic_signal.json @@ -0,0 +1,1139 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "process_traffic_signal_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "process_traffic_signal": { + "type": "node", + "builder": "process_traffic_signal", + "next": "process_traffic_signal_fork_result" + }, + "traffic_signal_buffer_access": { + "type": "buffer_access", + "buffers": [ + "traffic_signal_buffer" + ], + "next": "process_traffic_signal" + }, + "detect_traffic_signal": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + }, + "traffic_signal_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 1 + } + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "detect_traffic_signal", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_clone" + }, + "kinematics_fork_clone": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + }, + "trigger_fork_clone": { + "type": "fork_clone", + "next": [ + "traffic_signal_buffer_access", + "kinematics_buffer_access" + ] + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "description": "A workflow that moves the vehicle forward until it travelled the requested distance, while respecting the traffic light signals: go on Green, stop on Red, and slow down on Yellow.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "3cd19fde7420f0f8d9f44b07c4399f9642777772", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 485, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 350, + "y": 625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "type": "fork_result", + "position": { + "x": 620, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "process_traffic_signal_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "da53b797-960e-490e-b24a-d3cccb562f92", + "type": "node", + "position": { + "x": 350, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "c887a4d3-b9cc-4653-9a11-8fea88fdf05d", + "type": "node", + "position": { + "x": 620, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "type": "fork_result", + "position": { + "x": 485, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "type": "node", + "position": { + "x": 485, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "type": "node", + "position": { + "x": 620, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_traffic_signal", + "op": { + "type": "node", + "builder": "process_traffic_signal", + "next": "process_traffic_signal_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "type": "buffer_access", + "position": { + "x": 620, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "traffic_signal_buffer" + ], + "next": "process_traffic_signal" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "type": "node", + "position": { + "x": 870, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_traffic_signal", + "op": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "a8825063-f561-4c80-861f-61b3d721ebf5", + "type": "buffer", + "position": { + "x": 870, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 1 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "f75d8029-28c3-498c-96f8-e44026fc9678", + "type": "fork_clone", + "position": { + "x": 735, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "detect_traffic_signal", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "00673ad8-773a-4a11-84b6-5390c0908951", + "type": "node", + "position": { + "x": 610, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "trigger_fork_clone" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "50c9ba43-0f3e-4850-9e11-97e57e262dd3", + "type": "node", + "position": { + "x": 350, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "2c7fcae2-9b5a-435b-90ff-89b11e077d9d", + "type": "node", + "position": { + "x": 1120, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e377bd32-fb06-4a10-b1b4-7539caab9f6e", + "type": "buffer", + "position": { + "x": 1120, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "b367165e-e7f0-44c3-b8fe-89bf2cbc61d8", + "type": "buffer_access", + "position": { + "x": 1110, + "y": 625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e2ae7fe3-650f-4369-9e95-77ece7433cb3", + "type": "node", + "position": { + "x": 1110, + "y": 725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "561bbca3-e41e-4784-a5f8-2c4779e9ede9", + "type": "fork_result", + "position": { + "x": 1110, + "y": 825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_clone", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "fe33db42-d752-45fa-aec8-c225de762bd4", + "type": "node", + "position": { + "x": 1110, + "y": 925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "1fc249c0-62b5-46e9-af14-4af5c98de481", + "type": "fork_clone", + "position": { + "x": 620, + "y": 525 + }, + "data": { + "namespace": "", + "opId": "trigger_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "traffic_signal_buffer_access", + "kinematics_buffer_access" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "9fdc8183-0409-4215-80fc-42ba72d3758c", + "type": "node", + "position": { + "x": 100, + "y": 425 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "7713fb07-00eb-415d-be58-56ce8e4bacdf", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "9f9b8318-6797-49bd-95cd-46dfc30e49d0", + "source": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "sourceHandle": "forkResultOk", + "target": "c887a4d3-b9cc-4653-9a11-8fea88fdf05d", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "3d3f0646-4378-46cc-9ab7-847d1f58ed53", + "source": "da53b797-960e-490e-b24a-d3cccb562f92", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "ea17c617-01e7-4eb7-ac94-9394435de579", + "source": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "sourceHandle": "forkResultOk", + "target": "f75d8029-28c3-498c-96f8-e44026fc9678", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "ebb13a84-5795-43d8-b123-4cf85047f186", + "source": "8cb28806-7d70-4b6b-83a4-441e678d19a7", + "sourceHandle": null, + "target": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "400a9a8a-1318-4f39-9067-25d08c44c42a", + "source": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "sourceHandle": null, + "target": "d8366e5f-72ef-4e71-a6da-591d67f76a19", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "9a2f83c3-6bb7-44ff-9ff8-130edd80ab6f", + "source": "a8825063-f561-4c80-861f-61b3d721ebf5", + "sourceHandle": null, + "target": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {}, + "selected": false + }, + { + "id": "8e7db455-1728-47f7-85c3-26d56ba7cb5f", + "source": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "sourceHandle": null, + "target": "e5ce8e45-6bd1-4f32-a990-3e7c759827a2", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "a377a812-5761-4511-bf54-e5673976c76e", + "source": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "sourceHandle": "dataStream", + "target": "a8825063-f561-4c80-861f-61b3d721ebf5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "traffic_signal" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "1725f3f1-f765-4563-9920-83c17072a215", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "sourceHandle": null, + "target": "80ea05c5-5e1a-438f-b32b-4a56e2b51c7f", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "2adeadd7-27c6-4e02-bd12-d9930a56a602", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "00673ad8-773a-4a11-84b6-5390c0908951", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7917b061-6e59-45f6-9727-3ad5237f7e99", + "source": "00673ad8-773a-4a11-84b6-5390c0908951", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7b549dcf-ec9a-4a7a-bc63-81fca0824566", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "50c9ba43-0f3e-4850-9e11-97e57e262dd3", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c91885b4-bc68-4ed0-94cd-7279ad605832", + "source": "50c9ba43-0f3e-4850-9e11-97e57e262dd3", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f7a55530-56c7-4b1c-8b63-273579c05489", + "source": "e377bd32-fb06-4a10-b1b4-7539caab9f6e", + "target": "b367165e-e7f0-44c3-b8fe-89bf2cbc61d8", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "d1cc57fe-2b22-4906-a0f8-7f2674cf0564", + "source": "2c7fcae2-9b5a-435b-90ff-89b11e077d9d", + "sourceHandle": "dataStream", + "target": "e377bd32-fb06-4a10-b1b4-7539caab9f6e", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "fe147587-cd89-44e0-a174-0be5a1593f1f", + "source": "f75d8029-28c3-498c-96f8-e44026fc9678", + "target": "2c7fcae2-9b5a-435b-90ff-89b11e077d9d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "1105a557-f897-451c-bb53-d37bbb98317a", + "source": "b367165e-e7f0-44c3-b8fe-89bf2cbc61d8", + "target": "e2ae7fe3-650f-4369-9e95-77ece7433cb3", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "b34136cd-ecee-4b87-ab52-a4e4d14cf4a8", + "source": "e2ae7fe3-650f-4369-9e95-77ece7433cb3", + "target": "561bbca3-e41e-4784-a5f8-2c4779e9ede9", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "ae9fd04a-31e7-4905-b469-cd97aab85ecc", + "source": "561bbca3-e41e-4784-a5f8-2c4779e9ede9", + "sourceHandle": "forkResultOk", + "target": "fe33db42-d752-45fa-aec8-c225de762bd4", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "26e86342-4ea4-4627-b94b-dd08bf3cb121", + "source": "00673ad8-773a-4a11-84b6-5390c0908951", + "sourceHandle": "dataStream", + "target": "1fc249c0-62b5-46e9-af14-4af5c98de481", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "3cbc2b53-5cac-4bf1-8eae-2e6380a365a8", + "source": "1fc249c0-62b5-46e9-af14-4af5c98de481", + "target": "addc4ab1-d8f5-4d55-90bc-f0db0aef4bf5", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "5ad1ef24-d8ea-4755-8e44-4a9e09a69990", + "source": "1fc249c0-62b5-46e9-af14-4af5c98de481", + "target": "b367165e-e7f0-44c3-b8fe-89bf2cbc61d8", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "00507656-4cc6-425c-b82d-ee09f467c647", + "source": "6caeabd1-fc5a-4ee2-ab0b-0a19018738a5", + "sourceHandle": "forkResultErr", + "target": "9fdc8183-0409-4215-80fc-42ba72d3758c", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "957e4415-444f-4277-a446-59e11018f51f", + "source": "9fdc8183-0409-4215-80fc-42ba72d3758c", + "target": "da53b797-960e-490e-b24a-d3cccb562f92", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/diagrams/vehicle_check_ready.json b/examples/diagram/traffic_app/diagrams/vehicle_check_ready.json new file mode 100644 index 00000000..d475e273 --- /dev/null +++ b/examples/diagram/traffic_app/diagrams/vehicle_check_ready.json @@ -0,0 +1,1798 @@ +{ + "$schema": "https://raw.githubusercontent.com/open-rmf/crossflow/refs/heads/main/diagram.schema.json", + "version": "0.1.0", + "templates": {}, + "start": "start_engine", + "ops": { + "vehicle_check_scope": { + "type": "scope", + "start": "begin_vehicle_check", + "ops": { + "validate_vehicle_check": { + "type": "node", + "builder": "validate_vehicle_check", + "next": { + "builtin": "terminate" + } + }, + "41faf7b8-3733-464e-a629-656016961562": { + "type": "join", + "buffers": [ + "fuel_buffer", + "mirrors_buffer" + ], + "next": "validate_vehicle_check" + }, + "mirrors_buffer": { + "type": "buffer" + }, + "fuel_buffer": { + "type": "buffer" + }, + "mirrors_ready": { + "type": "node", + "builder": "vehicle_check_ready", + "next": "mirrors_buffer" + }, + "fuel_ready": { + "type": "node", + "builder": "vehicle_check_ready", + "next": "fuel_buffer" + }, + "vehicle_check_split": { + "type": "split", + "keyed": { + "fuel": "fuel_ready", + "mirrors": "mirrors_ready" + } + }, + "begin_vehicle_check": { + "type": "node", + "builder": "begin_vehicle_check", + "next": "vehicle_check_split" + } + }, + "next": "validate_check_fork_result" + }, + "trip_error": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + }, + "start_engine_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "vehicle_check_scope" + }, + "join": { + "type": "join", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "obstacles": "obstacles_buffer" + }, + "next": "join_traffic_signal_and_obstacles" + }, + "join_traffic_signal_and_obstacles": { + "type": "node", + "builder": "join_traffic_signal_and_obstacles", + "next": "join_fork_result" + }, + "traffic_signal_buffer": { + "type": "buffer" + }, + "detect_obstacles": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + }, + "join_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + }, + "stop_engine": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + }, + "accelerate_vehicle": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + }, + "validate_check_fork_result": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + }, + "start_engine": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + }, + "detect_traffic_signal": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + }, + "obstacles_buffer": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + }, + "start_engine_fork_clone": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "detect_traffic_signal", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + }, + "wait_for_destination_reached": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + }, + "abandon_trip": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + }, + "detect_kinematics": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + }, + "kinematics_buffer": { + "type": "buffer" + }, + "kinematics_buffer_access": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + }, + "process_kinematics": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + }, + "kinematics_fork_result": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + }, + "update_vehicle_state": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "description": "A workflow that conducts vehicle checks (e.g. mirrors, fuel level) before moving the vehicle forward until it travelled the requested distance.", + "input_examples": [], + "extensions": { + "crossflow-diagram-editor-v1": { + "hash": "64c866851359ff86233a9f9e84d149030e6aca21", + "state": { + "nodes": [ + { + "id": ":__builtin_start__", + "type": "start", + "position": { + "x": 417.5, + "y": 25 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":__builtin_terminate__", + "type": "terminate", + "position": { + "x": 292.5, + "y": 1625 + }, + "selectable": false, + "data": { + "namespace": "" + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "35b088ac-eed3-412c-910f-510acc8bf728", + "type": "scope", + "position": { + "x": 150, + "y": 325 + }, + "data": { + "namespace": "", + "opId": "vehicle_check_scope", + "op": { + "type": "scope", + "start": "begin_vehicle_check", + "ops": { + "begin_vehicle_check": { + "type": "node", + "builder": "begin_vehicle_check", + "next": "vehicle_check_split" + }, + "vehicle_check_split": { + "type": "split", + "keyed": { + "fuel": "fuel_ready", + "mirrors": "mirrors_ready" + } + }, + "fuel_ready": { + "type": "node", + "builder": "vehicle_check_ready", + "next": "d3637c59-98ed-421b-baa4-9f26101cf491" + }, + "mirrors_ready": { + "type": "node", + "builder": "vehicle_check_ready", + "next": "a9946745-7ff9-403a-a4e3-b249353b815e" + }, + "d3637c59-98ed-421b-baa4-9f26101cf491": { + "type": "buffer" + }, + "a9946745-7ff9-403a-a4e3-b249353b815e": { + "type": "buffer" + }, + "41faf7b8-3733-464e-a629-656016961562": { + "type": "join", + "buffers": [ + "d3637c59-98ed-421b-baa4-9f26101cf491", + "a9946745-7ff9-403a-a4e3-b249353b815e" + ], + "next": "validate_vehicle_check" + }, + "validate_vehicle_check": { + "type": "node", + "builder": "validate_vehicle_check", + "next": { + "builtin": "terminate" + } + } + }, + "next": "validate_check_fork_result" + } + }, + "width": 610, + "height": 850, + "zIndex": -1, + "measured": { + "width": 610, + "height": 850 + }, + "selected": false + }, + { + "id": ":vehicle_check_scope:__builtin_start__", + "type": "start", + "position": { + "x": 210, + "y": 50 + }, + "data": { + "namespace": ":35b088ac-eed3-412c-910f-510acc8bf728" + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": ":vehicle_check_scope:__builtin_terminate__", + "type": "terminate", + "position": { + "x": 210, + "y": 750 + }, + "data": { + "namespace": ":35b088ac-eed3-412c-910f-510acc8bf728" + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "4be2bf0a-85d7-4b9b-abd3-cca352dd0221", + "type": "node", + "position": { + "x": 210, + "y": 650 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "validate_vehicle_check", + "op": { + "type": "node", + "builder": "validate_vehicle_check", + "next": { + "builtin": "terminate" + } + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "b3ca763b-b025-462c-a5f0-82f43ab4c3af", + "type": "join", + "position": { + "x": 210, + "y": 550 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "41faf7b8-3733-464e-a629-656016961562", + "op": { + "type": "join", + "buffers": [ + "fuel_buffer", + "mirrors_buffer" + ], + "next": "validate_vehicle_check" + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "021b533d-3b65-4f84-af9f-45681bb560c0", + "type": "buffer", + "position": { + "x": 335, + "y": 450 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "mirrors_buffer", + "op": { + "type": "buffer" + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "4ae7f2fe-ecb6-452a-a252-f219d7575c92", + "type": "buffer", + "position": { + "x": 75, + "y": 450 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "fuel_buffer", + "op": { + "type": "buffer" + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "e0645003-9bde-44b1-97ed-944504627f39", + "type": "node", + "position": { + "x": 335, + "y": 350 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "mirrors_ready", + "op": { + "type": "node", + "builder": "vehicle_check_ready", + "next": "mirrors_buffer" + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "ede166b0-93e6-498c-ab20-1826840e1ef5", + "type": "node", + "position": { + "x": 75, + "y": 350 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "fuel_ready", + "op": { + "type": "node", + "builder": "vehicle_check_ready", + "next": "fuel_buffer" + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "6cda3bff-536e-4211-abba-5f20031cef1a", + "type": "split", + "position": { + "x": 210, + "y": 250 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "vehicle_check_split", + "op": { + "type": "split", + "keyed": { + "fuel": "fuel_ready", + "mirrors": "mirrors_ready" + } + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "5af2cdc3-5c7b-47ec-9a25-8af9395c7ba6", + "type": "node", + "position": { + "x": 210, + "y": 150 + }, + "data": { + "namespace": ":vehicle_check_scope", + "opId": "begin_vehicle_check", + "op": { + "type": "node", + "builder": "begin_vehicle_check", + "next": "vehicle_check_split" + } + }, + "parentId": "35b088ac-eed3-412c-910f-510acc8bf728", + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "fa23afb3-1fb6-4cf5-81c3-064d99587e7f", + "type": "node", + "position": { + "x": 100, + "y": 1325 + }, + "data": { + "namespace": "", + "opId": "trip_error", + "op": { + "type": "node", + "builder": "trip_error", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "d75576ec-5165-40e0-b164-c7cb4a410c7e", + "type": "fork_result", + "position": { + "x": 417.5, + "y": 225 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "vehicle_check_scope" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "37f51deb-17dd-4eda-9618-107fa51658d7", + "type": "join", + "position": { + "x": 1187.5, + "y": 1625 + }, + "data": { + "namespace": "", + "opId": "join", + "op": { + "type": "join", + "buffers": { + "traffic_signal": "traffic_signal_buffer", + "obstacles": "obstacles_buffer" + }, + "next": "join_traffic_signal_and_obstacles" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "07c1477b-58c9-44fc-add2-80cc00e93daf", + "type": "node", + "position": { + "x": 1187.5, + "y": 1725 + }, + "data": { + "namespace": "", + "opId": "join_traffic_signal_and_obstacles", + "op": { + "type": "node", + "builder": "join_traffic_signal_and_obstacles", + "next": "join_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "9b5d6c84-1b24-4d40-ba0a-83109a25a18b", + "type": "buffer", + "position": { + "x": 995, + "y": 1525 + }, + "data": { + "namespace": "", + "opId": "traffic_signal_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "b52b9a4d-1c1e-4fea-bfa1-2da395316f26", + "type": "node", + "position": { + "x": 1245, + "y": 1425 + }, + "data": { + "namespace": "", + "opId": "detect_obstacles", + "op": { + "type": "node", + "builder": "detect_obstacles", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "obstacles": "obstacles_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "54d151ba-a962-4abe-8f89-30619a2eeadc", + "type": "fork_result", + "position": { + "x": 1187.5, + "y": 1825 + }, + "data": { + "namespace": "", + "opId": "join_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "accelerate_vehicle" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "edb98b92-f49d-4287-b696-bac9fcee121d", + "type": "node", + "position": { + "x": 292.5, + "y": 1525 + }, + "data": { + "namespace": "", + "opId": "stop_engine", + "op": { + "type": "node", + "builder": "stop_engine", + "next": { + "builtin": "terminate" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "4d404b13-ab24-42c1-995c-a71b117b3b90", + "type": "node", + "position": { + "x": 1187.5, + "y": 1925 + }, + "data": { + "namespace": "", + "opId": "accelerate_vehicle", + "op": { + "type": "node", + "builder": "accelerate_vehicle", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "c5e5d184-833a-403c-9489-316fd8074594", + "type": "fork_result", + "position": { + "x": 485, + "y": 1225 + }, + "data": { + "namespace": "", + "opId": "validate_check_fork_result", + "op": { + "type": "fork_result", + "err": "trip_error", + "ok": "start_engine_fork_clone" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "15de07d9-e2aa-4b96-a702-b765462e53e6", + "type": "node", + "position": { + "x": 417.5, + "y": 125 + }, + "data": { + "namespace": "", + "opId": "start_engine", + "op": { + "type": "node", + "builder": "start_engine", + "next": "start_engine_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "84cff016-ea88-4d2a-a9c9-fd850eb82381", + "type": "node", + "position": { + "x": 995, + "y": 1425 + }, + "data": { + "namespace": "", + "opId": "detect_traffic_signal", + "op": { + "type": "node", + "builder": "detect_traffic_signal", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "traffic_signal": "traffic_signal_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "90571258-dabb-4e5f-9349-dfa1f534e8b1", + "type": "buffer", + "position": { + "x": 1245, + "y": 1525 + }, + "data": { + "namespace": "", + "opId": "obstacles_buffer", + "op": { + "type": "buffer", + "settings": { + "retention": { + "keep_last": 10 + } + } + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "c0f29881-abed-4fc0-affb-007cd75bb906", + "type": "fork_clone", + "position": { + "x": 735, + "y": 1325 + }, + "data": { + "namespace": "", + "opId": "start_engine_fork_clone", + "op": { + "type": "fork_clone", + "next": [ + "detect_obstacles", + "detect_traffic_signal", + "wait_for_destination_reached", + "abandon_trip", + "detect_kinematics" + ] + } + }, + "measured": { + "width": 200, + "height": 50 + } + }, + { + "id": "e3f8206d-2db0-4a08-99d7-5bca2aebf860", + "type": "node", + "position": { + "x": 495, + "y": 1425 + }, + "data": { + "namespace": "", + "opId": "wait_for_destination_reached", + "op": { + "type": "node", + "builder": "wait_for_destination_reached", + "next": "stop_engine", + "stream_out": { + "trigger": "kinematics_buffer_access" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "e404fc43-56a5-463e-a9f4-17abfd800cfe", + "type": "node", + "position": { + "x": 235, + "y": 1425 + }, + "data": { + "namespace": "", + "opId": "abandon_trip", + "op": { + "type": "node", + "builder": "abandon_trip", + "next": "stop_engine" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "a1cfc11f-c758-4e2e-965c-2f9f4052750b", + "type": "node", + "position": { + "x": 745, + "y": 1425 + }, + "data": { + "namespace": "", + "opId": "detect_kinematics", + "op": { + "type": "node", + "builder": "detect_kinematics", + "next": { + "builtin": "dispose" + }, + "stream_out": { + "kinematics": "kinematics_buffer" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false, + "dragging": false + }, + { + "id": "08010ae1-ed0a-49e7-8321-d75c87518972", + "type": "buffer", + "position": { + "x": 542.5, + "y": 1525 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer", + "op": { + "type": "buffer" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "7c8d5f15-07f0-4bc9-9cbb-676320606534", + "type": "buffer_access", + "position": { + "x": 677.5, + "y": 1625 + }, + "data": { + "namespace": "", + "opId": "kinematics_buffer_access", + "op": { + "type": "buffer_access", + "buffers": [ + "kinematics_buffer" + ], + "next": "process_kinematics" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "f30d70fd-2e4c-4b77-bc41-1f951cbf1126", + "type": "node", + "position": { + "x": 677.5, + "y": 1725 + }, + "data": { + "namespace": "", + "opId": "process_kinematics", + "op": { + "type": "node", + "builder": "process_kinematics", + "next": "kinematics_fork_result" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "d87ba6c9-f841-44a1-a018-8c79dab06a7d", + "type": "fork_result", + "position": { + "x": 677.5, + "y": 1825 + }, + "data": { + "namespace": "", + "opId": "kinematics_fork_result", + "op": { + "type": "fork_result", + "err": { + "builtin": "dispose" + }, + "ok": "update_vehicle_state" + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + }, + { + "id": "34fea2be-f8c5-4d04-b713-e9c14dd6b7e7", + "type": "node", + "position": { + "x": 677.5, + "y": 1925 + }, + "data": { + "namespace": "", + "opId": "update_vehicle_state", + "op": { + "type": "node", + "builder": "update_vehicle_state", + "next": { + "builtin": "dispose" + } + } + }, + "measured": { + "width": 200, + "height": 50 + }, + "selected": false + } + ], + "edges": [ + { + "id": "742b63fa-7c61-4507-bea9-7b90d47c8f83", + "source": ":__builtin_start__", + "sourceHandle": null, + "target": "15de07d9-e2aa-4b96-a702-b765462e53e6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "7d333f0d-0a03-4f71-937c-5911d8f5d2ff", + "source": "35b088ac-eed3-412c-910f-510acc8bf728", + "sourceHandle": null, + "target": "c5e5d184-833a-403c-9489-316fd8074594", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "454b523c-64a5-4a3b-805d-070d5944992c", + "source": ":vehicle_check_scope:__builtin_start__", + "sourceHandle": null, + "target": "5af2cdc3-5c7b-47ec-9a25-8af9395c7ba6", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f78c7475-adfb-4056-b70a-9dd0c62f7fb5", + "source": "4be2bf0a-85d7-4b9b-abd3-cca352dd0221", + "sourceHandle": null, + "target": ":vehicle_check_scope:__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "a2ee2ce6-6d23-43a2-bf62-78473cee2881", + "source": "4ae7f2fe-ecb6-452a-a252-f219d7575c92", + "sourceHandle": null, + "target": "b3ca763b-b025-462c-a5f0-82f43ab4c3af", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0, + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "8c7fca72-2128-406a-9c80-6e4d5cae6d04", + "source": "021b533d-3b65-4f84-af9f-45681bb560c0", + "sourceHandle": null, + "target": "b3ca763b-b025-462c-a5f0-82f43ab4c3af", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 1, + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "418108de-fdb7-41ac-a2ee-40a86caa38b8", + "source": "b3ca763b-b025-462c-a5f0-82f43ab4c3af", + "sourceHandle": null, + "target": "4be2bf0a-85d7-4b9b-abd3-cca352dd0221", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "0dd58b1a-1ec2-49f0-8d33-b6efd6ef461b", + "source": "e0645003-9bde-44b1-97ed-944504627f39", + "sourceHandle": null, + "target": "021b533d-3b65-4f84-af9f-45681bb560c0", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "083e50cc-bfbe-49c4-b6e8-9afd56b96995", + "source": "ede166b0-93e6-498c-ab20-1826840e1ef5", + "sourceHandle": null, + "target": "4ae7f2fe-ecb6-452a-a252-f219d7575c92", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "753c7116-ddd4-4b74-99f8-09e719a47509", + "source": "6cda3bff-536e-4211-abba-5f20031cef1a", + "sourceHandle": null, + "target": "ede166b0-93e6-498c-ab20-1826840e1ef5", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "splitKey", + "data": { + "output": { + "key": "fuel" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "be5bc5be-e28e-4803-84d8-c5e18a14f96d", + "source": "6cda3bff-536e-4211-abba-5f20031cef1a", + "sourceHandle": null, + "target": "e0645003-9bde-44b1-97ed-944504627f39", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "splitKey", + "data": { + "output": { + "key": "mirrors" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "28f79a95-f5e6-443b-8f06-693ea9123098", + "source": "5af2cdc3-5c7b-47ec-9a25-8af9395c7ba6", + "sourceHandle": null, + "target": "6cda3bff-536e-4211-abba-5f20031cef1a", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "d2ce2dd0-ea8c-4330-a7a2-aa61a7459647", + "source": "fa23afb3-1fb6-4cf5-81c3-064d99587e7f", + "sourceHandle": null, + "target": "edb98b92-f49d-4287-b696-bac9fcee121d", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "7a477b7a-7357-4f7b-8454-aaa40ae18aed", + "source": "d75576ec-5165-40e0-b164-c7cb4a410c7e", + "sourceHandle": "forkResultOk", + "target": "35b088ac-eed3-412c-910f-510acc8bf728", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "395b9e24-e6f6-4980-9b1e-17cf64da42c5", + "source": "d75576ec-5165-40e0-b164-c7cb4a410c7e", + "sourceHandle": "forkResultErr", + "target": "fa23afb3-1fb6-4cf5-81c3-064d99587e7f", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "17f28e85-7aa8-4b0d-b74d-2a0f9693a596", + "source": "9b5d6c84-1b24-4d40-ba0a-83109a25a18b", + "sourceHandle": null, + "target": "37f51deb-17dd-4eda-9618-107fa51658d7", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "traffic_signal", + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "8c416d43-7f6c-455c-b2f4-758882e591bc", + "source": "90571258-dabb-4e5f-9349-dfa1f534e8b1", + "sourceHandle": null, + "target": "37f51deb-17dd-4eda-9618-107fa51658d7", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferKey", + "key": "obstacles", + "fetchType": 0 + } + }, + "style": {} + }, + { + "id": "6f17e845-e086-46ca-8e20-f30bee3793f2", + "source": "37f51deb-17dd-4eda-9618-107fa51658d7", + "sourceHandle": null, + "target": "07c1477b-58c9-44fc-add2-80cc00e93daf", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "9f840f8b-60b1-4de4-80cb-241eb2f57779", + "source": "07c1477b-58c9-44fc-add2-80cc00e93daf", + "sourceHandle": null, + "target": "54d151ba-a962-4abe-8f89-30619a2eeadc", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f0bcddb7-fde9-4642-8f02-1b1fd8258ea8", + "source": "b52b9a4d-1c1e-4fea-bfa1-2da395316f26", + "sourceHandle": "dataStream", + "target": "90571258-dabb-4e5f-9349-dfa1f534e8b1", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "obstacles" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "93cb120e-92b3-49d5-99f6-5a5a593adab9", + "source": "54d151ba-a962-4abe-8f89-30619a2eeadc", + "sourceHandle": "forkResultOk", + "target": "4d404b13-ab24-42c1-995c-a71b117b3b90", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "37874b65-f6cf-4c6c-89cc-4485a7ef7b68", + "source": "edb98b92-f49d-4287-b696-bac9fcee121d", + "sourceHandle": null, + "target": ":__builtin_terminate__", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "478fab4b-8e75-47c3-aaa2-a65cbf990cb8", + "source": "c5e5d184-833a-403c-9489-316fd8074594", + "sourceHandle": "forkResultOk", + "target": "c0f29881-abed-4fc0-affb-007cd75bb906", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "64b23ecb-dcd6-4932-9d88-e5517acf25d4", + "source": "c5e5d184-833a-403c-9489-316fd8074594", + "sourceHandle": "forkResultErr", + "target": "fa23afb3-1fb6-4cf5-81c3-064d99587e7f", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultErr", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e6f50ea6-5624-4228-bf58-f8a630ff864e", + "source": "15de07d9-e2aa-4b96-a702-b765462e53e6", + "sourceHandle": null, + "target": "d75576ec-5165-40e0-b164-c7cb4a410c7e", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "44017b50-b035-4445-9fd5-6fbe38c6a245", + "source": "84cff016-ea88-4d2a-a9c9-fd850eb82381", + "sourceHandle": "dataStream", + "target": "9b5d6c84-1b24-4d40-ba0a-83109a25a18b", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "traffic_signal" + }, + "input": { + "type": "default" + } + } + }, + { + "id": "740b05e6-0faa-4755-8d45-ef742e881a90", + "source": "c0f29881-abed-4fc0-affb-007cd75bb906", + "sourceHandle": null, + "target": "b52b9a4d-1c1e-4fea-bfa1-2da395316f26", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f9c5ea97-c61d-40d9-a0b3-37bd6f570fe3", + "source": "c0f29881-abed-4fc0-affb-007cd75bb906", + "sourceHandle": null, + "target": "84cff016-ea88-4d2a-a9c9-fd850eb82381", + "targetHandle": null, + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "963f4d9c-c42d-4909-8312-7dd52a05e696", + "source": "c0f29881-abed-4fc0-affb-007cd75bb906", + "target": "e3f8206d-2db0-4a08-99d7-5bca2aebf860", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "287f1291-a426-443a-af8d-66730bf5ec70", + "source": "e3f8206d-2db0-4a08-99d7-5bca2aebf860", + "target": "edb98b92-f49d-4287-b696-bac9fcee121d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "012752d2-bd4d-440f-9c45-bda1b67dcfc7", + "source": "c0f29881-abed-4fc0-affb-007cd75bb906", + "target": "e404fc43-56a5-463e-a9f4-17abfd800cfe", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "e1482028-5125-48a1-aaa8-cee00a1b5478", + "source": "e404fc43-56a5-463e-a9f4-17abfd800cfe", + "target": "edb98b92-f49d-4287-b696-bac9fcee121d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "f9b7e7e0-9740-4386-90ca-36e252df57c6", + "source": "a1cfc11f-c758-4e2e-965c-2f9f4052750b", + "sourceHandle": "dataStream", + "target": "08010ae1-ed0a-49e7-8321-d75c87518972", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "kinematics" + }, + "input": { + "type": "default" + } + }, + "selected": false + }, + { + "id": "9c5b8d2b-d5fa-4421-9085-fe944869e2da", + "source": "c0f29881-abed-4fc0-affb-007cd75bb906", + "target": "a1cfc11f-c758-4e2e-965c-2f9f4052750b", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "03512bda-2d48-4c64-ae5e-30c4f9f539d2", + "source": "08010ae1-ed0a-49e7-8321-d75c87518972", + "target": "7c8d5f15-07f0-4bc9-9cbb-676320606534", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "buffer", + "data": { + "output": {}, + "input": { + "type": "bufferSeq", + "seq": 0 + } + }, + "style": {} + }, + { + "id": "c2f2fc54-d424-42d4-9eb3-680a35770575", + "source": "7c8d5f15-07f0-4bc9-9cbb-676320606534", + "target": "f30d70fd-2e4c-4b77-bc41-1f951cbf1126", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "217bfd71-e93b-4cfe-bd68-a2b299ba873c", + "source": "f30d70fd-2e4c-4b77-bc41-1f951cbf1126", + "target": "d87ba6c9-f841-44a1-a018-8c79dab06a7d", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "default", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "c4ec3ecd-ac1a-44d6-aee9-f5a02daa4778", + "source": "d87ba6c9-f841-44a1-a018-8c79dab06a7d", + "sourceHandle": "forkResultOk", + "target": "34fea2be-f8c5-4d04-b713-e9c14dd6b7e7", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "forkResultOk", + "data": { + "output": {}, + "input": { + "type": "default" + } + } + }, + { + "id": "083be127-3777-4b0b-80a6-fff7f8be7194", + "source": "e3f8206d-2db0-4a08-99d7-5bca2aebf860", + "sourceHandle": "dataStream", + "target": "7c8d5f15-07f0-4bc9-9cbb-676320606534", + "markerEnd": { + "type": "arrowclosed", + "width": 20, + "height": 20 + }, + "type": "streamOut", + "data": { + "output": { + "streamId": "trigger" + }, + "input": { + "type": "default" + } + }, + "selected": false + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/diagram/traffic_app/src/lib.rs b/examples/diagram/traffic_app/src/lib.rs new file mode 100644 index 00000000..bdd0bc8e --- /dev/null +++ b/examples/diagram/traffic_app/src/lib.rs @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2026 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +use bevy::prelude::*; +use crossflow_diagram_editor::basic_executor::{ + self, BasicExecutorSetup, DiagramElementRegistry, Error, +}; +use traffic_ops_catalog::{ + MovementPlugin, PedestrianPlugin, SpawnWorldPlugin, SpeedLimitPlugin, TrafficSignalPlugin, + UserInputPlugin, +}; + +pub fn run() -> Result<(), Box> { + basic_executor::run_custom_setup(None, || { + let mut app = App::new(); + app.add_plugins(( + SpawnWorldPlugin::default(), + UserInputPlugin::default(), + MovementPlugin::default(), + PedestrianPlugin::default(), + TrafficSignalPlugin::default(), + SpeedLimitPlugin::default(), + )); + + let registry = DiagramElementRegistry::new(); + let mut setup = BasicExecutorSetup { app, registry }; + + // Register traffic node builders from the traffic_ops_catalog library. + traffic_ops_catalog::register(&mut setup); + setup + }) +} diff --git a/examples/diagram/traffic_app/src/main.rs b/examples/diagram/traffic_app/src/main.rs new file mode 100644 index 00000000..289ee19f --- /dev/null +++ b/examples/diagram/traffic_app/src/main.rs @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2026 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +// ANCHOR: traffic_app_example +fn main() { + let _ = traffic_app::run(); +} +// ANCHOR_END: traffic_app_example diff --git a/examples/diagram/traffic_ops_catalog/Cargo.toml b/examples/diagram/traffic_ops_catalog/Cargo.toml new file mode 100644 index 00000000..bb4d5927 --- /dev/null +++ b/examples/diagram/traffic_ops_catalog/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "traffic_ops_catalog" +version = "0.1.0" +edition = "2024" + +[dependencies] +bevy = { workspace = true } +bevy_color = { version = "0.16" } +bevy_ecs = { workspace = true } +bevy_egui = { version = "0.34" } +crossflow = { version = "0.0.7", path = "../../..", features = ["diagram"] } +crossflow_diagram_editor = { path = "../../../diagram-editor", features = ["basic_executor"] } +rand = { workspace = true } +rmf_site_egui = { version = "0.0.2" } +serde = { workspace = true } +serde_json = { workspace = true } +schemars = { workspace = true } +thiserror = "2.0.16" +tokio = { workspace = true, features = ["time"] } diff --git a/examples/diagram/traffic_ops_catalog/src/lib.rs b/examples/diagram/traffic_ops_catalog/src/lib.rs new file mode 100644 index 00000000..f92c4015 --- /dev/null +++ b/examples/diagram/traffic_ops_catalog/src/lib.rs @@ -0,0 +1,1247 @@ +/* + * Copyright (C) 2026 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +use bevy::prelude::*; +use crossflow::{ConfigExample, NodeBuilderOptions, prelude::*}; +use crossflow_diagram_editor::basic_executor::BasicExecutorSetup; +use rand::Rng; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use serde_json::json; +use std::{collections::HashMap, thread::sleep, time::Duration}; +use thiserror::Error; + +pub mod movement; +pub use movement::*; + +pub mod pedestrian; +pub use pedestrian::*; + +pub mod spawn_world; +pub use spawn_world::*; + +pub mod speed_limit; +pub use speed_limit::*; + +pub mod traffic; +pub use traffic::*; + +pub mod traffic_signal; +pub use traffic_signal::*; + +pub mod user_panel; +pub use user_panel::*; + +pub mod vehicle; +pub use vehicle::*; + +#[derive(StreamPack)] +struct MidJourneyStreams { + trigger: (), +} + +#[derive(StreamPack)] +struct TrafficStateStreams { + arriving: ApproachingIntersection, + kinematics: Kinematics, + obstacles: Obstacles, + speed_limit: SpeedLimit, + traffic_signal: TrafficSignal, +} + +#[derive(Clone, Accessor)] +struct TrafficStateAccessor { + traffic_signal: BufferKey, + obstacles: BufferKey, + arriving: BufferKey, + speed_limit: BufferKey, +} + +#[derive(Clone, Accessor)] +struct TrafficSignalWithObstaclesAccessor { + traffic_signal: BufferKey, + obstacles: BufferKey, +} + +#[derive(Clone, Accessor)] +struct TrafficSignalWithArrivingAccessor { + traffic_signal: BufferKey, + arriving: BufferKey, +} + +#[derive(Clone, Debug, Default, Joined)] +pub struct TrafficSignalWithObstacles { + traffic_signal: TrafficSignal, + obstacles: Obstacles, +} + +#[derive(Clone, Debug, Default, Joined)] +pub struct TrafficSignalWithArriving { + traffic_signal: TrafficSignal, + arriving: ApproachingIntersection, +} + +#[derive(Clone, Debug, Error, Serialize, Deserialize, JsonSchema)] +pub enum TripRequestError { + #[error("Engine start error")] + EngineStartError, + #[error("Vehicle check error")] + VehicleCheckError, + #[error("Buffer access error")] + BufferAccessError, + #[error("Next move error")] + NextMoveError, + #[error("Vehicle position error")] + VehiclePositionError, +} + +pub fn register(setup: &mut BasicExecutorSetup) { + let registry = &mut setup.registry; + let app = &mut setup.app; + + // ========================================================================= + let start_engine_description = "Starts the engine"; + fn start_engine( + Blocking { + request: distance_to_destination, + .. + }: Blocking, + mut commands: Commands, + mut vehicle_state: ResMut, + vehicle_velocity: Query, With)>, + ) -> Result<(), TripRequestError> { + let Ok(e) = vehicle_velocity.single() else { + return Err(TripRequestError::EngineStartError); + }; + let e_cmds = commands.entity(e); + + vehicle_state.toggle_engine(true); + if vehicle_state.set_distance_to_destination(distance_to_destination) { + info!( + "Vehicle beginning its trip, distance to destination: {}", + vehicle_state.distance_left() + ); + // Move vehicle forward upon starting engine + vehicle_state.try_move(e_cmds, MoveVehicle::Forward(Velocity::default_forward())); + + Ok(()) + } else { + info!( + "Unable to begin trip, please check the input distance: {}", + distance_to_destination + ); + Err(TripRequestError::EngineStartError) + } + } + let start_engine_service = app.spawn_service(start_engine); + registry + .register_node_builder( + NodeBuilderOptions::new("start_engine".to_string()) + .with_description(start_engine_description), + move |builder, _config: ()| builder.create_node(start_engine_service), + ) + .with_result(); + + // ========================================================================= + let begin_vehicle_check_description = "Kicks off a vehicle check to ensure that \ + all components are in ready-state"; + fn begin_vehicle_check( + Blocking { .. }: Blocking<()>, + vehicle_state: Res, + ) -> HashMap { + vehicle_state.checklist().clone() + } + let begin_vehicle_service = app.spawn_service(begin_vehicle_check); + registry.register_node_builder( + NodeBuilderOptions::new("begin_vehicle_check".to_string()) + .with_description(begin_vehicle_check_description), + move |builder, _config: ()| builder.create_node(begin_vehicle_service), + ); + + // ========================================================================= + let vehicle_check_ready_description = "Toggles individual item on the vehicle checklist \ + to ready-state."; + registry.register_node_builder( + NodeBuilderOptions::new("vehicle_check_ready") + .with_description(vehicle_check_ready_description), + |builder, _config: ()| { + builder.create_map_async(|_current_state: ReadyState| { + let mut rng = rand::rng(); + let sleep_time = rng.random_range(100..500); + async move { + // Sleep for X seconds (randomized) to demonstrate checking different items, + // then updates the state to ready. + // We don't actually need to know the current state for this example. + sleep(Duration::from_millis(sleep_time)); + ReadyState::Ready + } + }) + }, + ); + + // ========================================================================= + let validate_vehicle_check_description = "Validates items in vehicle checklist are ready"; + fn validate_vehicle_check( + Blocking { + request: checklist, .. + }: Blocking>, + mut vehicle_state: ResMut, + ) -> Result<(), TripRequestError> { + for item in checklist.iter() { + if matches!(item, ReadyState::NotReady) { + // All or nothing check + return Err(TripRequestError::VehicleCheckError); + } + } + for (_item, state) in vehicle_state.checklist_mut().iter_mut() { + *state = ReadyState::Ready; + } + + Ok(()) + } + let validate_vehicle_check_service = app.spawn_service(validate_vehicle_check); + registry + .register_node_builder( + NodeBuilderOptions::new("validate_vehicle_check".to_string()) + .with_description(validate_vehicle_check_description), + move |builder, _config: ()| builder.create_node(validate_vehicle_check_service), + ) + .with_join() + .with_result() + .with_common_response(); + + // ========================================================================= + let detect_kinematics_description = "Detects vehicle kinematics via query"; + fn detect_kinematics( + srv: ContinuousService<(), (), TrafficStateStreams>, + mut orders: ContinuousQuery<(), (), TrafficStateStreams>, + main_vehicle: Query<(&Velocity, &Acceleration), With>, + time: Res