Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
fix(auto): Add drive subsystem as dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Feb 11, 2024
1 parent c807ca6 commit 6e684be
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/main/java/frc/robot/auto/Auto.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,30 @@ public class Auto extends Subsystem {
/** Instance variable for the auto subsystem singleton. */
private static Auto instance = null;

/** Reference to the odometry subsystem. */
private final Odometry odometry;

/** Reference to the swerve subsystem. */
private final Swerve swerve;

/** Sendable chooser for the subsystem. */
private final SendableChooser<Command> autoChooser;

/** Creates a new instance of the auto subsystem. */
private Auto() {
Supplier<Pose2d> robotPositionSupplier = () -> Odometry.getInstance().getPosition();
odometry = Odometry.getInstance();
swerve = Swerve.getInstance();

Supplier<Pose2d> robotPositionSupplier = () -> odometry.getPosition();

Consumer<Pose2d> robotPositionConsumer =
position -> Odometry.getInstance().setPosition(position);
position -> odometry.setPosition(position);

Supplier<ChassisSpeeds> swerveChassisSpeedsSupplier =
() -> Swerve.getInstance().getChassisSpeeds();
() -> swerve.getChassisSpeeds();

Consumer<ChassisSpeeds> swerveChassisSpeedsConsumer =
chassisSpeeds -> Swerve.getInstance().setChassisSpeeds(chassisSpeeds);
chassisSpeeds -> swerve.setChassisSpeeds(chassisSpeeds);

HolonomicPathFollowerConfig holonomicPathFollowerConfig =
new HolonomicPathFollowerConfig(
Expand All @@ -56,7 +66,7 @@ private Auto() {
swerveChassisSpeedsConsumer,
holonomicPathFollowerConfig,
this::shouldFlipPath,
this);
swerve);

autoChooser = AutoBuilder.buildAutoChooser();
}
Expand Down

0 comments on commit 6e684be

Please sign in to comment.