Professional Documents
Culture Documents
Be 1200 Final Report
Be 1200 Final Report
Be 1200 Final Report
Fadi Basheer
John Heinonen
Chirs Mann
BE 1200 Prof. Gina Shreve
Final Report
1. Clarify Objectives
Robot must be able to find wall using touch sensor and throw green ball
out of arena
5. Establish Design Specifications
NXT brick
Three lego motors
One light sensor
One touch sensor with a release type bumper
One ultrasonic sensor
Two wheels
One small track wheel
Various other small parts from Lego Mindstorms set
We used a similar design to the original tri-bot design that we built during
the first couple days of class. However, we added a third motor to the top
of the robot. This motor controls an arm which receives instructions from
the NXT Brick to either keep a white ball or throw a green ball out of the
arena. To the arm, a light sensor was attached to allow the robot to identify
the color of any ball it picks up. Also on the front of the robot, an ultrasonic
sensor allows the robot to read the wall of the arena so that it can reverse
and change direction. We added a touch sensor with a release type
bumper to the back of thero bot to detect the wall of the arena. It is used in
the task identify_ball. Once a green ball is picked up and identified, the
robot reverses until it detects the wall of the arena. At that point, the throw
arm is activated and the green ball is thrown out of the arena. We used
the release type bumper because our group decided that it seemed like
the more consistent way to trigger the touch sensor.
6. Generate Alternatives
Our group discussed either using another touch sensor on the front of
the robot to identify the wall instead of using the ultrasonic sensor. This
would have caused problems if the robot did not hit the wall squarely.
Also, we considered using a press setup instead of a release-type
setup for the touch sensor on the rear of the robot. This would have
yielded a simpler design, but would not have been as effective.
7. Modeling
We built our robot around the same general tri-bot concept that has been
used all semester, since it is simple and effective. Certain changes were required
since the task is so much different than any previous assignments, but the tri-bot
concept worked well.
Program Table:
#define WHITE
as 46
Tasks
task drive ()
This tasks commands the robot to
drive around looking for balls, unless it
gets too close to the wall.
OnFwd(OUT_AC, 75)
This commands the robot to drive
forward at 75% power unless the
conditions in the following while
(true) are met.
while (true){
This tells the robot that if the
if SensorUS(IN_3) <13
Ultrasonic Sensor (in input 3,) reads a
value less than 13, it should perform
the following lines of code.
Off(OUT_AC)
If the Ultrasonic sensor reads a value
less than 13; first, the motors shut off.
OnRev(OUT_AC, 75)
Then the robot reverses at 75%
power.
Wait(800)
The robot performs the proceeding
line of code for 800 milliseconds
OnFwd(OUT_A, 100)
This turns the robot to the left.
task identify_ball ()
This task commands the robot to use
the light sensor to identify both green
and white balls.
if (SENSOR_2 > 32 ,, SENSOR_2 <
This tells the robot that if it reads a
43);
value between 32 and 43 (which is a
Wait(50);
green ball) with the Light Sensor
if (SENSOR_2 > 32 ,, SENSOR_2 <
(Input 2) that it should wait 50
43);
milliseconds and read it again.
StopTask (drive)
This command makes the robot stop
performing task drive and makes the
robot perform the following lines of
code.
OnRev(OUT_AC, 50);
This tells the robot to back up at 50%
until (SENSOR_4 == 0)
power until our release type touch
sensor (Input 4) is bumped by the
wall.
OnRev(OUT_B, 100);
This commands the robot to move the
Wait(250)
motor plugged into output B (which is
the arm that ejects the balls) to move
in reverse for 250 milliseconds to
throw the ball.
Off(OUT_B);
These lines of code turn off our
Wait(50);
throwing arm, and then move it
OnFwd(OUT_B, 100); Wait(250)
forward back down to the ground.
Pictures:
Video:
The video will be posted on the website.
Refine and Optimize Design:
While constructing the robot, there was few changes that had to be made;
however, the biggest change had to be moving the ultrasonic sensor lower on the robot.
We had issues with it not detecting the wall of the arena, since the wall is so short.
When the ultrasonic sensor was moved lower, it made the detection of the barrier a lot
easier than before. Another problem we encountered in developing the robot was the
throw arm. Since we had never dealt with three motors before, we had difficulty in the
actual mechanical structure being strong enough. When the robot would hit the wall, the
throw arm would get knocked sideways. By squaring up the throw arm, the force
generated by the wall could no longer push the arm sideways, and the arm can stand
repeated bumps into the wall of the arena.
Advanced Strategies:
The main advanced strategy that was used for this robot was using the ultrasonic
sensor. Even though it was used by many students, it was a difficult sensor to use
since there was not a lot of knowledge about it. After reading the NXT tutorial, it was
easier to get an idea of how it needed to be programmed. Ultimately, it was the main
reason why the robot was able to successfully navigate the arena and find ping pong
balls. To go along with the ultrasonic sensor, the light sensor values that were used
helped the robot separate the green from the white balls. These differences in the
reflective light value allowed the robot to be successful.
Data Table:
1
Changes
The wait time on
multiple OnRev
and OnFwd codes.
Adjusting the
values of light
sensor on the
robot to get it to
detect different
colored balls.
New Result
During multiple parts of the project, changing the wait time
allowed the robots to act on different functions during
appropriate times. This allowed the robot to turn around in
different ways to grab different colored balls.
By changing the values on the light sensor, the robot was
able to detect different colored balls and separate them
from others. The values allowed the light sensor to be
more accurate as it was reading the values.
Placing the
ultrasonic sensor
higher on the
robot.
Changing the
distance the robot
detects the wall.
Adding on a
StopTask function
to get the robot to
stop immediately
at different points.
Adding a flat
surface on top of
the robot.
Flowchart:
Program Code:
#define WHITE 46
OnFwd(OUT_AC, 75);
while (true) {
if( SensorUS(IN_3) < 13)
{
Off(OUT_AC);
OnRev(OUT_AC, 75);
Wait(800);
Off(OUT_AC);
OnFwd(OUT_A, 100);
Wait(1500);
Off(OUT_A);
}
else
{
OnFwd(OUT_AC, 75);
}
}
}
task identify_ball()
while(true)
{
if(SENSOR_2 > 32 && SENSOR_2 < 43)
{
Wait(50);
if(SENSOR_2 > 32 && SENSOR_2 < 43)
{
StopTask(drive);
OnRev(OUT_AC, 50);
until(SENSOR_4 == 0);
Off(OUT_AC);
OnRev(OUT_B, 100);
Wait(250);
Off(OUT_B);
Wait(50);
OnFwd(OUT_B, 100);
Wait(250);
Off(OUT_B);
StartTask(drive);
}
}
if (SENSOR_2 > 46)
{
Wait(50);
if(SENSOR_2 > 46){
StopTask(drive);
OnRev(OUT_B, 100);
Wait(250);
Off(OUT_B);
Wait(50);
OnFwd(OUT_B, 100);
Wait(250);
Off(OUT_B);
StartTask(drive);
}
}
}
}
task main()
{
SetSensorTouch (IN_4);
SetSensorLowspeed(IN_3);
SetSensorLight(IN_2);
start identify_ball;
start drive;
}