Coder Social home page Coder Social logo

michael-j-ward / dora Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dora-rs/dora

0.0 1.0 0.0 3.76 MB

low latency, composable, and distributed dataflow for AI and robotic application

Home Page: https://dora.carsmos.ai

License: Apache License 2.0

C++ 0.30% Python 1.95% C 1.25% Rust 96.45% HTML 0.05%

dora's Introduction


What is dora-rs?

Dataflow-oriented robotic application (dora-rs) is a framework that makes creation of robotic applications fast and simple.

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:

  • make integration of hardware and software easy by supporting Python, C, C++, and also ROS2.
  • make communication low latency by using zero-copy Arrow messages.

dora-rs is still experimental and you might experience bugs, but we're working very hard to make it stable as possible.

Performance

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.

See: https://github.com/dora-rs/dora-benchmark/tree/main for reproduction.

Dataflow Paradigm

dora-rs implements a declarative dataflow paradigm where tasks are split between nodes isolated as individual processes.

Each node defines its inputs and outputs to connect with other nodes.

nodes:
  - id: webcam
    custom:
      source: webcam.py
      inputs:
        tick: dora/timer/millis/50
      outputs:
        - image

  - id: object_detection
    custom:
      source: object_detection.py
      inputs:
        image: webcam/image
      outputs:
        - bbox

  - id: plot
    custom:
      source: plot.py
      inputs:
        image: webcam/image
        bbox: object_detection/bbox

Nodes can either be:

  • custom nodes were dora-rs is embedded as a native libraries.
  • 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.

The dataflow paradigm has the advantage of creating an abstraction layer that makes robotic applications modular and easily configurable.

Communication

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.

Message Format

Nodes communicate with Apache Arrow Data Format.

Apache Arrow 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.

Opentelemetry

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.

Opentelemetry is an open source observability standard that makes dora-rs telemetry collectable by most backend such as elasticseach, prometheus, Datadog..

Opentelemetry is language independent, backend agnostic, and easily collect distributed data, making it perfect for dora-rs applications.

Hot-Reloading

dora-rs implements Hot-Reloading for python which means you can change code at runtime in Python while keeping your state intact.

Using the feature flag: --attach --hot-reload, dora-rs watch for code change and reload nodes that has been modified. You can check fail-safe mecanism at: dora-rs#239

demo

Self-Coding Robot: Code RAG (WIP)

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. See:examples/python-operator-dataflow

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:

Installation

Quickest way:

cargo install dora-cli --locked
pip install dora-rs # For Python API

dora --help

For more info on installation, check out our guide.

Getting Started

  1. Install the example python dependencies:
pip install -r https://raw.githubusercontent.com/dora-rs/dora/v0.3.3/examples/python-operator-dataflow/requirements.txt
  1. Get some example operators:
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.3/examples/python-operator-dataflow/webcam.py
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.3/examples/python-operator-dataflow/plot.py
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.3/examples/python-operator-dataflow/utils.py
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.3/examples/python-operator-dataflow/object_detection.py
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.3/examples/python-operator-dataflow/dataflow.yml
  1. Start the dataflow
dora up
dora start dataflow.yml --attach --hot-reload

Make sure to have a webcam

To stop your dataflow, you can use ctrl+c

To go further, you can add a yolov8 operator, check out our getting started here: https://dora.carsmos.ai/docs/guides/getting-started/yolov8/

ROS2 Bridge

  • Compilation Free Message passing to ROS 2
  • Automatic conversion ROS 2 Message <-> Arrow Array
import random
import pyarrow as pa

# Configuration Boilerplate...
turtle_twist_writer = ...

## Arrow Based ROS2 Twist Message
## which does not requires ROS2 import
message = pa.array([{
            "linear": {
                "x": 1,
            },
            "angular": {
                "z": 1
            },
        }])

turtle_twist_writer.publish(message)

You might want to use ChatGPT to write the Arrow Formatting: https://chat.openai.com/share/4eec1c6d-dbd2-46dc-b6cd-310d2895ba15

Hardwares

Cool hardware that we think might be good fit to try out dora-rs ๐Ÿ™‹ We are not sponsored by manufacturers:

Price Open Source Github type Dora Project
DJI Robomaster S1 550$ SDK https://github.com/dji-sdk/RoboMaster-SDK Rover https://huggingface.co/datasets/dora-rs/dora-robomaster
DJI Robomaster EP Core 950$ SDK https://github.com/dji-sdk/RoboMaster-SDK Rover, Arm
DJI Tello 100$ Drone
BitCraze Crazyflies 225$ Firmware, Lib, SDK https://github.com/bitcraze Drone
AlexanderKoch-Koch/low_cost_robot 250$ Everything https://github.com/AlexanderKoch-Koch/low_cost_robot Arm
xArm 1S 200$ Arm
Wavego 250$ Quadruplet
AINex 800$ Humanoid

For more: https://docs.google.com/spreadsheets/d/1YYeW2jfOIWDVgdEgqnMvltonHquQ7K8OZCrnJRELL6o/edit#gid=0

Documentation

The full documentation is available on our website

Discussions

Our main communication channels are:

Feel free to reach out on any topic, issues or ideas.

We also have a contributing guide.

Support Matrix

dora-rs Hoped for
Tier 1 Support Python, Rust C, C++, ROS 2
Tier 2 Support C, C++, ROS2
Hot-reloading Python Rust (https://github.com/orgs/dora-rs/discussions/360)
Message Format Arrow Native
Local Communication Shared Memory Custom Middleware, zero-copy GPU IPC, intra-process tokio::channel communication
Remote Communication TCP (See: dora-rs#459) Custom Middleware, Zenoh
Metrics, Tracing, and Logging Opentelemetry Native logging libraries into Opentelemetry
Data archives Parquet (dora-record)
Visualization and annotation OpenCV rerun.io
Supported Platforms (x86) Windows, macOS, Linux
Supported Platforms (ARM) macOS, Linux
Configuration YAML

License

This project is licensed under Apache-2.0. Check out NOTICE.md for more information.

dora's People

Contributors

phil-opp avatar haixuantao avatar eduidl avatar michael-j-ward avatar dependabot[bot] avatar meua avatar xxchang avatar heyong4725 avatar bobd988 avatar felixhuangsiling avatar mshr-h avatar wlee1248 avatar jerry73204 avatar messense avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.