Show HN: Elodin – A better framework for physics simulation
167 points| sphw | 2 years ago |github.com
Have you ever wondered what happens when a satellite is first placed into orbit? It turns out that often, they tumble out of control, end over end, in a miraculous fight against stability. Check out our demo here of a control system attempting to rectify this: https://app.elodin.systems/sandbox/hn/cube-sat
The spacecraft does not appreciate tumbling: deploying solar panels and antennas might not work, and doing anything worthwhile is out of the picture. So what are you to do about this? You'll equip your satellite with reaction wheels (or magnetorquers), but now you have a second problem. What commands do you send to the reaction wheels?
We created Elodin to help solve problems like this. These problems are firmly in the realm of GNC (guidance, navigation, and control) engineers; they are traditionally solved with MatLab / Simulink, a bunch of Python scripts, and/or a tool like Gazebo or Basilisk. While building the flight software for a deep-space mission, I tried all of these tools and didn’t like them. In particular, I found that running Monte Carlo simulations in the cloud was painful.
So we set out to build a better framework for physics simulation. You might call it "Tensorflow for Physics." The name fits for two reasons: we use XLA to accelerate your math, and we've built an extensible framework for creating new physics engines. Most physics engines are fixed-function. For example, something like MuJoCo (https://mujoco.readthedocs.io/en/stable/overview.html) is great for traditional robotics, but GMAT (https://gmat.atlassian.net/wiki/spaces/GW/overview) is far better for orbital analysis. No single physics engine can solve all problems, and it’s hard to integrate multiple engines. Our framework allows you to easily compose different physics algorithms.
Space is hard enough—let’s not have software make it harder than it needs to be! We are still early in building our stack, so we’d be grateful to hear any feedback that you have.
noobermin|2 years ago
Anyway, to each their own, it's fine for people who somehow think because there are wrapper methods everywhere a code is "cleaner". I just submit that this really is a aesthetic preference, and that instead of trying to "fix" other professions, understand there are often reasons why things are that way when everyone in a field works that way.
sphw|2 years ago
cl3misch|2 years ago
Of course, I once was that physicist! Now I prefer working with arrays and functions that receive arrays and return arrays, even in the top-level, user-facing script.
But who knows, maybe there will be a next stage in the journey!
igleria|2 years ago
As a computer scientist this sounds odd to me, but if you are the sole consumer of your own API, you do you!
schreiaj|2 years ago
From the little I can see of it, it looks like you don't allow writes to data and instead prefer to return a new thing based on a query? Based entirely on the below.
``` @system def control( sensor: Query[WorldPos, WorldVel, Goal], rw: Query[RWAxis, RWForce] ) -> Query[RWForce]: ```
I assume this is due to the distributed nature of your simulation framework?
Either way, neat. Very interested in this though for more terrestrial applications.
sphw|2 years ago
EDIT: One thing I forgot to add is that we actually use Bevy for our 3D viewer. IMO, its the perfect framework for developing 3d applications that aren't quite games. Most games engines make you carry around a ton of features you will never use, but Bevy is really good at being flexible, lightweight, and easy to use
leighleighleigh|2 years ago
Also just in case you were unaware, the name 'nox' refers to a popular Python testing framework... so if you were to release 'nox-py' on PyPi it would be a bit confusing. Maybe "nox-ecs"? Sorry to be a bummer!
sphw|2 years ago
sphw|2 years ago
leighleighleigh|2 years ago
sphw|2 years ago
leighleighleigh|2 years ago
jcgrillo|2 years ago
sphw|2 years ago
drojas|2 years ago
denhaus|2 years ago
archgoon|2 years ago
Elodin is not really the same sort of physics simulator at all.
5kg|2 years ago
Curious, why reimplementing jax in rust (nox)?
sphw|2 years ago
A fun side-effect of this architecture is that when we run your simulation we aren't actually running your code, Python or Rust in the loop. We compile down the whole thing to HLO at runtime, then run that HLO. So we could theoretically support lots of other languages.
amne|2 years ago
genshii|2 years ago
sphw|2 years ago
untech|2 years ago
(odin means one in some languages)
stealthcat|2 years ago
sphw|2 years ago
jcgrillo|2 years ago
EDIT: answered in a cousin comment.
pests|2 years ago
alephaleph|2 years ago
sphw|2 years ago
elashri|2 years ago
sphw|2 years ago
unknown|2 years ago
[deleted]