Skip to main content

Programming a Sequence - VEXcode IQ

Let's program a sequence!

In this activity, you will outline a plan for the sequence of movements that your robot will need to make in order to grab, lift, and move an object.

You will first review two tutorial videos about programming the claw and arm. Then you will identify the correct sequence of steps to approach, grab, and lift an object, and plan that project using pseudocode.
You will then create, download, and run the project using the pseudocode that helped you plan!

  • Make sure you have the hardware required, your engineering notebook, and VEXcode IQ downloaded and ready.

Materials Required:
Quantity Materials Needed
1

VEX IQ Super Kit

1

VEXcode IQ

1

Engineering Notebook

1

Meter stick or ruler

1

Clawbot (Drivetrain 2-motor) template example project

1

Aluminum can or empty water bottle

Step 1: Preparing for the Exploration

Before you begin the activity, do you have each of these items ready? The Builder should check each of the following:

Step 2: Start Planning a Path

Before you begin planning the path that your robot will take, first review the Moving the Arm and Open the Claw tutorial videos in VEXcode IQ.VEXcode IQ Toolbar with the Tutorials icon called out in a red box, to the right of the File menu.

  • Moving the Arm Tutorial VideoTutorial video icon reads Moving The Arm at the bottom, and shows a clawbot icon with arrows indicating moving the arm.
  • Open the Claw Tutorial VideoTutorial video icon reads Opening the Claw at the bottom and shows a clawbot icon with arrows indicating opening/closing the claw.

Now, in your engineering notebook, use pseudocode (Google Doc / .docx / .pdf to write the correct sequence of steps to approach, grab, and lift an object like an empty water bottle or aluminum can.Clawbot IQ with the arm down and claw open with a water bottle on the table between the claw.

  • Parts of this problem to keep in mind:
    • First, you will need to measure in millimeters how far away the object is from the robot. You will need this to determine how far forward and in reverse the robot should move.
    • Identify how many degrees the claw will have to open and close depending on its range of motion and how large the object is. For more help, refer to the previous page in the Play section.
      • Hint: Open the Device Menu and see how many degrees the claw will close with the object inside.
    • Identify how far up in degrees the arm will raise to carry the object.
    • When you approach an object, the claw should already be opened. If you approach an object with the claw closed, the closed claw could knock the object over.
    • The robot will also have to grasp the object in its claw, raise the object up, move in reverse to relocate the object, and then place the object back down and release it.

Step 3: Programming a Sequence

  • Open the Clawbot (Drivetrain 2-motor) template example project.Example project icon reading Clawbot drivetrain 2-motor, indicating which template to choose for this activity.
  • For help opening an example project, view the Use Example Projects and Templates tutorial video in VEXcode IQ Blocks.Tutorial icon reads Use Example Projects and Templates at the bottom, and shows a cursor hovering over an icon.
  • Rename and save the project as 'Sequence'.Project name dialog box in the VEXcode IQ Toolbar. Slot 1 is selected and the project name reads Sequence.
  • For help renaming and saving a project, view the Naming and Saving Your Project tutorial in VEXcode IQ.
  • Now, create your project using your pseudocode. First outline your project using comments to insert your pseudocode. The example shown below is a reference. Degree and distance measurements may be different depending on how far away your object is and its size.VEXcode IQ project plan showing a When started block with 7 Comment blocks attached. In order the comments read Open the claw 75 degrees, Drive forward 15mm to approach the object, Close the claw 60 degrees to grab the object, Raise the arm 315 degrees to lift the object, Drive in reverse 15mm to move the object to a new location, Lower the arm 315 degrees to place the object back down, and Open the claw 60 degrees to release the object.
  • Use the [Drive], [Spin for], and [Spin to position] blocks to create the project based on the pseudocode.

    Don't forget to reset the Arm Motor's position to 0 and to include a 3-second timeout for the Claw Motor.

    Use the image below as an example of how to organize the project. The following project is not complete but you should completely program yours.Building on the previous VEXcode IQ project with blocks added between the comment blocks. To begin the Arm motor position is set to 0 degrees and the clawmotor time out to 3 seconds. Beneath the first comment a Spin for block is added and set to clawmotor open for 75 degrees. Beneath the second commend a Drive for block is set to forward for 15mm. Beneath the 3rd comment a Spin for block is set to clawmotor, close for 60 degrees. Beneath the 4th comment a spin to position block is set to arm motor to position 315 degrees.
  • After your project is complete, predict what it will do. Write your predictions in your engineering notebook.

Step 4: Test the Project!

Now that you have created a project to approach, grab, and lift and object - let's test it!

  • Download and Run your Sequence project. For help, view the Download and Run a Project tutorial video in VEXcode IQ. It will have the following icon: Tutorial icon that reads Download and Run a Project with a download icon and a triangle above.

Did your project run as intended? Write your observations in your engineering notebook comparing your pseudocode to your final project and answer the following questions:

  • Did your project have your robot to grab, lift, and move an object?
  • Why is this sequence of movements important?