Sei sulla pagina 1di 7

BE 1200 Team 9

Midterm Report
Claude Kamdem
Elizabeth Stewart
Nicholas Wonsowicz

1. Clarify Objective: The object of our robot is to follow a black line until the
path is blocked by a paint can. The robot will then navigate around the paint
can until it finds the black line again. From there, it will follow the black line
until it reaches a green square, where the robot will stop and play a sound
confirming the completion of its task.
2. Establish User Requirements: The user will place the robot at the starting
position on the black line, and then press the run button to begin the
execution of the code.
3. Identify Constraints: The constraints are the limited amount of parts in our
robot kit. Also, the battery life of our robot will be a constraint as the sensors
quickly drain the battery. The limits of the code will also constrain our robot.
4. Establish Functions: The first function will be to follow the black line. This will
be done using the two front sensors, which will be set to stay on the white
paper. If either of senses the black line, the robot will correct to position both
sensors back over the white paper. The second function will be to detect the
object. A bumper on the front of the robot will be responsible for this. When
pressed the robot will back up and turn 90 degrees, and begin the next
function. Third the robot will dynamic follow the paint can, this will be done
using a side mounted ultrasonic sensor. The robot will have a range it needs
to keep the paint can in as it circles the can. The light sensors will know
when it crosses the black line again, which will switch it back into line
following mode. The final function will stop the robot on green and play the
sound. This will be done with the light sensors as well, detecting the value
change from the white paper into the green square.
5. Establish Design Specifications: A touch sensor in front will detect the object.
Two front mounted light sensors will be used for detection of the black line as
well as the green square. A side mounted ultrasonic sensor will be used to
dynamic follow the paint can.
6. Generate Alternatives: Instead of an ultrasonic sensor on the side, the option
of using a second touch sensor would be something that would work. Also,

we could change the code to use just one light sensor for following the black
line instead of using two.
7. Model or Analyze Design: Using the bump bot base that we had, we added
our sensors to suit or objective. Our first front bumper was release type, our
two light sensors mounted on the side of that, and our ultrasonic sensor was
on the left side of the robot.
Start

Detect Blk Line

Refinding blk
line
Line
Following

Detect Green

Detect Object

Stop

Play Music

Stop & back up

End

Dynamic Wall Following

Circle Object 2 times

8. Test and Evalute Design:


Line Following

Results

Refinding blk
line

Preset white and black values for


the light sensors in percent mode.
Dynamic Following
Use the front bumper to detect
object, turn 90 degrees and use the
ultrasonic sensor to stay in the a
pre defined range as the robot
circles the object.
Stop on Green
Using the two light sesnors, detect
the green square, stop the robot,
and play a sound.

Using the code from Homework 4, our line


following worked perfectly and had no
issues.
Results
Could not get the robot to turn and follow
the object. Robot would detect object but
not stop line following.

Results
Robot would play sound when stopped
during tests, but we could not get it to stop
on green. It would pass the square and
keep trying to line follow.

9. Refine and Optimize Design: The original set up used a release bumper in
front of the robot. This required too much force to release the bumper and
our robot was not hitting the paint can fast enough to generate it. So we
switched the bumper from release type to touch type. This required changing
the code to reflect the off position of the sensor. Another change made was
to create a better stand for the ultrasonic sensor. The first set up we used
was weak and the sensor would change position, causing it to aim towards
the floor instead of straight out to the side.
10.Document: See code and pictures below.

//follow black line on white background


//
//define motor outputs
#define LEFT OUT_C
#define RIGHT OUT_A
#define REYE SENSOR_1
#define LEYE SENSOR_3
#define BUMP SENSOR_2
#define THRESH 1000
#define LTHRESH 50
#define RTHRESH 50
#define PLEV 45
#define US SENSOR_4
#define FAR 21
#define CLOSE 15
#define REV_TIME 200
#define PWR 45
#define SPIN_TIME1 200
#define FORWARD_TIME 200
int count=0;

mutex MoveMutex;

int dir=0;

task decision()
{
while(true)
{
if(LEYE < LTHRESH)
{
dir = -1;
}
else
{
if (REYE < RTHRESH)
{
dir = 1;
}
if (LEYE > LTHRESH && REYE > RTHRESH) dir = 0;
}
}
}
task motion_control()
{
while(true)
if(BUMP==0)
{
{ Acquire (MoveMutex) ;
if (dir == -1) // Left sensor on line, so turn left
{
OnRev(LEFT,PLEV);
until (dir==0);
OnFwd(OUT_AC,PLEV);
}
else

{
if (dir ==1)
{
OnRev(RIGHT,PLEV);
until (dir==0);
OnFwd(OUT_AC,PLEV);
}
else OnFwd(OUT_AC,PLEV);
}
Release (MoveMutex);
}
}
else //switched to stop all tasks to get partial points
{
PlayTone(262,400); Wait(500);
StopAllTasks();
}
}
task stopgreen()
{
if (LEYE < 60 && REYE < 60)
PlayTone(262,400); Wait(500);
StopAllTasks();
}

task main()
{
// configure the sensor
SetSensorLight(IN_3);
SetSensorLowspeed(IN_4);
SetSensorLight(IN_1);
SetSensorTouch(IN_2);
Precedes(decision,motion_control,stopgreen);
}

Potrebbero piacerti anche