Skip to content

Commit 4be96a4

Browse files
committed
fix
1 parent fec5163 commit 4be96a4

File tree

7 files changed

+20
-16
lines changed

7 files changed

+20
-16
lines changed

src/main/java/frc/trigon/robot/commands/commandclasses/IntakeAssistCommand.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ public class IntakeAssistCommand extends ParallelCommandGroup {
2323
static final ProfiledPIDController
2424
X_PID_CONTROLLER = RobotHardwareStats.isSimulation() ?
2525
new ProfiledPIDController(0.5, 0, 0, new TrapezoidProfile.Constraints(2.8, 5)) :
26-
new ProfiledPIDController(0.6, 0, 0, new TrapezoidProfile.Constraints(2.65, 5.5)),
26+
new ProfiledPIDController(0.7, 0, 0, new TrapezoidProfile.Constraints(2.65, 4.5)),
2727
Y_PID_CONTROLLER = RobotHardwareStats.isSimulation() ?
2828
new ProfiledPIDController(0.5, 0, 0, new TrapezoidProfile.Constraints(2.8, 5)) :
2929
new ProfiledPIDController(0.25, 0, 0.03, new TrapezoidProfile.Constraints(2.65, 4)),
3030
THETA_PID_CONTROLLER = RobotHardwareStats.isSimulation() ?
3131
new ProfiledPIDController(0.4, 0, 0, new TrapezoidProfile.Constraints(2.8, 5)) :
32-
new ProfiledPIDController(0.2, 0, 0, new TrapezoidProfile.Constraints(2.65, 5.5));
32+
new ProfiledPIDController(0.6, 0, 0, new TrapezoidProfile.Constraints(2.8, 4.5));
3333
private Translation2d distanceFromTrackedGamePiece;
3434

3535
/**
@@ -161,6 +161,7 @@ private static double calculateNormalAssistPower(double pidOutput, double joysti
161161

162162
private static void resetPIDControllers(Translation2d distanceFromTrackedGamePiece) {
163163
X_PID_CONTROLLER.reset(distanceFromTrackedGamePiece.getX(), RobotContainer.SWERVE.getSelfRelativeVelocity().vxMetersPerSecond);
164+
X_PID_CONTROLLER.setGoal(-0.15);
164165
Y_PID_CONTROLLER.reset(distanceFromTrackedGamePiece.getY(), RobotContainer.SWERVE.getSelfRelativeVelocity().vyMetersPerSecond);
165166
THETA_PID_CONTROLLER.reset(distanceFromTrackedGamePiece.getAngle().plus(Rotation2d.k180deg).unaryMinus().getRadians(), RobotContainer.SWERVE.getSelfRelativeVelocity().omegaRadiansPerSecond);
166167
}

src/main/java/frc/trigon/robot/commands/commandfactories/AutonomousCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static Command getFindCoralCommand(boolean isRight) {
5151
SwerveCommands.getClosedLoopSelfRelativeDriveCommand(
5252
() -> 0,
5353
() -> 0,
54-
() -> AutonomousConstants.AUTO_FIND_CORAL_ROTATION_POWER
54+
() -> 0
5555
)
5656
);
5757
}

src/main/java/frc/trigon/robot/subsystems/armelevator/ArmElevatorCommands.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import frc.trigon.robot.RobotContainer;
77
import frc.trigon.robot.commands.commandfactories.GeneralCommands;
88
import frc.trigon.robot.constants.OperatorConstants;
9+
import frc.trigon.robot.subsystems.endeffector.EndEffectorCommands;
10+
import frc.trigon.robot.subsystems.endeffector.EndEffectorConstants;
911
import frc.trigon.robot.subsystems.swerve.SwerveCommands;
1012
import lib.commands.ExecuteEndCommand;
1113
import lib.commands.GearRatioCalculationCommand;
@@ -45,10 +47,11 @@ public static Command resetElevatorPositionCommand() {
4547
RobotContainer.ARM_ELEVATOR
4648
).until(() -> RobotContainer.ARM_ELEVATOR.atState(ArmElevatorConstants.ArmElevatorState.ZERO_ELEVATOR)),
4749
new ExecuteEndCommand(
48-
() -> RobotContainer.ARM_ELEVATOR.setElevatorVoltage(-OperatorConstants.DRIVER_CONTROLLER.getRightY() * 2),
50+
() -> RobotContainer.ARM_ELEVATOR.setElevatorVoltage(OperatorConstants.DRIVER_CONTROLLER.getRightY() * 2),
4951
() -> {},
5052
RobotContainer.ARM_ELEVATOR
51-
)).alongWith(SwerveCommands.getOpenLoopFieldRelativeDriveCommand(() -> 0, () -> 0, () -> 0)).finallyDo(RobotContainer.ARM_ELEVATOR::resetElevatorPosition);
53+
)
54+
).alongWith(SwerveCommands.getOpenLoopFieldRelativeDriveCommand(() -> 0, () -> 0, () -> 0), EndEffectorCommands.getSetTargetStateCommand(EndEffectorConstants.EndEffectorState.EJECT)).finallyDo(RobotContainer.ARM_ELEVATOR::resetElevatorPosition);
5255
}
5356

5457
public static Command getSetTargetStateCommand(ArmElevatorConstants.ArmElevatorState targetState) {

src/main/java/frc/trigon/robot/subsystems/armelevator/ArmElevatorConstants.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public class ArmElevatorConstants {
4848
private static final double
4949
ARM_MOTOR_CURRENT_LIMIT = 50,
5050
ELEVATOR_MOTOR_CURRENT_LIMIT = 50;
51-
private static final double ANGLE_ENCODER_GRAVITY_OFFSET = 0.184814453125 - 0.25;
52-
static final double ARM_POSITION_OFFSET_FROM_GRAVITY_OFFSET = RobotHardwareStats.isSimulation() ? 0 : 0.184814453125 - 0.25 - ANGLE_ENCODER_GRAVITY_OFFSET;
51+
private static final double ANGLE_ENCODER_GRAVITY_OFFSET = 0.347412109375 - 0.25;
52+
static final double ARM_POSITION_OFFSET_FROM_GRAVITY_OFFSET = RobotHardwareStats.isSimulation() ? 0 : 0.347412109375 - 0.25 - ANGLE_ENCODER_GRAVITY_OFFSET;
5353
private static final boolean
5454
SHOULD_ARM_FOLLOWER_OPPOSE_MASTER = false,
5555
SHOULD_ELEVATOR_FOLLOWER_OPPOSE_MASTER = false;
@@ -186,11 +186,11 @@ private static void configureArmMasterMotor() {
186186
config.Feedback.FeedbackRemoteSensorID = ANGLE_ENCODER.getID();
187187
config.Feedback.FeedbackSensorSource = FeedbackSensorSourceValue.RemoteCANcoder;
188188

189-
config.Slot0.kP = RobotHardwareStats.isSimulation() ? 34 : 60;
189+
config.Slot0.kP = RobotHardwareStats.isSimulation() ? 34 : 55;
190190
config.Slot0.kI = RobotHardwareStats.isSimulation() ? 0 : 0;
191191
config.Slot0.kD = RobotHardwareStats.isSimulation() ? 3 : 1.2;
192192
config.Slot0.kS = RobotHardwareStats.isSimulation() ? 0.026331 : 0.06;
193-
config.Slot0.kV = RobotHardwareStats.isSimulation() ? 4.8752 : 5.6;
193+
config.Slot0.kV = RobotHardwareStats.isSimulation() ? 4.8752 : 4.3;
194194
config.Slot0.kA = RobotHardwareStats.isSimulation() ? 0.17848 : 0;
195195
config.Slot0.kG = RobotHardwareStats.isSimulation() ? 0.1117 : 0.358;
196196

@@ -252,7 +252,7 @@ private static void configureElevatorMasterMotor() {
252252
config.MotorOutput.Inverted = InvertedValue.Clockwise_Positive;
253253
config.Feedback.SensorToMechanismRatio = ELEVATOR_GEAR_RATIO;
254254

255-
config.Slot0.kP = RobotHardwareStats.isSimulation() ? 3.5 : 12;
255+
config.Slot0.kP = RobotHardwareStats.isSimulation() ? 3.5 : 17;
256256
config.Slot0.kI = RobotHardwareStats.isSimulation() ? 0 : 0;
257257
config.Slot0.kD = RobotHardwareStats.isSimulation() ? 0.4 : 1;
258258
config.Slot0.kS = RobotHardwareStats.isSimulation() ? 0.016165 : 0.0546875;
@@ -341,11 +341,11 @@ public enum ArmElevatorState {
341341
SCORE_L3(Rotation2d.fromDegrees(25), PREPARE_SCORE_L3.targetPositionMeters, PREPARE_SCORE_L3, false, 0.8),
342342
SCORE_L4(Rotation2d.fromDegrees(-10), 1.5, PREPARE_SCORE_L4, false, 0.8),
343343
SCORE_NET(Rotation2d.fromDegrees(70), 1.61, null, false, 0.3),
344-
SCORE_PROCESSOR(Rotation2d.fromDegrees(0), 0.603, null, false, 0.7),
344+
SCORE_PROCESSOR(Rotation2d.fromDegrees(0), 0.1, null, false, 0.6),
345345
COLLECT_ALGAE_L2(Rotation2d.fromDegrees(0), 0.603, null, false, 1),
346-
COLLECT_ALGAE_L3(Rotation2d.fromDegrees(0), 1.2, null, false, 1),
346+
COLLECT_ALGAE_L3(Rotation2d.fromDegrees(0), 1.15, null, false, 1),
347347
PREPARE_COLLECT_ALGAE_FLOOR(Rotation2d.fromDegrees(-30), 0.3, null, false, 1),
348-
COLLECT_ALGAE_FLOOR(Rotation2d.fromDegrees(-30), 0.13, PREPARE_COLLECT_ALGAE_FLOOR, true, 1),
348+
COLLECT_ALGAE_FLOOR(Rotation2d.fromDegrees(-32), 0.16, PREPARE_COLLECT_ALGAE_FLOOR, true, 1),
349349
COLLECT_ALGAE_LOLLIPOP(Rotation2d.fromDegrees(0), 0.15, null, false, 1);
350350

351351

src/main/java/frc/trigon/robot/subsystems/climber/ClimberCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static Command getDebuggingCommand() {
2424

2525
public static Command resetClimberPositionCommand() {
2626
return new ExecuteEndCommand(
27-
() -> RobotContainer.CLIMBER.setTargetVoltage(-OperatorConstants.DRIVER_CONTROLLER.getRightY() * 3),
27+
() -> RobotContainer.CLIMBER.setTargetVoltage(OperatorConstants.DRIVER_CONTROLLER.getRightY() * 3),
2828
RobotContainer.CLIMBER::resetClimberPosition,
2929
RobotContainer.CLIMBER
3030
).alongWith(SwerveCommands.getOpenLoopFieldRelativeDriveCommand(() -> 0, () -> 0, () -> 0));

src/main/java/frc/trigon/robot/subsystems/endeffector/EndEffectorConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class EndEffectorConstants {
5050
private static final double
5151
DISTANCE_SENSOR_SCALING_SLOPE = 0.0002,
5252
DISTANCE_SENSOR_SCALING_INTERCEPT_POINT = -200;
53-
private static final double COLLECTION_DETECTION_DISTANCE_CENTIMETRES = 5;
53+
private static final double COLLECTION_DETECTION_DISTANCE_CENTIMETRES = 4;
5454
static final BooleanEvent COLLECTION_DETECTION_BOOLEAN_EVENT = new BooleanEvent(
5555
CommandScheduler.getInstance().getActiveButtonLoop(),
5656
() -> DISTANCE_SENSOR.getScaledValue() < COLLECTION_DETECTION_DISTANCE_CENTIMETRES

src/main/java/frc/trigon/robot/subsystems/intake/IntakeCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static Command getDebuggingCommand() {
2626

2727
public static Command resetIntakePositionCommand() {
2828
return new ExecuteEndCommand(
29-
() -> RobotContainer.INTAKE.setAngleMotorVoltage(-OperatorConstants.DRIVER_CONTROLLER.getRightY() * 2),
29+
() -> RobotContainer.INTAKE.setAngleMotorVoltage(OperatorConstants.DRIVER_CONTROLLER.getRightY() * 2),
3030
RobotContainer.INTAKE::resetIntakePosition,
3131
RobotContainer.INTAKE
3232
).alongWith(SwerveCommands.getOpenLoopFieldRelativeDriveCommand(() -> 0, () -> 0, () -> 0));

0 commit comments

Comments
 (0)