Artificial Intelligence and Robotics

advertisement
~1~
Artificial Intelligence and
Robotics
iRobot Create
Jose D. Garcia
Gopal Jani
CSE 5400 – Artificial Intelligence and Robotics
Amit Ramani
~2~
Table of Contents
I.
Introduction ........................................................................................................................... 3
A. Objective.............................................................................................................................. 3
B. Equipment and Software Installation ............................................................................... 4
C. Downloading your code to the iCreate Robot .................................................................. 5
II.
ICreate Robot Algorithm ....................................................................................................... 6
III.
ICreate Robot Demos ......................................................................................................... 6
A. Demo 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-A to Serial Cable (RadioShack)……………………………….5
CSE 5400 – Artificial Intelligence and Robotics
~3~
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
tasks:




First, the robot traverses from the Computer Science second floor’s
elevator and knocks on Rosely’s office door to pick up some cookies.
Second, the robot then attempts to knock on Dr. Silaghi’s door to let
him know the cookies has been picked up.
Third, the robot then attempts to deliver the cookies to the final
destination which is Dr. Stansifer’s office door.
Finally, the robot needed to do the first three tasks 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
CSE 5400 – Artificial Intelligence and Robotics
~4~
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 algorithm 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
package programmed in python, available for download from Dr. Zachary
Dodds’s personal website, provides all the interfaces needed to control the
robot’s actuator and as well as access to its entire sensor’s data.
CSE 5400 – Artificial Intelligence and Robotics
~5~
To set up your system to run our source code on the iCreate robot, you need
to do the following:




Install Python 2.4 - (Download Here)
Install PySerial for Windows – (Download Here)
Install Win32All for Python 2.4 – (Download here)
Install Create Package (Download Here)
Once you have installed the files above, you are ready to download our code
(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-Serial cable from RadioShack for $39.99. You can buy a
cheaper one online for about less than half of that price. Here is a link to the
cable our team used for the project (USB-to-Serial Cable).
Figure 3-Gigaware® 6-ft. USB-A to Serial Cable (RadioShack)
C.
Downloading your code to the iCreate Robot
To download you code to the 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:
CSE 5400 – Artificial Intelligence and Robotics
~6~
o
o
o
o
o
Type “ import Create ”
Type “ from Create import* ”
Type “ import nameofpackage ”
Type “ from nameofpackage import* ”
Type “ 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:
The task assign in first demo was to Start from Computer 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 point 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 battery 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 angle we should make turn.
Resolution:
CSE 5400 – Artificial Intelligence and Robotics
~7~
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 destination.
B. Demo Two:
Phase 1:
The task assign in Phase 1 of second 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 middle of the hall way without obstacle.
Phase 2:
The task assign in second 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 middle of the hall way with obstacle.
Problem Faced:
As mentioned, robot was following the left 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 working
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 solved the problem
but still it was not a reliable solution it needed a better solution which we figured it
out later.
CSE 5400 – Artificial Intelligence and Robotics
~8~
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 obstacle 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 time 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 reading of distance. After that the task was to
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
left 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.
CSE 5400 – Artificial Intelligence and Robotics
~9~
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 and anywhere in the path. So the
problems 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 this 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 that 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 figure it out that why the problem was occurring
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 recalculated the approximate distance and putted it down in the
code and the problem was solved immediately.
CSE 5400 – Artificial Intelligence and Robotics
~ 10 ~
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 behavior.
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 battery level.
CSE 5400 – Artificial Intelligence and Robotics
Download