View Single Post
  #4   Spotlight this post!  
Unread 31-01-2017, 19:40
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 118
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: Error with joystick controller and driver station

You have a while(true) in your teleopPeriodic() method. You should do that in an IterativeRobot implementation. Try changing:

Code:
	@Override
	public void teleopPeriodic() {
		while(true) {
			robotDrive1.arcadeDrive(leftJoystick.getY()*driveBaseSpeed, rightJoystick.getX());
			robotDrive2.arcadeDrive(leftJoystick.getY()*driveBaseSpeed, rightJoystick.getX());
			gearMotor.set(rightJoystick.getY()*gearMotorSpeed);
			
			if(rightJoystick.getRawButton(4)) {
				fuelGate.set(1.0*fuelGateSpeed);
			} else if(rightJoystick.getRawButton(5)) {
				fuelGate.set(-1*fuelGateSpeed);
			} else {
				fuelGate.set(0);
			}
			
			if(rightJoystick.getRawButton(6)) {
				scissorLift.set(1.0*scissorLiftSpeed);
			} else if(rightJoystick.getRawButton(7)) {
				scissorLift.set(-1*scissorLiftSpeed);
			} else {
				scissorLift.set(0);
			}
		}
	}
To:

Code:
	@Override
	public void teleopPeriodic() {

// teleopPeriodic() should do something and exit right away (it should not loop forever)
//		while(true) {

			robotDrive1.arcadeDrive(leftJoystick.getY()*driveBaseSpeed, rightJoystick.getX());
			robotDrive2.arcadeDrive(leftJoystick.getY()*driveBaseSpeed, rightJoystick.getX());
			gearMotor.set(rightJoystick.getY()*gearMotorSpeed);
			
			if(rightJoystick.getRawButton(4)) {
				fuelGate.set(1.0*fuelGateSpeed);
			} else if(rightJoystick.getRawButton(5)) {
				fuelGate.set(-1*fuelGateSpeed);
			} else {
				fuelGate.set(0);
			}
			
			if(rightJoystick.getRawButton(6)) {
				scissorLift.set(1.0*scissorLiftSpeed);
			} else if(rightJoystick.getRawButton(7)) {
				scissorLift.set(-1*scissorLiftSpeed);
			} else {
				scissorLift.set(0);
			}

// Removal of while(true) loop
//		}
	}
Hope that helps,
Paul
Reply With Quote