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:
-
View the video below to see a complete project where the VR Robot drives to three different numbers on the Number Grid Map Playground. This Playground features numbered squares from 1 to 100, in rows of 10, beginning with 1 in the lower left corner, and 100 in the upper right corner. The VR Robot begins on number 1, then navigates along one axis at a time to drive to the numbers 25, 78, and 42. At each number, the robot stops for 1 second to indicate it has reached its location.
- Create a new project or load a project from previous lessons in this Unit. If creating a new project, select the Number Grid Map Playground.
- 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!