Scenario: Two NAO Robots Wandering

advertisement
Scenario: Two NAO Robots Wandering
Junchao Xu, Chang Wang
18 February 2016
Abstract This document describes a scenario of two NAO robots wandering autonomously
in a closed area. The key issue here is to keep our two NAOs safe and sound from colliding
with the walls or each other. Part I will give an outline of the task. Part II illustrates the Goals,
Problems and Solutions(GPS) of the task. Basic choices have been made and implemented
according to different subtasks. The document is primarily targeted at people who are
interested in humanoid robotics. No special knowledge is required to understand it because a
storyline will be used to illustrate what and why we have done it this way.
PART I Outlines

Description
Two NAO robots will be put in a 4×5 m2 arena surrounded by several wooden boards as
walls. They will walk randomly and naturally, avoiding collision with walls and each other. In
this task, sonar sensors and camera will play important roles to detect obstacles and other
marks. Furthermore, when the two NAOs meet occasionally, they are supposed to interact.

Tasks
To fulfill this task, the main goal is divided into several subtasks, as shown in Table 1.
Table 1 the subtasks of two NAOs wandering
Subtasks
Content
Subtask 1
Subtask 2
Subtask 3
Avoid Collision with Walls
Avoid Collision with Robot
Recognition
Key Issues
Static obstacles avoidance; corner issues
Dynamic obstacles avoidance
Detect face, NAO logo and NAO marks
First, a single NAO robot should be able to walk around in the arena without any collision
with static obstacles, the walls. Second, another NAO will be put into the arena and they have
to avoid collision with each other as dynamic obstacle. In this two subtasks, higher
requirements are raised to make them act naturally, as it is unnatural to stop at the wall
standing still or to step backwards and forwards several times when there is no space to turn
left or right. Then, they are expected to recognize each other with cameras to distinguish the
other robot from walls. To solve this problem, face detection and NAO logo detection would
be used. Finally, the NAOs are supposed to have interaction such as greetings, like saying
“hello” to each other while waving hands to show friendly. It would be nice if they could
greet naturally like humans. Here, action sequence should be considered and well designed.
1
Two Nao Robots Wandering

Programming language
URBI script, a scripting language based on URBI middleware powered by a French company,
GOSTAI.
PART II GPS of Subtasks
Subtask 1: Avoid Collision with Walls

Goals
This subtask is to make a single NAO robot walk randomly in a static environment such as an
arena surrounded by walls. Meanwhile, the robot should avoid collision with the wall while
walking, which is a Static Obstacle Avoidance issue, as shown in Fig. 1. Theoretically, this is
an instance that robots perceive static environment. Typically, the robot should adjust his
walking direction such as turn left or right before getting too close to the walls.
wooden
boards
Fig. 1 avoid walls

Fig. 2 sonars features
Problems
In this subtask, sonar sensors will play the leading role so that the features such as range,
resolution and operational approach should be known in advance.
1. Sonar Features
As each robot has only two sonar sensors, thus it should be considered how to utilize them
and to what extent they can be relied to take actions in real time.

Range
nominal: 0.2~1.2 m; measured: 0.3~1.3 m.

Resolution
nominal: 9 mm.

Effective cone
60°, as shown in Fig.2
In the robot system, 10 successive echoes for each left and right sonar are recorded in the
memory as “Value” and “Value1~9”. In URBI, ALMemory method can be used to read them.
Sonar values which represent distances can be accessed directly by command “sonarL/R.val”,
sonarLVal = ALMemory.getData("Device/SubDeviceList/US/Left/Sensor/Value");
2
Two Nao Robots Wandering
sonarRVal = ALMemory.getData("Device/SubDeviceList/US/Right/Sensor/Value");
However, these values are not all usable. We only utilize the value of the first echo which is
the distance from the nearest obstacle to the robot because the values of following echoes are
overlapped and unstable.
2. Single Wall Avoidance
When NAO is walking towards a wall, it has to change walking direction to avoid collision. A
simple solution is to let it turn at a prefixed angle at a certain distance called “Threshold”, and
it decides to turn left or right depending on which side has bigger space (the bigger circle in
Fig. 3). The bigger space is determined by the bigger value between both sonars. In advance,
the turning angle is simply prefixed to 90 degree.
B
too
close
D
θ=?
E
sonarL
sonarL
C
sonarR
P
F
Q
sonarR
α=22.5°
A
Fig. 3 turning trajectory issue
β=22.5°
Fig. 4 calculation of turning trajectory
However, sometimes NAO walks too close to the wall while or after turning, which are likely
to cause collision as shown in Fig.3. Therefore, it is considered to design a trajectory by
geometry calculation to keep distance from the wall above a certain threshold. The angle at
which NAO turns should be adaptive to the orientation of NAO while walking and the turning
point should be well determined in case that NAO is too close to the wall after turning. As
shown in Fig.4, the demanding trajectory is arch PQ, where the turning point P is determined
by a threshold of the distance to the wall (0.5m). For the turning angle, calculating angle θ is
the key factor, which can be done by trigonometry according to both the left and right sonar
values. As a result, Q is easy to get. Once we know the coordinates of points P and Q, NAO
could move along the trajectory autonomously by calling ALMotion methods.
Unfortunately, the detection range of sonar is a large cone (Fig.2), which makes the point of
echoing wave from obstacles quite uncertain. In fact, an obstacle with regular shape like the
wall, the nearest point could be calculated. But too many parameters are involved and most of
them are inaccurate. In addition, this method is not adaptable for other possible situations, e.g.
trapped in the corner (will be described in the next part). Thus, this method is suspended as an
alternation.
In the end, a real-time control strategy is devised. The timeline of the entire motion is cut into
pieces/frames (points in Fig.5). At each point, NAO acts (e.g.,walk forwards, walk
3
Two Nao Robots Wandering
backwards, turn left or turn right) according to real-time data from sonar sensors. While
turning, it turns little by little once in a time slot. A finite state machine (FSM) is designed in
this strategy as shown in Fig.6. NAO decides its actions based on the states, and state
transitions depend on conditions formed by sonar values. In this way, NAO walks well with
no collision with one single wall.
C
B
sonarL>0.5m
and
sonarR>0.5m
T
back
S
sonarL<0.3m
and
sonarR<0.3m
Fig. 5 real-time adjust (every 100ms)
turn
left
walking
forward
sonarL<0.5m
or
sonarR<0.5m
sonarL>
sonarR
turn
sonarL<
sonarR
turn
right
Fig. 6 state machine
3. Corner Issue
At the corner, NAO might have been too close to the second wall after it has turned around
the first wall, so the turning condition is met and it has to turn again. However, it has not
turned fully around at point P but facing a little left to the corner (see red dash in Fig 7.1).
According to the strategy, it has to turn left (see red arrow). In this way, it may be trapped,
which means it might walk back and forth for several times, as shown in Fig 7.2. Therefore,
specific strategy has to be designed to make the robot turn around the corner with a smooth
trajectory (see green arrow in Fig 7.1) instead of iterative walking. The final strategy is
demonstrated in “Solutions” section.
P
good strategy
bad strategy
Fig. 7.1 reason of the problem
Fig. 7.2 overview of corner issue
Fig. 7 corner issue
The simplest solution is to enlarge the turning angle of NAO, so it would directly turn over
the corner along the trajectory shown as green arrow in Fig. 7 instead of stopping at P.
However, if NAO always turns such a big angle in all situations, it will walk unnaturally.
Then, the turning angels are different that NAO turns less at common obstacles such as one
single wall than at the corner. So NAO has to decide that it is approaching a corner and make
a bigger turn than usual.
Another idea comes from the so-called “Bang-Bang-Bang-Bang” strategy used in
4
Two Nao Robots Wandering
“Following a wall” task of “MiniBot” (a personal mobile robot) [1], and has been applied in
our NAO robot, as shown in Fig. 8. Generally speaking, there are three thresholds of distance
from the wall (i.e. 35cm, 50cm, 65cm) to control NAO’s motion, and only one-side sonar
value is used (left sonar in Fig. 8). That is, when distance is below 50cm, NAO will drift away
from the wall while above 50cm, drift towards the wall. However, one threshold might be not
enough, so two extra thresholds (35cm and 65cm) are used to prevent the robot to walk too far
away from the center threshold (50cm). In other words, when the distance is below 35cm,
NAO will turn away from the wall more rapidly than drift, and when above 65cm, NAO will
turn towards the wall rapidly.
35cm
sonarL
sonarR
sonarL
sonarL
50cm
sonarR
sonarR
65cm
Fig. 8 “Bang-Bang-Bang-Bang” Strategy
This strategy can really prevent NAO from walking back and forth at the corner, but it makes
NAO walk unnaturally along a serpentine curve. Thus, we combine this strategy with the
former natural walking strategy that we switch between the two strategies based on whether
Nao is at corner or1 not.
As shown in Fig. 8, before NAO walks to the corner, only the first wall could be detected,
which causes the right sonar value always bigger than the left one (refer to the purple dash),
even nothing is detected by the right sonar (the value would be beyond the measured range,
1.3m). However, when NAO is getting close to the corner, the right sonar will detect the
second wall. Meanwhile, the right sonar value is becoming smaller and smaller so that
theoretically we know NAO is approaching the corner, but the real situation is more
complicated. Details of sonar values are shown in Fig. 9 below.
1
http://forums.trossenrobotics.com/tutorials/how-to-diy-128/following-a-wall-3283/
5
Two Nao Robots Wandering
1.9
1.8
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
follow the wall, oscillating
approaching the corner
sonarL
1
28
55
82
109
136
163
190
217
244
271
298
325
352
379
406
433
460
487
514
541
sonarR
Fig. 9 chart of left-and-right sonar values
Up to now, effective way to processing the data for corner detection is still not found. One
reason is that the trend of the data varies at corners is not always so typical as shown in Fig.
9. Furthermore, the trend can only be perceived when NAO is walking into the corner, but
corners should be detected before the robot walks in, otherwise it would be trapped in corners.
We tried to detect the corner because we want to employ the “4Bang” strategy only when
NAO is walking towards the corner in order to prevent unnaturally walking in other
situations. Since no effective methods have been found to detect the method, a tradeoff should
be made between naturality and corner solutions, which is allowing NAO to walk a little bit
unnaturally but corner issue is solved.

Solutions
A simple solution is to reducing the oscillating amplitude of the serpentine walking along the
wall, and to force the robot walk apart from the wall after several seconds following the wall.
3s
3s
Fig. 10 a tradeoff solution
6
Two Nao Robots Wandering
As shown in Fig. 10, NAO walks along the wall by “4Bang” strategy. The turning angle is
adjusted to make the trajectory as straight as possible. For fear that NAO would follow the
walls all the time, after several seconds following it is forced to change orientation as to walk
apart from the wall to the center of the arena. In this case, NAO seems to walk naturally and it
should not be trapped in the corner.
Subtask 2: Avoid Collision with Robot

Goals
As shown in Figure 11, another robot is also walking in this arena, where they should avoid
collision with each other. This problem is different from Subtask1 because the obstacle (red
NAO to blue one) is moving too that is a dynamic obstacle avoidance issue. Theoretically,
this is an instance that robots need to perceive dynamic environment, and furthermore, hybrid
environment.
wooden
boards
Fig. 11 Two NAO robots wandering

Problems
The solution to Subtask1 cannot achieve the goal in Subtask2, because “4Bang” strategy
corresponds to static environment but not dynamic environment. Put differently, NAO robots
cannot succeed to avoid collision with moving objects by the former strategy in Subtask1.
A dynamic response strategy arose to cope with such a situation. It is a real-time decision
strategy based on closed-loop feedback control mechanism. State plays an important role in
this strategy denoted xt in the diagram shown in Fig. 12. State could be considered as the
collection of all aspects of the robot and its environment, particularly in this topic, it refers to
the relation between robots and surrounding obstacles.
7
Two Nao Robots Wandering
u
z
0
x
0
u
1
z
1
x
t-1
x
2 …
1
x
t-1
u
t-1
x
t
Fig. 12 dynamic strategy: x represents the state at a time point, z represents the measurement of a
state, and u represents the action taken at corresponding state. In our system, the interval between time
points is 100ms.
Each state has a measurement denoted zt based on sensor data, which is the estimation of the
environment, also called observation, and it refers to the distances to obstacles of the robots in
our topic. Actions denoted ut taken by robots is based on the observation of the state zt. Both
prior states and actions result in change of state, and new state arises. In our topic, this change
is confined to self-change of the robot, which is changing the form of the motion such as
turning left, turning right and walking straight.
The observation zt is acquired by sonar values. A 2-D observation space is constructed by left
and right sonar values, which perform as horizontal axis and vertical axis. Three range bins are
used for both left and right sonar values. They are ranged:
0~35cm
L1
R1
35~65cm
L2
R2
>65cm
L3
R3
Thus, the 2D space is divided 9 squares, and each square stands for the observation of a state.
States
L1
L2
L3
R1
S(1,1) S(1,2) S(1,3)
R2
S(2,1) S(2,2) S(2,3)
R3
S(3,1) S(3,2) S(3,3)
The action ut is taken corresponding to each observation,
S(1,1)
S(1,2)
S(2,1)
Turn with
standing still
Turn Small Right
Turn Small Left
S(2,2)
S(1,3)
S(3,1)
Turn Medium
(direction dependent
on the bigger value)
Turn Large Right
Turn Large Left
S(2,3)
S(3,2)
S(3,3)
Turn Slight Right
Turn Slight Left
Random walk
1. The 30cm dead area: This is an inherent problem in NAO robot platform. The sonar
8
Two Nao Robots Wandering
system has a minimum detect range of 30cm (tested). It is implied that NAO cannot detect
the distance variation only by sonars within 30cm range of the distance to obstacles,
which means the ability of environment perception is lost at such a short distance. It
should be avoided that NAO walks too close to obstacles with the distance decreased
below 30cm to keep safe. It is easy to fulfill this avoidance in Subtask1 because all the
obstacles are static. However, in Subtask2, two moving robots are easy to reduce their
distance between towards below 30cm, even touch each other in some cases. In this case,
the environment cannot be perceived anymore, so the only thing NAO can do is turning
with standing still until no close obstacles in front of it. But even then, physical contact
cannot be avoided sometimes.
2. The responding speed: Some case in which NAO cannot adjust its motion that quickly to
avoid collision is that another NAO suddenly shows up from the side of its body, as
shown in Fig. 13. When the blue NAO detects the red one, it is too late to turn around to
avoid the collision.
Fig. 13 red NAO suddenly walks to the front of blue NAO from side
3. The shortage of this method is that actions are taken in the light of observations, but
observations are acquired directly from sensor data, which is not perfectly precise. Thus,
uncertainty is involved, but not taken in account. So probabilistic methods should be
introduced to cover this issues.
A potential solution to the first problem is utilizing camera to detect the other moving NAO at
a relatively long distance in order to change the walking direction ahead of time. Color
detection is the most promising method due to its ease to use.

Solution
The color detection, logo detection and Naomark detection of machine vision technology by
NAO’s camera will be promising to solve the problem.
9
Two Nao Robots Wandering
Subtask 3: Recognition
As described in previous sections, our little robots can safely wander in the closed arena
without colliding the walls or each other. But that’s far from enough. They are still blind
about each other, regarding the other one as nothing but obstacles. This makes them the most
familiar strangers ever! To end the awkward situation, their cameras shall be used to detect
each other. This would be supplementary to sonar-only method, especially to subtask2, the
dynamic obstacle avoidance.

Goals
Recognize the other Nao when they are approaching each other. Only consider the face to
face situation, rather than the face to back one.

Problems
The key problem here is to choose a good feature or several features to distinguish the Nao
from the environment. We have a simplest choice at hand, to use the module ALVisionLogo to
detect the Aldebaran logo on the chest of every Nao robot.
Fig 14.1 Logo Detection
Fig 14.2 detection error caused by time lag
As shown in Fig. 14.1, if an Aldebaran logo is placed somewhere in the camera’s field of
vision, the detected logo(s) would be reported with blue crosses. But sometimes it gives false
detection even there is no logo in the present picture as in Fig 14.2. This is caused by the time
lag for pictures transmitted from Nao to the computer to display on the screen.
Also, detection features should be taken into account:

Lighting: tested under office lighting conditions - ie, under 100 to 500 lux.

Size range for the detected Logos: Min ~0.015rad=0.7 deg , Max ~0.40 rad = 23 deg.

Tilt : +/- 45 deg (0 deg corresponding to the logo facing the camera).

Rotation in image plane : +/- 30 deg
10
Two Nao Robots Wandering
This means there will be a big possibility that the logo will not be detected if the room is too
dark, or the logo is too far away, or the angle of logo facing the camera is bigger than 45
degrees, or the logo is rotated more than 30 degrees.
What’s more, the plastic logo on the chest of the robot doesn’t work well.
However, nothing could be worse than the shaking of camera when Nao is walking above a
certain velocity, resulting in blurred pictures that could hardly tell anything detected.
Seems a little frustrating! But we have methods to handle some of these problems, although
not all of them.

Solutions
First of all, stick the printed Aldebaran logo on Nao’s chest. Although seems a little silly, it
works well, as shown in Fig 14.3.
Fig 14.3 logo Detection using printed paper
Fig 14.4 color detection using a belt
Second, slow down the walking pace of Nao to let it take higher quality pictures.
Third, set the frame rate of picture taking to the highest value. This will help reduce the miss
of logo that ever appears in the camera’s field.
For the logo detection, these methods are quite effective. But what if the logo detection
malfunctions? We have to improvise to guarantee the recognition. Bingo! Color detection is
not a bad idea. As our Naos have colored armet, shoulders, chest, and even gloves, as can be
seen in Fig 14.3. To increase the probability of color detection, we could simply tie a color
belt around Nao’s waist, as in the Robcup, Fig 14.4. Then, from any directions, the Nao with
a color belt could hardly be missed by the camera.
Since blue and red NAO can recognize each other, it is feasible to implement greetings using
“Text to Speech” and “Speech Recognition” modules.
11
Download