Skip to content

Commit

Permalink
Merge pull request #14 from frc937/eat-dep-injection
Browse files Browse the repository at this point in the history
I ate dependency injection
  • Loading branch information
willitcode authored Jan 23, 2024
2 parents 8ba062a + d72986c commit 2a3f8f6
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spotless {
}

java {
licenseHeader '// Copyright (c) FIRST and other WPILib contributors.\n// Open Source Software; you can modify and/or share it under the terms of\n// the WPILib BSD license file in the root directory of this project.\n\n/*\n * Asimov\'s Laws:\n * The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm.\n * The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.\n * The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.\n */'
licenseHeader '// Copyright (c) FIRST and other WPILib contributors.\n// Open Source Software; you can modify and/or share it under the terms of\n// the WPILib BSD license file in the root directory of this project.\n\n/*\n * Asimov\'s Laws:\n * The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm.\n * The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.\n * The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.\n */\n\n'
removeUnusedImports()
formatAnnotations()
googleJavaFormat().reflowLongStrings()
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot;

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot;

import edu.wpi.first.wpilibj.RobotBase;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot;

import edu.wpi.first.wpilibj.TimedRobot;
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot;

import edu.wpi.first.math.MathUtil;
Expand Down Expand Up @@ -40,9 +41,9 @@ public class RobotContainer {
*/

/* For now, we don't make commands public static, as there isn't really a reason to. */
private final DriveRobotOriented driveRobotOriented = new DriveRobotOriented(drive);
private final DriveFieldOriented driveFieldOriented = new DriveFieldOriented(drive);
private final EnterXMode enterXMode = new EnterXMode(drive);
private final DriveRobotOriented driveRobotOriented = new DriveRobotOriented();
private final DriveFieldOriented driveFieldOriented = new DriveFieldOriented();
private final EnterXMode enterXMode = new EnterXMode();

/*
* ***********************
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/commands/DriveFieldOriented.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
Expand All @@ -18,8 +19,8 @@ public class DriveFieldOriented extends Command {
private final Drive drive;

/** Creates a new DriveFieldOriented. */
public DriveFieldOriented(Drive drive) {
this.drive = drive;
public DriveFieldOriented() {
this.drive = RobotContainer.drive;
addRequirements(drive);
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/commands/DriveRobotOriented.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
Expand All @@ -18,8 +19,8 @@ public class DriveRobotOriented extends Command {
private final Drive drive;

/** Creates a new DriveRobotOriented. */
public DriveRobotOriented(Drive drive) {
this.drive = drive;
public DriveRobotOriented() {
this.drive = RobotContainer.drive;
addRequirements(drive);
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/frc/robot/commands/EnterXMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.RobotContainer;
import frc.robot.subsystems.Drive;

public class EnterXMode extends Command {

private Drive drive;

/** Creates a new EnterXMode. */
public EnterXMode(Drive drive) {
this.drive = drive;
public EnterXMode() {
this.drive = RobotContainer.drive;
addRequirements(drive);
// Use addRequirements() here to declare subsystem dependencies.
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/subsystems/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.subsystems;

import edu.wpi.first.math.geometry.Translation2d;
Expand Down

0 comments on commit 2a3f8f6

Please sign in to comment.