Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions buildSrc/src/main/groovy/java-common-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
id 'com.diffplug.spotless'
id 'idea'
}

java {
Expand Down Expand Up @@ -119,5 +120,23 @@ javadoc {
links += "https://codedocs.revrobotics.com/java/"
// PhotonVision
links += "https://javadocs.photonvision.org/release/"

// Converts `@apiNote` paragraph to "Note: " section in the generated javadoc
tags += 'apiNote:a:Api Note:'

// Converts `@implSpec` paragraph to "Implementation Requirements: " section in the generated javadoc
tags += 'implSpec:a:Implementation Requirements:'
}
}

task sourceJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}

idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
31 changes: 14 additions & 17 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'java-common-conventions'
id 'edu.wpi.first.GradleRIO' version '2026.1.1-beta-1'
id 'edu.wpi.first.GradleRIO' version '2026.1.1'
id 'maven-publish'
}

version = '2.0.0-alpha.1'
version = '2.0.0'

dependencies {
implementation wpi.java.deps.wpilib()
Expand Down Expand Up @@ -39,20 +39,6 @@ tasks.named('test') {
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
}

javadoc {
options.tags = [
// Converts `@apiNote` paragraph to "Note: " section in the generated javadoc
'apiNote:a:Api Note:',
// Converts `@implSpec` paragraph to "Implementation Requirements: " section in the generated javadoc
'implSpec:a:Implementation Requirements:'
]
}

task sourceJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}

publishing {
publications {
lib2813(MavenPublication) {
Expand All @@ -63,13 +49,24 @@ publishing {
pom {
name = '2813 Library'
description = 'Frequently reused code written by team 2813'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'mango'
name = 'kyle'
name = 'Kyle'
email = 'mangoiscute95@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git'
developerConnection = 'scm:git:git://github.com/Prospect-Robotics/lib2813.git'
url = 'https://team2813.com'
}
organization {
name = '2813 Gear Heads'
url = 'https://team2813.com'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public final void setSetpoint(T position) {
* Returns a command that sets the desired setpoint to the provided value.
*
* @param setpoint the position to go to.
* @since 2.0.0
*/
public final Command setSetpointCommand(T setpoint) {
return new InstantCommand(() -> this.setSetpoint(setpoint), this);
Expand Down Expand Up @@ -168,6 +169,8 @@ public final void enable() {
*
* <p>The motor voltage will be set to zero, and the motor will not adjust to move towards the
* current setpoint.
*
* @since 2.0.0
*/
@Override
public final void stopMotor() {
Expand Down Expand Up @@ -200,23 +203,13 @@ public final void set(ControlMode mode, double demand) {
motor.set(mode, demand);
}

/**
* Clamps the given output value and provides it to the motor.
*
* @param output The output calculated by the PID algorithm.
* @param setpoint Ignored.
*/
private void useOutput(double output, double setpoint) {
motor.set(controlMode, clampOutput(output));
}

/**
* Clamps the given output value and provides it to the motor.
*
* <p>This is called by {@link #periodic()} if this subsystem is enabled.
*/
private void useOutput(double output) {
useOutput(output, controller.getSetpoint());
motor.set(controlMode, clampOutput(output));
}

/**
Expand All @@ -227,6 +220,7 @@ private void useOutput(double output) {
* @param output Output provided by the PID controller.
* @return Output to provide to the motor.
* @see edu.wpi.first.math.MathUtil#clamp(double, double, double)
* @since 2.0.0
*/
protected double clampOutput(double output) {
return output;
Expand Down Expand Up @@ -384,7 +378,12 @@ public MotorSubsystemConfiguration startingPosition(Supplier<Angle> startingPosi
return startingPosition(startingPositionSupplier.get());
}

/** Sets the acceptable position error. */
/**
* Sets the acceptable position error.
*
* @param error the error which is considered tolerable for use with {@code }atPosition()}
* @return {@code this} for chaining
*/
public MotorSubsystemConfiguration acceptableError(double error) {
this.acceptableError = error;
return this;
Expand All @@ -393,14 +392,22 @@ public MotorSubsystemConfiguration acceptableError(double error) {
/**
* Sets the unit to use for PID calculations
*
* @param rotationUnit The angle unit to use for calculations
* @param rotationUnit the angle unit to use for calculations
* @return {@code this} for chaining
*/
public MotorSubsystemConfiguration rotationUnit(AngleUnit rotationUnit) {
startingPosition = rotationUnit.convertFrom(startingPosition, this.rotationUnit);
this.rotationUnit = rotationUnit;
return this;
}

/**
* Enables publishing of data to the provided network table instance.
*
* @param ntInstance the network table instance to publish to
* @return {@code this} for chaining
* @since 2.0.0
*/
public MotorSubsystemConfiguration publishTo(NetworkTableInstance ntInstance) {
this.ntInstance = ntInstance;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

/**
* A subsystem for an intake.
*
* @since 2.0.0
*/
public abstract class ParameterizedIntakeSubsystem extends SubsystemBase implements AutoCloseable {
private final Motor intakeMotor;
private final Params params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

import java.time.ZonedDateTime;

/** Holder for data collected at build time about the robot code. */
/**
* Holder for data collected at build time about the robot code.
*
* @since 2.0.0
*/
public interface BuildConstants {

/** The current git branch when the code was built. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
* // Log the build constants in the robot console as well.
* buildConstantsPublisher.log();
* }</pre>
*
* @since 2.0.0
*/
public final class BuildConstantsPublisher {
/** The name of the NetworkTable under which the build constants are published. */
Expand Down
Loading
Loading