Automed Challenge - Python
Automed Challenge
In this challenge, you need to program your robot to navigate a hospital as it delivers medications to patients in several different rooms.
Teacher Tips
Increase engagement by creating a backstory to the hospital! What type of hospital is it and what type of patients does the hospital serve?
Challenge Rules
-
The robot must begin and end in the Start Zone.
-
The entire robot must be inside the Pharmacy, Elevator, and Patient Rooms and wait for the following times in order to complete the actions:
-
Pharmacy: Wait at least 5 seconds to pickup medications.
-
Elevator: Wait at least 5 seconds to reach another floor.
-
Patient Room: Wait at least 3 seconds to drop off medications.
-
-
The robot must not come into contact with or pass over any walls.
-
The robot must visit the Pharmacy first to pickup medications for Patient Rooms.
-
The robot must visit each of the Patient Rooms (in no particular order) to drop off medication.
-
Have fun!
Teacher Toolbox - Solution
A programming rubric to evaluate students can be found here (Google / .docx / .pdf ).
View a VEXcode V5 Python sample solution below:
# Library imports
from vex import *
# Begin project code
# Go to pharmacy
drivetrain.drive_for(FORWARD, 900, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 1350, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 600, MM)
wait(6, SECONDS)
# Go to room 1
drivetrain.drive_for(REVERSE, 600, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 600, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 600, MM)
wait(6, SECONDS)
# Go to elevator
drivetrain.drive_for(REVERSE, 600, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 600, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 600, MM)
wait(6, SECONDS)
# Go to room 2
drivetrain.drive_for(REVERSE, 800, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 1000, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 800, MM)
wait(5, SECONDS)
# Go to room 3
drivetrain.drive_for(REVERSE, 800, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 600, MM)
drivetrain.turn_for(RIGHT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 800, MM)
wait(5, SECONDS)
# Go to elevator
drivetrain.drive_for(REVERSE, 800, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 750, MM)
drivetrain.turn_for(LEFT, 90, DEGREES)
drivetrain.drive_for(FORWARD, 750, MM)
wait(6, SECONDS)
# Go back to the start zone
drivetrain.drive_for(REVERSE, 1500, MM)