Skip to main content

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 comparison operators.

Top down of the number grid playground. The VR Robot can be seen in the bottom left corner on the number 1. Callout boxes are on the numbers 25, 42, and 78 on the Playground.

Learning Outcomes

  • Apply commands 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 comparison operator used with the Location Sensor in a project are affected by the previous actions of a VR Robot and the direction a VR Robot is driving.

This aligns with left and right movements when looking at the Playground. If the VR Robot is moving from left to right or bottom to top (larger values), the less than operator is used to drive while the position is less than the target value. 

Two top down views of the Number grid map playground. In the first, the VR robot is shown on number 51 with an arrow indicating the robot is going to move to the right to the number 60. The text above reads 'drive while position is less than'. In the second, the VR robot is shown on number 6 with an arrow indicating the robot is going to move to the up to the number 96. The text above reads 'drive while position is less than'.

If the VR Robot is moving from right to left or top to bottom (smaller values), the greater than operator is used to drive while the position is greater than the target value.

Two top down views of the Number grid map playground. In the first, the VR robot is shown on number 60 with an arrow indicating the robot is going to move to the left to the number 51. The text above reads 'drive while position is greater than'. In the second, the VR robot is shown on number 96 with an arrow indicating the robot is going to move to the down to the number 6. The text above reads 'drive while position is greater than'.

Combining the use of comparison operators 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 operators 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.

Top down of the number grid playground. The VR Robot can be seen in the bottom left corner on the number 1. Callout boxes are on the numbers 25, 42, and 78 on the Playground.

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 when prompted.
  • Rename the project Unit6Challenge.
  • Open the Playground window if it is not already open. Be sure the Number Grid Map Playground opens.
  • Add the commands 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!

Questions

Please select a link below to access the lesson quiz.

Google Doc / .docx / .pdf