NXT-G Programming *Note: this presentation contains animations and is best viewed by pressing F5 or the button *
Mission: Rapid Blood Screening ď‚›
ď‚›
The purpose of this mission is to hit the lever on the right hand side of the dispenser, knocking down the syringe it holds. Completing this mission is worth 25 Points in the 2010-11 FLL Competition
Mission Map: Overview ď‚› Completion
of this mission will require the robot to follow a line in it’s approach and have a manipulator designed to hit down that lever.
Knock Down
Start
Theoretical Robot Design
Motor A is attached to an arm-like device that is capable of swinging back and forth Motor B is connected to the left wheel Motor C is connected to the right wheel
A B
L.S.
C
Psuedocode: articulating what should happen
Move motors B and C forward for 2 full rotations
Follow line for 1400 degrees of motor B
Hits the syringe
Turn motor B 2 full rotations
Places robot in front of the syringe
Move motor A 180 degrees
(gets robot out of base)
Knock Return Down
Turns robot back around towards the base
Turn motors B & C unlimitedly until button on NXT device is pressed
Puts robot back in the base
Line Follower
NXT-G: The Actual Code Move forward to get out of the base Use (loop) the line follower with the condition of the rotations of encoder B being less than 1400 degrees.
NXT-G: The Actual Code Stop All Motors Move Motor A Forward to Knock Down the Syringe Turn Around Return to base
Line Follower Segment
IF the light sensor detects a light surface
Stop the right motor (C) move the left one (B) for an unlimited period of time This causes the robot to swing left
IF the light sensor detects a dark surface (the line)
Stop the left motor (B) Move the right motor (C) for an unlimited period of time This causes the robot to swing right
Packaged as a reusable function block
Line Follower: Line Responses
If the light sensor picks up a dark surface:
L.S .
C
The C motor stops moving to prevent the sensor from going over the line. The B motor begins to move
B
It will be stopped once the light sensor no longer detects the line
The result of one motor moving and the other staying constant is an arc motion.
Line Follower: Table Responses
L.S .
B
If the light sensor picks up a light surface (not a line):
C
The B motor stops moving to stop the robot from moving away from the line The C motor begins to move
It will be stopped once the light sensor detects the line
Printing Values to the Screen
Takes the numeric value of the angle motor B has moved over the course of the program Converts that angle to text Displays the text This is useful when measuring the distance a robot traveled over a segment of the code.