mirror of
https://github.com/Team4388/2026KPopRobotHunters.git
synced 2026-06-09 00:38:03 -06:00
Update StayInPosition.java
This commit is contained in:
@@ -27,15 +27,18 @@ public class StayInPosition extends PID {
|
|||||||
double translationX = targetPose.getX() - currentPose.getX();
|
double translationX = targetPose.getX() - currentPose.getX();
|
||||||
double translationY = targetPose.getY() - currentPose.getY();
|
double translationY = targetPose.getY() - currentPose.getY();
|
||||||
if (translationX > 0.2){
|
if (translationX > 0.2){
|
||||||
|
//If below is changed make this change too so it never goes over 1
|
||||||
translationX = 0.2;
|
translationX = 0.2;
|
||||||
}
|
}
|
||||||
if (translationY > 0.2){
|
if (translationY > 0.2){
|
||||||
|
//Same here
|
||||||
translationY = 0.2;
|
translationY = 0.2;
|
||||||
}
|
}
|
||||||
if (Math.abs(translationX) < 0.01 && Math.abs(translationY) < 0.01) {
|
if (Math.abs(translationX) < 0.01 && Math.abs(translationY) < 0.01) {
|
||||||
driveTranslation = new Translation2d();
|
driveTranslation = new Translation2d();
|
||||||
} else {
|
} else {
|
||||||
driveTranslation = new Translation2d(translationX * 4.5, translationY * 4.5);
|
//TODO: Tweak for best corrector against another bot
|
||||||
|
driveTranslation = new Translation2d(translationX * 4.5, translationY * 4.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
drive.driveFieldAngleSIP(driveTranslation, targetPose.getRotation());
|
drive.driveFieldAngleSIP(driveTranslation, targetPose.getRotation());
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ public interface ShooterIO {
|
|||||||
// Angle shooterTargetPitch = Rotations.of(0);
|
// Angle shooterTargetPitch = Rotations.of(0);
|
||||||
// Current pitchMotorCurrent = Amps.of(0);
|
// Current pitchMotorCurrent = Amps.of(0);
|
||||||
|
|
||||||
AngularVelocity motor1TargetVelocity = RotationsPerSecond.of(0);
|
AngularVelocity motor1TargetVelocity = RotationsPerSecond.of(40); // For modeling purposes
|
||||||
AngularVelocity motor2TargetVelocity = RotationsPerSecond.of(0);
|
AngularVelocity motor2TargetVelocity = RotationsPerSecond.of(0);
|
||||||
double indexerTargetOutput = 0;
|
double indexerTargetOutput = 0;
|
||||||
|
|
||||||
|
|
||||||
AngularVelocity motor1Velocity = RotationsPerSecond.of(0);
|
AngularVelocity motor1Velocity = RotationsPerSecond.of(0);
|
||||||
AngularVelocity motor2Velocity = RotationsPerSecond.of(0);
|
AngularVelocity motor2Velocity = RotationsPerSecond.of(0);
|
||||||
AngularVelocity indexerForwardVelocity = RotationsPerSecond.of(42.53); //guestimate
|
AngularVelocity indexerForwardVelocity = RotationsPerSecond.of(0);
|
||||||
double indexerOutput = 0;
|
double indexerOutput = 0;
|
||||||
|
|
||||||
Current motor1Current = Amps.of(0);
|
Current motor1Current = Amps.of(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user