Skip to content

Commit

Permalink
Add compensation degrees
Browse files Browse the repository at this point in the history
  • Loading branch information
suryatho committed Feb 16, 2024
1 parent 7818a28 commit 5e782cd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/org/littletonrobotics/frc2024/RobotState.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import edu.wpi.first.math.numbers.N3;
import edu.wpi.first.math.util.Units;
import java.util.NoSuchElementException;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.ExtensionMethod;
import org.littletonrobotics.frc2024.subsystems.drive.DriveConstants;
import org.littletonrobotics.frc2024.util.AllianceFlipUtil;
Expand All @@ -40,9 +42,7 @@ public record AimingParameters(

private static final LoggedTunableNumber lookahead =
new LoggedTunableNumber("RobotState/lookaheadS", 0.0);

private static final LoggedTunableNumber shotHeightCompensation =
new LoggedTunableNumber("RobotState/CompensationMeters", 0.05);
private static final double poseBufferSizeSeconds = 2.0;

/** Arm angle look up table key: meters, values: radians */
private static final InterpolatingDoubleTreeMap armAngleMap = new InterpolatingDoubleTreeMap();
Expand All @@ -53,7 +53,7 @@ public record AimingParameters(
armAngleMap.put(Double.MAX_VALUE, Units.degreesToRadians(15.0));
}

private static final double poseBufferSizeSeconds = 2.0;
@Setter @Getter private double shotCompensationDegrees = 0.0;

private static RobotState instance;

Expand Down Expand Up @@ -201,7 +201,8 @@ public AimingParameters getAimingParameters() {
latestParameters =
new AimingParameters(
targetVehicleDirection,
Rotation2d.fromRadians(armAngleMap.get(targetDistance)),
Rotation2d.fromRadians(
armAngleMap.get(targetDistance) + Units.degreesToRadians(shotCompensationDegrees)),
feedVelocity);
Logger.recordOutput("RobotState/AimingParameters/Direction", latestParameters.driveHeading());
Logger.recordOutput("RobotState/AimingParameters/ArmAngle", latestParameters.armAngle());
Expand Down

0 comments on commit 5e782cd

Please sign in to comment.