@@ -28,7 +28,7 @@ public class IntakeAssistCommand extends ParallelCommandGroup {
28
28
new ProfiledPIDController (0.5 , 0 , 0 , new TrapezoidProfile .Constraints (2.8 , 5 )) :
29
29
new ProfiledPIDController (0.3 , 0 , 0.03 , new TrapezoidProfile .Constraints (2.65 , 5.5 )),
30
30
THETA_PID_CONTROLLER = RobotHardwareStats .isSimulation () ?
31
- new ProfiledPIDController (0.2 , 0 , 0 , new TrapezoidProfile .Constraints (2.8 , 5 )) :
31
+ new ProfiledPIDController (0.4 , 0 , 0 , new TrapezoidProfile .Constraints (2.8 , 5 )) :
32
32
new ProfiledPIDController (2.4 , 0 , 0 , new TrapezoidProfile .Constraints (2.65 , 5.5 ));
33
33
private Translation2d distanceFromTrackedGamePiece ;
34
34
@@ -104,7 +104,15 @@ private static Translation2d calculateTranslationPower(AssistMode assistMode, Tr
104
104
private static double calculateThetaPower (AssistMode assistMode , Translation2d distanceFromTrackedGamePiece , double intakeAssistScalar ) {
105
105
if (distanceFromTrackedGamePiece == null || !assistMode .shouldAssistTheta )
106
106
return 0 ;
107
- return calculateThetaAssistPower (assistMode , distanceFromTrackedGamePiece .getAngle ().plus (Rotation2d .k180deg ), intakeAssistScalar );
107
+ Rotation2d distanceAngle = distanceFromTrackedGamePiece .getAngle ().plus (Rotation2d .k180deg ).unaryMinus ();
108
+ Rotation2d robotAngle = RobotContainer .ROBOT_POSE_ESTIMATOR .getEstimatedRobotPose ().getRotation ();
109
+ Rotation2d diff = robotAngle .minus (distanceAngle );
110
+ Logger .recordOutput ("IntakeAssist/difference" , diff );
111
+ Logger .recordOutput ("IntakeAssist/robotAngle" , robotAngle );
112
+ Logger .recordOutput ("IntakeAssist/distanceAngle" , distanceAngle );
113
+ var pow = calculateThetaAssistPower (assistMode , distanceAngle , intakeAssistScalar );
114
+ Logger .recordOutput ("IntakeAssist/pow" , pow );
115
+ return pow ;
108
116
}
109
117
110
118
private static Translation2d calculateAlternateAssistTranslationPower (Translation2d joystickValue , double xPIDOutput , double yPIDOutput ) {
@@ -155,7 +163,7 @@ private static double calculateNormalAssistPower(double pidOutput, double joysti
155
163
private static void resetPIDControllers (Translation2d distanceFromTrackedGamePiece ) {
156
164
X_PID_CONTROLLER .reset (distanceFromTrackedGamePiece .getX (), RobotContainer .SWERVE .getSelfRelativeVelocity ().vxMetersPerSecond );
157
165
Y_PID_CONTROLLER .reset (distanceFromTrackedGamePiece .getY (), RobotContainer .SWERVE .getSelfRelativeVelocity ().vyMetersPerSecond );
158
- THETA_PID_CONTROLLER .reset (distanceFromTrackedGamePiece .getAngle ().getRadians (), RobotContainer .SWERVE .getSelfRelativeVelocity ().omegaRadiansPerSecond );
166
+ THETA_PID_CONTROLLER .reset (distanceFromTrackedGamePiece .getAngle ().plus ( Rotation2d . k180deg ). unaryMinus (). getRadians (), RobotContainer .SWERVE .getSelfRelativeVelocity ().omegaRadiansPerSecond );
159
167
}
160
168
161
169
/**
0 commit comments