diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-03-08 22:15:35 +0200 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-03-08 22:15:35 +0200 |
commit | 4a494bf31593d7e30e2aa360a7baa60b8779958e (patch) | |
tree | df97a89617d1de2d373e2cc62ba97e682d661ebc /src/main/java/frc/robot/subsystems | |
parent | 01d6a7ef435dd9f6835fc3916a7f623395288490 (diff) |
Diffstat (limited to 'src/main/java/frc/robot/subsystems')
-rw-r--r-- | src/main/java/frc/robot/subsystems/Chain.java | 2 | ||||
-rw-r--r-- | src/main/java/frc/robot/subsystems/Hooks.java | 1 | ||||
-rw-r--r-- | src/main/java/frc/robot/subsystems/Intake.java | 4 | ||||
-rw-r--r-- | src/main/java/frc/robot/subsystems/MainMech.java | 21 |
4 files changed, 7 insertions, 21 deletions
diff --git a/src/main/java/frc/robot/subsystems/Chain.java b/src/main/java/frc/robot/subsystems/Chain.java index 3ee7108..0e67c7e 100644 --- a/src/main/java/frc/robot/subsystems/Chain.java +++ b/src/main/java/frc/robot/subsystems/Chain.java @@ -36,7 +36,7 @@ public class Chain extends SubsystemBase double pid_out = m_pid.calculate(m_encoder.getDistance(), perc); Logger.recordOutput(getName() + "/pidOUt", pid_out); - m_motor.setVoltage(MathUtil.clamp(pid_out, -6, 6)); + m_motor.setVoltage(MathUtil.clamp(pid_out, -11, 11)); } public boolean isAtPosition(double pos) diff --git a/src/main/java/frc/robot/subsystems/Hooks.java b/src/main/java/frc/robot/subsystems/Hooks.java index 6e42322..76844e1 100644 --- a/src/main/java/frc/robot/subsystems/Hooks.java +++ b/src/main/java/frc/robot/subsystems/Hooks.java @@ -6,7 +6,6 @@ import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkLowLevel.MotorType; import frc.robot.Constants; -import edu.wpi.first.hal.FRCNetComm.tResourceType; import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj2.command.SubsystemBase; diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java index 036aae0..1237977 100644 --- a/src/main/java/frc/robot/subsystems/Intake.java +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -36,9 +36,9 @@ public class Intake extends SubsystemBase public void shoot() { if (Math.abs(m_intakeD_encoder.getVelocity()) > 2000) { - m_intakeT.set(-0.5); + m_intakeT.set(-0.3); } - m_intakeD.set(-0.5); + m_intakeD.set(-0.3); } @Override diff --git a/src/main/java/frc/robot/subsystems/MainMech.java b/src/main/java/frc/robot/subsystems/MainMech.java index 1e31892..ac2eff3 100644 --- a/src/main/java/frc/robot/subsystems/MainMech.java +++ b/src/main/java/frc/robot/subsystems/MainMech.java @@ -32,7 +32,7 @@ public class MainMech extends SubsystemBase }); public MechState states[] = { - new MechState(0.95, -40), + new MechState(0.8, -48), new MechState(0, -42), new MechState(0.95, 54.5), new MechState(0.5, -20), @@ -49,9 +49,11 @@ public class MainMech extends SubsystemBase public Command command(MechState state) { - return Commands.parallel( + Command c = Commands.parallel( m_arm.run(() -> m_arm.atAngleDegrees(state.m_arm_pos)), m_chain.run(() -> m_chain.atPercentage(state.m_chain_pos))); + c.addRequirements(this); + return c; } public Command toState(MechCmd state) @@ -59,21 +61,6 @@ public class MainMech extends SubsystemBase MechState next = states[state.ordinal()]; if (next.isValid()) { Command next_cmd = command(next); - if(state == MechCmd.INTAKE || current_state == MechCmd.INTAKE) { - current_state = state; - return new IntakeIntermediate(m_arm, m_chain).andThen(next_cmd); - } - if (state == MechCmd.MANUAL) { - current_state = state; - double arm_pos = m_arm.pos() + deadzone(-0.05, 0.05, Constants.controller2.getRawAxis(2)); - double chain_pos = Constants.controller2.getRawAxis(0) * (-0.5) + 0.5; - MechState manual_state = new MechState(chain_pos, arm_pos); - if (manual_state.isValid()) { - return command(manual_state); - } - return Commands.none(); - } - current_state = state; return next_cmd; } return Commands.none(); |