Robotics may not be a new field, but it is experiencing massive growth. In fact, many experts theorize that advancements in robotics, IoT and artificial intelligence will disrupt future labor markets as much (if not more) than the industrial revolution. Believe it or not, in 2016 the robotics industry, with regards to industrial and non-industrial sales, accounted for approximately $31 billion dollars. By 2022, that figure is expected to reach $237.3 billion.
Even though the robotics industry is a miracle of modern science well suited to increase automation, the robots still need creators, maintainers, coders. So let’s take a closer look at the best programming languages to learn for a future in the exciting and explosively growing field of robotics.
Contents (Jump to)
A Note for Beginners
Before we take a closer look at the best programming languages to learn, I did want to share a bit of my personal experience to help absolute beginners manage expectations. Unless you’re some programming wunderkind or veritable genius, learning any programming language is going to take a lot of time and good ol’ fashioned hard work. Remember, you have to walk before you run…and crawl before you walk.
Regardless of which programming language you choose to start with, be prepared for repetitive mundane exercises designed to teach you the basics. More often than not, you’re not even going to start by working with GUI code. Instead, you’re going to be printing values and commands to the terminal to understand how basic structures work. It can be frustrating starting out, but don’t despair. It will all be worth it when you get to start actually writing robotics code!
My very first introduction to the wide world of programming began, unsurprisingly and boringly, with BASIC. I wouldn’t personally say that BASIC and Pascal are the “most important” languages to learn for robotics, but they’re worth learning for several reasons. First of all, if you haven’t even scratched the surface, BASIC and Pascal are a great place to start. After all, BASIC stands for Beginner’s All-purpose Symbolic Instruction Code.
Do you know what conditional structures are? Do you know what a procedural language is? If you answered no to either question, you should probably start from square one with BASIC. But before you begin, I want to help you manage your expectations. BASIC isn’t flashy or an extremely sexy language, especially for beginners. Don’t think you’re going to be starting learning how to program microcontrollers, activate robots’ motors or create some visual eye-candy like your very own video game.
Every intro tutorial for a beginner (as far as I’ve seen) almost always starts with that irksome “Hello World” tutorial. And in BASIC/PASCAL, things aren’t any different. You’re going to be starting out with some simple command structures that essentially print text or perform some mathematical operations in a text box. Pretty exciting, right? Well, hang in there. The concepts learned from BASIC and PASCAL will act as a foundation upon which you can further build programming skills.
C (Objective) and C++
C and C++ are undoubtedly the most important programming languages you can learn to further your education and set up a trajectory for the robotics field. Why? Well, there are a ton of reasons. First and foremost, these two languages are the most used code in the robotics industry, but there are many ancillary benefits to learning either language.
C and C++ are object-oriented languages that are used in a wide variety of fields. Everything from game design to CAD uses C and C++, among other object-oriented languages. And once you learn one object-oriented language, you’ll have skills that easily transfer to other facets of programming. Even among different programming languages, once you’ve learned one object-oriented language, you’ve essentially learned them all (with few exceptions).
Really, the main thing that will change between different programming languages is the syntax. You’ll find that – more or less – object-oriented languages have the same data types and the same data structures. For example, arrays, loop structures, recursion and other such mechanisms are inherent to object-oriented languages. The exact characters you type to create those structures, however, will change from language to language.
But the toughest part is learning how all the mechanisms work in the first place. Learning one object-oriented language is a bit like riding a bicycle. Once you’ve learned how to do it once, you won’t forget. However, I did want to draw an important distinction. Technically, the C programming language, which is very old, is actually procedural. But there is a newer version called Objective C which, as you may have guessed, adds object-oriented syntax to the language.
C# and the .NET Framework
If you’ve already got some C++ coding skills under your belt, learning C# (pronounced “see sharp”) isn’t going to be that difficult. In fact, a lot of the syntax is identical, but what changes are the libraries of functions and objects which you can employ in your code. C# is only one of many programming languages within the all-encompassing .NET framework. As you may already know, C# and the .NET library are Microsoft products, which makes them the go-to platform for developing Windows applications.
By now, you’re probably wondering why you would want to learn C# if it is well suited for Windows programs, right? Well, Microsoft, as a perpetually forward thinking company, has already made investments in the future of robotics. More specifically, it has a tool called the Microsoft Robotics Developer Studio, and this tool uses C# as its main language.
The latest version, version four, comes with a variety of components including Visual Programming Language, Visual Simulation Environment, Decentralized Software Services, and Concurrency and Coordination Runtime. Naturally, it’s going to take a great deal of time to learn this environment, but having a foundational knowledge of C# is an undisputed asset.
MATLAB has been around seemingly forever and is now 34 years old. It is often used in engineering disciplines to control and analyze data, as well as to create controller systems. It’s also great because it “plugs into” (or interfaces) with other languages frequently used in robotics, such as C#, C, C++, Java, and others. One of its key features is the ability to manipulate and graph data and comes with a GUI environment.
But it also comes with a robotics-centric interface, known as the Robotics Toolbox, which supports mobile robotics functions as well as arm-type robotics. I wouldn’t recommend it as the best starting place for beginners, not because it’s difficult to learn, but because there are more versatile skills to learn (like C++) which have a much broader application.
I’ve heard some people claim that Python is a waste of time because it has outlived its prime, and will soon go the way of the dinosaurs. I’ve heard people say that about Fortran, and guess what? It’s still around too! Python isn’t on its last leg and has even been steadily growing in popularity in the world of robotics. Believe it or not, ROS (Robot Operating System) uses Python as one of its main programming languages.
Again, I wouldn’t recommend this as a language for beginners. But if you’ve spent some time with BASIC and have learned at least one object-oriented language, learning Python to expand your knowledge is a practical decision. Furthermore, Python interfaces well with C and C++, which will allow you to whet your object-oriented programming skills. After all, as they say – even with regards to knowledge and programming languages – use it or lose it!
Assembly language is the lowest form of coding. By that, I don’t mean it’s the most dishonorable; rather, it is the most basic instructions any controller or processor can be assigned. Languages like Java and C++ are high-level languages and have an abstraction layer between them and the underlying processor architecture which doesn’t require the programmer to understand all the tedious underlying processor-level commands.
However, understanding assembly language is a great skill for a robotics programmer to obtain, especially if you’re working on microcontrollers. However, know that there isn’t any single microcontroller platform or architecture and that assembly language isn’t a general foundational skill like C++. As such, I can only recommend this as an ancillary skill. Sure, it’s useful to know assembly language, but it isn’t required and certainly isn’t the best place to start.
The real drawback to assembly language is that it isn’t standardized like Java, BASIC, C++, or other similar languages. Assembly language changes from processor to processor, and while some commands and concepts are similar, many are not. So if you invest a great deal of time learning assembly language for processor X, and then are required to work on a controller using processor Y, you may feel as though you’ve wasted some time.
If you don’t know the difference between a procedural language and an object-oriented language, my advice is to start from the very beginning with BASIC. After that, I’d wholeheartedly recommend picking up some C++ skills. C++ is so popular and versatile you’ll be able to transfer those skills to other coding environments should you decide to stop pursuing robotics. Plus, C++ offers programming concepts that are used in other languages (though the syntax is likely different), such as arrays, if/then decisions, and other similar programming constructs.
MATLAB and Python are great to know too, but I wouldn’t start learning them until you have a well-rounded knowledge of BASIC, C, and C++. Once you have and eclectic knowledge of robotics-oriented programming languages, only then would I recommend trying your hand at assembly language. It isn’t as practical as the other languages, but could certainly give your career a competitive advantage under the right conditions.
Patrick Sinclair is a geek; make no mistake about that. He runs All Home Robotics in his spare time so he doesn’t have to think about his depressing cubicle and it gives him an excuse to buy expensive gadgets to review!