You are on page 1of 5

1.

Clarify Objectives
A group must design, construct, and program a Lego NXT microprocessor-based
robot. This robot has to be able to pick up /identify green colored balls positioned
arbitrarily in the square arena and place them outside of the arena. In this arena are
also white colored balls that can be collected but must be identified as white and
therefore be kept inside the arena. There will be a maximum time of 3 minutes for the
robot to attempt the task.

2. Establish User Requirements


The user needs to set the robot down in the center of the arena, and then just
press the Run button for the software file named “grace final”. No further interaction is
needed.
3. Identify Constraints
The robot is to stay confined inside the arena during the duration of the 3
minutes. It must also work autonomous using one downloaded NXC program. After the
robot is started there can be no interaction between the robot and the group. The robot
must also be built using the materials/pieces provided in the Lego kits.
4. Establish Functions
The robot must be able to collect the balls (green or white), and then be able to
discern/identify which ball is white and which is green and then sort them. The robot
must also be able to eject the identified the green balls while keeping the white balls
inside the arena. The robot must also be able to sample the arena space and be able to
randomly navigate around the arena so that it will eventually come in contact with the
balls that are scattered at random inside the arena.
5. Establish Design Specifications
 1 Lego light sensor
 1 Lego ultrasonic sensor
 2 Lego touch sensors
 1 assembled forklift
 1 assembled Lego nurse bot
 3 motors
 3 wheels
The robot must be able to sample the arena space, which is to continuously
move around until it senses a ball, however it cannot do this if it does not have a
way to back up if it comes into contact with a wall. By using the ultrasonic sensor on
the front of the nurse bot the robot is able to turn around and continue hunting
when it senses a wall so many centimeters away from the ultrasonic sensor. The
robot must be able to discern between the white and green balls and it is going to
do this by using the light sensor on the front of the nurse bot, and then it will
execute certain actions depending if the reading that it acquires from the light
sensor is within a certain threshold. When the robot senses a green ball it must be
able to eject it and that will be done using the forklift (to transport the green ball/
collect it) and the two touch sensors on the back of nurse bot (so that when it
bumps into a wall it then flips the forklift ejecting the green ball outside of the
arena). Also two motors were used (in outputs B and C) to turn left, right, and
proceed forward, and one other motors was also used (in output A) to control the
forklift.

6. Generate Alternatives
In the beginning of the project the team thought that the two touch sensors
should be used in the front, in order to detect walls when sampling the arena space, and
the ultrasonic sensor should be used in the back to sense when it is close to a wall and
then fling the ball out of the arena. The reason that this was the original design of the
robot was because when we were looking at examples of how people approached the
final project on blackboard we saw that most groups had bumpers in the front and so
we tried that model first. However this idea was quickly abandoned because the forklift
was continuously running into the wall before the bumpers (on either side of the robot)
got a chance to even come in contact with the wall. Also, to build better bumpers more
parts were needed than what was included in the Lego kit.
Once we abandoned this idea we thought of using the ultrasound sensor in the
front of the robot instead of the two touch sensors. This was a good idea because we
wouldn’t have to deal with the problem of the forklift being two long, we could just
program how close we wanted the robot to be able to come to the wall using the
ultrasound sensor. The group also visualized/discussed different ways of placing the
ultrasound sensor on the robot and which way would be the best/most effective. It was
decided that the ultrasound sensor would be on the front of the bot above the forklift.
The advantage of having it at this position was that the forklift would not run into the
wall before the ultrasound sensor picked up the wall. However the disadvantage is that
if the sensor was not placed correctly (if it pointed down at all) it would pick up the balls
and would then turn around thinking that it was the wall.
Lastly when it was decided to have the ultrasound sensor on the front of the
robot the two touch sensors were then moved to the back of the robot where a huge
bumper was created so that it could detect the wall when it reversed into it, and then
fling the ball out of the arena.

7. Model/Analyze Design
See Final Flowchart

Description
Tasks
main() This task sets the sensors and what ports
they are in, starts off the robot by stating
for it to move forward, and starts the task
hunt(), wall(), and ball().
hunt() This task causes to robot to sample the
arena space by continuously moving
forward and turning randomly by using
the variables move_time, and turn_time.
wall() This task lets the robot know when the
back of the robot is approaching a wall(by
using the ultrasound sensor), and then
flips the forklift. This task is made to eject
any green balls that are on the forklift,
and this is done by using and if
statement(which resides inside of a
while(true)statement) that deals with the
ultrasound sensor. It then restarts the task
hunt() to search for another green ball.
ball() This task is made to sense if there is a
green or white ball in front of the light
sensor by using “if” statements and
dynamic thresholds. If there is a green ball
(or reading inside a certain threshold) task
hunt(), and wall() are stopped, the robot
then moves the forklift upwards so that
whatever ball is on the forklift does not
fall off when backing up, and then
reverses until either or of the touch
sensors on the back of the robot are
activated(this is done by using an until
statement), and then flips the forklift all
the way back ejecting the ball. If a white
ball is sensed (or a reading within that
threshold) task hunt(), and wall() are then
stopped, and then the robot reverses a
little bit so that the light sensor and
forklift are cleared, and then restarts task
hunt(), and wall().
Preprocessor
#define LIGHT SENSOR_2 Sets the sensor in port two to be referred
to as “LIGHT” in the code instead of
SENSOR_2, in order to make it clearer that
we are using the light sensor.
#define TOUCH1 SENSOR_3 Sets the sensor in port three to be
referred to as “TOUCH1” in the code
instead of SENSOR_3, in order to make it
clearer that we are using one of the touch
sensors.
#define TOUCH2 SENSOR_4 Sets the sensor in port four to be referred
to as “TOUCH2” in the code instead of
SENSOR_4, in order to make it clearer that
we are using one of the touch sensors.
Variable
int move_time This variable is set to Random(9000), so
every time the while(true) statement
restarts a new random value is assigned to
this variable and is then used as a value
for how long the robot should move
forward.
int turn_time This variable is set to Random(5000), so
every time the while(true) statement
restarts a new random value is assigned to
this variable and is then used as a value
for how long the robot should turn right.

8. Test and Evaluate Design


See Testing Table
9. Refine and Optimize Design
When we first started we had the ultrasonic sensor in the back of the robot and
the two touch sensors were in the front of the robot, later on we swapped the
placement of the ultrasound and the two touch sensors, which lead to our final design
of the two touch sensors in the back of the robot creating a huge bumper and the
ultrasound sensor in the front of the robot above the forklift. Having the touch sensors
in the back was more effective because they were more useful in this position with
obtaining readings (and not having the long forklift get in the way), and the placement
of the ultrasound sensor was also better because the forklift was no longer bumping
into the wall, instead the robot was programmed to turn around when the ultrasound
sensor received a certain reading.
See Testing Table
10.Document Design
See photos
Team Member Contribution
Caleb Cummings-Did all of the building of the robot, and its extensions, and helped
with debugging/revising the code for the final project.
Andrea Dumitrescu-Did all of the write up/10 step implementation for the final
project and most of the testing and revising of the code for the robot.
Grace Crowe-Wrote the main code that was used for the final and helped with
revising/debugging the code.

You might also like