text
stringlengths 0
715
|
---|
Indexer.spin(reverse, 11, volt);
|
wait(120, msec);
|
Indexer.stop();
|
tripleShooting = false;
|
}
|
void buttonRightPressed() {
|
//if b is pressed, toggle optical sensor mode
|
if (Controller1.ButtonB.pressing()) {
|
opticalMode = !opticalMode;
|
//display a note on the controller, and also spin the intake in the right way
|
if (opticalMode) {
|
Intake.spin(forward);
|
Intake.setVelocity(100, percent);
|
printControllerSetup();
|
Controller1.Screen.print("Autoshoot mode enabled");
|
//gain = 0.000103;
|
flywheelTargetRPM = 1800;
|
} else {
|
Intake.stop();
|
printControllerSetup();
|
Controller1.Screen.print("Autoshoot mode disabled");
|
gain = defaultGain; //was 0.00013 before
|
flywheelTargetRPM = 1800;
|
}
|
} else {
|
//fire one disc
|
fireIndexer();
|
}
|
}
|
void buttonXPressed() {
|
//turn on or off the flywheel
|
//count the time it takes for rpm to reach 0
|
/*
|
if (!flywheelOn) {
|
int fTimer = 0;
|
while (Flywheel.velocity(rpm) != 0){
|
wait(20, msec);
|
fTimer += 20;
|
}
|
printController(fTimer);
|
}*/
|
if (Controller1.ButtonB.pressing()) {
|
//change the drawing mode and let the driver know
|
if (tempDrawMode < 9) {
|
drawMode = tempDrawMode + 1;
|
} else {
|
drawMode = tempDrawMode - 9;
|
}
|
if (drawMode > 3) drawMode = 0;
|
tempDrawMode = drawMode + 10;//let the release Button B function know that we changed the drawing mode
|
//printController(drawMode);
|
printControllerSetup();
|
if (drawMode == 0) {
|
Controller1.Screen.print("Draw: Flywheel graph");
|
} else if (drawMode == 1) {
|
Controller1.Screen.print("Draw: PID graph");
|
} else if (drawMode == 2) {
|
Controller1.Screen.print("Draw: Vision sensor");
|
}
|
} else {
|
flywheelOn = !flywheelOn;
|
//backup: velocity control based on internal motor PID's (it's bad)
|
if (useTBH == false) {
|
if (flywheelOn) {
|
Flywheel.setVelocity(100, percent);
|
Flywheel.spin(forward);
|
} else {
|
Flywheel.setVelocity(0, percent);
|
}
|
}
|
}
|
}
|
void buttonXReleased() {
|
}
|
void buttonAPressed() {
|
//reset odometry; if B is held down then display odometry constants instead
|
if (!Controller1.ButtonB.pressing()) {
|
/*
|
Controller1.Screen.clearScreen();
|
Controller1.Screen.setCursor(1, 1);
|
Controller1.Screen.print(pos[0]);
|
Controller1.Screen.newLine();
|
Controller1.Screen.print(pos[1]);
|
Controller1.Screen.newLine();
|
Controller1.Screen.print(angle * 180 / M_PI);
|
*/
|
} else {
|
pos[0] = 0;
|
pos[1] = 0;
|
angle = 0;
|
}
|
}
|
void buttonBPressed() {
|
//prints out a bunch of useful information on the brain screen--a status check
|
Brain.Screen.clearScreen();
|
Brain.Screen.setCursor(1, 1);
|
Brain.Screen.print("Battery voltage: ");
|
Brain.Screen.print(Brain.Battery.voltage());
|
Brain.Screen.newLine();
|
Brain.Screen.print("Battery current: ");
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.