Skip to main content

Lesson 3: Using Drivetrain Commands to Navigate the Wall Maze

Now that the VR Robot has driven to the letter ‘A’ as well as to the number ‘2’ on the Maze Wall Playground, how would you create a project where the VR Robot drives to other locations, such as to the letter ‘B?’

  • Begin by modifying your previous project or create a new project to match this base project. You can use VEXcode blocks, Switch blocks, or a combination of both block types. 

    VEXcode VR project to drive to the letter b. The project begins with a When started block. The rest of the blocks from top to bottom are Drive forward, Wait until left bumper pressed, Turn left for 90 degrees, Drive forward, Wait until left bumper pressed, Turn right for 90 degrees, Drive forward, Wait until left bumper pressed, Turn left for 90 degrees, Drive forward, Wait until left bumper pressed, Stop driving.
  • The project above begins to drive the VR Robot to the letter ‘B,’ however, in order for the VR Robot to do so, it would first need to back up and then turn left.

    Wall Maze Playground with the robot facing a wall with arrows indicating how the robot would need to first drive in reverse and then turn to the left in order to begin driving to the letter B.
  • If the code only contained [Drive] and [Turn for] blocks, the VR Robot would be “stuck” in the ‘2’ section of the Wall Maze, because it would continue to turn left or right without ever backing up.

    Wall Maze playground with the VR Robot stuck in the corner on the number 2, to show what would happen if only drive and turn for blocks were used in a project.
  • Edit the code by removing the [Stop driving] block and replacing it with the [Drive for] and [Turn for] blocks. Set the parameters of the [Drive for] block to “reverse” for 300 millimeters (mm) and set the parameters of the [Turn for] block to “left” 90 degrees.

    Two VEXcode VR projects from this lesson. The one on the left shows the project with the Stop driving block at the bottom. A red arrow points to the one on the right, which shows the Stop driving block replaced with Drive reverse for 300 millimeters and Turn left for 90 degrees blocks.
  • Launch the Wall Maze Playground if it is not already open and run the project.
  • Adding these blocks will orient the VR Robot in the right direction to drive the letter ‘B.’

    Wall Maze Playground with the VR Robot no longer stuck in the corner on the number two and facing towards the bottom of the Playground ready to drive towards the Letter B.
  • Select the “Reset” button to reset the Playground and move the VR Robot back to the starting position.
  • Now that the VR Robot is oriented in the correct direction, add the following blocks to drive the VR Robot to the letter 'B' on the Wall Maze Playground!

    VEXcode VR project from this Lesson with the Stop driving block removed from the bottom of the project and replaced by additional blocks. The additional blocks from top to bottom are Drive forward, Wait until left bumper pressed, Turn right for 90 degrees, Drive forward, Wait until left bumper pressed, Turn right for 90 degrees, Drive forward, Wait until left bumper pressed, Stop driving.
  • Launch the Wall Maze Playground if it is not already open and run the project.
  • The VR Robot will now drive to the letter ‘B’ on the Wall Maze Playground!

    Wall Maze Playground with the VR Robot on the letter B.

Mini Challenge

In this challenge, the VR Robot should navigate to the number ‘3’ in the Wall Maze Playground using the [Wait until] block and the Bumper Sensor.

Wall Maze Playground with the robot on the Number 3.

Follow these steps to complete the mini challenge:

  • Watch the solution video below and review 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 follows the same pattern of driving to a wall until the bumper is pressed then turning. The robot drives the same path to start, that it did to drive to the letter B. At the turning point away from the wall, the robot turns right to continue on to number 3. From that point it drives forward and turns left twice to get around the next set of walls, past the letter B. Finally, the robot drives forward and turns right twice to get around the final walls to reach number 3.

  • Create a project by adding or removing the necessary blocks to the Unit4Lesson3 project to drive the VR Robot to the number ‘3’ on the Wall Maze Playground
  • Start the project to test if it works.
  • If the project is not successful, edit and try again. Continue this process until the challenge is complete.
  • Once the VR Robot successfully drives to the number ‘3’ on the Wall Maze Playground, save the project.

Congratulations! You have successfully completed the Wall Maze Challenge!

Questions

Please select a link below to access the lesson quiz.

Google Doc / .docx / .pdf