Skip to content

Commit

Permalink
fixed shooting while moving backwards and forwards, and patched odome…
Browse files Browse the repository at this point in the history
…try glitches
  • Loading branch information
2491NoMythic committed Nov 21, 2024
1 parent e98822c commit 76b2b19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public double calculateSpeakerAngle() {
offsetSpeakerX = Field.SHOOTER_RED_SPEAKER_X - targetOffset.getX();
offsetSpeakerY = Field.RED_SPEAKER_Y - targetOffset.getY();
} else {
offsetSpeakerX = Field.SHOOTER_BLUE_SPEAKER_X - targetOffset.getX();
offsetSpeakerX = Field.SHOOTER_BLUE_SPEAKER_X + targetOffset.getX();
offsetSpeakerY = Field.BLUE_SPEAKER_Y - targetOffset.getY();
}
double offsetDeltaX = Math.abs(dtvalues.getX() - offsetSpeakerX);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/DrivetrainSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void updateOdometryWithVision() {
}
if(!doRejectUpdate) {
Logger.recordOutput("Vision/MergesPose", estimate.pose);
odometer.addVisionMeasurement(new Pose2d(estimate.pose.getX(), estimate.pose.getY(), getGyroscopeRotation()), estimate.timestampSeconds);
odometer.addVisionMeasurement(estimate.pose, estimate.timestampSeconds);
}
RobotState.getInstance().LimelightsUpdated = true;
} else {
Expand Down Expand Up @@ -435,7 +435,7 @@ public double calculateSpeakerAngleMoving(){
correctionDirection = -1;
speakerX = Field.ROBOT_RED_SPEAKER_X;
}
offsetSpeakerX = speakerX+(targetOffset.getX()*correctionDirection);
offsetSpeakerX = speakerX-(targetOffset.getX()*correctionDirection);
offsetSpeakerY = speakerY+(targetOffset.getY()*correctionDirection);
offsetDeltaX = Math.abs(dtvalues.getX() - offsetSpeakerX);
offsetDeltaY = Math.abs(dtvalues.getY() - offsetSpeakerY);
Expand Down

0 comments on commit 76b2b19

Please sign in to comment.