Professional Documents
Culture Documents
BE 1200
Shreya Sutariya
Jonathon Khang
Jiwanjot Singh-Gill
Team 6 BE 1200 2
not stable enough for the task, and also involved too many parts. We then
used the Express Bot design for our base. We found this conserved some
parts, and separated the ramp from the forklift arm, to make for a better flow
during the task. We added two big and two small wheels turned sideways to
act as a rolling bumper. As the bot was moving randomly, if it hit a wall
without triggering the touch sensor right away, these wheels would guide it
along the wall, either turning it or triggering the sensor. This design proved
very efficient and reliable.
2. Sometimes white ball would get trapped in the space beneath the forklift
arm, or the lone touch sensor at the back would not help guide the bot away
from the wall, as it was still further away. In order to solve this problem, we
attached a larger piece from the bar on the touch sensor, underneath the
forklift arm, attaching to the other side of the bot. This helped by both
ensuring a ball didnt get trapped, and by created a pseudo-bumper
underneath the forklift. This way, if the fork-lift hit a wall and moved back far
enough, while the touch sensor hadnt, it would still trigger the touch sensor,
causing the bot to turn around.
Model Design:
Team 6 BE 1200 3
Team 6 BE 1200 4
Performance
Parameters
Success Refinements
Rate
Retest
Rate
Navigate
50%
100%
Green ball
detection and
ejection
100%
60%
Added dynamic
color detection
100%
90%
90%
Added commands to
move the bot
backward for half a
second.
50%
50%
Decreased range of
threshold values for
the white balls.
100%
60%
Added dynamic
color detection
100%
Back up to the
1
edge of the arena
before ejecting
white ball
Bot immediately
ejects the white ball
instead of going to
the edge of the
arena.
0%
100%
Avoid arenas
edge
0%
Replaced if
statement about
touch sensor with an
until statement.
0%
White ball
detection and
ejection
Team 6 BE 1200 5
0%
Changed fork_lift
function into a task
30%
30%
Implementation Plan:
In this final project design, there were a few unexpected complications with
the overall design with the robot. The use of sounds and tones were a large aid in
determining what part of the program was working correctly and inaccurately.
1. With this project, the objective is to construct a robot that can navigate its
way throughout the arena autonomously and while navigating, be able to
differentiate between green and white ping pong balls while placing the white
ping pong balls outside of the arena. The first step is to construct the base
design of the robot as Express Bot. From there, we built a ramp that is high
enough to place a white ping pong ball outside of the arena and we also
added a third motor for a motorized fork lift arm. We then install three
sensors, two touch sensors and one light sensor. One touch sensor on the
rear end, one touch sensor on the front end, the light sensor behind the fork
lift on the front end. We also add two large wheels of the front end of the
robot on each side. This will prevent any major damage or collision to the
robot itself and also assist with the robot maneuvering around the arena walls
more efficiently. Now, its time for programming!
2. First thing first, we want to write a task for the robot to navigate around the
arena at random amounts of time. We create a task called navigate that
can have the robot move forwards, backwards, and only turn counter
clockwise. To determine the random movements, instead of using a specified
wait time, we write Wait(Random(*Some number*)). With this, the robot will
move accordingly to its command at a random time from one to the specified
number minus one. For example, if the number is 1000, the robot will
randomly move at a time between 1 and 999.
3. Next, we need to write a task for when the light sensor detects the ball.
Instead of a task, we want this part of the program to consistently be running,
but only when a ball is detected. First, we have to write a subroutine function
to dynamically determine the threshold value of the white ball. We name this
subroutine setup and within this, the threshold value of the white ball can
be defined. We also have to define or set a minimum and maximum threshold
value for the green ball.
Team 6 BE 1200 6
4. Write another subroutine, called fork lift, for when to command the fork lift
arm when the light sensor detects a white ball. In a while true statement, if
the white ball is detected, we want the robot to stop task navigate and move
backwards with the motors in sync until the rear touch sensor is pressed. At
that same moment when the touch sensor is tripped, we want the motors to
stop and the fork lift arm to lift the white ball up onto the ramp, where it will
fall out of the arena. After the white ball is placed outside of the arena, the
robot will start task navigate again.
5. Within the subroutine fork lift, we want the green ball to be ejected out of the
fork lift arm contraption. To do that, we write if the green ball is detected,
stop task navigate, command the robot will move backwards, forwards, and
backwards again, causing a jerk movement to occur. This command will
cause the green ball to leave the fork lift arm and begin task navigate again.
6. The last command we need is for the robot to back up a certain amount of
distance when the front end touch sensor is pressed. In order to accomplish
this, write an if statement stating that if the front touch sensor is pressed, to
stop task navigate, and move backwards while in sync at a specified wait
time. Within each of these if statements, the use of sounds are very helpful
when determining the thresholds of each colored ball, when the touch
sensors are pressed, and when the robot is doing certain commands overall.
7. Last but not least, we have to set up a main task. Inside the main task, we set
up all of our sensors. Add the subroutine set up so it will initiate as soon as
the program starts. Then add a start command, initiating the navigate task
and add the subroutine fork lift so it will always be running throughout the
program since it is in a while true statement.
8. Now with all of the programming finished, test out the robot and record any
results you might notice. Make any necessary changes if needed. If all is
correct, congratulations! Youve finished the assignment!
Debugging Procedures:
1. One problem we had is that the light sensor would not differentiate clearly
between green or white ping pong balls. In order to fix this issue, we
changed the program to eliminate anything involved with green. In other
words, the bot would not do anything if it sensed green. During a trial run,
this proved problematic because it loaded a green ball on, didnt do
anything, and prevented white balls from getting loaded on. In order to
avoid this problem, we decided on using fixed variables for green, and
dynamic variables for white. To prevent the accidental exit of the green
ball from the arena during the fling, which is meant to keep it in the
arena, we decided to create a code to jerk the robot when it loaded a
Team 6 BE 1200 7
green ball. Instead of using the forklift at all, we decided to move the bot
forward and reverse for a few seconds, expelling the green ball. This was
very successful as it would keep jerking until the green ball fell out.
2. There was also a slight design change that needed to occur for this jerk
to work. Originally there was a black bar at the front of the forklift,
trapping the loaded ball on. After the jerk idea was thought of, we
replaced this single black bar, with two shorter grey bars. These would still
serve the purpose of holding the ball in place while loaded, but had
enough of a gap between them to allow a ball to escape if jerked.
4. When backing up while a white ball is detected, there was a slight issue of
when the rear touch sensor will be pressed. Sometimes it wouldnt be
pressed at all and that was because the piece that was held in the touch
sensor, to extend its capability, was too short. In order to avoid this kind of
complication again, we decided to replace the shorter piece with a much
longer piece, thus eliminating the problem of not being pressed when
needed.
Program Table:
Item
Description
Preprocessor Directives
Team 6 BE 1200 8
GREENMIN
conveniently
GREENMAX
conveniently
EYE
Global Variables
WHITE
Tasks
navigate ()
Functions
void setup()
void fork_lift()
Program Code:
#define GREENMIN 32
#define GREENMAX 36
#define EYE SENSOR_2
Team 6 BE 1200 9
int WHITE;
void setup()
{
WHITE = EYE;
PlaySound(SOUND_UP);
Wait(2000);
PlaySound(SOUND_DOUBLE_BEEP);
Wait(2000);
}
task navigate()
{
while(true)
{
OnRev(OUT_AC, 73);
Wait (Random(3200));
OnFwd(OUT_C, 63);
Wait (Random (1500));
OnFwd (OUT_AC,73);
Wait (Random(3200));
Team 6 BE 1200 10
OnRev(OUT_A, 63);
Wait(Random (1500));
}
}
void fork_lift()
{
while(true)
{
if(EYE >= WHITE) //((EYE <= WHITEMAX) && (EYE >= WHITEMIN))
{
StopTask(navigate);
PlaySound(SOUND_DOUBLE_BEEP);
OnFwdSync(OUT_AC, 50, 0);
until(SENSOR_3 == 1);
{
PlaySound(SOUND_UP);
Off(OUT_AC);
Wait(1000);
RotateMotor(OUT_B, 23, -135);
Wait(100);
RotateMotor(OUT_B, 43, 135);
StartTask(navigate);
Team 6 BE 1200 11
}
}
else if((EYE < GREENMAX) && (EYE > GREENMIN))
{
StopTask(navigate);
PlayTone(1000, 40);
OnFwdSync(OUT_AC, 80, 0);
Wait(200);
OnRevSync(OUT_AC, 80, 0);
Wait(200);
OnFwdSync(OUT_AC, 80, 0);
Wait(500);
StartTask(navigate);
}
else if(SENSOR_1 == 1)
{
StopTask(navigate);
PlayTone(1000,1000);
OnFwd(OUT_AC, 50);
Wait(1000);
OnFwd(OUT_A, 50);
Wait(600);
Team 6 BE 1200 12
StartTask(navigate);
}
}
}
task main()
{
SetSensorLight(IN_2);
SetSensorTouch(IN_1);
SetSensorTouch(IN_3);
setup();
StartTask(navigate);
fork_lift();
}