This post describes how robots can be controlled using a compact textual robot language.
For the user interested in reading a document the following document is available:
T. Lourens Programming Robots using TiViPE –A step by step approach using Aldebaran’s NAO robots [1.76 MB pdf], Technical Report, Draft version 0.2, 74 pages, September 2011.
The aim of TiViPE is to integrate different technologies in a seamless way using graphical icons . Due to these icons the user does not need to have in depth knowledge of the underlying hardware architecture. This report elaborates on controlling robots, NAO robots in particular, with the TiViPE environment. The report can be used as a step by step manual, starting to setup and use the software, get acquainted, with the textual robot command language , use of ready TiViPE modules to control the robot, and will be provided substantial information on how to adapt, extend, and to create modules within TiViPE.
Controlling a robot using textual commands
The goal is to construct a compact textual language that is able deal with commands in both a serial and parallel manner. We have constructed a language that is as follows
[a | b] & c | d & e
where a, b, c, d, and e represent textual commands, a bar (|) denotes parallel execution and an ampersand (&) serial execution. The order of execution of these commands is created in analogy with adding and multiplying.
(a + b) * c + d * e
where multiplication binds stronger than addition, serial order binds stronger than parallel execution. Figure 1 provides a graphical representation of this command.
Figure 1: Graphical representation of commands a–e.
The commands a-e given in figure 1 are symbolic, and represent generic, motor, led, and audio commands. The user gains full control over the robot using a little over 20 different commands. Generic commands are flush and wait. The 25 motors of the NAO robot are controlled by collision, fall, safeguard, stiff, speed, move, movem, movemsi, behavior, posture, and speed control commands. The robot contains a considerable amount of LEDs which can be set using ledon, ledoff, ledset, and ledfade commands. Further auditory commands are provided by say, saya, play, and vocabulary.
Two generic commands are available wait to let the robot do nothing in some of its parallel processes for a given duration (in milliseconds). The flush command is used to remove all the commands that are scheduled and not in execution, yet. While normal commands are appended or ignored, this command is executed immediately and used to change the behavior of the robot abruptly. The loop command do(10) … enddo can be used to reduce the number of commands. While comments in the text start with a # and automatically end at a new line.
The stiffness of a motor is usually set at the beginning using for example stiff (1.0, 1000, 0) to set all motors to maximum (1.0) stiffness in 1 second time. In case there is no (0.0) stiffness no electronic motor control is possible. For robot protection collision, fall, safeguard, can be switched off and on for instance by sending the safeguard(on) command to the robot.
Command speed lets the user set a global value of execution of motors. This global value adjusts every time elements by newtime = speedval / 100 * time. It implies that speed (200) slows down motor execution by a factor 2, while speed(100) uses the default speed. This command is used to easily modify the speed of a movement behavior.
One can move a single motor to a given angle over a specific time, for example move (HeadYaw, 30.0, 1000) moves the ‘head yaw’ motor to an angle of 30 degrees in one second time. In practice multiple moves for multiple motors are performed and writing as string like [move (HeadYaw, 30.0, 1000) & move (HeadYaw, -30.0, 1000)] | [move (HeadPitch, 20.0, 700) & move (HeadPitch, -20.0, 600)] can be written in a more compact manner like movem (HeadYaw, 30.0, 1000, -30.0, 1000, HeadPitch, 20.0, 700, -20.0, 600) using the move multiple elements command. On the NAO robot 25 different motors can be controlled, and it is common to construct a multiple move command considering all of these motors in parallel.
User can also upload ready applications to the robot. For instance when the application presentation is uploaded the user can start this application using behavior(presentation). The posture command with argument Sit, Stand, or Crouch brings the robot for any position to the given posture.
Setting LEDs is performed with the ledset command, in this case all LED’s have a unique name, and can be given a value between 0 (ledoff) and 1 (ledon). In case of a transition from the current color to a new color the ledto (also known as ledfade) command is used and a duration in milliseconds is provided. In this implementation, a single led command with 1, 2, or 3 arguments is sufficient. For the NAO robot 141 names can be given, these names control either a single or a group of LEDs.
Two powerful audio commands say and play can be used provided that a text to speech and mp3 player engines are available on the robot. The first argument of the ‘say’ command is a text string. In this text every space needs to be substituted with an underscore, and comma’s are not allowed. The optional second argument is the volume, it can be set between 0 and 100, when it is not used the last volume setting is used. For the optional third and fourth argument, which are language and personality, respectively the text to speech engine should provide support to both of them. The saya performs animated speech, the second argument sets the type of animation it is either, disabled, contextual, or random. When disabled the saya command behaves the same as the say command. The vocabulary command is used to control the automated speech recognition system of the robot.