midterm report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/midtermreport.docx · web...

30

Upload: phamthien

Post on 29-Aug-2019

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination
Page 2: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

Midterm Report.1.Clarify Objectives

For this project we needed our robot to follow a line without

straying from the line at all. Also, the robot needed to

recognize, go around an object twice and find the line again.

Lastly, we needed the robot to play a sound once it reached the

green square and start the process over again, but this time when

the green square is reached the robot will stop on the green

square and play a sound.

2.Establish User Requirements

The robot needed to follow a 1” thick black line of tape. The

course is a circular loop with green on one green square and red

obstacle within the track. The red obstacle is located on the

opposite side of the starting point for the robot. The robot has

to follow the track in a clockwise direction and the robot starts

in front of the square. While the robot follows the tape, it

needs to recognize a (height) tall object and use a rotation

Start Point(CLockwise direction)

Page 3: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

sensor to maneuver around the circumference of the object twice,

while staying within a car length of the object. Then, the robot

needs to find the line that starts on the opposite side of the

object. Next, the robot needs to go past a 4” x 6” green square

and continue around once more, completing the tasks that were

stated earlier in this paragraph. When the green square is

reached again, the robot needs to stop on the green square and

play a sound.

3.Identify Constraints

Before starting our project, we had only one constraint and

that was the combination of sensors we would use for project. In

the beginning, we wanted to use two light sensors for line

following, one light sensor for proximity (is this the correct

word for what I’m talking about?), and a rotation sensor for

maneuvering around the wall. We did not have enough input ports

for this combination of sensors, and from our knowledge of

stacking sensors, there was no combination of stacking the

sensors that would allow us to use each sensor. The second

constraint was that the left turns made with the tape were too

sharp, and our robot could not keep up with the rapid changes in

the readings of the light sensor. The robot not recognizing that

the light sensor was over the black was a result of this problem,

and the robot would go off.

4.Establish Functions

For this project, the robot has four function; line following,

detecting and going around the object , recognizing the green

Page 4: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

square, realigning after the green square has been recognized,

and realigning the light sensors to repeat the line following

process.

The first function keeps the robot centered on the black line,

and is used for finding the line after the robot has gone around

the object twice. This function uses two light sensors, which

communicates, to the program, the robots direction of motion in

relation to the black line. This allows the program to correct

the motion of the robot so that the robot’s motion is parallel

with the black line. Also, this same method of keeping the

robot, works for finding the line after going around the object.

Once the robot goes around the object the robot it refers back to

this function, and the robot keeps turning to the left until the

right sensor touches the line.

The second function detects the object and goes around the

object twice. This function detects the object, puts the robot

in a position for going around the object, and then the goes

around the object. The function needs to put the robot in a

position for going around the object, because, initially, the

robot is facing the object and needs to be moved so that it is at

an angle in which the robot can begin going forward to go around

the object. This function uses a touch sensor ,for detecting the

object, and a rotation sensor, for identifying where the robot is

in relation to the object and keeping the robot close to the

object as it goes around.

The third function detects the green square, and, also,

signifies the end of the program. This function uses the two

light sensors used for the line following function. The two light

sensors give the program a certain value for the green square,

Page 5: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

and this value lets the program know that the robot is over the

green square.

5.Establish Design Specifications

The basic build of our robot is Tankbot, but we have added a

few pieces for the function of the sensors to be most

effective. First, we built Tankbot. We connected two pairs of

15x1 beams together by using four friction pegs. Then, we

connected the ends of the paired beams with two 2x8 Technic

plates, then we inserted two sets of eight peg length(8pls)

axles half way into the front and back of the paired 15x1

beams, and put spacers on them to keep them in place. We put

another 2x8 technic plate on the top rear of the 15x1 beams.

Next, we put a 24-tooth on the rear axles, which mesh with the

gears on the motors. Placed another 2x8 technic plate in front

of the previous placed technic place of equal size. Then, we

put a two 2x4 technic plate on top of either side of the two

2x8 technic plates. Next, we inserted a 4x1 beam to the back

of the front. Afterwards, we mounted two motors,

symmetrically, onto the technic plates. The motors’ 24-tooth

gear meshed with the 24-gear below it. For the last part of

the tankbot, we mounted the RCX in front of the motors, and

then and then connected the RCX to the frame using four 6x1

beams and four friction pegs. Now, we had to build the sensor

structures. First, we started on the structure for the light

sensors, because we were used this structure for our line-

following quiz. We placed a 90-degree 2x2 plate onto the two

front, center pegs of the RCX brick. After, we placed the

center of a 12x6 technic brick on the 90-degree 2x2 plate with

the pegs facing inward. At each end of the 12x6 plate we

Page 6: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

placed a light sensor with the light on the bottom edge of the

plate, in order to get the light sensors as close to the

ground as possible. Next, we created our structure for the

touch sensor. We mounted a 2x6 technic plate on top of one 2x2

sensor brick and a 90-degree 2x2 plate. The 2x2 sensor plate

will go onto an input block, and will serve as the right

sensor input. Then, we centered a 2x8 technic plate on top of

the 2x6 technic plate. We put a 1x2 hole connector at the

front and center of the 2x6 technic plate, and the touch

sensor on the rear. The two 1x2 hole connectors will be used

to keep the axle, which will be pushed back into the light

sensor when it hits an object. When we place the axle into the

front hole connector we insert a spacer to keep the axle from

sliding out. To finish the structure we put a 40-tooth on the

end of the axle. For the rotation sensor structure we put two

2x4 technic plates on the right motor, then we connected to

1x8 beams with two friction pegs. We put these two beams on

its side onto the technic plates and plates 5 friction pegs in

various places on top of the top side of the beam. Next, we

put a rotation sensor on the right side of the two beams, and

place an axle inside the beam with a spacer arm on the top

side of the axle and a spacer on the other. We place a axle in

the arm with a blue spacer arm on the outside, with a friction

peg in the other arm. Next, we place a blue rubber band around

the friction pegs that were placed on the topside of the beam

with the friction peg from the rotation sensor inside of the

rubber band.

6.Generate Alternatives

Page 7: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

Finding a design that was suitable for the completion of the

user requirements was an easy task. We did not spend much time

coming up with a design. We only created one design before

finding our final design. This design consisted of one light

sensor for proximity, two light sensors for line following, and a

rotation sensor for maneuvering around the obstacle. As stated

above this combination of sensors did not work, because there was

no way to use these sensors together. Even though we had to come

up with a different combination of sensors, we still had to use

the rotation sensor for going around the object, due to the user

requirements. Before building a new design, we needed to know how

we were going to use the rotation sensor to go around the object.

First, we came up with a design that connected the rotation

sensor to the right motor using a 40 tooth gear( is the right

term for this gear). We called this configuration of the rotation

sensor the “gear style”. For the programming, the rotation sensor

to make the robot go around the red obstacle, we were going to

set the power of the inside gear to a lower power than the

outside gear, therefore, making the robot move in a circular

motion, but due to user requirements, which is the robot has to

make contact with the obstacle while going around the object, we

could not use the build of the rotation sensor. Then, we decided

to

7.Model or Analyze Design

For our program we used two light sensors, a touch sensor, and

a rotation sensor. We used global variables for all of our input

and output ports: REYE for the right light sensor, LEYE for the

left light sensor and touch sensor, ROTATOR for the rotation

sensor, LEFT for the left motor, and RIGHT for the right motor.

Page 8: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

For the left light and touch sensor we used one global variable,

because both of these sensors used the same port. Also, we used

global variables for the limits for the light sensors: RTOODARK,

LTOODARK, RGREEN, and LGREEN. RTOODARK and LTOODARK represent the

value for which the light sensor reads it is on black, which are

46 for both of these variables. RGREEN and LGREEN represent the

value for which the light sensor reads when it is on the green

square, which is 53 for both of these variables. The R and L at

the beginning of each variable means right light sensor for R and

left light sensor for L. Actually, the light sensors do not have

to equal the values of the variables, from above, when they come

across the black line or the green square. In the code, they are

used as upper limits in condition statements. For example, both

light sensors can read 52, and this reading still means that the

robot is on the green square, even though the value of LGREEN AND

RGREEN is set to 53.This happens often in the program, because

the is moving, and the light emitted from every spot on the track

is different. Also, we use a local variable, “black”, in one of

the three void statements. This basic use of this local variable

is to keep track of how many times the robot has gone around the

object and will be discussed in detail when explaining the

corresponding void function. Next, we used the void function for

each established function: drive(), collision(), extramovement().

All of the global variables and void functions defined outside of

task main(), in which they are called and put into effect. Due to

the order in which the functions are called the functions behave

in the order they are mention.

Drive() is used for line following and finding the line after

the robot has gone around the object. Drive() uses the until

statement, and this condition terminates when the touch sensor

Page 9: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

has been pressed, or when both light sensors read less than or

equal to LGREEN or RGREEN. When these conditions are not yet met,

the until statement runs a series of condition-based statements.

The first condition statement within the until statement is an if

statement. This starts when the right sensor (REYE) is less than

or equal to RTOODARK, and the robot will turn to the right until

the right sensor is not over the black line, which terminates

this condition. The next condition statement is an else if

statement, which starts when then left light sensor (LEYE) is

less than or equal to LTOODARK, and the robot will turn left

until the left sensor is not over the black. The last condition

statement is an else statement, which only runs if none of the

conditions of the if or else if statement are met. This statement

tells the robot to go forward. Lastly, if the condition of until

statement is met the robot breaks out of the until statement and

is instructed to stop. That is, when either the touch sensor or

when the robot is on the green square. After the robot stops, the

drive function terminates.

Next, the collision function is used to detect the object,

maneuver the robot around the object, and find the line after the

robot has gone around the object twice. This function starts

after the drive function when the touch sensor is pressed

(LEYE==100). A reading of 100 occurs, instead of 1 like a normal

touch sensor reading, because the sensor port is set for a light

sensor. This value was a benefit to us, because the light sensor

will never read 100 on this track, because it is only black,

grey, and white. Grey comes about when the instant when the light

sensor is half-way on black and white. After the light sensor is

pressed, the robot sets the local variable black to 0, sets the

power of both motors(LEFT and RIGHT) to 4. We did this so the

Page 10: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

robot could track of almost every rotation sensor reading, so

that the robot would not lose track of the object and stray away

from it. The robot waits 1 second, starts to turn left for .7

seconds, and turns off both motors. This turn is needed to

prepare the robot to start its voyage around the obstacle. Due to

the rotation sensor extruding from the body of the robot, we

needed the robot to turn enough to put the robot on a trajectory

that will allow the axle extruding from the rotation sensor to

make contact with the object, but not close enough for the

rotation sensor itself to touch the object, and possibly break

away from the robot. Next, the robot starts an until statement,

that runs until the rotation sensor equals one (ROTATOR==1). The

default reading of the rotation sensor’s position is zero. When

the robot goes forward the axle will be pushed backward, and the

readings of the rotation sensor will increase. When the rotation

sensor equals 1, the robot will break out of the until statement,

and will go into a second until statement, which terminates when

the local variable “black” equals 16. This condition statement

contains four condition statements. The first condition statement

is a if statement, which starts when the light sensor first

touches the black line. This statement is responsible for the

robot going around the object twice. Surprisingly, when the light

sensor comes across the black, the robot reads the value of the

black line more than once. The reasoning behind this finding will

be explained in the “Test and Evaluate Design” portion of this

document. When the left light sensor crosses the line, the robot

is instructed to increment the value of “black” one unit and play

a sound each time a value is read. Also, there is an if statement

after the first. This statement runs when the rotation sensor is

less than two, meaning the robot is still close to the object but

not too close. This statement tells the robot to turn right. The

Page 11: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

reason for this statement being an if statement too, is that we

need the two statements to run simultaneously. If the second

statement is an else if statement the incrementing will not occur

as the robot moves across the black line, the robot will just

stop. We did not test making of the statement an else if

statement, but in theory we thought this reasoning was sound.

After this function terminates, the robot will go onto an else if

statement that starts when the rotation sensor is greater than

zero. This statement keeps the robot from getting too close to

the object by telling the robot to turn left. This statement

terminates when the rotation sensor is less than 2. When none of

the conditions for the previous statements are met the program

runs an else statement that sets the power of the right motor to

six the left to eight, and tells the motor to go forward. If the

program does not read the value of the rotation sensor in enough

time the robot will still continue in a circular path until the

program can get the value of the rotation sensor. This statement

brings the robot closer to the object, making the value for the

rotation sensor higher than two and when the program reads the

rotation sensor the robot will run the else if statement. When

“black” equals 16 the robot will break out of the until loop and

the complete a series of tasks. First, the robot will stop for

half of a second, and then it will enter a until statement, that

terminates when the right sensor is over the black line. The

until statement will tell the robot to turn left, until the

terminating point. When the robot has reached the terminating

point of the until statement, the light sensors will be on either

side of the line and ready for line following. After this

statement is done, the robot waits a half of a second, sets the

value of “black” to 0, and breaks out of the collision function.

Now that the robot has found the line on the other side of the

Page 12: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

object the robot will go into back into the drive function due to

the configuration of task main(), which will be discussed later

in this section of the document.

Now, the robot will follow the line until it reaches the green

square, and drive will terminate do to its condition statement,

which is it runs until the light sensor read a value less than or

equal to the green value. For the right light sensor it is RGREEN

and for the left it is LGREEN.

Lastly, the robot will run a function called extra movements.

This function is needed, because the robot is not perfectly

aligned with the track to go around once more. In other words,

when the robot reaches the green square, it is not in position to

go straight, and have each light sensor on opposite sides of the

line. This happens because the robot might be in the middle of a

turn for correcting its position when it reaches the green

square, and the robot keeps forward on the green for a short

time, because the program does not recognize the light sensors

immediately. This amount of distance the robot needs make up to

be back aligning with the track is small. Due to the light

sensors having a relatively large amount of space between itself

and the edge of the line and the line on both sides of the and

the relatively small amount of disposition the robot has to make

up, we do not need to worry much about precision in realigning

the robot with the track. First, the program will set the power

of the motors to four, so that we can get a more accurate reading

for the time the robot has to wait for the robot turn, which .17

seconds. Next, the motors are shut off, the program waits for 1

second, the motors are turned back on, told go forward for .7

seconds, and, finally, are turned off again. There is no

Page 13: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

significance to turning off the motors the first in this last

line of tasks, and the off command is just used as another way of

telling the motors to stop. At the end of this function, the

robot’s sensors will be on white and ready to go around the track

once more.

The order of these functions are due to the calling of them in

task main(). In task main() the sensors are first set. Next, the

functions are put into order; first with drive, collision, drive,

and extra movement. Lastly, a repeat statement is used to make

this order repeat twice, making the robot go around the track

twice. After this repeat, the robot will turn off all motors,

ending the entire program.

Page 14: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

Flowchart

(4)

(2)

(2) (3)

task main()Set sensors(1)Start drive()(2)Start collision()(3)Start drive()(4)Start extramovementReapeat once more

Void drive()Until LEYE equals 100 or LEYE equals LGREEN and REYE equals RGREEN

if (REYE <= RTOODARK)o Turn right

else if(LEYE <= LTOODARK)o Turn left

elseo Go straight

Void collision()Set value of “black”= 0Set power of LEFT and RIGHT to 4Wait 1 secondTurn leftWait .7 secondsUntil rotation sensor=1

Go forwardUntil “black”=16

if LEYE less than LTOODARKo add one to the value

of “black”o play sound

if rotation sensor < 2 o set power of left to

0 and power of right to 8

o turn left if rotation sensor is less

than or equal to 2o set power of left to

8 and power of right to 0

o turn right else

o set power of left to 6 and power of right to 8

o make a rounded right turn

Wait .5 seconds Set the value of “black” to 0

Void extramovement()Set power of LEFT and RIGHT to 4Turn rightWait .17 secondsTurn off LEFT and RIGHTWait 1 secondGo forwardWait .7 secondsTurn off LEFT and RIGHT

Page 15: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

Tables for the Midterm Code

Task DescriptionMain() This task sets up the sensors,

and calls on the inline functions in this order: drive, collision, drive, and extra movements. Also, this task is responsible for making the robot go around the track twice by using a repeat command that encloses the calling of the inline functions.

Inline Functionsdrive() This inline function is

responsible for line-following. When one of the light sensors is over the black line, the robot is turned in the opposite direction and continues forward. This function ends when the touch sensor is pressed or when the light sensors are both over green.

collision() This inline function is responsible for detecting the object, and going around the object twice. When the object hits the light sensor it backs up and turns to the left a little, and goes forward until the object pushes the axle back a certain distance. Then, the robot begins to turn along the object, until the axle is pushed back too far and the object turns left to bring the axle near its original position. The robot counts how many times it has gone across the black and on the second revolution, the robot stops and sweeps until the robot is centered back on the track.

Page 16: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

extramovements() This task is used to realign the robot once it has reached the green square. The robot turns a little, and then moves forward, putting itself back on the track.

Global VariablesLTOODARK This is a fixed variable that is

used to represent the highest value the left light sensor will read when it is over the black line. This value is 46.

RTOODARK This is a fixed variable that is used to represent the highest value the right light sensor will read when it is over the black line. This value is 46.

LGREEN This is a fixed variable that is used to represent the highest value the left light sensor will read when it is over the green square. This value is 53.

RGREEN This is a fixed variable that is used to represent the highest value the right light sensor will read when it is over the green square. This value is 53.

Local VariablesDark dark tells the program when the

robot has gone twice around the track. Every time the left light sensor reads a value that is equal to or less than LTOODARK, dark is incremented one unit. When dark equals 16. The robot will start to look for the line, because 16 signifies that the robot has gone around the track twice.

NQC codes for the Midterm

#define LEYE SENSOR_1#define REYE SENSOR_2#define ROTATOR SENSOR_3

Page 17: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

#define LEFT OUT_A#define RIGHT OUT_C

#define RTOODARK 46#define RGREEN 53

#define LTOODARK 46#define LGREEN 53void drive(){    until(LEYE == 100 || (LEYE == LGREEN && REYE == RGREEN))    {        if (REYE <= RTOODARK)        {            SetPower(LEFT,8);            SetPower(RIGHT,0);            OnFwd(LEFT);            OnRev(RIGHT);        }        else if(LEYE <= LTOODARK)        {            SetPower(RIGHT,8);            SetPower(LEFT, 0);            OnFwd(RIGHT);            OnRev(LEFT);        }        else        {            SetPower(LEFT+RIGHT,1);            OnFwd(LEFT+RIGHT);        }    }    Off(LEFT+RIGHT);}void collision(){    int black = 0;    SetPower(LEFT+RIGHT, 4);

Page 18: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

    Wait(100);    OnRev(LEFT);    OnFwd(RIGHT);    Wait(95);    Off(LEFT+RIGHT);

    until(ROTATOR == 1)        OnFwd(LEFT+RIGHT);        until(black == 5)    {        if (LEYE < LTOODARK)        {            OnFwd(LEFT+RIGHT);            Wait(40);            Off(LEFT+RIGHT);            black += 1;            PlaySound(1);        }        if (ROTATOR < 2)        {            SetPower(LEFT,0);            SetPower(RIGHT,8);            OnFwd(RIGHT);            OnRev(LEFT);        }        else if (ROTATOR >= 2)        {            SetPower(LEFT,8);            SetPower(RIGHT,0);            OnFwd(LEFT);            OnRev(RIGHT);        }        else            SetPower(RIGHT, 6);            SetPower(LEFT, 8);            OnFwd(LEFT+RIGHT);    }

    OnRev(LEFT+RIGHT);    Wait(42);

Page 19: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

    Off(LEFT+RIGHT);    Wait(50);

    until(LEYE < LTOODARK)    {        SetPower(RIGHT, 2);        SetPower(LEFT, 1);        Off(LEFT);        OnFwd(RIGHT);    }    Wait(50);    black = 0;}

void extramovement(){    SetPower(LEFT+RIGHT, 4);    OnFwd(LEFT);    OnRev(RIGHT);    Wait(17);    Off(LEFT+RIGHT);    Wait(100);    OnFwd(LEFT+RIGHT);    Wait(70);    Off(LEFT+RIGHT);}

task main(){    SetSensor(LEYE, SENSOR_LIGHT);    SetSensor(REYE, SENSOR_LIGHT);    SetSensor(ROTATOR, SENSOR_ROTATION);        repeat(2)    {        drive();        collision();        drive();        extramovement();    }

Page 20: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

    PlaySound(2);    Off(LEFT+RIGHT);}

8. Test and Evaluate Design

Function Problem Trial w/ solution ResultLine- Following

When using “while true” loops, the program would not break out of the while true, and whatever statement is planned on being the terminating with the while true loop, will be repeated infinitely. When the robot comes in contact with the object it runs the else statement of the line function over and over again.

1. Use until statements in the place of the “while true” loops.

The

Line- Following

Some of the turns are too sharp for the program to

1. We made the robot slow down its readings by shutting the inside motor off and turning the

Worked 9/10 times.

Page 21: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

keep track of the rapid value changes in the light sensor. Mainly, the first right turn and the only left turn on the track. The robot straying away from the line in a direction tangent to the curve, is the result.

outside on, in order to turn the robot in the correct direction.

Going around the object

We needed to find a wait turn time for which will give the robot a trajectory that will not create contact between the rotation sensor and object, but close enough for contact between the extruding axle(connected to rotation sensor), and object.

1. Wait(100) Did not work at all. The robot was perpendicular to the object.

2. Wait(70) Worked perfectly.

Page 22: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

The rotation never touched the object, and the axle did.

Going around the object

We needed to find the number of times the robot reads the value of the black line over a total of two revolutions around the object. This number serves as the argument in the second until statement of the collision function.

1. First, we told the robot to play a sound every time it read the value for the black line. Then, we ran three trials and took the value of the trial with the least amount value readings (17)and used that value as our value for the limit argument statement.Argument:Until(black==17)

This worked perfectly. The robot stopped after it had gone pass the line 5 times, which meant it had gone around twice. The robot stopped with a reasonable distance for it to pivot on its axis, and the black line.

Going around the track twice

When the robot stopped on the green square, it aligned with the track so that it could go forward with the light sensors on opposite sides of the black line. We have a

1. Wait(50) When the robot went forward onto the track again, both light sensors were on the inside of the track, and the robot went straight in the direction

Page 23: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

program written for this, but we need to find the wait time for which the robot must turn, in order to be in-line with the track

it was pointed when it came back onto the track. The light sensor was not even close to being aligned.

2. Wait(25) The light sensor were still on the inside of the track, and the robot went forward into the direction it was pointed.

3. SetPower(LEFT+RIGHT, 4);…Wait(17);

This worked perfectly. The light sensors were on opposite sides of the line, and the line-following process started perfectly.

Implementation Plan

1. Set up variables for input and output ports, and find define values for the black line, and green. First, test each value found by writing simple program that shuts off all motors,

Page 24: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

when the both light sensors read the value of the each found value for green and black.

2. Now write void drive(), and put it into task main(). Remember to set the sensors in task main(), and run void to see it runs correctly.

3. First, write collision(but only for one time around the object), manually, run it into the object and let the robot start the collision program. Find out how many times the robot reads the sensor. The robot needs to finish on the opposite side of the object and on the track, ready to start drive.

4. Find a way to write collision for two times around the object.

5. Next, run drive(), with collision following, and see if the programs run one after the other ending with the robot ready to start line-following.

6. Next, add drive() after collision, and the robot needs to follow the line after going around the object, and needs to stop on green.

7. Write extramovement() and place it after the second drive. The robot should be in position to start line- following again.

8. Finish task main() by adding a repeat around the functions to run the functions twice. Drive should start when extramovement() begins.

9. Celebrate when the robot finishes twice.

9. Refine and Optimize Design

Our design did not need a lot of refine of our design. The first change we made in our design, was turning the powers to either zero or eight when we wanted to tell the motors to go forward or stop. We used this approach in our line-following and collision function. The reason for this was that the program never lost the line when we turned the robot using the power. Second, we tried multiple builds when using the rotation sensor as a touch sensor. The various proposed problems that excluded them immediately before even reaching the testing stage. All of these structures’ problem arose when none of them could provide a good from the rotation sensor, due the angle of force not being great enough. In other words, not of the configurations could give a good constant reading. For example, sometimes the value for touching could 2 and the next the rotation sensor would not even be pressed due the bad angle at which the axle is placed. Therefore, we went with a simple build, which was not connected

Page 25: Midterm Report - webpages.eng.wayne.eduwebpages.eng.wayne.edu/~el0838/MidtermReport.docx · Web viewBefore starting our project, we had only one constraint and that was the combination

Team 1 BE 1200

to the robot as the rest of the builds that allowed us to make the most firm connection between the object the axle. We had no problems with this build coming off the robot when going around the object.

10. Document Design

Student responsibilities:

Lionel: Helped create the report and posted the report onto the team website, and gave advice for the program

Bryant: created the design, code for the robot, and gave advice for the report.

Ervin Mealy: Helped create the report and created the design of the robot, and gave advice for the code