Lucas Sifoni

The Elixir Telescope
Part 6 : Three.js + websockets = a 3D moving telescope

optics elixir three.js


Entries up to this point :

This entry will be quite short. I managed to play with Three.js a bit over the weekend, and hooked the Scope.TelescopeApi module to handle events on a websocket.

First, you don’t know how the scope was shut down last time it was used. You need to home it, like a 3D printer homes itself when you start a print.

Then, a viable scope state appears. We can see that the lower endstop is engaged, so you can’t go down.

You can press directional buttons to move, the focuser in/out buttons to focus in or out, and the 3D scope updates live. The DOF simulation updates after you release the focus buttons.

This is a rough POC, but I’ve been really pleased with the beginner THREE.js experience, especially the ease with which you can load foreign 3D models from, for example, blender.

Thanks to Phoenix, as usual, you get the ability to broadcast state to multiple clients for free. It would be trivial to discriminate authenticated users, so that only one user can move the scope, while other receive updates.

Now is really time to finish the mirror and begin construction. What will happen to the code written up to this point ?

See you soon for further developments !


Previous post : The Elixir Telescope -- Part 5 : Porting the depth of field simulation to Elixir + Rust
Next post : The Elixir Telescope -- Part 7 : Elixir architecture questions