mirror of
https://github.com/Team4388/2026KPopRobotHunters.git
synced 2026-06-09 00:38:03 -06:00
Better Defense
This commit is contained in:
@@ -26,16 +26,16 @@ public class StayInPosition extends PID {
|
||||
Pose2d currentPose = drive.getCurrentPose();
|
||||
double translationX = targetPose.getX() - currentPose.getX();
|
||||
double translationY = targetPose.getY() - currentPose.getY();
|
||||
if (translationX > 0.8){
|
||||
translationX = 0.8;
|
||||
if (translationX > 0.2){
|
||||
translationX = 0.2;
|
||||
}
|
||||
if (translationY > 0.8){
|
||||
translationY = 0.8;
|
||||
if (translationY > 0.2){
|
||||
translationY = 0.2;
|
||||
}
|
||||
if (Math.abs(translationX) < 0.01 && Math.abs(translationY) < 0.01) {
|
||||
driveTranslation = new Translation2d();
|
||||
} else {
|
||||
driveTranslation = new Translation2d(translationX, translationY);
|
||||
driveTranslation = new Translation2d(translationX * 4.5, translationY * 4.5);
|
||||
}
|
||||
|
||||
drive.driveFieldAngleSIP(driveTranslation, targetPose.getRotation());
|
||||
|
||||
Reference in New Issue
Block a user