Programming Languages

There are hundreds if not over 1,000 different specialized computer languages that one can learn.

For the robotics beginner of today, it seems that the best choice may be to learn Python and C++.

The advice could be different if you are trying to get a job in a top 5 social media tech company or an older factory using 20 year old Fanuc or some other older major robot brand arms.

Also if you wanted to make fast money perhaps you should jump in on the blockchain revolution and learn about decentralized finance (DeFi) and start to learn how to program in Rust and Solidity and make $150k a year next week! (check out our website to learn more under const Dec 16/21)

One must keep in mind that sometimes the term “programming the robot” is misused and a shop foreman simply means to train the robot to do some tasks by either moving its arms to have it remember a routine or touching a computer tablet called a teaching pendant to draw a sequence of events that the robot is to follow.

But to actually program a robot at the level of repairing it or building a robot, you would be working with programming languages like Python or some language that the older warehouse robot company may have sold along with that particular robot arm.

Also we are lucky that its become so much easier to do complicated things in AIwith a robot, like facial recognition because big companies have created the code like OpenCV that we simply have to include in our own short program and sometimes only add a handful or our own custom code to it, written in a language like Python.

So now lets talk about the many languages like C, C++, Java, Pyton, Ruby, Matlab, Kotlin, Javascript etc.

Surprisingly, Javascript is still considered to be a very strong choice as a language for developing apps and still others love Java and still others promote the use of Python and C++ for various reasons.

The old timers from the 1980’s always say that its all about being able to learn. They say that once you know the fundamentals of programming, that you can learn just about any programming language.

C is often taught before C++ in many universities like U of Waterloo (top robot/computer University in Canada) partly because C is considered to be more difficult in some senses in that you must know about memory management. Also, it is considered to be a more low level language.

Back in the 1980’s, many prorammers learned low level Assembler which is right down to the level of moving around the zeros and ones like machine code.

At Waterloo (where Mark Tilden of Robosapien toy fame and several of the founders of Clearpath Robotics graduated from) programmers learned about object oriented programming with C++ after learning C. Waterloo also taught a language called Scheme.

But today, Python seems to the language that everyone is pushing and learning in the robotics and AI world.

People are really getting comfortable with Python since it is easier than other languages in many respects.

You don’t have to worry about data typing or memory management.

Some companies like the Czech company Jetstreams has produced software IDE’s and tools that make it easier to program in Python and other languages.

Jetstreams has their programIDE Pycharm being used by over 10 million users and they also produced the language called Kotlin which is an open source statically typed language.

Others like the Eclipse program development environment for developing Java and even Python. Many prefer it to Pycharm for some reasons like auto completion and what is called its better ‘refactoring”.

Many use a language called Anaconda (another snake name like Python) to do machine learning models.

Anaconda is a “package distribution” of both Python and the R programming language and it is designed more for scientists while Python is more for general programming use. There is something called the package manager in both and Anaconda uses one called Conda while Python uses a package manager called Pip.

Some like to use the free IDE program Microsoft Visual studio instead of Eclipse or others. Many say its a good idea to pay the extra $30 to get the Visual Micro plug in to make it easier to do development work with Arduino.

Now there are control programs or environments that aren’t really languages and not really IDEs either but they help to control your robots and use Arduino. The MRL or MyRobotLab is one such program. Another is ARC by Synthiam but it operates with different microcontrollers and some Arduino boards but it looks very impressive. The creator of this has a long history with robotics and the EZ robot and attended Waterloo University as did the boys from Clearpath Robotics and Mark Tilden (Wowwee Robosapien).

We could also talk about other languages and we will soon explain the difference between a compiled language and an interpreted language.

When using an Arduino board you call up a sketch (which is a program similar to C) and then you compile it and run it.

So please spend some time on the internet and consul with others about the best language to learn but we are giving you somewhere to start with your search.

If you have zero background in programming then you can start learning the basics of progamming in a book, or by playing with one of the tech toys that we talk about on this site like the Lego Mindstorms EV3, or the Meccanoids robots or the various STEM programming kits available.

The future of robotics however does seem to be leaning towards understanding the ROS Robot Operating system and this requires that one get comfortable with Python early on and then eventually go with C++ if you will be involved with serious robotics work or development.

Now factories and warehouses that already have older robots may have specific languages that you may be required to learn if you want to work there.

But we will come back to that in a moment but lets finish off talking about languages in general.

At home you can buy a $30 arduino board and start learning how to work with the built in code or programs (sketches) that come with it. There will be some sample programs and reusable code libraries and which may be written in C.

Get comfortable with what C programs look like. …with the main function, the idea of including prewritten code libraries at the top of your program, calling functions and passing variables to them, various control structures including if thens and while loops and cases and eventually the hard part which AI uses (matrixes or rows and columns of numbers) …where you may be dealing with the more advanced concepts of arrays and pointers.

Eventually you may buy a more powerful $60 Raspberry pi board and the language there will be mostly Python which can eventually lead you to some kind of job in many of the newer robotics companies.

A Raspberry Pi will probably run a form of Linux as its operating system….Ubuntu or perhaps a Debian Linux version like Raspbian.

There is a bit of a long learning curve to working at the command level with Linux and you will need to know your way around the command prompt when you eventually access files or share code with other programmers on Github and perhaps need to know how to unpack compressed tar files etc.

But lets cover the older languages for a minute.

For business it was always COBOL, for scientists it was Pascal, for beginners in was Basic for AI development it was LISP, Prolog and perhaps Ada and Smalltalk.

As a sidenote LISP or List processor (created in 1958) and Prolog were one of the first Articial intelligence languages and strangely enough, the Lego Mindstorms product has a relationship to it.

The creator of Lego Mindstorms, Seymour Pappert, worked on AI at MIT with the well known AI god Marvin Minsky.

Pappert modified Lisp in 1967 into a children’s language that he designed, along with Wally Feurzeig and Cynthia Solomon called LOGO which had about 100 simple commands, or words to make a small animated turtle move.

Logo simply referred to the Greek word logos which means a word or thought.

He later joined up with Lego and created the Mindstorm product using a similar programming language that could move motors and react with sensors in a way easy enough for kids to understand.

Pappert worked with a team which included people at MIT like Mitchel Resnick, Steve Ocko and later Fred Martin who developed the programmable brick (the Lego bricks are called microcontrollers just like the more modern Arduino.

The Raspberry pi is not a microcontroller but is more of a full blown computer and runs an operatin system usually Linux based.

As a sidenote, several years later Pappert and Resnick got together on a project first thought of by Nicholas Negroponte, called OLPC (One Laptop Per Child) whose aim was to bring very affordable laptop computers to children around the world.

The project was successful in its own way….but I came across one in a thrift store for $5 in 2020 and it is the most amazing looking and functioning computer you could ever see!

It is based on the linux system (Ubuntu) and it did allow me to get on the internet although only in black and white. Here is a photo of my OLPC laptop.

Now back to the discussion of old programming languages.

Pascal was taught in the 1980s as a language for science while COBOL was taught as the language for business and Basic was the language for anyone.

Basic was packaged with just about any microcomputer sold in the 1980s like the Commodore Vic 20, Texas Instrument Sinclair, Apples and the IBM PC.

Some old companies may still use Pascal with their robots but the key is learning the essential parts of every program and learning …how to learn new languages.

A very complex programming technique used years ago which has made a comeback lately is HDL FPGA which is a hardware description language to program a field programmable array.

This technique is used by engineers and is highly complex but apparently does have its use in AI deep learning applications.

There are many block type languages (arrange programmable cartoon blocks around the screen in a sequence) that come with STEM toys and these toys can even work with more professional level visual development programs like Scratch. This is often used in training schools to work with robots.

There is C and there is the newer object oriented language called C++ which is where programming has gone.

C++ deals with making resuable code with concepts like classes, objects, encapsulation etc.

You could also talk about C#/.NET and Microsoft’s Robot developer studio program. (programs are either interpreted or compiled).

The following may be an oversimplification but the two kinds of languages are interpreted languages and compiled languages and the differences can get hard to explain.

A compiled language takes your source code and compiles it once to create code that the specific computer can understand whereas an interpreted language will translate the source code line by line every time the program is run to make any computer understand it.

The advantage of a compiled language is that it runs maybe 10 times faster than an interpreted language while the disadvantage is that compiled programs must be written to run on each different type of computer whereas an interpreted language will run on any type of computer.

To make both techniques more like each other, there are newer techniques like JIT (just in time) compiler which make compiled languages more like interpreted languages in that they will run when they are needed and thereby work on any computer.

Anyhow, C++ and COBOL are compiled languages whereas Basic and Python are interpreted languages.

Java and C# are interpreted and do not get compiled into what is called machine code (very low level language). With Java there is something called the JVM or java virtual machine which interprets the instructions at runtime. Code can then be used on other machines that can run the JVM.

Python is simpler to learn than C++ and it reduces the number of things that the programmer has to worry about.

You don’t have to define and cast variable types which is a bit of a hard concept to understand at first.

Some variable types include : INT, char, float, BOOLEAN etc

These days you don’t need to write programs from scratch since there are thousands of free libraries of prewritten routines to simply copy and use with your programs.

So you don’t have to waste time writing what has been written 100 times before…like moving a robots arm or its eyeballs.

Now there are other languages in the robot world like MATLAB which is used to analyze data and for developing control systems. There is an Opensource version called Octave. Like many higher end programs there is a Robotics toolkit for Matlab.

For those familiar with Basic in the past, one could look into newer Basic versions like PowerBasic and EZ GUI which allows for creating faster interfaces.

There is a language called Processing which is used in the visual arts community because it makes it easier to put graphics on the screen and it is an easier to work with language which is similar in some ways to both Basic and LOGO.

Lego’s Mindstorm is by no means just a toy in the right hands.

It is set up to allow young programmers to go as far as they want in the programming world.

You can buy the Robot C program for Mindstorms or you could learn some linux and put that on the Mindstorm EV3.

So as you can see there are many ways to go when it comes to learning to program.

It does appear though that the quickest way to get started in robotics programming is to get an arduino or a raspberry pi at home and start learning with the built in sketches and then C and Python.

The R language is used mostly for statistical analysis which is needed in data science (a branch of AI related to machine learning and deep learning in the sense that they all deal with massive amounts of data).