Skip to main content

Lesson 2: Plan the Project

In this Lesson, you will learn how to use the energize command to pick up and drop disks on the Disk Mover Playground. You will use the energize command with Drivetrain commands to pick up and move three blue disks into the blue goal in the mini challenge.

Learning Outcomes

  • Describe how comments can be used to plan and organize a VEXcode VR Python project.
  • Describe the program flow in a project that has the VR Robot use the Electromagnet to pick up, carry, then drop a disk.

Planning a Project with the Electromagnet

To begin the Disk Mover challenge, the VR Robot will pick up and move the first blue disk into the blue goal. In order to do this, the VR Robot will complete four behaviors, using the Electromagnet and the Drivetrain commands. It is useful to plan the behaviors needed to complete a project prior to beginning to build your code, so that you can ensure that you have a conceptual understanding of the goal of the coding project. The goal of moving the first blue disk can be broken down as follows:

  • First, the VR Robot will drive forward to the first blue disk.

    A top down view of the Disk Mover Playground at the start, with the VR Robot in the center of the blue goal in the lower left corner. A dotted arrow points from the front of the robot to the first blue disk in front of it, illustrating the intended movement of the robot.

  • Second, the VR Robot will use the Electromagnet to pick up the first blue disk.

    A side view of the VR Robot on the Playground at the first blue disk location, with the Disk attached to the Electromagnet.

  • Third, the VR Robot will drive in reverse back to the blue goal.

    A top down view of the Disk Mover Playground with the VR Robot at the first blue disk, and a dotted arrow pointing from the rear of the robot back to the blue goal, illustrating the intended movement of the robot.

  • Lastly, the VR Robot will use the Electromagnet to drop the blue disk into the blue goal.

    A front view of the VR Robot in the blue goal on the Playground with the blue disk below the electromagnet, having been released in the goal.

Now that the behaviors in the project have been identified, those behaviors can be used to create comments in the project.

Using Comments for Project Planning

You can use comments in a VEXcode VR Python project to help plan the behaviors of the VR Robot, by organizing them into smaller sections within the project. While building the project, the commands associated with each desired behavior are placed beneath the matching comment.

  • Start a new project and select the Disk Mover Playground when prompted. Disk Mover Playground selection tile, reads Disk Mover across the bottom.
  • Name the project Unit8Lesson2.The VEXcode VR Toolbar with the project name box highlighted with a red box. The project name reads Unit 8 Lesson 2.

     

  • Type 4 comments into the workspace. Comments in Python start with the # (pound) sign. Add comments for each of the steps outlined above.

    def main():
        # 1. Drive to the first blue disk
    
        # 2. Pick up the first blue disk
    
        # 3. Drive in reverse to the blue goal
    
        # 4. Drop the blue disk in the blue goal

With comments in place, we can begin building our project one command at a time.  

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