Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
agrinmanriv0537 committed Jan 22, 2024
1 parent 4a5d4d4 commit e897024
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 5 deletions.
24 changes: 24 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ java {

def ROBOT_MAIN_CLASS = "frc.robot.Main"

repositories {
maven {
url = uri("https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit")
credentials {
username = "Mechanical-Advantage-Bot"
password = "\u0067\u0068\u0070\u005f\u006e\u0056\u0051\u006a\u0055\u004f\u004c\u0061\u0079\u0066\u006e\u0078\u006e\u0037\u0051\u0049\u0054\u0042\u0032\u004c\u004a\u006d\u0055\u0070\u0073\u0031\u006d\u0037\u004c\u005a\u0030\u0076\u0062\u0070\u0063\u0051"
}
}
mavenLocal()
}

configurations.all {
exclude group: "edu.wpi.first.wpilibj"
}

task(checkAkitInstall, dependsOn: "classes", type: JavaExec) {
mainClass = "org.littletonrobotics.junction.CheckInstall"
classpath = sourceSets.main.runtimeClasspath
}
compileJava.finalizedBy checkAkitInstall

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project DeployUtils.
deploy {
Expand Down Expand Up @@ -69,6 +90,9 @@ dependencies {

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
// testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

def akitJson = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text)
annotationProcessor "org.littletonrobotics.akit.junction:junction-autolog:$akitJson.version"
}

test {
Expand Down
41 changes: 36 additions & 5 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

package frc.robot;

import edu.wpi.first.wpilibj.TimedRobot;
import org.littletonrobotics.junction.LogFileUtil;
import org.littletonrobotics.junction.LoggedRobot;
import org.littletonrobotics.junction.Logger;
import org.littletonrobotics.junction.networktables.NT4Publisher;
import org.littletonrobotics.junction.wpilog.WPILOGReader;
import org.littletonrobotics.junction.wpilog.WPILOGWriter;
import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj.PowerDistribution.ModuleType;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;

Expand All @@ -14,7 +21,7 @@
* the package after creating this project, you must also update the build.gradle file in the
* project.
*/
public class Robot extends TimedRobot {
public class Robot extends LoggedRobot {

private Command m_autonomousCommand;

Expand All @@ -27,9 +34,33 @@ public class Robot extends TimedRobot {
*/
@Override
public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
m_robotContainer = new RobotContainer();
Logger.recordMetadata("ProjectName", "MyProject"); // Set a metadata value

if (isReal()) {
Logger.addDataReceiver(new WPILOGWriter()); // Log to a USB stick ("/U/logs")
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
new PowerDistribution(1, ModuleType.kCTRE); // Enables power distribution logging
} else {
setUseTiming(false); // Run as fast as possible
String logPath = LogFileUtil.findReplayLog(); // Pull the replay log from AdvantageScope
// (or prompt the user)

Check warning on line 46 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L46 <com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck>

Comment has incorrect indentation level 58, expected is 12, indentation should be the same level as line 47.
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:46:59: warning: Comment has incorrect indentation level 58, expected is 12, indentation should be the same level as line 47. (com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck)
Logger.setReplaySource(new WPILOGReader(logPath)); // Read replay log
Logger.addDataReceiver(new WPILOGWriter(LogFileUtil.addPathSuffix(logPath, "_sim"))); // Save

Check warning on line 48 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L48 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 105).
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:48:0: warning: Line is longer than 100 characters (found 105). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
// outputs

Check warning on line 49 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L49 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 108).
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:49:0: warning: Line is longer than 100 characters (found 108). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
// to

Check warning on line 50 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L50 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 103).
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:50:0: warning: Line is longer than 100 characters (found 103). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
// a

Check warning on line 51 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L51 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 102).
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:51:0: warning: Line is longer than 100 characters (found 102). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
// new

Check warning on line 52 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L52 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 104).
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:52:0: warning: Line is longer than 100 characters (found 104). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
// log

Check warning on line 53 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L53 <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck>

Line is longer than 100 characters (found 104).
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:53:0: warning: Line is longer than 100 characters (found 104). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)

Check warning on line 53 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L53 <com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck>

Comment has incorrect indentation level 98, expected is 12, indentation should be the same level as line 57.
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:53:99: warning: Comment has incorrect indentation level 98, expected is 12, indentation should be the same level as line 57. (com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck)

// Logger.disableDeterministicTimestamps() // See "Deterministic Timestamps" in the
// "Understanding Data Flow" page
Logger.start(); // Start logging! No more data receivers, replay sources, or metadata
// values may be added.

Check warning on line 58 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/Robot.java#L58 <com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck>

Comment has incorrect indentation level 28, expected is 12, indentation should be the same level as line 62.
Raw output
/github/workspace/./src/main/java/frc/robot/Robot.java:58:29: warning: Comment has incorrect indentation level 28, expected is 12, indentation should be the same level as line 62. (com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck)
// Instantiate our RobotContainer. This will perform all our button bindings, and put
// our
// autonomous chooser on the dashboard.
m_robotContainer = new RobotContainer();
}
}

/**
Expand Down
42 changes: 42 additions & 0 deletions vendordeps/AdvantageKit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"fileName": "AdvantageKit.json",
"name": "AdvantageKit",
"version": "3.0.2",
"uuid": "d820cc26-74e3-11ec-90d6-0242ac120003",
"frcYear": "2024",
"mavenUrls": [],
"jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json",
"javaDependencies": [
{
"groupId": "org.littletonrobotics.akit.junction",
"artifactId": "wpilib-shim",
"version": "3.0.2"
},
{
"groupId": "org.littletonrobotics.akit.junction",
"artifactId": "junction-core",
"version": "3.0.2"
},
{
"groupId": "org.littletonrobotics.akit.conduit",
"artifactId": "conduit-api",
"version": "3.0.2"
}
],
"jniDependencies": [
{
"groupId": "org.littletonrobotics.akit.conduit",
"artifactId": "conduit-wpilibio",
"version": "3.0.2",
"skipInvalidPlatforms": false,
"isJar": false,
"validPlatforms": [
"linuxathena",
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
]
}
],
"cppDependencies": []
}

0 comments on commit e897024

Please sign in to comment.