Skip to main content

Lesson 3: Turning at a Further Distance

Navigating to the Turning Location

  • Add the following commands to your project. You can copy and paste from your existing project, or type them into the Workspace.  Adding another while loop to the project

  • We can estimate that the distance from the next wall to our desired turning location in the maze, is approximately 300 millimeters (mm). image of the next step in the VR Robot's path with the approximate distance marked 

For Your Information

You can use the Distance Sensor data as reported in the Dashboard to estimate the distance the VR Robot is from an object. Stop your project when the VR Robot reaches your desired location. Once stopped, the values in the Dashboard will display the sensor values for the VR Robot where it is currently positioned. This can be used to observe sensor values as well as visualize the distance between the VR Robot and an object at a certain point in time.

stop button in playground window

Stopping the project when the VR Robot reaches a specific point, enables you to pause the project to see what value the Distance Sensor is reporting in real time. In the case of the Wall Maze, this value can be used in the greater than (>) operator to make the VR Robot stop at a further distance from the wall.
distance sensor reading on dashboard

  • Adjust the value in the comparison operator to 300 millimeters (mm). This will enable the VR Robot to drive forward while the distance to the wall is greater than 300 millimeters. When it is less than 300 millimeters, the VR Robot will turn left, at the desired turning location in the Wall Maze.image of the project with the 300 millimeter value highlighted 
  • Launch the Wall Maze Playground if it is not already open and run the project. Notice how the VR Robot turns left at the desired turning location, so that it is ready to continue through the maze to the letter 'B'. image of the project alongside the final location of the VR Robot when the project is run
  • Next, add the following commands to your project, so the VR Robot continues on its path to the letter 'B'. Image of project of completed path to letter 'B'
  • Launch the Wall Maze Playground if it is not already open and run the project again.
    Ends on B!
  • The VR Robot now drives from the start of the Wall Maze Playground and stops on the letter ‘B.’
  • Notice that changing the right operand to 300 millimeters allowed the VR Robot to turn at a distance farther from the wall, which was necessary to turn at the correct location.
  • The distance value reported in the Dashboard can be used to observe how far the VR Robot was from a wall when it needed to turn to get to the letter ‘B'.
    distance sensor reporting 300mm on dashboard

Select the Next button to continue with the rest of this Lesson.