diff --git a/.github/main.yml b/.github/workflows/main.yml similarity index 81% rename from .github/main.yml rename to .github/workflows/main.yml index 8993ae7..a3eb57a 100644 --- a/.github/main.yml +++ b/.github/workflows/main.yml @@ -27,6 +27,11 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - # Runs a single command using the runners shell - name: Compile and run tests on robot code - run: ./gradlew build \ No newline at end of file + run: ./gradlew build + + - name: Publish package + env: + Version: 0.0.${{ github.run_id }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew publish -PprojVersion="$Version" diff --git a/.github/pr.yml b/.github/workflows/pr.yml similarity index 100% rename from .github/pr.yml rename to .github/workflows/pr.yml diff --git a/build.gradle b/build.gradle index a4dea7f..0eecd1a 100644 --- a/build.gradle +++ b/build.gradle @@ -15,8 +15,6 @@ if (project.hasProperty('projVersion')) { project.version = '0.0.0' } -def ROBOT_MAIN_CLASS = "frc.robot.Main" - // Define my targets (RoboRIO) and artifacts (deployable files) // This is added by GradleRIO's backing project DeployUtils. deploy { @@ -35,8 +33,6 @@ deploy { frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) { files = project.fileTree('src/main/deploy') directory = '/home/lvuser/deploy' - deleteOldFiles = false // Change to true to delete files on roboRIO that no - // longer exist in deploy directory of this project } } } @@ -79,10 +75,6 @@ test { systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true' } -// Simulation configuration (e.g. environment variables). -wpi.sim.addGui().defaultEnabled = true -wpi.sim.addDriverstation() - // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') // in order to make them all available at runtime. Also adding the manifest so WPILib // knows where to look for our Robot Class. @@ -91,7 +83,6 @@ jar { from('src') { into 'backup/src' } from('vendordeps') { into 'backup/vendordeps' } from('build.gradle') { into 'backup' } - manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) duplicatesStrategy = DuplicatesStrategy.INCLUDE } @@ -118,10 +109,21 @@ publishing { publications { mavenJava(MavenPublication) { groupId = 'org.frc538' - artifactId = 'doc' + artifactId = 'leonardo' version = project.version from components.java } } + + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/frc538/leonardo" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } } diff --git a/src/main/java/frc538/leonardo/can/Kraken.java b/src/main/java/frc538/leonardo/can/Kraken.java new file mode 100644 index 0000000..57b346b --- /dev/null +++ b/src/main/java/frc538/leonardo/can/Kraken.java @@ -0,0 +1,28 @@ +package frc538.leonardo.can; + +import com.ctre.phoenix6.hardware.TalonFX; + +/** + * Custom wrapping for a TalonFX Motor Controller (Falcon 500) + */ +public class Kraken { + private final TalonFX mTalon; + + /** + * Creates a Falcon with the given CAN ID. + * + * @param canId the CAN ID of the Falcon's TalonFX + */ + public Kraken(int canId) { + mTalon = new TalonFX(canId); + } + + /** + * Sets the output of the motor. + * + * @param scaledOutput motor's output between -1.0 and +1.0 + */ + public void set(double scaledOutput) { + mTalon.set(scaledOutput); + } +} diff --git a/src/main/java/frc538/leonardo/can/Neo.java b/src/main/java/frc538/leonardo/can/Neo.java new file mode 100644 index 0000000..a3e0917 --- /dev/null +++ b/src/main/java/frc538/leonardo/can/Neo.java @@ -0,0 +1,29 @@ +package frc538.leonardo.can; + +import com.revrobotics.spark.SparkMax; +import com.revrobotics.spark.SparkLowLevel.MotorType; + +/** + * Custom wrapping for a SPARK Max Motor Controller (Neo or Neo 550) + */ +public class Neo { + private final SparkMax mNeo; + + /** + * Creates a Neo/Neo 550 with the given CAN ID. + * + * @param canId the CAN ID of the Neo's SPARK Max + */ + public Neo(int canId) { + mNeo = new SparkMax(canId, MotorType.kBrushless); + } + + /** + * Sets the output of the motor. + * + * @param scaledOutput motor's output between -1.0 and +1.0 + */ + public void set(double scaledOutput) { + mNeo.set(scaledOutput); + } +}