Midterm Implementation
Midterm Implementation
1. Clarify Objectives
A robot needs to be designed that will follow the black line and
proceed clockwise to the end point that is designated, which is the
green square, and stop on the green square when it reaches it. The
robot must also be able to successfully circumnavigate around the
solid object that blocks the black line at some point in the track, and
after navigating around this obstacle it needs to refind the line and
proceed to the green square.
3. Identify Constraints
We were constrained to use one code file, the components that
the Lego kit gave us, and the coding must be done using the Brixcc
Command Center (NQC programming language).
4. Establish Functions
The robot must be able to follow the black line all throughout the
course. The robot must be able to detect the obstacle about half way
through the course, circumnavigate it a total of two times, and then
refind the black line and continue following it. The robot must be able
to detect the green square, stop on it and play a tone. The robot must
also complete this whole course at least once.
1
1
1
1
The robot must have a means to be able to follow the black line all
the way around the track by using light sensors, it must also be able to
detect the obstacle and navigate around it, and this will be done using
the touch sensor ( to detect the obstacle), and the ultrasonic sensor
( to navigate around the object). At the end the robot must also be able
to detect the green square and to stop when it reaches it; this will be
done using the light sensor again, but a different threshold range. Also,
the motors were used in order to turn the robot left, right, and proceed
forward, and built in speakers were used to play the sounds.
6. Generate Alternatives
When first starting the project most of the team thought that two
touch sensors should be used (one to detect the bump on the front of
the bot, and another on the side of the bot when navigating around the
obstacle). The reason most of the team wanted to do this is because in
hw4 most of the team used touch sensors, but that soon changed to
our current bot which uses an ultrasonic sensor. This construction was
chosen because using an ultrasonic sensor involves the robot not
having to repeatedly bump into the obstacle in order to navigate
around it, but instead can use readings to navigate around it. Another
down side to using two touch sensors is that if the ports were mixed up
when writing the code it would completely distort what the robot would
execute and not perform how it should, or how it is intended to.
When first starting out with the ultrasonic sensor it was set up
horizontally to the ground, but because the object that needed to be
avoided was cylindrical it made more sense to set the ultrasonic sensor
perpendicularly to the ground so that both points acquiring readings on
it would be receiving readings on the same plane/same part of the
obstacle.
Lastly, when the robot would detect the object and then turn (in
order to pick up readings) the ultrasonic sensor had to be
moved/placed more towards the front of the bot in order so that it
would be picking up the readings more accurately and not miss any
readings, again because the object is curved. After all these changes
were applied the robot is identical to its current state which allowed it
to run throughout the whole track successfully.
7. Model/Analyze Design
See Midterm Flowchart
Description
Tasks
main()
linefollow()
wallfollow()
countimes()
bump()
Preprocessor
#NEAR 8
#TOO_DARK 26
#TOO_BRIGHT 64
#LEFT OUT_C
#RIGHT OUT_A
#EYE SENSOR_2
Variables
int ANDY
10.
Document Design
See photos