You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 14 kB

Add Opentelemetry capabilities though capnproto messages (#24) * Multithreaded Python API and Pylot Example (#18) * Refactoring for multithreading * Refactoring code in order to use MemoryView * Resolving multi output by casting Python output type * Adding Python example runner * Adding Rayon ThreadPool for CPU bound multithreading * Adding benches * Small Refactoring of Python Binding * Adding documentation to Pylot Demo * Removing cloning states data using RwLock * Refactoring Servers to pass messages through tokio channels * Removing unwrap when possible * Splitting Zenoh function into separate module * Refactoring Zenoh into a struct * Adding several Python fix * Fix eyre issue * Adding docker for ease of build * Fixing docker problem * Reduce the frequency of source * Adding better Python Operator * Improving carla visualisation capabilities * Enabling better visualisation * adding object trajectory * Improving planning * Refactoring Python * Adding control operator * Improving planning operator * Better Control Operator * Fixing Planning Errors linked to applying Speed Factor * Fixing Docker Image Build issues * Adding a timestamp to messages * Fixing PID mutlithread errors * Drop Push Send after Pull period * Limiting the latency * Adding InfluxDB * Fixing Influxdb Naming and quota * Adding positional data * Making launching container command faster * Removing Dora-Pylot * Refactor Error Handling * Refactoring Error dubgging function Co-authored-by: haixuanTao <hai-xuan.tao@student.ecp.fr> * adding capnp metadata into messages * Allowing Context to propagate throughout node * Adding better tracing * Refactoring opentelemetry mod * Adding a degree parameter in messages * Adding depth for better tracing * Put a feature flag on tracing * Removing unnecessary copy of the messages * Small refactoring of messages * Refactoring of context logging * Adding opentelemetry metrics of system * Adding process telemetry * Commenting the build script * Rename feature tracing * Add documentation to module * Adding message documentation * Remove build script * skip capnp generated file * Reformating * Reformating loop * Testing example * Removing zenoh dependencies in Python * Improving example python api * removing rayon that is appearing twice due to merge * Simplifying python binding * Create a separate crate for messages * Moving `metrics` and `tracing` into separate crate * Moving `python` into a separate crate and removing `main` crate * Refactoring newly created crate * Remove `depth` from the message `metadata` * Add `capnp` installation within the CI * Add `capnp` installation into CI `clippy` step Co-authored-by: haixuanTao <hai-xuan.tao@student.ecp.fr>
3 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <p align="center">
  2. <img src="./docs/src/logo.svg" width="400">
  3. </p>
  4. <h2 align="center">
  5. <a href="https://www.dora-rs.ai">Website</a>
  6. |
  7. <a href="https://www.dora-rs.ai/docs/api/python-api">Python API</a>
  8. -
  9. <a href="https://docs.rs/dora-node-api/latest/dora_node_api/">Rust API</a>
  10. |
  11. <a href="https://www.dora-rs.ai/docs/guides/">Guide</a>
  12. |
  13. <a href="https://discord.gg/6eMGGutkfE">Discord</a>
  14. </h2>
  15. <div align="center">
  16. <a href="https://github.com/dora-rs/dora/actions">
  17. <img src="https://github.com/dora-rs/dora/workflows/CI/badge.svg" alt="Build and test"/>
  18. </a>
  19. <a href="https://crates.io/crates/dora-rs">
  20. <img src="https://img.shields.io/crates/v/dora_node_api.svg"/>
  21. </a>
  22. <a href="https://docs.rs/dora-node-api/latest/dora_node_api/">
  23. <img src="https://docs.rs/dora-node-api/badge.svg" alt="rust docs"/>
  24. </a>
  25. <a href="https://pypi.org/project/dora-rs/">
  26. <img src="https://img.shields.io/pypi/v/dora-rs.svg" alt="PyPi Latest Release"/>
  27. </a>
  28. </div>
  29. ---
  30. # What is dora-rs?
  31. Dataflow-oriented robotic application (dora-rs) is a framework that makes creation of robotic applications fast and simple.
  32. Building a robotic application can be summed up as bringing together hardwares, algorithms, and AI models, and make them communicate with each others. At dora-rs, we try to:
  33. - make integration of hardware and software easy by supporting Python, C, C++, and also ROS2.
  34. - make communication low latency by using zero-copy Arrow messages.
  35. dora-rs is still experimental and you might experience bugs, but we're working very hard to make it stable as possible.
  36. ## Performance
  37. dora-rs can show impressive performance, up to 17x faster compared to current status quo ROS2 in Python! This is the result of using our own shared memory server and Apache Arrow to achieve zero copy data passing.
  38. <a href="https://www.dora-rs.ai/">
  39. <img src="./docs/src/latency.png" align="center" width="600">
  40. </a>
  41. > See: https://github.com/dora-rs/dora-benchmark/tree/main for reproduction.
  42. ## Dataflow Paradigm
  43. dora-rs implements a declarative dataflow paradigm where tasks are split between nodes isolated as individual processes.
  44. Each node defines its inputs and outputs to connect with other nodes.
  45. ```yaml
  46. nodes:
  47. - id: webcam
  48. custom:
  49. source: webcam.py
  50. inputs:
  51. tick: dora/timer/millis/50
  52. outputs:
  53. - image
  54. - id: object_detection
  55. custom:
  56. source: object_detection.py
  57. inputs:
  58. image: webcam/image
  59. outputs:
  60. - bbox
  61. - id: plot
  62. custom:
  63. source: plot.py
  64. inputs:
  65. image: webcam/image
  66. bbox: object_detection/bbox
  67. ```
  68. Nodes can either be:
  69. - custom nodes were dora-rs is embedded as a native libraries.
  70. - runtime nodes were dora-rs takes care of the main loop and run user-defined operators. This make dora-rs featureful as we can run features like `hot-reloading`.
  71. The dataflow paradigm has the advantage of creating an abstraction layer that makes robotic applications modular and easily configurable.
  72. <a href="https://www.dora-rs.ai/">
  73. <img src="https://raw.githubusercontent.com/dora-rs/dora-rs.github.io/main/static/img/overview.svg" align="center" width="600">
  74. </a>
  75. ## Communication
  76. Communication between nodes is handled with shared memory on a same machine and TCP on distributed machines. Our shared memory implementation tracks messages across processes and discards them when obsolete. Shared memory slots are cached to avoid new memory allocation.
  77. ## Message Format
  78. Nodes communicate with Apache Arrow Data Format.
  79. [Apache Arrow](https://github.com/apache/arrow-rs) is a universal memory format for flat and hierarchical data. The Arrow memory format supports zero-copy reads for lightning-fast data access without serialization overhead. It defines a C data interface without any build-time or link-time dependency requirement, that means that dora-rs has **no compilation step** beyond the native compiler of your favourite language.
  80. <img align="center" src="https://github.com/dora-rs/dora-rs.github.io/blob/main/static/img/arrow.png?raw=true" width="600">
  81. ## Opentelemetry
  82. dora-rs uses Opentelemetry to record all your logs, metrics and traces. This means that the data and telemetry can be linked using a shared abstraction.
  83. [Opentelemetry](https://opentelemetry.io/) is an open source observability standard that makes dora-rs telemetry collectable by most backend such as elasticseach, prometheus, Datadog..
  84. Opentelemetry is language independent, backend agnostic, and easily collect distributed data, making it perfect for dora-rs applications.
  85. <img src="https://github.com/dora-rs/dora-rs.github.io/blob/main/static/img/opentelemetry.png?raw=true" align="center" width="600">
  86. ## Hot-Reloading
  87. dora-rs implements Hot-Reloading for python which means you can change code at runtime in Python while keeping your state intact.
  88. Using the feature flag: `--attach --hot-reload`, dora-rs watch for code change and reload nodes that has been modified.
  89. You can check fail-safe mechanism at: https://github.com/dora-rs/dora/pull/239
  90. <a href="http://www.youtube.com/watch?v=NvvTEP8Jak8">
  91. <img align="center" width="600" alt="demo" src=http://img.youtube.com/vi/NvvTEP8Jak8/0.jpg>
  92. </a>
  93. ## Self-Coding Robot: Code RAG (WIP)
  94. You can easily create a self-coding robot, by combining Hot-reloading with a Retrieval Augmented Generation (RAG) that is going to generate code modification from your prompt.
  95. See:[examples/python-operator-dataflow](examples/python-operator-dataflow)
  96. <img src="https://github.com/dora-rs/dora-rs.github.io/blob/main/static/img/RAG.svg?raw=true" align="center" width="600">
  97. Self-Coding Robot is just the tip of the iceberg of robotics combined with llm, that we hope to power. There is so much more that we haven't explored yet like:
  98. - [self-debugging](https://arxiv.org/pdf/2304.05128.pdf)
  99. - [memory](https://github.com/cpacker/MemGPT)
  100. - [function calling](https://github.com/ShishirPatil/gorilla)
  101. - ...
  102. ## Installation
  103. Quickest way:
  104. ```bash
  105. cargo install dora-cli --locked
  106. pip install dora-rs # For Python API
  107. dora --help
  108. ```
  109. For more info on installation, check out [our guide](https://www.dora-rs.ai/docs/guides/Installation/installing).
  110. ## Getting Started
  111. 1. Install the example python dependencies:
  112. ```bash
  113. pip install -r https://raw.githubusercontent.com/dora-rs/dora/v0.3.5/examples/python-operator-dataflow/requirements.txt
  114. ```
  115. 2. Get some example operators:
  116. ```bash
  117. wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.5/examples/python-operator-dataflow/webcam.py
  118. wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.5/examples/python-operator-dataflow/plot.py
  119. wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.5/examples/python-operator-dataflow/utils.py
  120. wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.5/examples/python-operator-dataflow/object_detection.py
  121. wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.5/examples/python-operator-dataflow/dataflow.yml
  122. ```
  123. 3. Start the dataflow
  124. ```bash
  125. dora up
  126. dora start dataflow.yml --attach --hot-reload
  127. ```
  128. > Make sure to have a webcam
  129. To stop your dataflow, you can use <kbd>ctrl</kbd>+<kbd>c</kbd>
  130. To go further, you can add a yolov8 operator, check out our getting started here: https://www.dora-rs.ai/docs/guides/getting-started/yolov8/
  131. ## ROS2 Bridge
  132. - Compilation Free Message passing to ROS 2
  133. - Automatic conversion ROS 2 Message <-> Arrow Array
  134. ```python
  135. import random
  136. import pyarrow as pa
  137. # Configuration Boilerplate...
  138. turtle_twist_writer = ...
  139. ## Arrow Based ROS2 Twist Message
  140. ## which does not requires ROS2 import
  141. message = pa.array([{
  142. "linear": {
  143. "x": 1,
  144. },
  145. "angular": {
  146. "z": 1
  147. },
  148. }])
  149. turtle_twist_writer.publish(message)
  150. ```
  151. > You might want to use ChatGPT to write the Arrow Formatting: https://chat.openai.com/share/4eec1c6d-dbd2-46dc-b6cd-310d2895ba15
  152. ## Hardwares
  153. Cool hardware that we think might be good fit to try out dora-rs 🙋 We are not sponsored by manufacturers:
  154. | | Price | Open Source | Github | type | Dora Project |
  155. | --------------------------------- | ----- | ------------------ | ---------------------------------------------------- | ---------- | ------------------------------------------------------- |
  156. | DJI Robomaster S1 | 550$ | SDK | https://github.com/dji-sdk/RoboMaster-SDK | Rover | https://huggingface.co/datasets/dora-rs/dora-robomaster |
  157. | DJI Robomaster EP Core | 950$ | SDK | https://github.com/dji-sdk/RoboMaster-SDK | Rover, Arm | |
  158. | DJI Tello | 100$ | | | Drone | |
  159. | BitCraze Crazyflies | 225$ | Firmware, Lib, SDK | https://github.com/bitcraze | Drone | |
  160. | AlexanderKoch-Koch/low_cost_robot | 250$ | Everything | https://github.com/AlexanderKoch-Koch/low_cost_robot | Arm | |
  161. | xArm 1S | 200$ | | | Arm | |
  162. | Wavego | 250$ | | | Quadruplet | |
  163. | AINex | 800$ | | | Humanoid | |
  164. > For more: https://docs.google.com/spreadsheets/d/1YYeW2jfOIWDVgdEgqnMvltonHquQ7K8OZCrnJRELL6o/edit#gid=0
  165. ## Documentation
  166. The full documentation is available on [our website](https://www.dora-rs.ai)
  167. ## Discussions
  168. Our main communication channels are:
  169. - [Our Discord server](https://discord.gg/6eMGGutkfE)
  170. - [Our Github Project Discussion](https://github.com/orgs/dora-rs/discussions)
  171. Feel free to reach out on any topic, issues or ideas.
  172. We also have [a contributing guide](CONTRIBUTING.md).
  173. ## Support Matrix
  174. | | dora-rs | Hoped for |
  175. | --------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
  176. | **Tier 1 Support** | Python, Rust | C, C++, ROS 2 |
  177. | **Tier 2 Support** | C, C++, ROS2 |
  178. | **Hot-reloading** | Python | Rust (https://github.com/orgs/dora-rs/discussions/360) |
  179. | **Message Format** | Arrow | Native |
  180. | **Local Communication** | Shared Memory | Custom Middleware, [zero-copy GPU IPC](https://arrow.apache.org/docs/python/api/cuda.html), intra-process `tokio::channel` communication |
  181. | **Remote Communication** | TCP (See: https://github.com/dora-rs/dora/issues/459) | Custom Middleware, [Zenoh](https://zenoh.io/) |
  182. | **Metrics, Tracing, and Logging** | Opentelemetry | Native logging libraries into Opentelemetry |
  183. | **Data archives** | Parquet ([dora-record](libraries/extensions/dora-record)) |
  184. | **Visualization and annotation** | OpenCV | [rerun.io](rerun.io) |
  185. | **Supported Platforms (x86)** | Windows, macOS, Linux |
  186. | **Supported Platforms (ARM)** | macOS, Linux |
  187. | **Configuration** | YAML |
  188. ### Unstable functionality
  189. `dora-rs` Ros2 Bridge is marked as **unstable**.
  190. There are a number of reasons functionality may be marked as unstable:
  191. - We are unsure about the exact API. The name, function signature, or implementation are likely to change in the future.
  192. - The functionality is not tested extensively yet. Bugs may pop up when used in real-world scenarios.
  193. - The functionality does not integrate well with the full dora-rs API. You may find it works in one context but not in another.
  194. Releasing functionality as unstable allows us to gather important feedback from users that use dora-rs in real-world scenarios.
  195. This helps us fine-tune things before giving it the final stamp of approval.
  196. Users are only interested in solid, well-tested functionality can avoid this part of the API.
  197. Functionality marked as unstable may change at any point without it being considered a breaking change.
  198. ## License
  199. This project is licensed under Apache-2.0. Check out [NOTICE.md](NOTICE.md) for more information.