Skip to main content

The V5 Clawbot is ready to grasp!

This exploration will let you start creating some cool projects that use the V5 Clawbot's claw to grasp objects.

  • VEXcode V5  Instructions that will be used in this exploration include:
    • ClawMotor.setPosition(0, degrees);
    • ClawMotor.spinFor(90, degrees);
    • ClawMotor.setTimeout (2, seconds);
  • To find out more information about the instruction, select Help and then select the question mark icon next to a command to see more information.

    Image of the VEXcode V5 Workspace with the Help Notes open for the Drive command

  • Make sure you have the hardware required, your engineering notebook, and VEXcode V5 downloaded and ready.
Materials Required:
Quantity Materials Needed
1

VEX V5 Classroom Starter Kit  (with up-to-date firmware)

1

VEXcode V5

1

Engineering Notebook

1

Clawbot Template (Drivetrain 2-motor, No Gyro) example project

1

Aluminum can

Step 1: Preparing for the Exploration

Before you begin the activity, do you have each of these items ready? Check each of the following:

  • Are the motors plugged into the correct ports?

  • Are the smart cables fully inserted into all of the motors?

  • Is the Brain turned on?

  • Is the battery charged?

Step 2: Start a New Project

Before you begin your project, select the correct template project. The Clawbot Template (Drivetrain 2-motor, No Gyro) example project contains the Clawbot's motor configuration. If the template is not used, your robot will not run the project correctly.

Image showing the File menu open in VEXcode V5 showing the Open Examples option

Complete the following steps:

  • Open the File menu.
  • Select Open Examples.

Image showing the Example projects with a red box around the Clawbot (Drivetrain 2-motor, No Gyro) Template Project

  • Select and open the Clawbot Template (Drivetrain 2-motor, No Gyro) example project.
  • Since we will be programming to control the claw, rename your project ClawControl.
  • Save your project.
  • Check to make sure the project name ClawControl is now in the window in the center of the toolbar.

Image of the project name changed to ClawControl in the VEXcode V5 Toolbar

Step 3:  Program the V5 Claw to Open

We are now going to begin by programming the claw to open!

A screenshot of a C++ code snippet for a VEX robotics project. The code initializes the robot's configuration and sets the position of the ClawMotor to 0 degrees. The main components of the code include initializing the robot configuration with vexcodeInit() and setting the claw motor position using ClawMotor.setPosition(0, degrees)

  • Write the ClawMotor.setPosition(); instruction as shown above in the programming area to set the starting position for the claw.

A screenshot of a C++ code snippet for a VEX robotics project. The code initializes the robot's configuration and sets the position of the ClawMotor to 0 degrees, followed by setting a timeout of 2 seconds for the ClawMotor. The code includes vexcodeInit() to initialize the robot configuration, ClawMotor.setPosition(0, degrees) to set the claw motor position, and ClawMotor.setTimeout(2, seconds) to set the timeout duration

  • Add the ClawMotor.setTimeout(); instruction as shown above.
    • Notice that this instruction appears before the ClawMotor.spinFor(); instruction. Its purpose is to set how long the Claw motor can run and stops it after that time. So even if the motor doesn't move a full 60 degrees, the project stops the Claw motor after two seconds have passed.

A screenshot of a C++ code snippet for a VEX robotics project. The code initializes the robot's configuration, sets the ClawMotor's position to 0 degrees, establishes a timeout of 2 seconds for the ClawMotor, and then commands the ClawMotor to spin in reverse for 60 degrees. The code includes the following commands: vexcodeInit() for initializing the robot configuration, ClawMotor.setPosition(0, degrees) to set the initial position, ClawMotor.setTimeout(2, seconds) for setting the timeout, and ClawMotor.spinFor(reverse, 60, degrees) to perform the motor spin action.

  • Write the ClawMotor.spinFor(); instruction as shown above to open the claw 60 degrees.

Image showing the Slots with a red box around Slot 1

  • Select the slot that the project will be downloaded to on the V5 Robot Brain by clicking on the boxed 1 icon to open up all available project slots and select the desired slot.

Image of the VEXcode V5 Toolbar with a red box around the green Brain Icon

  • Connect the robot to your computer or tablet. The Brain icon in the toolbar turns green after a successful connection has been made.

Image of the VEXcode V5 Toolbar with a red box around the Download icon

  • Click on the Download icon next to the Device Info icon to download the project to the V5 Robot Brain.

Image of the VEX V5 Brain Screen showing the project downloaded to the Brain

  • Check that the ClawControl project has downloaded to the brain in the slot you chose.
  • Run(in C++ or Python) the project on the Clawbot by making sure the project is selected and then press the Run button. Congratulations on creating your first project for moving the Claw!

Step 4:  Try This: Close the V5 Claw

Now that you have programmed the claw to open, you will now program it to close.

Image of the V5 Claw closed Now that you can open the claw, you will want to close it as well.

  • Return to your ClawControl project and add an additional ClawMotor.spinFor(); instruction to have the Claw Motor spin closed for 30 degrees. The claw should close half of the way because it originally spun open for 60 degrees.
  • Test that your revised project has the claw open for 60 degrees and then close for 30 degrees by downloading and running your ClawControl project.

Step 5: Try This: Sequencing Multiple Movements

Image of the V5 Claw open with  Red arrows at the bottom of the image indicate the directions in which the claw can open and close, moving horizontally to grip or release objectsNot everything that you pick up with the claw will be the same size. Try opening the claw to different positions along the range of motion.

  • Spin the motor in order to:
    • Open for 70 degrees
    • Close for 20 degrees
    • Open for 10 degrees
    • Close for 30 degrees
    • Close for 25 degrees
  • If the Claw Motor starts at 0 degrees, how many degrees is the Claw Motor open at the end of the project?
  • Begin with the Claw Motor closed.

Step 6:  Completing the Lock Tight Challenge

Closeup image of the V5 Claw holding an aluminum can The Lock Tight Challenge

  • Program the Clawbot to securely close the claw on an empty 12-ounce aluminum can without crushing the sides.
  • Have the Clawbot hold onto the can while it raises and lowers its arm for 45 degrees.
  • The Clawbot should then release the can and back away from it.
  • Start the challenge with an opened claw and an empty can within it.