Autoware.Auto avp demo on Zenoh-Flow stack.
This document describes SOW Phase 2 project (Autoware stack over zenoh-flow) related technical architecture, product demo methods and work schedule.
The SOW Phase 2 project goal is to build an autonomous driving environment based on zenoh-flow and Autoware. zenoh-flow provides basic operation framework and data flow transmission, Autoware provides algorithm library.
The project should include:
Zenoh-Flow allow users to declare a dataflow graph, via a YAML file, and use tags to express location affinity and requirements for the operators that makeup the graph. When deploying the dataflow graph, Zenoh-Flow automatically deals with distribution by linking remote operators through zenoh.
A dataflow is composed of set of nodes: sources — producing data, operators — computing over the data, and sinks — consuming the resulting data. These nodes are dynamically loaded at runtime.
Remote source, operators, and sinks leverage zenoh to communicate in a transparent manner. In other terms, the dataflow graph retails location transparency and could be deployed in different ways depending on specific needs.
Zenoh-Flow developed with Rust.
Autoware is the world’s first “all-in-one” open-source software for self-driving vehicles hosted under the Autoware Foundation. The Autoware.Auto project, based on ROS 2, is the next generation successor of the Autoware.AI project, based on ROS 1. The major differentiators of Autoware.Auto compared to Autoware.AI are:
CXX library provides a safe mechanism for calling C++ code from Rust and Rust code from C++, not subject to the many ways that things can go wrong when using bindgen or cbindgen to generate unsafe C-style bindings.
Zenoh-Flow framework code is implemented by Rust, and the Autoware algorithm is inside ROS framework and implemented by C++. How to get an executable file containing both side code logic. There are two ways here:
Finally, we chased the second, which is the purpose of the previous architecture goals: Avoid large-scale modification of AutowareAuto and ROS code, prevent the original ROS launch from unavailable. And the first option will handle very complex ROS include paths problem.
In the original ROS framework, a message is bound to a callback function when subscribing to a topic, and this project needs to be passed into the message callback function from Zenoh-Flow.
Send data directly using publish method under the original ROS framework and needs return to Zenoh-Flow side in this project.
How to connect the methods between C++ and Rust language and transfer data types? We use CXX to generate binding codes between C++ and Rust:
ROS message types defined in independent files witch Rust side cannot use directly. CXX needs all message types defined in FFI mod and generate corresponding data types different from ROS message types. We provide two ROS package for this message conversion:
They are the packages that other nodes rely on.
Usually, ROS nodes have the following functions:
And Zenoh-Flow nodes have the similar functions:
We use ROS node functions as backup and replace ones Zenoh-Flow covered. Service and TF system in ROS are retained.
When Zenoh-Flow operator node startup, an ROS node also awaked, but not send ROS messages in zenoh-flow launch method.
A new node inherited from ROS node can set runtime type between ROS/Zenoh-Flow and so on, and auto switch the pub/sub functions between different runtimes. This mechanism allows the same node codes to be launched by ROS and Zenoh-Flow.
For setting up planning and control functions, those main components are used from AutowareAuto.
This graph shows the data flow of those components in AutowareAuto.
Autoware ROS nodes are seal in Zenoh-Flow operator nodes. When deploying on a single device, both ROS and Zenoh-Flow nodes use shared memory communication. And when deploying on multiple devices, ROS use Cyclone DDS and Zenoh-Flow use Zenoh for network communication.
In ROS nodes there are usually timers callback functions to perform calculations. In Zenoh-Flow we need a similar mechanism.
Tick Source gives operator the update time and perform the data flow.
Map provider source load map configurations from graph yaml file,and launch lanelet2_map_provider node that provider HD map service.
Lanelet2 Global Planner have no configurations, and process on current pose and goal pose are valid.
Local planner update trajectory and vehicle state command every tick.
All nodes are packaged as ROS nodes, and installed into system paths. And Zenoh-Flow runtime are installed into user home path. Runtime load graph files in system paths can launch the demo.