Show HN: Impossible Machines: declaratively program the physical world
Posted by bhaprayan 4 days ago
Hey all —
Sharing a thought experiment I put together. The premise: what might declarative programming feel like for the physical world?
We’re already familiar with this paradigm in software land (eg SQL etc where we declare what we want and the execution engine figures out how).
I didn’t have access to an actuator so I mocked up the concept in software. The way it works is you demonstrate the effect and the system figures out how to achieve it. So say you want to ring a bell and you have a crank. The system will find a way to connect the two. If you add obstacles it figures out how to work around them (runs a constraint solver runs behind the scenes).
I think what’s interesting about this is being able to think about the problem at a higher level of abstraction, with the system figuring out a way to achieve the intended effect.
Anyways, curious to read reactions, feedback, and interesting ideas on how to extend this!
Comments
Comment by skinfaxi 4 days ago
Comment by bhaprayan 4 days ago
Behind the scenes, I’ve tried to make the audio production realistic, so there’s some acoustic modeling going on (eg echoes, attenuation of sound, etc). But yes you could imagine having the input forces be continuous and having the mechanism trying to figure out how to reproduce the sound exactly.
Comment by skinfaxi 3 days ago
Comment by bhaprayan 3 days ago
Comment by pshc 4 days ago
Comment by bhaprayan 4 days ago
Comment by SeanAnderson 4 days ago
Comment by bhaprayan 4 days ago
Comment by wemakethings 1 day ago
Comment by bhaprayan 1 day ago
I was primarily thinking about more sources, obstacles, and sinks. Right now the solver picks a random solution so it may be interesting to optionally make that deterministic too.
Comment by donalddominko 4 days ago
Comment by bhaprayan 4 days ago
High level:
I’m using ThreeJS for the rendering and Rapier (https://rapier.rs/) for simulating bodies, joints, collisions, forces, etc. The mechanism is solved for using a simple heuristic search (eg constraints, etc that you introduce in the scene) and then run through Rapier to find a configuration that works, though there are definitely more sophisticated ways to do this. The audio is based off a sound pack which I tried to make physically realistic so impacts are panned relative to the camera, with compression and a small generated reverb.
Comment by mcphage 4 days ago
Comment by bhaprayan 4 days ago
Some of the mechanisms (belt drives etc) might be a little tricky with 3D printers, but would be very cool to see the mechanism tangibly realized.
Comment by jdw64 4 days ago
[1]https://www.microsoft.com/en-us/research/publication/motion-...
Comment by bhaprayan 4 days ago
Comment by pinePulse 2 days ago
Comment by verdantNorth 2 days ago
Comment by insiderprint 4 days ago
Comment by bhaprayan 4 days ago
Comment by hilde574 4 days ago
Comment by bestdn4u 3 days ago