What language for programming a humanoid robot?
Among existing languages, which provides the functions best suited to programming a robot or android?
Humanoid robots should not be programmed like computers. Machines as they are, it seems impossible however to predetermine all their acts in a real environment and turn them into lines of code, because the information they receive is unlimited unlike what comes from a keyboard.
Also the design of computer languages seems ill-suited to robotics, but there is certainly a language more appropriate than others.
Robots must be able to learn
Humanoid robots must be capable of learning, which means that even if we describe a method of operation to accomplish a task, what dies a program, their knowledge of the task must evolve and adapt according to results obtained when the robot tries to accomplish it.
The programming language should allow once a specific process defined, that it is perfected automatically based on the results and improve itself for the unexpected cases, that the robot will first attempt to deal with what it knows before to forge new modes of operation.
They must share their knowledge
Robots must be able to exchange. We see in press releases they know how to be successful for each function, for example, one to walk or run, the other to speak, the other to mimic human expressions, but each is limited to a capacity, it does not seem possible to transmit that from one to the other, and less again to combine these capabilities and make them work together.
This requires that the programming language is able to provide these combinations of programs.
Parallelism is a basic function needed
Robots are composed of units that must operate simultaneously: arms, legs, hands, face... This requires that the programming language implements parallelism, which often do modern languages. The UrbiScript language dedicated to robotics implements it even in its syntax and the Urbiforge offers a set of tools ready to use with the language and a library of UObjets to interface with robots.
They need a representation of the outside world
Like ourselves, they need an internal representation of the world, so a form of consciousness.
Programming languages describe objects, which are made of functions and variables to represent the real objects. These are the classes, and can adapt to different cases through inheritance.
Objects as well represented as values and functions depending on parameters remain fully formal, so the language should be able to go beyond classes. Real-world objects are not all rigidly defined, the world is in constant movement and the representation of the world should follow this dynamism.
In conclusion, the best suited current language is ...
The C++ language is widely used ni robotics for hardware drivers and some specialized programs. But it is a choice based on the habit and skills of programmers, and not because it works best.
The newest Go language wants to replace it, and it deviates from the model of static classes and replaces them with interfaces. But that is not dynamic, however.
Dataflow oriented languages are also an option to consider. We program by combining visual objects as you can do with some development system for robots. What matters for this language are states and their connections. The change of one state to an object changes the states of other connected objects, and it is a form of representation of the real world more realistic than that of algorithms. But rather complex to implement ...
JavaScript itself also differs from the static object-oriented model with objects that evolve during the processing, which is a step towards what we need. Indeed it can facilitate learning if the machine produces descriptive classes of a real object and complement it as it discovers new aspects of the object.
It is possible to pass through prototypes to other instances of an object which is dynamically added to an object, which is also that we need.
But to really answer what we want should be that beside these dynamic objects there are more than sets of variables and functions. This is something that remains to be defined.
JavaScript is a language that runs in parallel by attaching events to objects. The parallelism of JavaScript could probably replaces the connections of dataflows states, if we attach to objects events, with the advantage that the connections are dynamic and evolving.
Finally, for dynamic, learning, knowledge exchange, JavaScript seems the most appropriate language for programming a humanoid robot moving among humans.
By Denis Sureau November 29, 2011.
Photo: Aiko android by Le Trung.
- The V8 JavaScript compiler.The compiler from Google can work at command line. We can even modify it and compile it with Visual C++ Express.
- V8 may be used directly from the command line with Node.js.
- Arduino Experimenter's Guide for Node.js. Programming electronic circuits may be done in JavaScript.