Automed Challenge - C++

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 C++ sample solution below:
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// Begin project code
// Go to pharmacy
Drivetrain.driveFor(forward, 900, mm);
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.driveFor(forward, 1350, mm);
Drivetrain.turnFor(right, 90, degrees);
Drivetrain.driveFor(forward, 600, mm);
wait(6, seconds);
// Go to room 1
Drivetrain.driveFor(reverse, 600, mm);
Drivetrain.turnFor(right, 90, degrees);
Drivetrain.driveFor(forward, 600, mm);
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.driveFor(forward, 600, mm);
wait(5, seconds);
// Go to elevator
Drivetrain.driveFor(reverse, 600, mm);
Drivetrain.turnFor(right, 90, degrees);
Drivetrain.driveFor(forward, 600, mm);
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.driveFor(forward, 600, mm);
wait(6, seconds);
// Go to room 2
Drivetrain.driveFor(reverse, 800, mm);
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.driveFor(forward, 1000, mm);
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.driveFor(forward, 800, mm);
wait(5, seconds);
// Go to room 3
Drivetrain.driveFor(reverse, 800, mm);
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.driveFor(forward, 600, mm);
Drivetrain.turnFor(right, 90, degrees);
Drivetrain.driveFor(forward, 800, mm);
wait(5, seconds);
// Go to elevator
Drivetrain.driveFor(reverse, 800, mm);
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.driveFor(forward, 600, mm);
Drivetrain.turnFor(right, 90, degrees);
Drivetrain.driveFor(forward, 800, mm);
wait(6, seconds);
// Go back to the start zone
Drivetrain.driveFor(forward, 1500, mm);
}