Skip to main content

Lesson 4: Move a Blue Disk

Move One Disk of Each Color

In Lesson 3, you created a project to have the VR Robot pick up and drop each of the three blue disks into the blue goal on the Disk Mover Playground.

all 3 disks

In this Lesson, you will now create a project to pick up and move one disk of each color into its corresponding colored goal in the Disk Mover Playground!

one of each color
  • The VR Robot will need to repeat the behaviors of driving to the disk, picking it up, turning around, and then driving back to the colored goal one time for each color. In order for the VR Robot to repeat the actions of picking up and dropping one disk of each color, the VR Robot will need to perform the following behaviors three times:
    • First, drive forward to the first blue disk using the Down Eye Sensor.
      drive to blue
    • Then, pick up the first blue disk.
      pick up blue disk
    • Next, turn around.
      turn around left
    • Then, drive back to the goal using the Distance Sensor and drop the disk.
      turn around drop
  • Start a new project in VEXcode VR and name the project Unit8Lesson4.
    Unit 8 Lesson 4
  • Build the following code that instructs the VR Robot to complete the four behaviors listed above.
    blocks project
  • Open the Disk Mover Playground and run the project.
  • When this project is run, the VR Robot will drive and pick up the first blue disk, turn around, drive to the blue goal, and drop the disk.
    stop in blue goal
  • In order to collect the next colored disk, the VR Robot will need to drive toward the next colored goal. However, in order to prevent colliding with the blue disk, the VR Robot will now need to move out of the way of the disk. To do this, the VR Robot will need to reverse 100 millimeters (mm), or half of the length of a grid square on the Playground.
    100mm goal
  • Add a [Drive for] block to the code and set the parameter to “reverse” for 100 millimeters (mm).
    add comment on reverse
  • The VR Robot will now need to turn left to face the next colored goal.
    turn to goal
  • Add a [Turn to heading] block to the code and set the parameter to 90 degrees in order for the VR Robot to face the next goal.
    turn toward next goal

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