Hacker News new | comments | show | ask | jobs | submit login

Why JavaScript? This is not a flame, I'm sincerly interested.

I have made several robots from small hobby projects up to an autonomous driving car (college team). For all of those we used C or C++, with one exception that used Java. For the Java controlled robot I built a web interface that allowed you to control it remotely over wifi (similar to this, without the repeaters).

I have been thinking about using Python or Ruby for the high level logic while using C/C++ down low controlling motors/sensors. Or maybe running a JVM and doing the high level logic in Closure or Scala with JNI over the drivers.

Either way, I see why you want a high level language for the logic, but why JavaScript/Node.JS? I guess this is more remote-controlled rather than autonomous, but for autonomous systems I don't see what JavaScript brings to the table.




For one, it's nice having the evented framework. Pretty much everything on the robot from user input to GPS pinging is modeled well by async events. Node.js also has some nice libraries for websockets, which make for good real-time user input from a web interface. Third, we didn't actually need anything that complicated. All we needed to was talk over serial and websockets (pretty much). Fourth, it was just fun to play around with, and I am highly amused that I can say I built a robot that is controlled almost entirely through JavaScript. I would be the first to admit that this doesn't NEED to be written in JavaScript. I can't speak much to autonomous systems except that this might be a good area for event-driven processes, if nothing else.


I guess there are some interesting results as a result of this effort:

* Javascript can be used to program these things and is quite capable of handling low-level kind of stuff

* Since it's easier to write js code than c/c++ code (for me), I would personally prefer it; assuming that the performance degradation is within allowable limits


What do you define as low-level stuff? It seems that Node.js was used to communicate with the components running on a regular Linux OS, not really the low-level stuff that you would be able to do with, say, C.


Right. I'm not very familiar with Arduino but I assume its microcontroller was programmed in C or assembly. Probably it listens for simple commands such as "activate/stop left wheel", "activate/stop right wheel".

edit: Apparently, Arduino uses its own programming language: "Arduino hardware is programmed using a Wiring-based language (syntax and libraries), similar to C++ with some slight simplifications and modifications, and a Processing-based integrated development environment." https://en.wikipedia.org/wiki/Arduino




Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: