Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
spotless ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
realjoshuau committed Nov 7, 2024
1 parent 30ac321 commit 3b1ce3c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 46 deletions.
71 changes: 28 additions & 43 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
import org.littletonrobotics.junction.wpilog.WPILOGWriter;

/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to
* each mode, as described in the TimedRobot documentation. If you change the
* name of this class or
* the package after creating this project, you must also update the
* build.gradle file in the
* The VM is configured to automatically run this class, and to call the functions corresponding to
* each mode, as described in the TimedRobot documentation. If you change the name of this class or
* the package after creating this project, you must also update the build.gradle file in the
* project.
*/
public class Robot extends LoggedRobot implements Logged {
Expand All @@ -44,16 +41,15 @@ public class Robot extends LoggedRobot implements Logged {
private double correctionAngle;

/**
* This function is run when the robot is first started up and should be used
* for any
* This function is run when the robot is first started up and should be used for any
* initialization code.
*/
@Override
public void robotInit() {
System.out.println("--Robot.robotInit()--");
RobotController.setBrownoutVoltage(
4.75); // the "blackout" voltage is 4.5 // lowk if this bot dont work im setting this
// to
// to
// like 0
configureAdvantageKit();
if (Constants.FeatureFlags.kMonologueEnabled) {
Expand All @@ -64,15 +60,16 @@ public void robotInit() {
m_robotContainer = new RobotContainer();

Map<String, Integer> commandCounts = new HashMap<>();
BiConsumer<Command, Boolean> logCommandFunction = (Command command, Boolean active) -> {
String name = command.getName();
int count = commandCounts.getOrDefault(name, 0) + (active ? 1 : -1);
commandCounts.put(name, count);

Logger.recordOutput(
"CommandsUnique/" + name + "_" + Integer.toHexString(command.hashCode()), active);
Logger.recordOutput("CommandsAll/" + name, count > 0);
};
BiConsumer<Command, Boolean> logCommandFunction =
(Command command, Boolean active) -> {
String name = command.getName();
int count = commandCounts.getOrDefault(name, 0) + (active ? 1 : -1);
commandCounts.put(name, count);

Logger.recordOutput(
"CommandsUnique/" + name + "_" + Integer.toHexString(command.hashCode()), active);
Logger.recordOutput("CommandsAll/" + name, count > 0);
};
CommandScheduler.getInstance()
.onCommandInitialize(
(Command command) -> {
Expand Down Expand Up @@ -108,8 +105,9 @@ private void configureAdvantageKit() {
} else {
if (Constants.Logging.kAdvkitUseReplayLogs) {
setUseTiming(false); // Run as fast as possible
String logPath = LogFileUtil
.findReplayLog(); // Pull the replay log from AdvantageScope (or prompt the user)
String logPath =
LogFileUtil
.findReplayLog(); // Pull the replay log from AdvantageScope (or prompt the user)
Logger.setReplaySource(new WPILOGReader(logPath)); // Read replay log
// Save outputs to a new log
Logger.addDataReceiver(new WPILOGWriter(LogFileUtil.addPathSuffix(logPath, "_sim")));
Expand Down Expand Up @@ -166,13 +164,10 @@ private void configureMonologue() {
}

/**
* This function is called every 20 ms, no matter the mode. Use this for items
* like diagnostics
* This function is called every 20 ms, no matter the mode. Use this for items like diagnostics
* that you want ran during disabled, autonomous, teleoperated and test.
*
* <p>
* This runs after the mode specific periodic functions, but before LiveWindow
* and
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
* SmartDashboard integrated updating.
*/
@Override
Expand Down Expand Up @@ -204,17 +199,12 @@ public void robotPeriodic() {

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

@Override
public void disabledPeriodic() {
}
public void disabledPeriodic() {}

/**
* This autonomous runs the autonomous command selected by your
* {@link RobotContainer} class.
*/
/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
@Override
public void autonomousInit() {
m_autonomousCommand = m_robotContainer.getAutonomousCommand();
Expand All @@ -227,8 +217,7 @@ public void autonomousInit() {

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

@Override
public void teleopInit() {
Expand All @@ -243,8 +232,7 @@ public void teleopInit() {

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

@Override
public void testInit() {
Expand All @@ -254,8 +242,7 @@ public void testInit() {

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

@Override
public void driverStationConnected() {
Expand All @@ -275,11 +262,9 @@ public void driverStationConnected() {

/** This function is called once when the robot is first started up. */
@Override
public void simulationInit() {
}
public void simulationInit() {}

/** This function is called periodically whilst in simulation. */
@Override
public void simulationPeriodic() {
}
public void simulationPeriodic() {}
}
7 changes: 4 additions & 3 deletions src/main/java/frc/robot/utils/StackJumper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ public class StackJumper {
public static String getCallerMethodName() {
if (traceTime) {
double d = HALUtil.getFPGATime();
String methodName = StackWalker.getInstance()
.walk(stream -> stream.skip(2).findFirst().get())
.getMethodName();
String methodName =
StackWalker.getInstance()
.walk(stream -> stream.skip(2).findFirst().get())
.getMethodName();
System.out.println(
"Time to get method name: " + (HALUtil.getFPGATime() - d) + " ns for " + methodName);
return methodName;
Expand Down

0 comments on commit 3b1ce3c

Please sign in to comment.