-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ports, tuned PID/FF, added sensors to kicker
- Loading branch information
1 parent
b217a3f
commit 2c6194e
Showing
16 changed files
with
145 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 24 additions & 2 deletions
26
src/main/java/frc/robot/subsystems/kicker/KickerIONeo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,49 @@ | ||
package frc.robot.subsystems.kicker; | ||
|
||
import com.revrobotics.CANSparkBase.IdleMode; | ||
import com.revrobotics.CANSparkLowLevel.MotorType; | ||
import com.revrobotics.CANSparkMax; | ||
import com.revrobotics.RelativeEncoder; | ||
import edu.wpi.first.wpilibj.DigitalInput; | ||
|
||
public class KickerIONeo implements KickerIO { | ||
private CANSparkMax m_motor; | ||
private RelativeEncoder m_encoder; | ||
private DigitalInput m_beamBreakOne; | ||
private DigitalInput m_beamBreakTwo; | ||
|
||
public KickerIONeo(int port) { | ||
m_motor = new CANSparkMax(port, MotorType.kBrushless); | ||
public KickerIONeo(int motorPort, int beamBreakOnePort, int beamBreakTwoPort) { | ||
m_motor = new CANSparkMax(motorPort, MotorType.kBrushless); | ||
m_motor.setIdleMode(IdleMode.kCoast); | ||
m_encoder = m_motor.getEncoder(); | ||
m_beamBreakOne = new DigitalInput(beamBreakOnePort); | ||
m_beamBreakTwo = new DigitalInput(beamBreakTwoPort); | ||
} | ||
|
||
@Override | ||
public void updateInputs(KickerInputs inputs) { | ||
inputs.angularVelocityRPM = m_encoder.getVelocity(); | ||
inputs.voltage = m_motor.getAppliedOutput() * m_motor.getBusVoltage(); | ||
inputs.current = m_motor.getOutputCurrent(); | ||
inputs.beamBreakOne = beamBreakOneBroken(); | ||
inputs.beamBreakTwo = beamBreakTwoBroken(); | ||
} | ||
|
||
@Override | ||
public void setVoltage(double voltage) { | ||
m_motor.setVoltage(voltage); | ||
} | ||
|
||
@Override | ||
public boolean hasGamePiece() { | ||
return beamBreakOneBroken() || beamBreakTwoBroken(); | ||
} | ||
|
||
private boolean beamBreakOneBroken() { | ||
return !m_beamBreakOne.get(); | ||
} | ||
|
||
private boolean beamBreakTwoBroken() { | ||
return !m_beamBreakTwo.get(); | ||
} | ||
} |
Oops, something went wrong.