Computer Science Level 1 - Blocks

Unit 6 - Knowing Your Location

Lesson 4: Drive to Three Numbers Challenge

In the Drive to Three Numbers Challenge, the VR Robot will drive to three numbers on the Number Grid Map Playground in any order, using the Location Sensor and operator blocks.

Learning Outcomes

• Apply blocks from the Drivetrain, Sensing, and Control categories in the correct sequence in order to have the VR Robot successfully drive to three numbers on the Number Grid Map Playground in any order, while using the Location Sensor.

Putting It All Together

The Location Sensor can be used to navigate the coordinates of any Playground or to move a VR Robot to a known location. Using the coordinate grid from each Playground, a VR Robot can use multiple sensor values (X and Y values) to drive to these specified locations. The blocks used with the Location Sensor in a VEXcode VR project are affected by the previous actions of a VR Robot and the direction a VR Robot is driving.

If a VR Robot needs to drive down or to the left, the targeted sensor value for the Location Sensor will need to be less than the starting information. This means that the project should use a <Less than> block. For a VR Robot to drive up or to the right, the targeted sensor values for the Location Sensor will need to be greater than the previous position, requiring the use of a <Greater than> block.

Combining the use of operator blocks and multiple values from the Location Sensor allows a VR Robot to drive to any known location, avoid falling off a Playground, or navigate the coordinate plane of any Playground.

Challenge Overview

In the Drive to Three Numbers challenge, you will drive the VR Robot to three numbers using the Location Sensor and comparison blocks on the Number Grid Map Playground. To complete this challenge, the VR Robot must drive to the numbers ‘25,’ ‘42,’ and ‘78’ in any order.

Follow these steps to complete the challenge:

• Watch the solution video to see how the VR Robot should drive in order to complete the challenge. Note that for this challenge, the VR Robot can drive to each of the three given numbers in any order.

• Create a new project or load a project from previous lessons in this Unit.
• Rename the project Unit6Challenge.
• Launch the Playground window.
• Load the Number Grid Map Playground.
• Add the blocks necessary to navigate the VR Robot to the numbers ‘25,’ ‘42,’ and ‘78.’
• Start the project to test if it works.
• If the project is not successful, edit and try again. Continue to revise and run the project until the VR Robot successfully drives to the numbers ‘25,’ ‘42,’ and ‘78.’
• Save the project once the VR Robot successfully drives to each of these numbers.

Congratulations! You have successfully completed the Drive to Three Numbers Challenge!