1. Aaron Truitt, Reyna Monrreal, and Pengcheng Zhai
Professor Oruklu – TA Linjie Li - ECE 100-004
2. PROBLEM STATEMENT:
The objective is to program a robot using Handy board/
interactive C in order to go through a maze in a quick and
efficient manner . The maze is unknown so the
timing, speed, and interactive C code will be the variables
we are allowed to control & aid the robot into the
undisclosed maze.
Reyna
3. INVESTIGATION/ RESEARCH:
Handy bugs are small robots that can be manipulated to do a series of
functions. They allow us to program them to the tenth of a second or to a
random program (where we put it in the code to do a random operation).
This will make to “turtle” move around the maze and with each mistake or
flaw noticed we can quickly make adjustments without dismantling the
whole robot. Getting the robot to have good maneuvering skills in order
to win the race is a process of constant trial and error.
With each modification we get we have to change certain aspects of the
small robot to accommodate for those changes. A situation that came
across was the moment when the robot hits a perfect right angle and it
continues to perform as programmed becoming further stuck.
One of the ways we dealt with this was using what is called a random in the
code. The random performed a large turn when it was enabled. Enabled
after 3-4 bumps on the right angle it made a complete turn so as to get
unstuck (an emergence (Martin 2001).
Reyna
4. CONSTRAINTS & SUB-PROBLEMS
The speed prevents the handy bug from making good turns. The speed was
a good idea in theory, the time to cross the maze would be less and the
program gave less time for turns (Sleep.9) so the angle became less
when it turned and it would be first to finish. Metasens4.ic
A small issue that constantly came up would be the installing of the cables
into the ports, if they were in backwards our wheels would go to
opposite way and affected the robots ability to escape emergence(going
back and forth on a corner)
When the test was conducted to prove the efficiency of the handy bug, it u
fortunately came out of the entrance. This was believed it was due to
probability. However the robot turned at an angle that was too wide for
it to bump against the wall in order to continent going forward.
A shorter angle was programmed and as the handy bug hit the wall it went
backwards rested for a fraction of a second and made a smaller turn
angle. This again prevented it from going out of the entrance.
The programming however still needed less time due to the consistent
Reyna
problem of exiting thought the entrance.
5. Alternative Solution random.ic
forward
while(1)
left touch?
yes
yes
recent?
yes
5 times?
no
left avoid
left avoid
random avoid
reset timer
yes
reset timer
bump=1
right
touch?
reset timer
incr.bump
bump=0
recent?
yes
yes
5 times?
right avoid
right avoid
random avoid
reset timer
reset timer
reset timer
bump=1
incr, bump
bump=0
Pengcheng Zhai
6. forward
Alternative Solution turnaround.ic
while(1)
left touch?
yes
yes
recent?
yes
3 times?
no
left avoid
left avoid
turnaround towards right
reset timer
yes
reset timer
bump=1
right
touch?
reset timer
incr.bump
bump=0
recent?
yes
yes
3 times?
right avoid
right avoid
reset timer
reset timer
bump=1
incr, bump
turnaround towards left
reset timer
bump=0
Pengcheng Zhai
7. Optimum solution
• different floating numbers
void left_avoid() { backward();
sleep(.4); right(); sleep(.4);}void
right_avoid() { backward(); sleep(.4);
left(); sleep(.4);
0.4 second turning sleep time approximately 150º
angles turn
void left_avoid() { backward();
sleep(.15); right(); sleep(.15);}void
right_avoid() { backward(); sleep(.15);
left(); sleep(.15);
Vs.
0.15 second turning sleep time approximately
45º angles turn
• Main method
void random_avoid() {
backward(); sleep(.4);
set_beeper_pitch(1000.);
beeper_on(); if (random(2) ==
0 ) left(); else right();
sleep((float) random(100)/100. +
.5); beeper_off();
undeclared direction
while(1)
{forward();
if
(digital(10) )
{if (timer()< 2.)
{if (recent_bumps ==5)
{random_avoid();
reset_timer();
recent_bumps= 0;
5 times bumps and less than 2
seconds
void main(){ int recent_bumps=0; reset_timer();
if (digital(10) )
{if (timer()< 2.)
{if
(recent_bumps ==3)
{right();
sleep(.3);
reset_timer();
recent_bumps= 0;
}
else
{left_avoid();
reset_timer();
recent_bumps++;
}
}
else {
left_avoid();
reset_timer();
recent_bumps= 1;
}
}
if
(digital(RIGHT_TOUCH) )
{if (timer()< 2.)
{if (recent_bumps ==3)
{left();
sleep(.3);
reset_timer();
recent_bumps= 0;
}
else
{right_avoid();
reset_timer();
recent_bumps++;
}
}
else
{right_avoid();
reset_timer();
recent_bumps=1;
}
} }}
3 times bumps less than 2 second;
100% chance to turnaround after 3 bumps.
Pengcheng Zhai
9. ANALYSIS AND TESTING
• Tested in maze scenarios.
• Steady results and reliable outcomes
• Average time of 56.7 seconds in lab tests per
maze completion.
• Durability
Aaron Truitt