# Artificial Intelligence and Robotics

Λογισμικό & κατασκευή λογ/κού

7 Νοε 2013 (πριν από 4 χρόνια και 6 μήνες)

117 εμφανίσεις

~
1

~

CSE 5400

Artificial Intelligence and Robotics

Artificial Intelligence and
Robotics

iRobot Create

Jose D. Garcia

Gopal Jani

Amit Ramani

~
2

~

CSE 5400

Artificial Intelligence and Robotics

I.

Introduction

................................
................................
................................
...........................

3

A.

Objective
................................
................................
................................
..............................

3

B.

Equipment and

Software Installation

................................
................................
...............

4

C.

................................
................................
..

5

II.

ICreate Robot Algorithm

................................
................................
................................
.......

6

III.

ICreate Robot Demos

................................
................................
................................
.........

6

A.

D
emo One:

................................
................................
................................
...........................

6

Problem Faced:

................................
................................
................................
......................

6

Resolution:

................................
................................
................................
.............................

6

B.

Demo Two:

................................
................................
................................
..........................

7

Problem Faced:

................................
................................
................................
......................

7

Resolution:

................................
................................
................................
.............................

7

C.

Demo Three:

................................
................................
................................
.......................

8

Problem Faced:

................................
................................
................................
......................

8

Resolution:

................................
................................
................................
.............................

8

D.

Demo Four:

................................
................................
................................
......................

9

Problem Faced:

................................
................................
................................
......................

9

Resolution:

................................
................................
................................
.............................

9

IV.

Important Factor for Future Work

................................
................................
.................

10

Table of Figures

Figure 1
-
Map of Computer Science Building second floor)
………………………………
……..
3

Figure
2
-

Map of path followed by robot to mapped the floor

………………………………
.
4

Figure 3
-

Gigaware® 6
-
ft. USB
-
……………………………….
5

~
3

~

CSE 5400

Artificial Intelligence and Robotics

I.

Introduction

A.

Objective

The purpose of this project is to program an iRobot Create series robot to
map the Computer Science Department corridor and

perform the
following
s:

First, t
he robot traverse
s

from the Computer Science second floor’s
elevator a
nd knock
s

on Rosely
’s
office
door to pick up
some
.

Second, t
he robot
then
attempts to knock on Dr. Silaghi’s door

to let
him know the cookies has been picked up
.

Third, t
he robot then attempts to deliver the cookies to

the final
destination which is

Dr. Stansifer’s office

door
.

Finally,
the robot need
ed

to do the first three task
s

in the shortest
amount of time possible to win the race against the
other team’s
robots.

Figure
1
-
Map of Computer

Science Building second floor

~
4

~

CSE 5400

Artificial Intelligence and Robotics

Figure
2
-
Map of path followed by robot to mapped the floor

The robot make use of its sensors to locate itself inside the corridor and
make decisions
such as when to make a turn or as when
just
to keep

going
straight.

Our a
lgorithm
revolved around sensing the walls with the robot’s
bump sensors and keeping track of the distance of the walls to

minimize
uncertainty to whether we are at the desired location or not
.

However, there
are pros and cons for using this kind of method

which will be
explained later.

B.

Equipment and Software Installation

Our team used the final program as our baseline from the previous work of
students who took the class in the spring of 2009. They used the python
programming language to implement their project. The reason why they
picked python was because python have an
easy and user
-
friendly serial
communication interface to communicate with the robot. Also, a Create
Dodds’s personal website, provides all the interfaces needed to control the
robot’s ac

~
5

~

CSE 5400

Artificial Intelligence and Robotics

To set up your system to run our source code on the iCreate robot, you need
to do the following:

Install Python 2.4
-

He
re
)

Install PySerial for Windows

Here
)

Install Win32All for Python 2.4

here
)

Here
)

(or your code) to the iCreate robot. PySerial assume that you have serial port
(RS
-
232) in your laptop for communication. However if you do not
have a
serial port but have a USB port, you are going to need a USB
-
to
-
Serial cable.
We bought a USB
-
to
-
cheaper one online for about less than half of that price. Here is a link to the
cable our team u
sed for the project (
USB
-
to
-
Serial Cable
).

Figure
3
-
Gigaware® 6
-
ft. USB
-

C.

iCreate robot, follow the following steps:

Connect the USB end of the USB
-
to
-
Serial cable to your laptop (if the
laptop you own do not have a Serial port) and the other end to the
serial port of the iCreate Robot cable.

Verify in the Python code, the
right port is specified for
communication.

To run the program,
Type the following commands in the Python
command line:

~
6

~

CSE 5400

Artificial Intelligence and Robotics

o

Type “ import Create ”

o

Type “ from Create import* ”

o

Type “ import nameofpackage ”

o

Type “ from nameofpackage import* ”

o

T
ype “

aimain()

II.

ICreate

Robot Algorithm

In this section, we are going to describe the main algorithm to program the robot
:

III.

ICreate

Robot Demos

A.

Demo
One:

Science second floor’s
elevator and knocks on Roselyn

s
office
door to pick up some cookies.

Problem Faced
:

At the time of first demo, the planning for mapping the corridor of computer
science building, program was based on the traveling time from one po
int to
another, the distance covered by the robot and the angle at which it will turn. But by
considering these three factors it was not possible to have a robust program
through which the robot can reach to the destination. We have faced so many
problems
in that program and that problems are as follows,

1.

Time

factor depends on the robot’s battery charging level. That means, consider
the case where the charging of the battery is full, in that case the robot will go
faster because of the rotation of the motor for the wheels will be faster, and I
case when the ba
ttery level is low the rotation of the motor will be slower than
normal. So for both the cases we will go forward for particular seconds but the
distance covered by the robot will be different.

2.

Distance

is also about the same factor as the time because as

we have explained
in time, distance is also not reliable factor. On each run the distance covered by
the robot for same path will be different.

3.

Angle

of turning the robot in particular direction will depend on the previous
position of the robot and main importantly the previous angle may differ
because of the surface of the floor. So we cannot determine how much was the
previous angle and at how much a
ngle we should make turn.

Resolution
:

~
7

~

CSE 5400

Artificial Intelligence and Robotics

To solve the above mentioned problem, we decided to redefine the algorithm
and we decided to develop a new strategy. The idea in the new algorithm was to
follow the wall by left side wall sensor of the I
-
create robot.

In this strategy we were
not bothering about the time and distance. We programmed the robot that will
follow the left hand side wall and by identifying the points it will map the path and
in this way robot will identify where it is while reaching to the d
estination.

B.

Demo
Two
:

Phase 1
:

Science
second floor’s

elevator and knocks on Roselyn’s

office door to pick up some
cookies and reach middle of the hall way without obstacle.

Phase 2:

Science second
floor’s eleva
tor and knocks on Roselyn
’s office door to pick up some cookies and
reach middle of the hall way with obstacle.

Pro
blem Faced
:

As mentioned, robot was following the lef
t hand side wall to search the path
and go through that. We have faced problems in that program

1.

The angle at which it will turn little bit in right side when it will touch the wall
was not working as intended it was going in wrong direction. It was worki
ng
good when it will take right turn but when it was trying to take the left turn
again to sense the wall it was not able to compensate the angle and due to that it
was going so much right that it was hitting the wall with the front bump and the
algorithm
was failing
.

Resolution:

To solve this particular problem we reduced the speed while turning. Due to
the reduced speed the robot was able to take sharp turn in specified directions. And
the problem was fixed up to a level. Though reduction in speed
sol
ved the problem
but still it was not a reliable solution it needed a

better solution which we figured it
out later.

~
8

~

CSE 5400

Artificial Intelligence and Robotics

C.

Demo
Three
:

The task for the Third demo was to Start from Computer

Science second floor’s
elevator and knocks on Roselyn
’s office door to

pick up some cookies and reach
Dr. Silaghi’s office

door
.

Problem Faced
:

At the time of the third demo there was lots of problem because there was a
new task as well as there was a new milestone, that mile stone was obstacle in the
path on which robot
will travel. There was issue regarding the angle of turning
which we have discussed. Due to this we have again refined the algorithm and coded
it accordingly to make it robust. All together the problems faced was as below,

1.

The new milestone of having obst
acle in the path was difficult to handle, because
for that we made so many changes in the algorithm, program flow as well as in
the code.

2.

Secondly as we were already aware of the problem of taking turn right and left
while following the wall. So at that ti
me it was very important to solve this
problem.

3.

There was a bug in the code.

Resolution:

1.

To solve the condition in which the robot will have the obstacle anywhere in the
path we took distance in the picture. We added logic in the following wall and
that
logic was to keep track of distance. We were aware of the thing that the
distance factor is not reliable. But by keeping track of minimum distance from
one point to another and adjusting that distance by adding some offset we
managed to have more reliable
applying that logic in the running condition. For that we have given the condition
that specifies that if the distance is less than the minimum and robot hits the
front bump, there is an obstacle, and if the
distance is greater than the minimum
distance then it is the point where the robot was intended to reach.

2.

Now the challenging task was to solve the problem of turning in right and left
while following the wall. Just reducing the speed it will not solve the

problem
because we was making robot to turn in specified angle. To solve this we added
code that will not specify the angle. After hitting the wall left wall sensor will be
activated so we specified minimum hit to the wall by left bump and if hit to the
l
eft wall by bump is greater than the minimum, it will stop, and it will turn in to
right direction until it will loses the contact to the wall and the left bump. And it
will go forward with some degree angle to the left side to find the wall again.

3.

After

doing lots of run we came to know that the bug due to one unnecessary call
to a function and after removing that function call the problem was solved.

~
9

~

CSE 5400

Artificial Intelligence and Robotics

D.

Demo
Four
:

In final Demo the task was to
start

from Computer

Science second floor’s
elevator and knocks on Roselyn
’s office door to pick up some cookies and reach
Dr. Silaghi’s office door and then final reached Dr.
Stansifer’s

office door
.

Problem Faced
:

At the time of final demo the task was more difficult
because there were 3
obstacles in the path. But actually that was not the problem in our case because at
first time when the obstacle was introduced, we developed the code that can
overcome as many as obstacle in the path a
nd anywhere in the path. So the
p
roblems

faced this time where

as follows

1.

We got one problem which we never got before, and that was, when it was
hitting the front bump to the wall while detecting the wall it was intended to
stop and turn parallel to the wall in right direction. But what

was happening, it
was stopping after hitting the wall and after that instead of taking right turn to
be parallel to the wall, it was taking turn in some weird direction. In this case it
was also difficult to find out what exactly is going wrong because th
is kind of
thing was never happened.
We found this same problem at three different
places.

2.

Another problem was a normal problem with the calculation of covered distance.
It was a simple error so we fixed it immediately as we found it.

3.

Moreover, we found th
at at one place it was detecting as reached to the door but
it was not at the door. That was also a normal problem which was very easy to
figure it out and solve it.

Resolution:

1.

After so much work we actually figu
re it out that why the problem
was occurri
ng
though it was not

regularly
. So the problem was, after hitting the wall the robot
was not able to reset the sensors and it was not compensating from the effect.
Due to that the angle of turning was getting massed up. To solve this we have
simply applied

some logic where after hitting the wall it will stop for some time
and go little bit reveres to compensate the sensors and the angles. In this way
the problem was solved and worked very well without any error or any
uncertain results.

2.

We have just recalcu
lated the approximate distance and putted it down in the
code and the problem was solved immediately.

~
10

~

CSE 5400

Artificial Intelligence and Robotics

3.

This problem is almost same as previous problem so its solution was also same
.
So we fixed it up very quickly.

IV.

Important Factor for Future Work

The
ICreate

robot can be programmed in very efficient manner using the sensors it
has. But for the future work we have to keep in mid following factors.

1.

Behavior of the robot depends on the battery level of the robot (but it is not a big
problem in this case
behavior will be changed negligible).

2.

It is also dependent on the computer system you use. Because in each and every
computers the computational time is different. So our suggestion is to use same laptop if
possible because it affects a lot in robot behavi
or.

3.

Sensors in
ICreate

robot do not give the value as just 0 and 1 or say true or false.
It provides a range of signals like 0, 1, 2, 3, 4, 5…

4.

It is also possible that it will give different reading of sensor at same place,
because it depends on the batter
y level.