Robot actuation

Humanoid robots are intriguing when they start moving. In this post is explained how to setup robot communication, and what commands are used. This is done by providing examples.

TiViPE setup

TiViPE requires two building blocks to send commands to a robot. One to generate the robot commands (ConnectTextFile) and the other to execute these commands (NaoRobotN). Select the modules as illustrated in Figure 1a and 1b.

  1. Drag the modules to the desired position.
  2. Right click the NaoRobotN module until it turns red.
  3. Select the right ip-address of this robot module by clicking the lower left rectangle in the module. We have created a module that keeps running.
  4. Right click the output connection of the CommandTextFile until the upper part of the connection turns green. We have created a socket connection.
  5. Connect the two modules by clicking first on the output connection of the CommandTexFile module and then on the input connection of the NaoRobotN module.
  6. Select a command file by clicking the right upper rectangle inside the CommandTextFile module, the window as illustrated in Figure 1c pops up, select the file and close the window by clicking the Ok button.

The program is ready to be executed see also Figure 1d.

(a)robotprogram1
(b)robotprogram2
(c)robotprogram3
(d)robotprogram4

Figure 1: (a) Select CommandTextFile module. (b) SelectNaoRobotN module. (c) Select the desired command file. (d) Connected robot program.

The program is saved to TVProbotControlByTextFile.net, and can be read from file into the TiViPE environment.

Run the program by clicking the right upper rectangle in the CommandTextFile module, the environment will send the command data to the robot module and start this module.

LED control

Leds can be switched on and off using the ledon and ledoff commands:

ledon(AllLeds)
&
wait(2000)
&
ledoff(AllLeds)

The example TVPled.txt needs to be selected in the CommandTextFile module as illustrated in Figure 1c. This example illustrates the available led commands (ledon, ledoff, ledset, and ledfade). Sending these commands yields the following behavior

All avaialble LED control names are provided in the file TVPledTest.txt this file tests all 89 physical  LEDs or LED groups. In total different 175 names can be provided. The example given ‘AllLeds’ controls all 89 leds and lights up the robot like a Xmas tree.

Audio

The NAO robot contains a set of two loudspeakers and is controlled by  a text to speech (TTS) engine allowing text to be converted to spoken sentences using the ‘say’ command. Music or auditory files can be played using the ‘play’ command.

say(Hello_world)
&
saya(Hello_world)
&
say(Hello_world, 75, English)
&
saya(Hello_world, contextual, 75, English)
&
play(/home/nao/audio/swiftswords_ext.mp3, 75)

Audio files need to be stored on the robot. For instance the swiftswords_ext.mp3 can be obtained by downloading TVPnaoAudio.tgz. This file needs to be copied to the robot and extracted

pscp TVPnaoAudio.tgz nao@192.168.1.55:
plink nao@192.168.1.55
tar xzf TVPnaoAudio.tgz
exit

Here we assume that the user types the appropriate ip-address for the robot (since it is not likely to be 192.168.1.55) using putty pscp and plink, and types the appropriate password for the robot when asked.

The example TVPaudio.txt needs to be selected in the CommandTextFile in the CommandTextFile module as illustrated in Figure 1c. This example illustrates the available audio commands (say, saya, and play). Sending these commands yields the following behavior

Running a third party application

Aldebaran allows users to upload applications. These application in turn can be downloaded to the robot. Using the behavior command

behavior(touch-my-head)
behavior(run_dialog_dev)
behavior(stay-relaxed-0355b7)
behavior(presentation)
behavior(presentation, English)
behavior(animations/Stand/Emotions/Positive/Laugh_2)
behavior(dialog_move/crouch)
behavior(dialog_move/standup)

The example TVPbehavior.txt needs to be selected in the CommandTextFile in the CommandTextFile module as illustrated in Figure 1c. This example illustrates the ‘behavior’ command. Sending these commands yields the following behavior

The example TVPbehaviorTest.txt provides additional examples with behavior. The behavior command is powerful since an application is started, the drawback is that it is not clear when such an application quits, and what side effects it causes. For instance, an application might have unexpected behavior,  a timer can be set that automatically moves to a (relaxing) position after a time out, speech recognition is set with a specific vocabulary, or the applications never quits.

Posture

The NAO robot supports 8 different body postures, Crouch, LyingBack, LyingBelly, Sit, (SitOnChair), SitRelax, Stand, StandInit, and StandZero. These commands are convenient since the robot moves from any arbitrary position to the posture command that has been set. For instance

stiff (1, 500, 0)
&
posture(Crouch)
&
stiff(0, 500, 0)

lets the robot move to a crouching position. An example of postures is TVPposture.txt it needs to be selected in the CommandTextFile in the CommandTextFile module as illustrated in Figure 1c. This example illustrates all 8 posture commands. Sending these commands yields the following movie

Note that the first crouching behavior is ready immediately because the robot starts in this position.

Walking

For walking the TiViPE robot language has three different commands

stiff (1, 500, 0)
&
posture(StandInit)
&
moveto(0.2, 0, 0.0)
&
moveto(0.0, 0.0, 180.0)
&
movenormal(1.0, 0.0, 0.0, 2000)
&
movenormal(0.0, 0.0, 1.0, 2000)
&
movefast(1.0, 0.0, 0.0, 2000)

The moveto(x, y, z) command tells the robot to move to the desired position, where x and y are given in meters, and rotating around the vertical axis is given in degrees from -180 to 180. A positive x denotes moving forward, while negative means backward. A positive y moves the robot to the left (from its own perspective, while a negative value moves to the right. Expect the motion to be slightly off  the desired position; on a 20 cm movement it can be up to 5 cm off.

Commands movenormal(x, y, z, duration) and movefast(x, y, z, duration), move the robot also, but in this case values of x, y, and z are between -1.0 and 1.0. These values are indicators for the maximum speeds, 0.0 denotes none, where 1.0 or -1.0 denote the maximum speed. The duration of movement is provided in milliseconds. The robots stops safely after the duration has elapsed.

An example of movements is given by TVPmove.txt it needs to be selected in the CommandTextFile in the CommandTextFile module as illustrated in Figure 1c. The example is shown in the following movie

Motor control

Motor control commands control individual motors by name, angle, and time. The available motor commands are move, movem, and movemsi. From these commands the movem which stands for move multipe motors multiple times. The advantage of the move command is that a single individual motor can be enabled as shown below

stiff (1, 500, 0)
&
movem(LWristYaw,    -100, 1000, -50, 1000, -100, 1000,
      RWristYaw,     100, 1000,  50, 1000,  100, 1000,
      LHand,          57, 1000,   0, 1000,
      RHand,          57, 1000,   0, 1000,
      LShoulderPitch, 40, 1000,  80, 1000,
      RShoulderPitch, 40, 1000,  80, 1000)
&
stiff (0, 500, 0)
&
# shaking no no
move(HeadYaw, 10, 250, 1)
&
movem(HeadYaw, -10, 500, 10, 500, -10, 500, 10, 500, 0, 250)

An example of movements is given by TVPmotors.txt it needs to be selected in the CommandTextFile in the CommandTextFile module as illustrated in Figure 1c. The example is shown in the following two movies

Dance

Dancing is a powerful way of demonstrating the robot actuation capabilities. The dances are composed with a mixture of the movem, led, and play audio commands.

An example of gangnam, macarena, and tai chi dances is given by TVPdances.txt it needs to be selected in the CommandTextFile in the CommandTextFile module as illustrated in Figure 1c. The example is shown in the following movie

Creating a new dance is labor intensive but possible. The following dance has been created

Leave a Reply

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