Giter VIP home page Giter VIP logo

elodin's Introduction

Elodin is a platform for rapid design, testing, and simulation of drones, satellites, and aerospace control systems.

Quick Demo: https://app.elodin.systems/sandbox/hn/cube-sat

Sandbox Alpha: https://app.elodin.systems
Docs (WIP): https://docs.elodin.systems

This repository is a collection of core libraries:

  • libs/nox: Tensor library that compiles to XLA (like JAX, but for Rust).
  • libs/nox-ecs: Rust ECS framework built to work with JAX and Nox, that allows you to build your own physics engine.
  • libs/nox-py: Python version of nox-ecs, that works with JAX
  • libs/nox-ecs-macros: Derive macros to generate implementations of ECS and Nox traits.
  • libs/conduit: Column-based protocol for transferring ECS data between different systems.
  • libs/xla-rs: Rust bindings to XLA's C++ API (originally based on https://github.com/LaurentMazare/xla-rs).

Join us on Discord: https://discord.gg/agvGJaZXy5!

Getting Started

  1. Install Rust using https://rustup.rs
  2. Setup a new venv with:
python3 -m venv .venv
 . .venv/bin/activate.fish # or activate.sh if you do not use fish
  1. Install elodin, and matplotlib with
pip install libs/nox-py
pip install matplotlib
  1. Try running the following code
import matplotlib.pyplot as plt
import jax.numpy as np
from elodin import *

@system
def gravity(q: Query[WorldPos]) -> Query[Force]:
  return q.map(Force, lambda _p: Force.from_linear(np.array([0.0, -9.81, 0.0])))

@system
def bounce(q: Query[WorldPos, WorldVel]) -> Query[WorldVel]:
  return q.map(WorldVel, lambda p, v: jax.lax.cond(
    jax.lax.max(p.linear()[1], v.linear()[1]) < 0.0,
    lambda _: WorldVel.from_linear(v.linear() * np.array([1.,-1.,1.]) * 0.85),
    lambda _: v,
    operand=None
  ))

w = WorldBuilder()
w.spawn(
    Body(
        world_pos=WorldPos.from_linear(np.array([0.0, 10.0, 0.0])),
        world_vel=WorldVel.from_linear(np.array([0.0, 0.0, 0.0])),
        inertia=Inertia.from_mass(1.0),
    )
)
client = Client.cpu()
exec = w.build(bounce.pipe(six_dof(1.0 / 60.0, gravity)))
t = range(500)
pos = []
for _ in t:
    exec.run(client)
    y = exec.column_array(Component.id(WorldPos))[0, 5]
    pos.append(y)
fig, ax = plt.subplots()
ax.plot(t, pos)
plt.show()

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

elodin's People

Contributors

akhilles avatar ch-greams avatar nestordemeure avatar sphw avatar x46085 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

elodin's Issues

AI generated documentation for Nox

Hi!

Would you be interested in a PR adding AI-generated documentation to the types, traits, and functions in Nox? It would be manually checked by a human (me) who has knowledge of Jax and Rust but not this particular codebase.

I have run some quick tests and the output seem serviceable, definitely not perfect but a good starting point to be tweaked by people familiar with the codebase before merging.

nit: step #2 from readme doesn't run as written

The single quote inside the comment here (don't) prevents me from copy pasting this command into terminal. Prompts me to complete the <quote>

python3 -m venv .venv
 . .venv/bin/activate.fish # or activate.sh if you don't use fish

Extracting Nox

Hi!

First, great work! I have done a lot of numerical computing (in non-space-related domains) and you have built some things I have been wishing for several times in the past few years! Thank you so much for sharing your work with the community.

On that topic, is there a plan to extract your XLA bindings and Nox into their own repository (to make targeted contributions / issues easier) and crates1 (so that others can start using them for non-Elodin related projects)?

Footnotes

  1. I guess the XLA bindings might have a shot at being merged back into Laurent Mazare's crate if he is open to contributions. โ†ฉ

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.