5 ms·
SpaceX Dragon ISS Docking Autopilot PID Controller in JavaScript
Here there is a youtube video recording of the controller in action:
https://www.youtube.com/watch?v=bH6x3b0McRo
The code can be found here:
https://gist.github.com/rzilleruelo/f44252e77036403af4c6a3e85e990c3d
- gabrielblack 5y agoIMHO the title is misleading : it's a simulator of ISS Autopilot not the real one.
- rzilleruelo 5y agoIt was not intentional to be misleading. Though I agree with your comment, the title should be something like "". I tried to change it but it's seems is not longer possible. I'm sorry about that.
- rzilleruelo 5y agoSpaceX Dragon ISS Docking Simulator Autopilot PID Controller in JavaScript
- oliv__ 5y agoIsn't Javascript terrible for dealing with numerics (floats in particular)?
- anoncake 5y agoDealing with integers is what it's terrible at because it doesn't have them.
- ralusek 5y agoBigInt(5) or 5n would give you an integer. You can only operate with other integers. 2n ** 256n === 115792089237316195423570985008687907853269984665640564039457584007913129639936n Can also work with integers with the likes of: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- rzilleruelo 5y ago"terrible" depends of what you are trying to do. In this case I would said is good enough to make it work.
- nikolay 5y agoJavaScript abuse keeps going on... A language designed for simple browser automation is turning into a plague. It's funny how we bounce from one extreme to another wasting so much effort and focus - many people moved from Java to JavaScript as a revolt against the complexity of the Java ecosystem and specs and laziness to code strongly typed. But look at the JavaScript ecosystem today - with Babel and the JSON libraries, it overshadows the old Java one! Pretty much every Java and XML technology got reinvented and reimplemented in worse ways. And now many replaced JavaScript with TypeScript...
- duxup 5y ago>The controller code is designed to be injected into the SPACEX - ISS Docking Simulator (https://iss-sim.spacex.com/ https://iss-sim.spacex.com/). What's the problem?
- nikolay 5y agoYou can run Python in the browser and reuse the code.
- janderland 5y agoWhat is your point and how does it relate to this project? Seeing as this controller is used in a browser-based simulation, this seems like a perfectly valid use of JavaScript.
- nikolay 5y agoIn 2021, there are ways to run other languages in the browser - including Python.
- runawaybottle 5y agoYou might not like to hear this but it’s probably the Java people that are bringing those ideas to JavaScript.
- nikolay 5y ago
- stevenpetryk 5y agoPeople keep shitting on JavaScript in this thread. To be clear, this is a JavaScript game that SpaceX made, and somebody wrote an autopilot... yes, in JavaScript... because that's what browsers run. It's a cool algorithm running in the only language browsers natively know to play a browser-native game. Relax. It's cool. It's impressive.
- duxup 5y agoSometimes I don't even mention that I work with JavaScript or even front end frameworks for fear of triggering some rant from someone frustrating by those topics.
- vanillax 5y agoCan you provide instructions how to use this? Do I just have to paste it in the chrome console window and go?
- rzilleruelo 5y agoYes no problem. Open the SpaceX simulator. https://iss-sim.spacex.com/ https://iss-sim.spacex.com/ Then open the console and paste the code in the gist. https://gist.github.com/rzilleruelo/f44252e77036403af4c6a3e85e990c3d https://gist.github.com/rzilleruelo/f44252e77036403af4c6a3e8... Then just paste this code to start the controller. let regimeController = startRegimeController(config); let controller = startControl(config); Also you can change the config on the fly to change the target value, so you can make it do something else if you want. For example: config.x.target = 0.0; config.z.target = 10.0; config.pitch.target = -45.0;
- app4soft 5y ago> Then open the console and paste the code in the gist. 1. Open the SpaceX Simulator webpage[0]; 2. Open your browser console (e.g., in Pale Moon browser its in menu "Tools > Web Developer > Web Console" or just type [Ctrl]+[Shift]+[K] shortcut); 3. Copy code from the gist[1] to browser console and execute it; 4. Enjoy [0] https://iss-sim.spacex.com/ https://iss-sim.spacex.com/ [1] https://gist.github.com/rzilleruelo/f44252e77036403af4c6a3e85e990c3d https://gist.github.com/rzilleruelo/f44252e77036403af4c6a3e8...
- rzilleruelo 5y agothank you for providing very clear steps.
- rzilleruelo 5y agoSteps to run the controller: 1. Open the SpaceX simulator: https://iss-sim.spacex.com/ https://iss-sim.spacex.com/. 2. Open the browser javascript console. Example for Google Chrome https://developer.chrome.com/docs/devtools/console/javascript/ https://developer.chrome.com/docs/devtools/console/javascrip.... 3. Past the code in the gist: https://gist.github.com/rzilleruelo/f44252e77036403af4c6a3e85e990c3d https://gist.github.com/rzilleruelo/f44252e77036403af4c6a3e8... 4. Paste this code to start the controller: let regimeController = startRegimeController(config); let controller = startControl(config); 5. Optionally, you can change the target values to make the controller set the capsule in a different state. For example: config.x.target = 0.0; config.z.target = 10.0; config.pitch.target = -45.0;