summaryrefslogtreecommitdiff
path: root/src/main/java/frc/robot/subsystems/Intake.java
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2024-03-07 06:05:41 +0200
committerkartofen <mladenovnasko0@gmail.com>2024-03-07 06:05:41 +0200
commit4452529be059c5fbe4aaf9190f25cfc734715f01 (patch)
tree9483caad7d9316dc06c1e61eceaeb8172b74577d /src/main/java/frc/robot/subsystems/Intake.java
parent1ceb7c4d5ff83eca3009a0197a431d9c1441bef7 (diff)
orks
Diffstat (limited to 'src/main/java/frc/robot/subsystems/Intake.java')
-rw-r--r--src/main/java/frc/robot/subsystems/Intake.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java
index 85cbbf8..41620bb 100644
--- a/src/main/java/frc/robot/subsystems/Intake.java
+++ b/src/main/java/frc/robot/subsystems/Intake.java
@@ -1,17 +1,25 @@
package frc.robot.subsystems;
import org.littletonrobotics.junction.Logger;
+
+import com.revrobotics.CANSparkLowLevel.MotorType;
import com.revrobotics.CANSparkMax;
+import com.revrobotics.RelativeEncoder;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
public class Intake extends SubsystemBase
{
- private final CANSparkMax m_intakeT = Constants.intakeT;
- private final CANSparkMax m_intakeD = Constants.intakeD;
+ public static final CANSparkMax m_intakeT = new CANSparkMax(Constants.intakeT_ID, MotorType.kBrushless);
+ public static final CANSparkMax m_intakeD = new CANSparkMax(Constants.intakeD_ID, MotorType.kBrushless);
+ private final RelativeEncoder m_intakeD_encoder = m_intakeD.getEncoder();
- public Intake() { }
+ public Intake()
+ {
+ m_intakeT.setInverted(true);
+ m_intakeD.setInverted(true);
+ }
public void atPercentage(double perc)
{
@@ -23,12 +31,18 @@ public class Intake extends SubsystemBase
m_intakeT.set(upPerc);
m_intakeD.set(downPerc);
}
+ public void shoot()
+ {
+ if (m_intakeD_encoder.getVelocity() > 2000) {
+ m_intakeT.set(1);
+ }
+ m_intakeD.set(1);
+ }
@Override
public void periodic()
{
Logger.recordOutput(getName() + "/speedT", m_intakeT.getEncoder().getVelocity());
Logger.recordOutput(getName() + "/speedD", m_intakeD.getEncoder().getVelocity());
-
}
}