Skip to main content
Teacher Portal

Package Dash Challenge - C++

Sample layout for the package dash challenge showing the loading dock in the lower left corner, three areas for can placement, and the start area in the upper right corner with a Clawbot inside it.

A grid layout of a robotic competition field showing a robot positioned in the 'Start' area on the right side. The field includes a 'Loading Dock' area on the left side and three smaller zones, each containing an image of a can placed on top of a book, distributed across the field. The zones are arranged to create a task-oriented environment where the robot may be required to interact with the objects in the smaller zones and transport them to the Loading Dock.

Package Dash Challenge

In this challenge, you will program your robot to pick up packages and bring them to a loading dock as fast as possible!

Challenge rules:

  • The robot must begin the challenge in the Start Zone.
  • The packages (aluminum cans) can only come in contact with the books, the Clawbot's claw, and the Loading Dock.
    • If a package is dropped on the warehouse ground, you must reset the field and start over again.
  • The time for each run starts as soon as the robot moves.
  • The time stops as soon as the last package is dropped in the Loading Dock.
  • When resetting the field, everything should be returned to the exact location as it started.
  • Have fun!

Teacher Tips icon Teacher Tips

  • Increase engagement by creating a backstory or purpose to the warehouse! What kind of warehouse is it? What types of packages are found in the warehouse? Who owns the warehouse?

  • Allow students to create different routes or strategies that will allow them to transport the cans more efficiently.

  • Compare not only the times to completion to decide the winner of this challenge (if you're organizing it to be competitive) but also the navigation techniques used so that students can consider other teams' solutions.

Teacher Toolbox icon Teacher Toolbox - Solution

A programming rubric to evaluate students can be found here.

The following is one possible solution to the challenge. Solutions can vary depending on the starting position of the robot and the path that is chosen. There are multiple paths that can lead to moving all packages.

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // Safely run the Claw motor and pick up the first package
  ClawMotor.setTimeout(2, seconds);
  Drivetrain.driveFor(forward, 900, mm);
  Drivetrain.turnFor(right, 90, degrees);
  ArmMotor.spinFor(forward, 315, degrees);
  ClawMotor.spinFor(reverse, 180, degrees);
  Drivetrain.driveFor(forward, 215, mm);
  ClawMotor.spinFor(forward, 120, degrees);

  // Drive to the Loading Dock to drop off the first package
  Drivetrain.driveFor(reverse, 110, mm);
  Drivetrain.turnFor(right, 90, degrees);
  Drivetrain.driveFor(forward, 920, mm);
  Drivetrain.turnFor(left, 90, degrees);
  Drivetrain.driveFor(forward, 2300, mm);
  Drivetrain.turnFor(left, 90, degrees);
  Drivetrain.driveFor(forward, 750, mm);
  ArmMotor.spinFor(reverse, 315, degrees);
  ClawMotor.spinFor(reverse, 120, degrees);

  // Pick up the second package
  Drivetrain.driveFor(reverse, 200, mm);
  Drivetrain.turnFor(left, 170, degrees);
  Drivetrain.driveFor(forward, 900, mm);
  Drivetrain.turnFor(right, 90, degrees);
  Drivetrain.driveFor(forward, 2300, mm);
  ArmMotor.spinFor(forward, 315, degrees);
  ClawMotor.spinFor(forward, 120, degrees);

  // Drive to the Loading Dock to drop off the second package
  Drivetrain.driveFor(forward, 900, mm);
  Drivetrain.turnFor(right, 90, degrees);
  Drivetrain.driveFor(forward, 960, mm);
  ArmMotor.spinFor(reverse, 315, degrees);
  ClawMotor.spinFor(reverse, 120, degrees);

  // Pick up the third package
  Drivetrain.driveFor(reverse, 150, mm);
  Drivetrain.turnFor(left, 90, degrees);
  ArmMotor.spinFor(forward, 315, degrees);
  Drivetrain.driveFor(forward, 490, mm);
  ClawMotor.spinFor(forward, 120, degrees); 

  // Drive to the Loading Dock to drop off the third package
  Drivetrain.driveFor(reverse, 490, mm);
  Drivetrain.turnFor(right, 90, degrees);
  Drivetrain.driveFor(forward, 150, mm);
  ArmMotor.spinFor(reverse, 315, degrees);
  ClawMotor.spinFor(reverse, 120, degrees);
  
}