Skip to main content

Lesson 4: Build the Project

Organize the project and get started 

  • Start a new text project and select the Disk Mover Playground when prompted. Image of the Disk Mover Playground selection tile
  • Name the project Unit8Lesson4.Unit8Lesson4


  • Using the behaviors that were just identified, add the following comments to organize the project. image of the comments to organize the project
  • Build the following code that instructs the VR Robot to complete the first four behaviors listed above. This project will use the same commands that were used in the previous lesson to move disks using sensor feedback. 
    image of the start of the project using commands from the previous lesson
  • Open the Playground Window if it is not already open. Be sure the Disk Mover Playground opens, 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

Turn and drive to the next set of disks

  • In order to collect the next colored disk, the VR Robot will need to turn and drive toward the next colored goal. Using what we learned in the previous lesson, in order to prevent colliding with the disk in the goal, 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 command to the code and set the parameter to “REVERSE” for 100 millimeters (mm).
    image of the drivetrain command to reverse and avoid the disk in the goal
  • The VR Robot will now need to turn left to face the next colored goal.turn to goal
  • Add a turn_to_heading command beneath the fifth comment and set the parameter to 90 degrees in order for the VR Robot to face the next goal.image of the turn to heading command added beneath the fifth comment
  • Next, the VR Robot will need to drive forward to the next colored goal. Note that the VR Robot will have to drive forward four grid squares, or 800 millimeters (mm) in order to drive to the center of the next colored goal.
    drive towards next goal
  • Add a drive_for command to the code and set the parameter to forward 800 millimeters (mm).
    image of the drive for command added to the project
  • The VR Robot will now need to turn to face the colored disks.
    turn from goal
  • Add another comment and a second turn_to_heading command to the code and set the parameter to zero degrees. This will turn the VR Robot to face the colored disks.
    image of the next comment and command in the project
  • Open the Disk Mover Playground if it is not already open, and run the project.
  • The VR Robot will pick up and move the first blue disk into the blue goal, and then drive over the red goal. The VR Robot will also turn to face the red disks.
    orient forward

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