The Groove Machine Challenge - C++
The Groove Machine Challenge
In this challenge, you will break up into teams and program your robot to go through a dance routine using your knowledge of loops. Your teacher will set a time limit for developing/testing the dance and a time limit for the length of the dance. Everyone not on the competing head-to-head dance-off teams will judge the dances and vote on the team that they think is best.
Rules:
- Each Clawbot will dance one-at-a-time within the 1x1 meter area.
- The dancing continues until the Stop button on the Brain's screen is pressed to stop the project from running.
- The arm must be raised and lowered.
- The claw must open and close.
- The Clawbot must turn left and right.
- The Clawbot must drive forward and in reverse.
- The project needs to be stopped immediately if the Clawbot collides with anything or falls over. That is a losing dance.
Teacher Toolbox
Judging for this competition could be handled in a number of ways. One way to increase engagement is to have students video record the dance-off and have students from other classes vote on the winner. If that is too ambitious, consider appointing a panel of impartial judges before beginning this challenge, or bringing in other students, teachers, or staff.
The solution below is merely a combination of all three example dance moves strung together.
// Include the V5 Library
#include "vex.h"
// Allows for easier use of the VEX Library
using namespace vex;
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
while (true) {
ArmMotor.spinFor(forward, 300, degrees);
ArmMotor.setStopping(brake);
repeat(3) {
Drivetrain.turnFor(right, 90, degrees);
repeat(2) {
ClawMotor.spinFor(forward, 90, degrees);
ClawMotor.spinFor(reverse, 90, degrees);
}
Drivetrain.turnFor(left, 90, degrees);
repeat(2) {
ClawMotor.spinFor(forward, 90, degrees);
ClawMotor.spinFor(reverse, 90, degrees);
}
}
repeat(2) {
ArmMotor.spinFor(forward, 300, degrees);
ArmMotor.setStopping(brake);
Drivetrain.turnFor(right, 90, degrees);
repeat(9) {
Drivetrain.turnFor(left, 10, degrees);
wait(.5, seconds);
}
ArmMotor.spinFor(reverse, 300, degrees);
}
ArmMotor.setVelocity(80, percent);
Drivetrain.setTurnVelocity(65, percent);
repeat(2) {
ArmMotor.spinFor(forward, 900, degrees);
repeat(3) {
Drivetrain.turnFor(left, 90, degrees);
Drivetrain.turnFor(right, 90, degrees);
}
ArmMotor.spinFor(reverse, 900, degrees);
}
}
}