Landing : Athabascau University
  • Blogs
  • Teaching Machines to Think with Programming Languages

Teaching Machines to Think with Programming Languages

Teaching Machines to Think with Programming Languages

All machines are designed to do something. A few are designed to do nothing, which is still something. To do, they have to think, at least a little. Modern robots are almost entirely governed by computer systems, all built with programming languages.

How important is the programming language? Could it make or break a device or robot?

The choice of programming language is important for pragmatic reasons, two important factors being compiler limitations for a particular platform and speed of development. Technically, any Turing-complete programming language, which is nearly all of them, can be used to program any device (robot). Even those interpreted or JIT-compiled (or combinations thereof) languages that normally require large libraries or other tools, such as Java or Python, can theoretically be translated into machine code and written in a way that makes the result equal in every way, including performance and memory space, to code written in other languages. The reason so many programming languages exist is that some of them make development on a certain platform and certain applications easier and faster. A microprocessor’s specific assembly language is often better suited for the smallest memory spaces and fastest execution times; large Python frameworks are often better suited for fast development times (low costs) on x86 processors; algorithms written in FORTRAN are used in some industrial plant control systems where they have had decades of testing. There is often some choice between a few languages, and the final decision coming down to personal preferences, amount of support, or the availability of compilers for a certain platform. The x86 processor, especially when running a popular operating system, can be programmed in most languages; while the 8086 processor has few options other than 8086 assembly language. Some robots should be programmed with more than one language, either because its various parts are programmed separately and are best suited to different languages, (and/or) because different tasks are better suited to different languages (e.g. write a ‘fast’ algorithm in C++, then write the rest of the program in MATLAB code), or (/and) because a device is best programmed in steps that require different languages (e.g. program bootloader in C++ that allows loading your Python code).

Virtually any programming language can be used to program a robot, but some are more practical than others. I’ve listed some programming languages for different platforms without repeating those that apply to multiple, in order of popularity (as ranked by the TIOBE Programming Community Index) or development timeline. Some languages that would not likely be chosen to program robot behaviour, such as those used primarily for web development, were skipped (e.g. PHP), though these languages are often a good choice to program interfaces or other system components.

  • General computing: Java, C# / Visual Basic .NET, Python, JavaScript, MATLAB / Octave, R, Swift, Lisp, and Prolog.
  • General purpose microcontrollers with restricted processing and memory capabilities (not ARM, x86, etc.): C / C++ (or Arduino), Assembly language, BASIC / Pascal.
  • Proprietary systems, especially those used with industrial robots, are sometimes programmed with proprietary languages such as ABB RAPID, Kuka Robot Language (KRL), Comau PDL2, Yaskawa INFORM, Kawasaki AS, Fanuc Karel, Staubli VAL3, and Universal Robots URScript.
  • Some non-proprietary languages, libraries, or software (“middleware”) has been developed for use primarily in robotics such as ROS-Industrial (stands for “Robot Operating System”), Player Project, RT-middleware, Urbi, MIRO, Orca, OpenRDK, and YARP.
  • Some visual programming methods exist, such as Lego Mindstorms ROBOLAB or Scratch.
  • Languages developed for robotics in the past include Variable Assembly Language (VAL, VALII), SIGLA, ROL, FUNKY, SERF, AML, RAIL, and HELP.
  • Hardware Description Languages (HDLs) are used to program logic blocks such as FPGAs, which may be used in robotics for high-throughput systems.

Our course uses what is officially called the "Arduino" language. In essence, it is most of C++ [and C] supported by libraries written by the Arduino company and community.

With the constant development of new technologies that use computation, the number of computer languages has been and will continue to grow at increasingly faster rates, keeping pace with the computational industry. Matarić mentions this as well: As robotics is growing and maturing as a field, there are more and more specialized programming languages and tools (p. 138).

Comments

  • Susanne Cardwell October 11, 2017 - 6:55pm

    Nicely written Tyler. As for your article on control theory, is control theory onerous math ... and avoidable?  What applications do we need control theory for ... and why is it so vital?

    Thank you.

  • Tyler Lucas October 11, 2017 - 7:50pm

    Control theory does get into pretty gnarly math. Laplace and z-Transforms combined with linear algebra (non-linear if you're a masochist). You don't need it for this course, and can avoid it for many applications, even some of those that use a control system. That's what PID Without a PhD is all about. I've been trying to write a blog post all week that derives the optimal PID coefficients for moving my robotic arm, but have been stumped by the math to the point of giving up on that approach. (And I've already done a fair amount of that type of math before, having taken control systems courses.) The theory is important when you need to improve control performance.

  • Susanne Cardwell October 11, 2017 - 8:20pm

    Check out Tableau software for your Excel data, Tyler.