Skip to content

Commit

Permalink
Add arm angle to AimingParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
camearle20 committed Feb 11, 2024
1 parent 6acf6ce commit 0beef02
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main/java/org/littletonrobotics/frc2024/RobotState.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ public record OdometryObservation(

public record VisionObservation(Pose2d visionPose, double timestamp, Matrix<N3, N1> stdDevs) {}

public record AimingParameters(
Rotation2d driveHeading, double effectiveDistance, double radialFF) {}
public record AimingParameters(Rotation2d driveHeading, Rotation2d armAngle, double radialFF) {}

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

private static LoggedTunableNumber shotHeightCompensation =
new LoggedTunableNumber("Superstructure/CompensationInches", 6.0);

private static final double poseBufferSizeSeconds = 2.0;

private static RobotState instance;
Expand Down Expand Up @@ -176,7 +178,15 @@ public AimingParameters getAimingParameters() {
robotVelocity.dx * vehicleToGoalDirection.getSin() / targetDistance
- robotVelocity.dy * vehicleToGoalDirection.getCos() / targetDistance;

latestParameters = new AimingParameters(targetVehicleDirection, targetDistance, feedVelocity);
latestParameters =
new AimingParameters(
targetVehicleDirection,
new Rotation2d(
targetDistance - SuperstructureConstants.ArmConstants.armOrigin.getX(),
FieldConstants.Speaker.centerSpeakerOpening.getZ()
- SuperstructureConstants.ArmConstants.armOrigin.getY()
+ shotHeightCompensation.get()),
feedVelocity);
return latestParameters;
}

Expand Down

0 comments on commit 0beef02

Please sign in to comment.