Is Wolfram Language the New ROS?
In the last few weeks, Wolfram Research has made two announcements which have great significance for hobby robotics:
1. They’ve started to demo the new “Wolfram Language,” which is essentially the language used in Mathematica, but with a large library of built-in functions for everything from social networking to interfacing with hardware. It’s all symbolic and forms what Wolfram believes is a significantly new paradigm of “knowledge-based programming.”
This is big news. Really big news.
If you’re one of the many people who have never used Mathematica much, it’s probably because you were put off by the price tag. It’s not cheap software; even for students, the cost is about $100 per year (and for commercial use, you can append a zero and increment the first digit a few times). However, if you have used Mathematica, you know that it can best be described as “awesome.” It’s particularly strong at math, of course; once you learn to use it, it’s like having a very smart, if somewhat literal, mathematics grad student working for you, cranking out derivations and pretty plots with ease.
However, it’s now clear that with Wolfram Language, they’re pushing hard to be a more general-purpose development environment. It will still be great at math, of course, but it will now be good (maybe great) at lots of other things too. These include a number of capabilities relevant to robotics: machine learning, image analysis, error correction, sensor fusion, and, of course, interfacing with hardware. See the video for more:
Mathematica is expensive because Wolfram has been paying armies of mathematicians and computer scientists to encode the best algorithms in each field for the last several decades. And did we mention that you can now get all this for free (as in beer) on the Raspberry Pi?
The products for RPi are actually twofold: one is Mathematica, with its full graphical notebook interface. Stephen Wolfram admits that this runs a little sluggishly on the RPi, which is not too surprising; X Window apps are all a bit sluggish there, but it’s reported to be quite usable. The other one is a command-line implementation of Wolfram Language, which is quite zippy because it’s not taxing the GUI pipeline. Neither product is crippled in any way; the full language and libraries are available.
What all this means is that you can now write the control code for your bot entirely in Wolfram Language, and have the all that power — all those algorithms, interfaces, and the whole knowledge-based programming bag — at your fingertips. This isn’t open-source software, where you spend most of your time hacking scripts and juggling library versions just to get something to work. This is commercial, industrial-grade stuff that, I believe, is going to Just Work.
So what would it actually look like? To get an idea, check out this blog post, in which they interface with a GPS module connected to the RPi’s serial port. Or this one, which twiddles some LEDs plugged into the RPi’s GPIO port. Talking to something more complex? The Wolfram Connected Devices project aims to catalog (and provide an API for) thousands of off-the-shelf gadgets of all kinds.
Let me end with a more personal example to illustrate why this is so exciting. I’m currently working on making a balancing (Segway-style) robot. This has been done many times before, generally by using a couple of PID controllers to control the wheel rotation based on the position and tilt of the robot. Easy enough — until you want the robot to be able to actually go from point A to point B in an efficient way, or to adapt automatically to a change in circumstances (such as a strong wind or the addition of some lopsided weight). Then the PID controllers are inadequate. So I started looking into using model predictive control, with machine learning for the prediction part.
Now, since I was doing all this in simulation in Unity, I was writing in C#. Many machine learning algorithms work best with matrices, so I had to begin by finding a decent matrix library that would work in that environment. This turns out to be harder than it sounds, and even once I clear that hurdle, I still have to actually implement and debug the algorithms. Then, when I move all this out of simulation and onto a real robot, I’ll also have to work out the code to interface with the gyroscope, accelerometer, and motors. I’ll also need to build a bleeding-edge version of Mono, or run a nonstandard Linux distro, in order to work around this problem.
With Mathematica and Wolfram Language, most of those hurdles go away. Matrices? Child’s play. Machine learning? A variety of good algorithms are already built in. Interfacing with sensors? Probably there too — if not yet, then soon. And you can bet that it all works like butter on the standard distro.
All this leads back to the question in the title. Robot Operating System (ROS) is a library of routines, of varying quality, intended to take care of a lot of common robotics tasks for you. These include things like vision, inverse kinematics, and interfacing with various kinds of sensors. However, like most open-source software, you get what you pay for — and you will end up paying, if not in dollars, then in hours spent trying to get the parts you care about to work. ROS was designed to run on Intel PCs, and many of the routines don’t work on ARM processors. This isn’t anyone’s fault; it’s just the nature of volunteer, uncompensated software.
With Wolfram Language, we have essentially the same promise of a standard abstraction layer plus a large suite of standard algorithms. But this one is backed by a large company with decades of experience. My own experience with Mathematica leads me to expect great quality and coverage from Wolfram Language. Of course, unlike ROS, Wolfram Language is not aimed specifically at robotics. But if it does everything we need, on a platform that makes a reasonable robot controller and at an unbeatable price point, then maybe that’s all that matters.
What do you think? Is Wolfram Language the future of robot software, or will it end up being a minor side-note? Weigh in with your comments below.