Esempio n. 1
0
	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;
			}
		}		
	}
Esempio n. 2
0
	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;
			}
		}		
	}
Esempio n. 3
0
	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);
	}
Esempio n. 4
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;
		}
	}