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.
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!
- 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.
-
Then, pick up the first blue disk.
-
Next, turn around.
-
Then, drive back to the goal using the Distance Sensor and drop the disk.
-
-
Start a new project in VEXcode VR and name the project Unit8Lesson4.
-
Build the following code that instructs the VR Robot to complete the four behaviors listed above.
- 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.
-
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.
-
Add a [Drive for] block to the code and set the parameter to “reverse” for 100 millimeters (mm).
-
The VR Robot will now need to turn left to face the next colored 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.
Select the Next button to continue with the rest of this Lesson.