5 ms·
Seems kind of pointless. A flight controller that can run JavaScript fast enough would be a waste of resources.
by demondemidi 2y ago
Seems kind of pointless. A flight controller that can run JavaScript fast enough would be a waste of resources.
- lelanthran 2y ago> Seems kind of pointless. A flight controller that can run JavaScript fast enough would be a waste of resources. According to the docs (for both this and the Johnny-Five project), the JS ONLY runs on a PC-class computer. You connect your IoT device to the computer that is running the JS program, and the JS program then controls the device. The IoT device must be tethered to a PC of some sort. I'm guessing that controlling PC does things like "set GPIO-$X to input", "read GPIO-$X, "set GPIO-$Y to output", "write GPIO-$Y", "read ADC-$A", etc. Maybe they designed their custom protocol to also handle time-constraints (like clocking a signal at a certain frequency on a particular pin), or maybe counting transitions on a digital input for specific duration, so that you can mostly do what you'd expect to, but I wouldn't bet on it. My understanding of these types of projects is that they don't compile the input into a state-machine that is downloaded to the device; they send each instruction as and when it occurs. This is especially problematic considering that the example in linked page is for a drone taking off, flying, then landing 10s later. You better hope that your drone doesn't ascend so fast in that 10s that it is out of range by the time the `land` command is issued.
- deleted 2y ago[deleted]
- _akhe 2y agoJavaScript is a hell of a lot faster than Ruby, PHP, or Python, yet Python is mostly used for AI/ML. I think V8 is plenty "fast enough" (why wouldn't it be)?
- wiseowise 2y agoI think their problem is not performance of JS, but efficiency. V8 is relatively resource heavy and if your microcontroller can run it - it is too powerful for what it is.
- _akhe 2y agoAs if there's no downside to building everything in C
- demondemidi 2y agoJust need to be jerk today, huh?
- fwip 2y agoWhen it comes to performance, ML/AI isn't "written in Python," it's "configured in Python."
- _akhe 2y agoSure and V8 is written in C++ and JS is just the scripting layer
- fwip 2y agoNo, that's not what I mean. What I mean is that the performant libraries of the ML/AI python ecosystem are all written in C or another high-speed compiled language. The speed of the underlying execution is not meaningfully affected by the speed of the Python interpreter. If CPython 3.12 came out with a huge performance regression and ran 50% slower than 3.11, these ML programs would run at almost exactly the same speed they do today.
- _akhe 2y ago> not what I meant > the libs are all in C Yeah node uses bindings too, examples: node-llama-cpp (C++)... node-SDL (C)... Why wouldn't it also be true for mechatronics? Have some native bindings for C libraries then you can write Node or Python and still use the machine code where needed. Speaking of which: > The speed of the underlying execution is not meaningfully affected by the speed of the Python interpreter Wouldn't both JIT vs not JIT have an impact on speed, and also some of the "heuristical" stuff V8 does? I wouldn't rule out JavaScript for mechatronics, everything ends up in JavaScript.
- fwip 2y agoThat's a good point. I suppose my knee-jerk reaction was driven by "interpreted languages are not suitable for low-resource machines," because the fixed overhead of booting up a Javascript or Python interpreter/JIT are comparatively higher in embedded environments. But the space nowadays is a lot bigger/wider than the traditional "embedded" space (where 4KB of RAM is a luxury), so there's no reason a drone or robot can't have a few gigs of RAM and multiple cores to use. So Javascript/Python is probably fine for a huge category of mechatronics applications. Thanks for discussing with me. :)
- demondemidi 2y agoBecause performant flight controllers are written in C, and often ARM assembly.