public Shooter() throws CANTimeoutException { loadingStick = new CANJaguar(5); // http://www.chiefdelphi.com/forums/showthread.php?t=101737 // Configuring firstShootMotor in order to control speed with encoder firstShootingMotor = new CANJaguar(6, CANJaguar.ControlMode.kSpeed); firstShootingMotor.configEncoderCodesPerRev(256); firstShootingMotor.enableControl(); firstShootingMotor.changeControlMode(CANJaguar.ControlMode.kVoltage); firstShootingMotor.enableControl(); // Configuring secondShootMotor in order to control speed with encoder secondShootingMotor = new CANJaguar(7, CANJaguar.ControlMode.kSpeed); secondShootingMotor.configEncoderCodesPerRev(256); secondShootingMotor.enableControl(); secondShootingMotor.changeControlMode(CANJaguar.ControlMode.kVoltage); secondShootingMotor.enableControl(); angleMotor = new CANJaguar(8); frontSwitch = new DigitalInput(1); backSwitch = new DigitalInput(1); table = NetworkTable.getTable("shooter"); table.putNumber("firstSpeed", 0); table.putNumber("angle", 0); }
public Intake() { preferences = Preferences.getInstance(); leftGate = new DoubleSolenoid( ElectricalConstants.rightGateForward, ElectricalConstants.rightGateReverse); rightGate = new Solenoid(ElectricalConstants.leftGate); try { arm = new CANJaguar(ElectricalConstants.armJag); arm.changeControlMode(CANJaguar.ControlMode.kPercentVbus); arm.configNeutralMode(CANJaguar.NeutralMode.kBrake); arm.configFaultTime(0.5); arm.configPotentiometerTurns(1); arm.setPositionReference(CANJaguar.PositionReference.kPotentiometer); arm.setPID(0, 0, 0); arm.enableControl(0); } catch (CANTimeoutException ex) { ex.printStackTrace(); } rollers = new Victor(ElectricalConstants.rollerVic); }
/** Disables the climber closed loop puts it into open loop. */ public void disableClosedLoop() { if (ClimbJag != null) { try { ClimbJag.disableControl(); ClimbJag.changeControlMode(CANJaguar.ControlMode.kPercentVbus); m_closedLoop = false; } catch (CANTimeoutException ex) { m_fault = true; System.err.println("CAN timeout"); } } }
public void reInit() { try { jagFlip = new CANJaguar(ElectricalConstants.JagFlipper); jagFlip.changeControlMode(CANJaguar.ControlMode.kPosition); jagFlip.configFaultTime(0.5); jagFlip.configNeutralMode(CANJaguar.NeutralMode.kBrake); jagFlip.configPotentiometerTurns(10); jagFlip.setPositionReference(CANJaguar.PositionReference.kPotentiometer); jagFlip.setPID(p, i, d); jagFlip.enableControl(0); } catch (CANTimeoutException ex) { ex.printStackTrace(); } }
/** Sets up the climber closed loop and puts it in Position mode. */ public void enableClosedLoop() { if (ClimbJag != null) { try { ClimbJag.changeControlMode(CANJaguar.ControlMode.kPosition); ClimbJag.setPID(150.0, 0.0, 0.0); double position = ClimbJag.getPosition(); ClimbJag.enableControl(position); m_closedLoop = true; } catch (CANTimeoutException ex) { m_fault = true; System.err.println("CAN timeout"); } } }
private Flipper() { p = PIDConstants.flipperP; i = PIDConstants.flipperI; d = PIDConstants.flipperD; try { jagFlip = new CANJaguar(ElectricalConstants.JagFlipper); jagFlip.changeControlMode(CANJaguar.ControlMode.kPosition); jagFlip.configFaultTime(0.5); jagFlip.configNeutralMode(CANJaguar.NeutralMode.kBrake); jagFlip.configPotentiometerTurns(10); jagFlip.setPositionReference(CANJaguar.PositionReference.kPotentiometer); jagFlip.setPID(p, i, d); jagFlip.enableControl(0); } catch (CANTimeoutException ex) { ex.printStackTrace(); } gotoPosition(); }