Package Dash Challenge - Python
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
- 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 - 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.
# Begin project code
# Safely run the Claw motor and pick up the first package
claw_motor.set_timeout(2, seconds)
drivetrain.drive_for(FORWARD, 900, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
arm_motor.spin_for(FORWARD, 315, DEGREES)
claw_motor.spin_for(REVERSE, 180, DEGREES)
drivetrain.drive_for(FORWARD, 215, MM)
claw_motor.spin_for(FORWARD, 120, DEGREES)
# Drive to the Loading Dock to drop off the first package
drivetrain.drive_for(REVERSE, 110, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 920, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 2300, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 750, MM)
arm_motor.spin_for(REVERSE, 315, DEGREES)
claw_motor.spin_for(REVERSE, 120, DEGREES)
# Pick up the second package
drivetrain.drive_for(REVERSE, 200, MM)
drivetrain.turn_for(LEFT, 170, DEGREES)
drivetrain.drive_for(FORWARD, 900, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 2300, MM)
arm_motor.spin_for(FORWARD, 315, DEGREES)
claw_motor.spin_for(FORWARD, 120, DEGREES)
# Drive to the Loading Dock to drop off the second package
drivetrain.drive_for(FORWARD, 900, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 960, MM)
arm_motor.spin_for(REVERSE, 315, DEGREES)
claw_motor.spin_for(REVERSE, 120, DEGREES)
# Pick up the third package
drivetrain.drive_for(REVERSE, 150, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 490, MM)
arm_motor.spin_for(FORWARD, 315, DEGREES)
claw_motor.spin_for(FORWARD, 120, DEGREES)
# Drive to the Loading Dock to drop off the third package
drivetrain.drive_for(REVERSE, 490, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 150, MM)
arm_motor.spin_for(REVERSE, 315, DEGREES)
claw_motor.spin_for(REVERSE, 120, DEGREES)