handybug robot
DESCRIPTION
TRANSCRIPT
Robot 0711
Aaron Truitt, Reyna Monrreal, and Pengcheng ZhaiProfessor Oruklu – TA Linjie Li - ECE 100-004
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 Monrreal
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 Monrreal
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 problem of exiting thought the entrance.
Reyna Monrreal
forward
left touch?
recent? 5 times?yesyes
left avoid left avoid
reset timer reset timer
bump=1 incr.bump
random avoid
reset timer
bump=0
yes
right touch?
no
recent? 5 times?
right avoid right avoid
yes yes yes
random avoid
reset timerreset timer reset timer
bump=1 bump=0incr, bump
while( 1)Alternative Solution random.ic
Pengcheng Zhai
forward
left touch?
recent? 3 times?yesyes
left avoid left avoid
reset timer reset timer
bump=1 incr.bump
reset timer
bump=0
yes
right touch?
no
recent? 3 times?
right avoid right avoid
yes yes yes
turnaround towards left
reset timerreset timer reset timer
bump=1 bump=0incr, bump
while( 1)
turnaround towards right
Alternative Solution turnaround.ic
Pengcheng Zhai
• different floating numbersvoid left_avoid() { backward();
sleep(.4); right(); sleep(.4);}void right_avoid() { backward(); sleep(.4); left(); sleep(.4);
void left_avoid() { backward(); sleep(.15); right();
sleep(.15);}void right_avoid() { backward(); sleep(.15); left();
sleep(.15);
0.4 second turning sleep time approximately 150º angles turn
0.15 second turning sleep time approximately 45º angles turn
Optimum solution
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();
Vs.
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; } } }}
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
3 times bumps less than 2 second;100% chance to turnaround after 3 bumps.
• Main method
Pengcheng Zhai
Optimization in Construction
• Lowered center of gravity
• Structural stability• 1:1 Gear Ratio• Extended bumpers
Aaron Truitt
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
FINAL EVALUATION
• Best Solution For Your Business.
• Our Design team has more ideas to come!
void right_avoid() { backward(); sleep(.15); left(); sleep(.15);}void main(){ int recent_bumps=0; reset_timer(); while(1) {forward(); 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; } } }}
int LEFT_MOTOR= 1;int RIGHT_MOTOR= 3;
void forward(){ fd(LEFT_MOTOR); fd(RIGHT_MOTOR);}
void backward(){ bk(LEFT_MOTOR); bk(RIGHT_MOTOR);}
void right(){ fd(LEFT_MOTOR); bk(RIGHT_MOTOR);}
void left(){ bk(LEFT_MOTOR); fd(RIGHT_MOTOR);}void stop(){ off(LEFT_MOTOR); off(RIGHT_MOTOR);}
int LEGHT_TOUCH= 10;int RIGHT_TOUCH= 11;float _timer;void reset_timer() { _timer= seconds();}
float timer() { return seconds() - _timer;}
}
void left_avoid() { backward(); sleep(.15); right(); sleep(.15);}