Skip to content

Commit

Permalink
spotless Apply
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkerMeyers committed Jan 13, 2024
1 parent 19b6bee commit 08715e0
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 191 deletions.
26 changes: 12 additions & 14 deletions src/main/java/bhs/devilbotz/BuildConstants.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package bhs.devilbotz;

/**
* Automatically generated file containing build version information.
*/
/** Automatically generated file containing build version information. */
public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "Crescendo2024";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 6;
public static final String GIT_SHA = "6953095ae13c329bcab835ed51bd92802e10b482";
public static final String GIT_DATE = "2024-01-10 22:36:31 EST";
public static final String GIT_BRANCH = "main";
public static final String BUILD_DATE = "2024-01-12 14:32:22 EST";
public static final long BUILD_UNIX_TIME = 1705087942925L;
public static final int DIRTY = 1;
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "Crescendo2024";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 6;
public static final String GIT_SHA = "6953095ae13c329bcab835ed51bd92802e10b482";
public static final String GIT_DATE = "2024-01-10 22:36:31 EST";
public static final String GIT_BRANCH = "main";
public static final String BUILD_DATE = "2024-01-12 14:32:22 EST";
public static final long BUILD_UNIX_TIME = 1705087942925L;
public static final int DIRTY = 1;

private BuildConstants(){}
private BuildConstants() {}
}
13 changes: 5 additions & 8 deletions src/main/java/bhs/devilbotz/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@

import edu.wpi.first.wpilibj.RobotBase;

/**
* Main initialization function. Do not perform any initialization here.
*/
/** Main initialization function. Do not perform any initialization here. */
public final class Main {
private Main() {
}
private Main() {}

public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
}
264 changes: 118 additions & 146 deletions src/main/java/bhs/devilbotz/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,35 @@
* @see Logger
*/
public class Robot extends LoggedRobot {
private Command autonomousCommand;

private RobotContainer robotContainer;

/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*
* <p>Note that this will be called before the AdvantageKit logging system is initialized.
*/
@Override
public void robotInit() {
// START: Setup AdvantageKit

// Record build metadata generated by Gversion
Logger.recordMetadata("ProjectName", BuildConstants.MAVEN_NAME);
Logger.recordMetadata("BuildDate", BuildConstants.BUILD_DATE);
Logger.recordMetadata("GitSHA", BuildConstants.GIT_SHA);
Logger.recordMetadata("GitDate", BuildConstants.GIT_DATE);
Logger.recordMetadata("GitBranch", BuildConstants.GIT_BRANCH);
switch (BuildConstants.DIRTY) {
case 0 -> Logger.recordMetadata("GitDirty", "All changes committed");
case 1 -> Logger.recordMetadata("GitDirty", "Uncommitted changes");
default -> Logger.recordMetadata("GitDirty", "Unknown");
}

// Set up data receivers & replay source

// We will add support for replay mode later
private Command autonomousCommand;

private RobotContainer robotContainer;

/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*
* <p>Note that this will be called before the AdvantageKit logging system is initialized.
*/
@Override
public void robotInit() {
// START: Setup AdvantageKit

// Record build metadata generated by Gversion
Logger.recordMetadata("ProjectName", BuildConstants.MAVEN_NAME);
Logger.recordMetadata("BuildDate", BuildConstants.BUILD_DATE);
Logger.recordMetadata("GitSHA", BuildConstants.GIT_SHA);
Logger.recordMetadata("GitDate", BuildConstants.GIT_DATE);
Logger.recordMetadata("GitBranch", BuildConstants.GIT_BRANCH);
switch (BuildConstants.DIRTY) {
case 0 -> Logger.recordMetadata("GitDirty", "All changes committed");
case 1 -> Logger.recordMetadata("GitDirty", "Uncommitted changes");
default -> Logger.recordMetadata("GitDirty", "Unknown");
}

// Set up data receivers & replay source

// We will add support for replay mode later
/*if (Constants.AdvantageKit.REPLAY_MODE) {
// Running in replay mode
setUseTiming(false); // Run as fast as possible
Expand All @@ -61,127 +61,99 @@ public void robotInit() {
new WPILOGWriter(
LogFileUtil.addPathSuffix(logPath, "_sim"))); // Save outputs to a new log
} else {*/
if (isReal()) {
// Running on real robot
Logger.addDataReceiver(new WPILOGWriter("/media/sda1/")); // Log to a USB stick
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
} else {
// Running in simulation
Logger.addDataReceiver(new WPILOGWriter("")); // Log to a file in the current directory
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
}
// }

// Start logging! No more data receivers, replay sources, or metadata values maybe added.
Logger.start();

// END: Setup AdvantageKit
robotContainer = new RobotContainer();
}

/**
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*/
@Override
public void robotPeriodic() {
CommandScheduler.getInstance().run();
}

/**
* This function is called once each time the robot enters Disabled mode.
*/
@Override
public void disabledInit() {
}

/**
* This function is called periodically when disabled.
*/
@Override
public void disabledPeriodic() {
}

/**
* This function is called once each time the robot enters any mode except Disabled after leaving
* Disabled mode.
*/
@Override
public void disabledExit() {
}


/**
* This autonomous runs the autonomous command selected by your {@link RobotContainer} class.
*/
@Override
public void autonomousInit() {
autonomousCommand = robotContainer.getAutonomousCommand();

if (autonomousCommand != null) {
autonomousCommand.schedule();
}
if (isReal()) {
// Running on real robot
Logger.addDataReceiver(new WPILOGWriter("/media/sda1/")); // Log to a USB stick
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
} else {
// Running in simulation
Logger.addDataReceiver(new WPILOGWriter("")); // Log to a file in the current directory
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
}

/**
* This function is called periodically during autonomous.
*/
@Override
public void autonomousPeriodic() {
// }

// Start logging! No more data receivers, replay sources, or metadata values maybe added.
Logger.start();

// END: Setup AdvantageKit
robotContainer = new RobotContainer();
}

/**
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*/
@Override
public void robotPeriodic() {
CommandScheduler.getInstance().run();
}

/** This function is called once each time the robot enters Disabled mode. */
@Override
public void disabledInit() {}

/** This function is called periodically when disabled. */
@Override
public void disabledPeriodic() {}

/**
* This function is called once each time the robot enters any mode except Disabled after leaving
* Disabled mode.
*/
@Override
public void disabledExit() {}

/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
@Override
public void autonomousInit() {
autonomousCommand = robotContainer.getAutonomousCommand();

if (autonomousCommand != null) {
autonomousCommand.schedule();
}
}

/**
* This function is called once each time the robot exists Autonomous
*/
@Override
public void autonomousExit() {
}
/** This function is called periodically during autonomous. */
@Override
public void autonomousPeriodic() {}

/**
* This function is called once each time the robot enters Teleop mode.
*/
@Override
public void teleopInit() {
if (autonomousCommand != null) {
autonomousCommand.cancel();
}
}

/**
* This function is called periodically during operator control.
*/
@Override
public void teleopPeriodic() {
}

/**
* This function is called once each time the robot enters any mode except Disabled after leaving
* Teleop mode.
*/
@Override
public void teleopExit() {
}

/**
* This function is called once each time the robot enters Test mode.
*/
@Override
public void testInit() {
CommandScheduler.getInstance().cancelAll();
}

/**
* This function is called periodically during test mode.
*/
@Override
public void testPeriodic() {
}
/** This function is called once each time the robot exists Autonomous */
@Override
public void autonomousExit() {}

/**
* This function is called once each time the robot enters any mode except Disabled after leaving
* Test mode.
*/
@Override
public void testExit() {
/** This function is called once each time the robot enters Teleop mode. */
@Override
public void teleopInit() {
if (autonomousCommand != null) {
autonomousCommand.cancel();
}
}

/** This function is called periodically during operator control. */
@Override
public void teleopPeriodic() {}

/**
* This function is called once each time the robot enters any mode except Disabled after leaving
* Teleop mode.
*/
@Override
public void teleopExit() {}

/** This function is called once each time the robot enters Test mode. */
@Override
public void testInit() {
CommandScheduler.getInstance().cancelAll();
}

/** This function is called periodically during test mode. */
@Override
public void testPeriodic() {}

/**
* This function is called once each time the robot enters any mode except Disabled after leaving
* Test mode.
*/
@Override
public void testExit() {}
}
43 changes: 20 additions & 23 deletions src/main/java/bhs/devilbotz/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,26 @@
* @see Command
*/
public class RobotContainer {
/**
* The container for the robot. Contains subsystems, OI devices, and commands.
*/
public RobotContainer() {
configureBindings();
}
/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
configureBindings();
}

/**
* Use this method to define your button->command mappings. Buttons can be created by instantiating
* a {@link edu.wpi.first.wpilibj.GenericHID GenericHID} or one of its subclasses ({@link
* edu.wpi.first.wpilibj.Joystick Joystick} or {@link edu.wpi.first.wpilibj.XboxController
* XboxController}), and then passing it to a {@link edu.wpi.first.wpilibj2.command.button.JoystickButton
* JoystickButton}.
*/
private void configureBindings() {
}
/**
* Use this method to define your button->command mappings. Buttons can be created by
* instantiating a {@link edu.wpi.first.wpilibj.GenericHID GenericHID} or one of its subclasses
* ({@link edu.wpi.first.wpilibj.Joystick Joystick} or {@link edu.wpi.first.wpilibj.XboxController
* XboxController}), and then passing it to a {@link
* edu.wpi.first.wpilibj2.command.button.JoystickButton JoystickButton}.
*/
private void configureBindings() {}

/**
* Use this to pass the autonomous command to the main {@link Robot} class.
*
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured");
}
/**
* Use this to pass the autonomous command to the main {@link Robot} class.
*
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured");
}
}

0 comments on commit 08715e0

Please sign in to comment.