Sneaky Robots

Learn Build and Share with us

Programming Languages

What are the most popular programming languages used in Robotics and Artificial Intelligence?

The most popular programming languages that are used in robotics and Artificial Intelligence are the following

  1. Python
  2. Java
  3. LISP
  4. Matlab
  5. C/C++

There are other languages you will find but today we will focus on these 5 programming Languages.

Robotic Programming Language
Robotic Programming Language

1. Python

In recent years, there has been a huge resurgence of Python, especially in robotics. There are many reasons for it, first it’s a core language of ROS (Robot Operating System), Python along with C++ are the two main programming languages found in Robot Operating System. Another reason is that it’s an interpretive language (like Java). But unlike Java, Python’s prime focus is ease of use: no build process, simple syntax, a REPL, dynamic typing. Due to this many people tends to agree that it achieves its objective (of ease of use) very well.

Python Language
Python Programming Language

Another thing, Python dispenses with a lot of the usual things (such as defining and casting variable types) which takes up time in programming. Also, there are a lot of free libraries for it, which means when you need to implement some basic functionality you wouldn’t have to “reinvent the wheel”.

For e.g., if you are trying to figure out a new way to model statistical sensor uncertainty for motion planning, You wouldn’t have to write your own fast linear algebra library, it’s already done for you. And since Python interfaces with C/C++ code, thus to avoid performance loss the heavy parts of the code can be implemented in these languages too.



Python is (mostly) cross-platform: It works fine on systems such as Linux and OSX which are the primaries in robotics, and it also works mostly on Windows too, depending on the libraries you’re using. So we are likely going to see a lot more of Python in robotics as more electronics (as with Raspberry Pi) starts to support Python “out-of-the-box”.

2. C/C++

Despite being one of the toughest programming languages, C and C++ still find a lot of scope in robot programming today, mostly owing to their faster compilation speed. Many people will tend to agree that C and C++ are a good starting point for new roboticists.

Because a lot of hardware libraries use these languages including:

ROS, one of the top platforms for robot programming and simulation today, ROS has numerous libraries in C++.

OpenCV, an open sourced computer vision platform, also supports C++.

OpenRave, an openly sourced motion planning environment for your robotic system, also many libraries are written in C++.

Apart from these, you have Arduino which runs on a C/C++ based syntax. ROBOTC is also based on standard on C/C++.

My Arduino with the USB cable
Arduino uses C programming language

There are many reasons for C and C++ popularity, some of them are: 

  • They allow interaction with low-level hardware.
  • Also, they allow for real-time performance and are
  • They are very mature programming languages, as they have been known for a while.



C++ is used more than C because it has much more functionality. Basically it’s an extension of C but still, it can be useful to learn at least a little bit of C first so that you can recognize it when you find a hardware library written in C. C/C++ are not as simple to use as, say, Python or MATLAB. As it will require many more lines of code and time to implement the same functionality using C. But still, C and C++ are probably the closest things that any roboticists have to “a standard language”, due to the dependency of robotics on real-time performance.

3. LISP

Developed between the 1970s and 1980s, LISP is the world’s second oldest programming language (FORTRAN is the oldest). Although LISP may not be as widely used as the other languages on this list; however, it is still quite important within Artificial Intelligence programming.

LISP is used as the first computer language for artificial intelligence, this language is quite flexible and extendable. Its features such as fast prototyping and macro utility (that let developers create a domain-specific level of abstraction on which to build the next level) make it very useful in artificial intelligence creating.

This programming language makes powerful things in an easy way, as it provides a clear mapping thus making systemic changes easy. Also in Lisp, complex programs are easy to write as Lisp generates efficient code with well development compilers.

What really makes Lisp one of the most popular languages for artificial intelligence programming is its features such as powerful object systems, condition system, dynamic typing and automatic garbage collection with dynamic creation of new object.

Due to these features, it impresses AI developers quite well and has been used in many classic AI Projects (such as Macsyma, DART, and CYC) as well. The factor that places it at the last position is that in comparison to others it is not fast. Parts of ROS (Robot Operating System) are written in LISP, although you don’t need to know it to use ROS. Because of its usability and symbolic structure, this language is used in Machine Learning/ILP subfield too.

4. JAVA

If you come to robotics from a computer science background (as many people do, especially in research) you will probably already have learned Java. Java is an interpretive language (Like C# and MATLAB), which means that it is not compiled into machine code. Rather, the JVM (Java Virtual Machine) interprets the instructions at runtime, thus allowing you to use the same code on many different machines. In theory, it sounds good but in practice, this doesn’t always work out and can sometimes cause the code to run slowly.

JAVA programming Language
JAVA programming Language

Also, Java is not as high level as Lisp and Prolong and is also not faster than C. However despite all this, this language is still quite popular in some parts of robotics; as it provides all the high-level features needed to work on AI projects.

First, it is a portable language & offers inbuilt garbage collection. The plus point with Java community there will always be somebody to assist you with your queries and effort. Since AI is full of the algorithm, thus making Java the best choice to use as it provides an easy way to code good algorithms. You can develop algorithms like natural language processing algorithm, search algorithm, or neural algorithm. Also, Java has the feature of scalability thus making it perfect for AI projects.

Its main benefits include portability, transparency, maintainability, and versatility. So if you are a beginner, then you’ll like the fact that there are hundreds of tutorials on the Internet. That will make your learning easier and more effective.


Its other general features include a good user interaction, debugging ease, facilitated visualization, easy work with big projects, incorporation of Swing and SWT. Projects made with Java have sophisticated and appealing interfaces.

5. MATLAB

Visualization, programming, and computation are integrated by MATLAB in an easy-to-use environment where solutions and problems are expressed in familiar mathematical notation.

ADVANTAGES:

A simple integer is considered a matrix (its basic data element) of one row and one column in MATLAB. Several mathematical operations (such as dot-products, cross-products, inverse matrices & determinants) that work on matrices or arrays are built-in to the MATLAB environment.

MATLAB Programming Language
MATLAB Programming Language

Instead of a “for or while” loop, vectorized operations (Adding two arrays together) requires only one command in MATLAB. The graphical output in MATLAB is optimized for interaction. You can easily plot your data, and then by using the graphical interactive tools, you can easily change its sizes, colors, scales, etc.

By the addition of toolboxes (sets of specific functions), the functionality of MATLAB can be greatly expanded. As more specialized functionality is provided by these toolboxes. Ex: You can write data in a format recognized by Excel with the help of Excel link. You can do even more specialized statistical manipulation of data with the help of Statistics Toolbox (Basic Fits, Anova, etc).



Furthermore, image analysis can also be performed in MATLAB. You might have heard about OpenCV library for Computer Vision in Python or C/C++. Computational Photography is also possible in MATLAB. A large number of data scientists, software engineers, students, etc, first implement their machine learning algorithms on the MATLAB. After that, if they feel the need of production in the computer market, they try to implement it in other programming languages like C/C++, Java, etc.

Finally, there is no language better than the other, it only depends on which one you prefer and finds it easier to learn. I prefer you know the basics of each of them.

Tagged:
Hamoudi
I’m an electrical engineer and a part-time blogger. I love to Play around with electronic parts (build small robots of any kind). I try to post information that can help others.

LEAVE A RESPONSE

Your email address will not be published. Required fields are marked *

You Might Also Like