Lesson 5: Disk Mover Challenge
In the Disk Mover Challenge, the VR Robot must use the Electromagnet to pick up each disk and move it to the goal of the same color on the Disk Mover Playground. You will need to use nested loops and the Electromagnet along with commands from the Drivetrain, Sensing, and Control categories to solve the Disk Mover challenge.
Learning Outcome
- Apply commands from the Drivetrain, Sensing, and Control categories in the correct sequence in order to have the VR Robot successfully complete the Disk Mover Challenge.
Putting It All Together
This Unit explores how to use the Electromagnet on the VR Robot to pick up and put down colored disks on the Disk Mover Playground. This Unit also combines skills learned in previous units such as using the Eye Sensor and Distance Sensor with the while loop to navigate the Disk Mover Playground and to pick up disks.
The activities in this Unit require many repetitive movements. Using loops and nested loops in VEXcode VR projects allow the user to control the project flow and shorten a long list of repeated commands into just a few. Loops can also be used with commands that return Booleans, allowing the VR Robot to evaluate and respond to its environment, such as stopping and energizing the Electromagnet when the Down Eye Sensor detects a disk.
while not down_eye.near_object():
drivetrain.drive(FORWARD)
wait(5, MSEC)
drivetrain.stop()
magnet.energize(BOOST)
Placing one loop inside of another loop is called ‘nesting.’ When loops are nested, the outer loop takes control of the number of times the inner loop executes. Nested loops are helpful in projects where a VR Robot repeats the same behaviors more than once. Nesting loops organizes and condenses a project.
Select the Next button to continue with the rest of this Lesson.