
Ask HN: What's the most suitable language for robotics? - galfarragem
Thinking about the future, what do you think that should be the standard programming language for robotics?
======
pedalpete
If you twist Atwood's Law a bit, the answer is, of course, javascript.

The current de-facto language is C. I personally believe (as the creator of a
JS IoT Library) that we will see a split in how we define the hardware field
which will be a deciding factor in what things are written in.

What does 'robotics' mean? Is a device that waters plants a 'robot'? What
about an autonomous drone?

Let's go with a very broad example look at any hardware controlling device
which is not just sensing (so interacting with it's environment). Is that
fair?

I believe that if a robot is doing dangerous and mission critical work, work
that is maybe time and computer intensive, definitely needs a real-time clock
for finite control, etc. etc. Than C is the way to go (happy to hear
alternatives here, but I think you want to get as close to the metal as
possible).

Thing is, C programmers aren't exactly a dime a dozen, they are fairly
specialized. How many websites and apps are being written in C?

So, if the field is going to grow at the forcasted rate, there is going to
have to be a huge volume of developers learning C to program IoT and robotics.
But, how can you scale up that many devs. Or repurpose devs from the most
popular language already, and one that runs on many low-powered devices. I
don't think another language fits that mold as well as javascript.

For this reason, I've been building an IoT javascript library
[http://getfavor.net](http://getfavor.net). Still in early stages, but keen to
hear feedback.

~~~
galfarragem
And what do you think about elixir/erlang? Great error handling and ability to
send/receive fast messages. Wouldn't that be suitable for really complex
robots (e.g. humanoids) to get inputs from surrounding environment?

(I'm completely _naif_ on this subject, maybe my question doesn't even make
any sense)

~~~
pedalpete
I don't know much about erlang or elixir. Erlang was popular at work for a
short period of time, but I think more people are fans of Haskell now (seems
Scala may even be falling out of favor a bit).

As Seren said, C is pretty much defacto at the moment. C has a fairly large
community. What would be gained by using Erlang? My understanding is that
Erlang is geared toward distributed systems. I can absolutely imagine an
massively distributed control system would benefit from Erlang. If you think
of 'robotics' like cars where there is essentially a different robot for each
control, maybe Erlang is a good fit. If the device is going to have a single
CPU, maybe not so much.

It really depends on the application and the architecture, but to me, Erland
isn't a natural choice.

~~~
merdreubu
You get a lot from Erlang VM. Among other things: by far the best VM
instrumentation out there, rock solid stability, fault tolerance and hot code
loading, exemplified in this little video of a drone in-flight flying control
system upgrade

[https://www.youtube.com/watch?v=96UzSHyp0F8](https://www.youtube.com/watch?v=96UzSHyp0F8)

On the Elixir side of things, there's something like the Rails of embedded
development in the making, a project called Nerves. This is a recent
presentation on the project:

Justin Schneck - Enhanced Embedded Systems with Nerves (ElixirConfEU 2016)

[https://www.youtube.com/watch?v=118-g0ODfgg](https://www.youtube.com/watch?v=118-g0ODfgg)

------
seren
Currently I would say that for the low level parts, this is C and/or a subset
of C++ for hard real time constraints (motion control, safety,...)

As someone struggling with legacy C++ spaghetti code, I feel that the
situation would slightly improved if Rust took over but there is a long way to
go. The closer you are to the metal the more conservative people are regarding
their technology stack (maybe rightly so!)

But let's be honest in 15 years, in the best case, someone will struggle with
legacy Rust spaghetti code.

