Skip to content

Commit

Permalink
Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Anhysteretic committed Sep 21, 2024
1 parent d81eb07 commit 35ff2f7
Show file tree
Hide file tree
Showing 15 changed files with 608 additions and 176 deletions.
173 changes: 90 additions & 83 deletions src/main/java/com/team841/calliope/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,105 +17,112 @@
import org.littletonrobotics.junction.wpilog.WPILOGWriter;

public class Robot extends LoggedRobot {
private Command m_autonomousCommand;

private RobotContainer m_robotContainer;

@Override
public void robotInit() {

Logger.recordMetadata("ProjectName", "Calliope-software");
Logger.recordMetadata("TuningMode", Boolean.toString(RC.robotType == RC.RunType.DEV));
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");
break;
case 1:
Logger.recordMetadata("GitDirty", "Uncomitted changes");
break;
default:
Logger.recordMetadata("GitDirty", "Unknown");
break;
private Command m_autonomousCommand;

private RobotContainer m_robotContainer = RobotContainer.getInstance();

@Override
public void robotInit() {

Logger.recordMetadata("ProjectName", "Calliope-software");
Logger.recordMetadata("TuningMode", Boolean.toString(RC.robotType == RC.RunType.DEV));
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");
break;
case 1:
Logger.recordMetadata("GitDirty", "Uncomitted changes");
break;
default:
Logger.recordMetadata("GitDirty", "Unknown");
break;
}

switch (RC.robotType) {
case COMP, DEV:
Logger.addDataReceiver(new WPILOGWriter()); // Log to a USB stick ("/U/logs")
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
new PowerDistribution(1, PowerDistribution.ModuleType.kRev); // Enables power distribution logging
break;
case SIM:
Logger.addDataReceiver(new NT4Publisher()); // Save outputs to a new log
break;
case REPLAY:
setUseTiming(false);
String logPath = LogFileUtil.findReplayLog(); // Pull the replay log from AdvantageScope (or prompt the user)
Logger.setReplaySource(new WPILOGReader(logPath));
Logger.addDataReceiver(new WPILOGWriter(LogFileUtil.addPathSuffix(logPath, "_sim"), 0.01));
break;
}

Logger.start();
}

switch (RC.robotType){
case COMP:
Logger.addDataReceiver(new WPILOGWriter()); // Log to a USB stick ("/U/logs")
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
new PowerDistribution(1, PowerDistribution.ModuleType.kRev); // Enables power distribution logging
break;
case SIM:
Logger.addDataReceiver(new NT4Publisher()); // Save outputs to a new log
break;
case REPLAY:
setUseTiming(false);
String logPath = LogFileUtil.findReplayLog(); // Pull the replay log from AdvantageScope (or prompt the user)
Logger.setReplaySource(new WPILOGReader(logPath));
Logger.addDataReceiver(new WPILOGWriter(LogFileUtil.addPathSuffix(logPath, "_sim"), 0.01));
break;
@Override
public void robotPeriodic() {
CommandScheduler.getInstance().run();
}

Logger.start();

m_robotContainer = new RobotContainer();
}

@Override
public void robotPeriodic() {
CommandScheduler.getInstance().run();
}

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

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

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

@Override
public void autonomousInit() {
m_autonomousCommand = m_robotContainer.getAutonomousCommand();
@Override
public void autonomousInit() {
m_autonomousCommand = m_robotContainer.getAutonomousCommand();

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

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

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

@Override
public void teleopInit() {
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
@Override
public void teleopInit() {
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
}
}
}

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

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

@Override
public void testInit() {
CommandScheduler.getInstance().cancelAll();
}
@Override
public void testInit() {
CommandScheduler.getInstance().cancelAll();
}

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

@Override
public void testExit() {}
@Override
public void testExit() {
}
}
Loading

0 comments on commit 35ff2f7

Please sign in to comment.