void HandleShooterInputs() { if (shooterTimer.HasPeriodPassed(SPINUP_TIME)) { shooterTimer.Stop(); shooterTimer.Reset(); indexerMotor.Set(INDEXER_FWD); } else if (!m_collectorMotorRunning && !m_shooterMotorRunning) { if (kEventClosed == gamepad.GetEvent(BUTTON_SHOOTER)) { shooterMotor.Set(SHOOTER_FWD); shooterTimer.Start(); m_shooterMotorRunning = true; } } else { if (indexSwitch.GetEvent() == kEventOpened) { indexerMotor.Set(0.0); shooterMotor.Set(0.0); m_shooterMotorRunning = false; } } }
void HandleShooterInputs() { if (!m_collectorMotorRunning && !m_shooterMotorRunning) { if (kEventClosed == gamepad.GetEvent(BUTTON_SHOOTER)) { shooterMotor.Set(-0.5); indexerMotor.Set(-0.5); m_shooterMotorRunning = true; } } else { if (indexSwitch.GetEvent() == kEventClosed) { indexerMotor.Set(0.0); shooterMotor.Set(0.0); m_shooterMotorRunning = false; } } }
void Autonomous(void) { myRobot.SetSafetyEnabled(false); // Move the arm to a level position armMotor.Set(ARM_FWD); while (!((potentiometer.GetVoltage() > 2.4) && (potentiometer.GetVoltage() < 2.6))) { // Check to make sure we don't overrotate the arm in either direction if (potentiometer.GetVoltage() > 4.5 || potentiometer.GetVoltage() < 0.5) { armMotor.Set(0.0); return; } Wait(0.2); UpdateStatusDisplays(); } armMotor.Set(0.0); // Drive robot DoAutonomousMoveStep(&m_autoForward[0], "Moving..."); DoAutonomousMoveStep(&m_autoForward[1], "Moving..."); //Shoot for five seconds Timer* t = new Timer(); t->Start(); shooterMotor.Set(SHOOTER_FWD); indexerMotor.Set(INDEXER_FWD); while(!t->HasPeriodPassed(5.0)) { Wait(0.02); } shooterMotor.Set(0.0); indexerMotor.Set(0.0); }
void HandleResetButton(void) { if (gamepad.GetEvent(BUTTON_STOP_ALL) == kEventClosed) { collectorMotor.Set(0.0); m_collectorMotorRunning = false; shooterMotor.Set(0.0); m_shooterMotorRunning = false; indexerMotor.Set(0.0); armMotor.Set(0.0); jogTimer.Stop(); jogTimer.Reset(); m_jogTimerRunning = false; } }
void UpdateStatusDisplays(void) { // Joystick values SmartDashboard::PutNumber("stickX", stick.GetX()); SmartDashboard::PutNumber("stickY", stick.GetY()); SmartDashboard::PutBoolean("shift", stick2.GetState(BUTTON_SHIFT) ? kStateClosed : kStateOpen); // Shooter/Indexer values SmartDashboard::PutBoolean("indexSwitch", indexSwitch.GetState() ? kStateClosed : kStateOpen); SmartDashboard::PutNumber("shooterMotor", shooterMotor.Get()); SmartDashboard::PutNumber("indexerMotor", indexerMotor.Get()); // Misc Motor Values SmartDashboard::PutNumber("collectorMotor", collectorMotor.Get()); SmartDashboard::PutNumber("armMotor", armMotor.Get()); // Arm position via potentiometer voltage (2.5 volts is center position) dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "Voltage: %3.1f", potentiometer.GetVoltage()); SmartDashboard::PutNumber("Potentiometer", potentiometer.GetVoltage()); // Claw lock states SmartDashboard::PutBoolean("Green Claw State", greenClawLockSwitch.GetState()); SmartDashboard::PutBoolean("Yellow Claw State", yellowClawLockSwitch.GetState()); dsLCD->PrintfLine(DriverStationLCD::kUser_Line4, "Green : %s", greenClawLockSwitch.GetState() ? "Locked" : "Unlocked"); dsLCD->PrintfLine(DriverStationLCD::kUser_Line5, "Yellow: %s", yellowClawLockSwitch.GetState() ? "Locked" : "Unlocked"); // Pneumatic shifter count SmartDashboard::PutNumber("Shift Count", m_shiftCount); // State viariables dsLCD->PrintfLine(DriverStationLCD::kUser_Line6, "CMR: %s SMR: %s JTR: %s", m_collectorMotorRunning ? "T" : "F", m_shooterMotorRunning ? "T" : "F", m_jogTimerRunning ? "T" : "F"); }