Skip to main content

Lesson 2: Drive to Number ‘5’

In this Lesson, the VR Robot will drive to the number ‘5’ and back to the number ‘1’ on the Number Grid Map Playground!

number-grid-map-playground-5

Notice that the VR Robot will be traveling along the X axis with X values increasing to move to the number ‘5’ on the Number Grid Map Playground.

L2_x-axis-go-to-5

The VR Robot will drive to the location of the number ‘5’ on the Number Grid Map Playground. However, before the VR Robot can navigate to that number, the VR Robot has to be told where that number’s location is. Beginning at the center of the Playground, the coordinates of number ‘5’ are (-100, -900).

L2_x-axis-go-to-5-with-arrows01
  • To begin, the VR Robot needs to be facing the number ‘5.’ Drag in a [Turn for] block to the workspace.
    turn-right
  • Drag the [Drive] non-waiting block into the workspace.
    add-drive-block
  • Attach a [Wait until] block beneath the [Drive] block.
    add-wait-until
  • The [Wait until] block accepts Boolean conditions. Just like the Distance Sensor Unit, this project will use the conditionals to drive through the Number Grid Map Playground. Drag the <Greater than> Boolean reporter block into the [Wait until] block.
    add-greater-than
  • Note that the <Greater than> block is used instead of the <Less than> block because the VR Robot is driving to the right from the left side of the Playground. The VR Robot is starting at a X-value of -900 millimeters (mm). As the VR Robot drives forward, the X-values increase.
    L2_x-axis-go-to-5-with-arrows01
  • Drag the (Position of Robot) block into the <Greater than> block.
    add-position-of-block

    For Your Information

    The (Position of Robot) block is a numeric reporter block that reports the X or Y coordinate position of the center of the VR Robot. Choose whether the X or Y coordinate position is reported.

    position-x

    The (Position of Robot) block can report values in millimeters (mm) or inches.

    position-mm
  • Set the parameter of the <Greater than> block to -100.
    change-parameter
  • Drag in a [Stop driving] block and add it to the project.
    add-stop-driving
  • Open the Number Grid Map Playground if it is not already open and run the project.
  • Watch the VR Robot drive to number ‘5’ on the Number Grid Map Playground.
    stop-on-5
  • In this project, the VR Robot drives to the number ‘5’ on the Number Grid Map Playground. The [Wait until] block is used so that the VR Robot will continue to drive forward until the X-value is greater than the X-value of the coordinate that the indicated number is on.
  • Once the X-value is greater than -100, the project moves to the next block in the stack, which is a [Stop driving] block. Since the X-value of the number ‘5’ is -100, the VR Robot will stop driving once the X-value is greater than -100.
    unit-6-lesson-2-project-flow

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