Skip to main content

Lesson 2: Mini Challenge

Mini Challenge

For this mini challenge, create a project where the VR Robot drives from start to the number ‘1’ on the Wall Maze Playground using the distance sensor. This project will use multiple while loops with greater than (>) operators and get_distance commands.

A top down view of the Wall Maze Playground with the VR Robot in its starting location and the number 1 highlighted with a red box, toward the lower right hand corner, separated by a short vertical and horizontal wall.

For Your Information

The values reported by the Distance Sensor can also be monitored in the Monitor Console. Monitoring sensor values in the Monitor Console allows the user to view real-time reports of a specific value (or multiple values) in a project. Access the Monitor Window by selecting the Monitor icon next to the Help.

The VEXcode VR Toolbar with the Monitor button highlighted in a red box. The Monitor is located directly to the left of the Help button.

In this project, the Monitor Console can be used to view the values being reported by the get_distance command to help determine when the VR Robot needs to turn to successfully drive through the Wall Maze Playground. In the video clip below, as the VR Robot moves on the Playground, the open Monitor Console shows the data for Front Distance in millimeters and Front Distance in inches update in real time.

Video file

To display the sensor values in the Monitor Console, in the first line of the project, drag in or type the monitor_sensor command as shown below. Type the identifier of the sensor as a string into the parameter of the command. For this project, the values displayed in the Monitor Console are from the Front Distance Sensor, and the string parameter will be "front_distance.get_distance".

def main():
    monitor_sensor("front_distance.get_distance")

For more information on how to use the Monitor Console, view this article.

Follow these steps to complete the mini challenge:

  • Watch the solution video to see how the VR Robot should drive in order to complete the mini challenge. In the video clip below, the VR Robot begins in the starting location and first turns right to face the short wall separating the robot from the number 1. The robot then drives forward, turn left, drives forward and turns right twice to get past the first wall. Next, the robot turns right and drives forward twice to get around the horizontal wall to the number 1. 
Video file
  • Create a project by adding or removing the necessary commands to the Unit5Lesson2 project.
  • Start the project to test it.
  • If the project is not successful, edit and try again. Continue to revise and run the project until the VR Robot successfully drives from start to the number ‘1.’
  • Save the project once the VR Robot successfully drives from start to the number ‘1.’

Congratulations! You solved the mini challenge!

Questions

Please select a link below to access the lesson quiz.

Google Doc / .docx / .pdf