mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[build] Bring naming checkstyle rules up to date with Google Style guide (#1781)
Also update Checkstyle to 8.38. Google changed their style guide from the last time we imported it. This PR brings in those naming changes. The change they made is allowing single letter member, parameter, and local variable names. They also added a lambda naming scheme and I thought it would be good to bring that in too.
This commit is contained in:
@@ -70,7 +70,7 @@ public final class CameraServer {
|
||||
private int m_nextPort;
|
||||
private String[] m_addresses;
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String makeSourceValue(int source) {
|
||||
switch (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))) {
|
||||
case kUsb:
|
||||
@@ -90,15 +90,16 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String makeStreamValue(String address, int port) {
|
||||
return "mjpg:http://" + address + ":" + port + "/?action=stream";
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
private synchronized String[] getSinkStreamValues(int sink) {
|
||||
// Ignore all but MjpegServer
|
||||
if (VideoSink.getKindFromInt(CameraServerJNI.getSinkKind(sink)) != VideoSink.Kind.kMjpeg) {
|
||||
if (VideoSink.getKindFromInt(CameraServerJNI.getSinkKind(sink))
|
||||
!= VideoSink.Kind.kMjpeg) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@ public final class CameraServer {
|
||||
return values.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
private synchronized String[] getSourceStreamValues(int source) {
|
||||
// Ignore all but HttpCamera
|
||||
if (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))
|
||||
@@ -160,7 +161,9 @@ public final class CameraServer {
|
||||
return values;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.AvoidUsingHardCodedIP", "PMD.CyclomaticComplexity"})
|
||||
@SuppressWarnings({"MissingJavadocMethod",
|
||||
"PMD.AvoidUsingHardCodedIP",
|
||||
"PMD.CyclomaticComplexity"})
|
||||
private synchronized void updateStreamValues() {
|
||||
// Over all the sinks...
|
||||
for (VideoSink i : m_sinks.values()) {
|
||||
@@ -205,7 +208,7 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String pixelFormatToString(PixelFormat pixelFormat) {
|
||||
switch (pixelFormat) {
|
||||
case kMJPEG:
|
||||
@@ -225,13 +228,13 @@ public final class CameraServer {
|
||||
|
||||
/// Provide string description of video mode.
|
||||
/// The returned string is "{width}x{height} {format} {fps} fps".
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String videoModeToString(VideoMode mode) {
|
||||
return mode.width + "x" + mode.height + " " + pixelFormatToString(mode.pixelFormat)
|
||||
+ " " + mode.fps + " fps";
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String[] getSourceModeValues(int sourceHandle) {
|
||||
VideoMode[] modes = CameraServerJNI.enumerateSourceVideoModes(sourceHandle);
|
||||
String[] modeStrings = new String[modes.length];
|
||||
@@ -241,7 +244,7 @@ public final class CameraServer {
|
||||
return modeStrings;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.CyclomaticComplexity"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.CyclomaticComplexity"})
|
||||
private static void putSourcePropertyValue(NetworkTable table, VideoEvent event, boolean isNew) {
|
||||
String name;
|
||||
String infoName;
|
||||
@@ -294,7 +297,7 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.UnusedLocalVariable", "PMD.ExcessiveMethodLength",
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.UnusedLocalVariable", "PMD.ExcessiveMethodLength",
|
||||
"PMD.NPathComplexity"})
|
||||
private CameraServer() {
|
||||
m_defaultUsbDevice = new AtomicInteger();
|
||||
|
||||
@@ -203,7 +203,6 @@ public class CameraServerJNI {
|
||||
kSourceBytesReceived(1),
|
||||
kSourceFramesReceived(2);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
TelemetryKind(int value) {
|
||||
|
||||
@@ -11,7 +11,6 @@ public class HttpCamera extends VideoCamera {
|
||||
public enum HttpCameraKind {
|
||||
kUnknown(0), kMJPGStreamer(1), kCSCore(2), kAxis(3);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
HttpCameraKind(int value) {
|
||||
|
||||
@@ -30,7 +30,6 @@ public class VideoEvent {
|
||||
kSinkPropertyValueUpdated(0x20000),
|
||||
kSinkPropertyChoicesUpdated(0x40000);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
Kind(int value) {
|
||||
|
||||
@@ -11,7 +11,6 @@ public class VideoMode {
|
||||
public enum PixelFormat {
|
||||
kUnknown(0), kMJPEG(1), kYUYV(2), kRGB565(3), kBGR(4), kGray(5);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
PixelFormat(int value) {
|
||||
|
||||
@@ -11,7 +11,6 @@ public class VideoProperty {
|
||||
public enum Kind {
|
||||
kNone(0), kBoolean(1), kInteger(2), kString(4), kEnum(8);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
Kind(int value) {
|
||||
|
||||
@@ -13,7 +13,6 @@ public class VideoSink implements AutoCloseable {
|
||||
public enum Kind {
|
||||
kUnknown(0), kMjpeg(2), kCv(4), kRaw(8);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
Kind(int value) {
|
||||
|
||||
@@ -13,7 +13,6 @@ public class VideoSource implements AutoCloseable {
|
||||
public enum Kind {
|
||||
kUnknown(0), kUsb(1), kHttp(2), kCv(4), kRaw(8);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
Kind(int value) {
|
||||
@@ -47,7 +46,6 @@ public class VideoSource implements AutoCloseable {
|
||||
*/
|
||||
kForceClose(2);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
ConnectionStrategy(int value) {
|
||||
|
||||
@@ -95,7 +95,7 @@ public final class HAL extends JNIWrapper {
|
||||
|
||||
public static native int nativeGetControlWord();
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static void getControlWord(ControlWord controlWord) {
|
||||
int word = nativeGetControlWord();
|
||||
controlWord.update((word & 1) != 0, ((word >> 1) & 1) != 0, ((word >> 2) & 1) != 0,
|
||||
@@ -104,7 +104,7 @@ public final class HAL extends JNIWrapper {
|
||||
|
||||
private static native int nativeGetAllianceStation();
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static AllianceStationID getAllianceStation() {
|
||||
switch (nativeGetAllianceStation()) {
|
||||
case 0:
|
||||
@@ -124,13 +124,13 @@ public final class HAL extends JNIWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static native boolean isNewControlData();
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static native void releaseDSMutex();
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static native boolean waitForDSDataTimeout(double timeout);
|
||||
|
||||
public static int kMaxJoystickAxes = 12;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class MatchInfoData {
|
||||
/**
|
||||
* Called from JNI to set the structure data.
|
||||
*/
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public void setData(String eventName, String gameSpecificMessage,
|
||||
int matchNumber, int replayNumber, int matchType) {
|
||||
this.eventName = eventName;
|
||||
|
||||
@@ -14,7 +14,7 @@ public final class CANExceptionFactory {
|
||||
static final int ERR_CANSessionMux_NotAllowed = -44088;
|
||||
static final int ERR_CANSessionMux_NotInitialized = -44089;
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.CyclomaticComplexity"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.CyclomaticComplexity"})
|
||||
public static void checkStatus(int status, int messageID) throws CANInvalidBufferException,
|
||||
CANMessageNotAllowedException, CANNotInitializedException, UncleanStatusException {
|
||||
switch (status) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CANStatus {
|
||||
@SuppressWarnings("MemberName")
|
||||
public int transmitErrorCount;
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public void setStatus(double percentBusUtilization, int busOffCount, int txFullCount,
|
||||
int receiveErrorCount, int transmitErrorCount) {
|
||||
this.percentBusUtilization = percentBusUtilization;
|
||||
|
||||
@@ -18,7 +18,6 @@ public enum NetworkTableType {
|
||||
kStringArray(0x40),
|
||||
kRpc(0x80);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
NetworkTableType(int value) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "8.12"
|
||||
toolVersion = "8.38"
|
||||
configDirectory = file("${project.rootDir}/styleguide")
|
||||
config = resources.text.fromFile(new File(configDirectory.get().getAsFile(), "checkstyle.xml"))
|
||||
}
|
||||
|
||||
@@ -30,10 +30,12 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
<property name="eachLine"
|
||||
value="true" />
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile">
|
||||
<property name="lineSeparator"
|
||||
value="lf" />
|
||||
<module name="LineLength">
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="max" value="100"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile" />
|
||||
<module name="SuppressWarningsFilter" />
|
||||
<module name="TreeWalker">
|
||||
<module name="SuppressionCommentFilter">
|
||||
@@ -79,12 +81,6 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
<property name="allowNonPrintableEscapes"
|
||||
value="true" />
|
||||
</module>
|
||||
<module name="LineLength">
|
||||
<property name="max"
|
||||
value="100" />
|
||||
<property name="ignorePattern"
|
||||
value="^package.*|^import.*|a href|href|http://|https://|ftp://" />
|
||||
</module>
|
||||
<module name="ImportOrder">
|
||||
<property name="option"
|
||||
value="bottom"/>
|
||||
@@ -107,13 +103,33 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH" />
|
||||
</module>
|
||||
<module name="NeedBraces" />
|
||||
<module name="LeftCurly" />
|
||||
<module name="RightCurly" />
|
||||
<module name="RightCurly">
|
||||
<property name="option"
|
||||
value="alone" />
|
||||
<module name="LeftCurly">
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT" />
|
||||
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
|
||||
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
|
||||
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
|
||||
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
|
||||
OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlySame"/>
|
||||
<property name="tokens"
|
||||
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
|
||||
LITERAL_DO"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens"
|
||||
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
|
||||
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF,
|
||||
COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="SuppressionXpathSingleFilter">
|
||||
<!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
<property name="query" value="//RCURLY[parent::SLIST[count(./*)=1]
|
||||
or preceding-sibling::*[last()][self::LCURLY]]"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors"
|
||||
@@ -170,19 +186,24 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format"
|
||||
value="^m_[a-z][a-z0-9][a-zA-Z0-9]*$" />
|
||||
value="^(m_[a-z]([a-zA-Z0-9]*)|value)$" />
|
||||
<message key="name.invalidPattern"
|
||||
value="Member name ''{0}'' must match pattern ''{1}''." />
|
||||
</module>
|
||||
<module name="ParameterName">
|
||||
<property name="format"
|
||||
value="^[a-z][a-z0-9][a-zA-Z0-9]*$" />
|
||||
value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
|
||||
<message key="name.invalidPattern"
|
||||
value="Parameter name ''{0}'' must match pattern ''{1}''." />
|
||||
</module>
|
||||
<module name="LambdaParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="CatchParameterName">
|
||||
<property name="format"
|
||||
value="^[a-z][a-z0-9][a-zA-Z0-9]*$" />
|
||||
value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
|
||||
<message key="name.invalidPattern"
|
||||
value="Catch parameter name ''{0}'' must match pattern ''{1}''." />
|
||||
</module>
|
||||
@@ -190,7 +211,7 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
<property name="tokens"
|
||||
value="VARIABLE_DEF" />
|
||||
<property name="format"
|
||||
value="^[a-z][a-z0-9][a-zA-Z0-9]*$" />
|
||||
value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" />
|
||||
<property name="allowOneCharVarInForLoop"
|
||||
value="true" />
|
||||
<message key="name.invalidPattern"
|
||||
@@ -226,24 +247,18 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
value="GenericWhitespace ''{0}'' is not preceded with whitespace." />
|
||||
</module>
|
||||
<module name="Indentation">
|
||||
<property name="basicOffset"
|
||||
value="2" />
|
||||
<property name="braceAdjustment"
|
||||
value="0" />
|
||||
<property name="caseIndent"
|
||||
value="2" />
|
||||
<property name="throwsIndent"
|
||||
value="4" />
|
||||
<property name="lineWrappingIndentation"
|
||||
value="4" />
|
||||
<property name="arrayInitIndent"
|
||||
value="2" />
|
||||
<property name="basicOffset" value="2"/>
|
||||
<property name="braceAdjustment" value="2"/>
|
||||
<property name="caseIndent" value="2"/>
|
||||
<property name="throwsIndent" value="4"/>
|
||||
<property name="lineWrappingIndentation" value="4"/>
|
||||
<property name="arrayInitIndent" value="2"/>
|
||||
</module>
|
||||
<module name="AbbreviationAsWordInName">
|
||||
<property name="ignoreFinal"
|
||||
value="false" />
|
||||
<property name="allowedAbbreviationLength"
|
||||
value="3" />
|
||||
value="4" />
|
||||
</module>
|
||||
<module name="OverloadMethodsDeclarationOrder" />
|
||||
<module name="VariableDeclarationUsageDistance" />
|
||||
@@ -280,24 +295,18 @@ module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF" />
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope"
|
||||
value="public" />
|
||||
<property name="allowMissingParamTags"
|
||||
value="true" />
|
||||
<property name="allowMissingThrowsTags"
|
||||
value="true" />
|
||||
<property name="allowMissingReturnTag"
|
||||
value="true" />
|
||||
<property name="minLineCount"
|
||||
value="2" />
|
||||
<property name="allowedAnnotations"
|
||||
value="Override, Test, Before, After, BeforeClass, AfterClass, Parameters" />
|
||||
<property name="allowUndeclaredRTE"
|
||||
value="true" />
|
||||
<property name="allowThrowsTagsForSubclasses"
|
||||
value="true" />
|
||||
<property name="suppressLoadErrors"
|
||||
value="true" />
|
||||
<property name="scope" value="public"/>
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="MissingJavadocMethod">
|
||||
<property name="scope" value="public"/>
|
||||
<property name="minLineCount" value="2"/>
|
||||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF,
|
||||
COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format"
|
||||
|
||||
@@ -6,7 +6,9 @@ suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
<suppress files=".*sim.*"
|
||||
checks="(LineLength|EmptyLineSeparator|ParameterName|ImportOrder|AbbreviationAsWordInName|JavadocMethod|NoFinalizer)" />
|
||||
<suppress files=".*test.*"
|
||||
checks="JavadocMethod" />
|
||||
checks="MissingJavadocMethod" />
|
||||
<suppress files=".*wpilibjIntegrationTests.*"
|
||||
checks="MissingJavadocMethod" />
|
||||
<suppress files=".*JNI.*"
|
||||
checks="(LineLength|EmptyLineSeparator|ParameterName)" />
|
||||
</suppressions>
|
||||
|
||||
@@ -37,7 +37,6 @@ public abstract class Trigger implements Sendable {
|
||||
*
|
||||
* @return whether get() return true or the internal table for SmartDashboard use is pressed.
|
||||
*/
|
||||
@SuppressWarnings("PMD.UselessParentheses")
|
||||
private boolean grab() {
|
||||
return get() || m_sendablePressed;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param i the integral value
|
||||
* @param d the derivative value
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(String name, double p, double i, double d) {
|
||||
super(name);
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output);
|
||||
@@ -69,7 +68,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param d the derivative value
|
||||
* @param period the time (in seconds) between calculations
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(String name, double p, double i, double d, double period) {
|
||||
super(name);
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output, period);
|
||||
@@ -83,7 +81,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param i the integral value
|
||||
* @param d the derivative value
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(double p, double i, double d) {
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output);
|
||||
}
|
||||
@@ -98,7 +95,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param d the derivative value
|
||||
* @param period the time (in seconds) between calculations
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(double p, double i, double d, double period) {
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output, period);
|
||||
}
|
||||
@@ -112,7 +108,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param d the derivative value
|
||||
* @param subsystem the subsystem that this command requires
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(String name, double p, double i, double d, Subsystem subsystem) {
|
||||
super(name, subsystem);
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output);
|
||||
@@ -129,7 +124,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param period the time (in seconds) between calculations
|
||||
* @param subsystem the subsystem that this command requires
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(String name, double p, double i, double d, double period,
|
||||
Subsystem subsystem) {
|
||||
super(name, subsystem);
|
||||
@@ -145,7 +139,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param d the derivative value
|
||||
* @param subsystem the subsystem that this command requires
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(double p, double i, double d, Subsystem subsystem) {
|
||||
super(subsystem);
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output);
|
||||
@@ -162,7 +155,6 @@ public abstract class PIDCommand extends Command {
|
||||
* @param period the time (in seconds) between calculations
|
||||
* @param subsystem the subsystem that this command requires
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDCommand(double p, double i, double d, double period, Subsystem subsystem) {
|
||||
super(subsystem);
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output, period);
|
||||
|
||||
@@ -55,7 +55,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
* @param i the integral value
|
||||
* @param d the derivative value
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDSubsystem(String name, double p, double i, double d) {
|
||||
super(name);
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output);
|
||||
@@ -71,7 +70,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
* @param d the derivative value
|
||||
* @param f the feed forward value
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDSubsystem(String name, double p, double i, double d, double f) {
|
||||
super(name);
|
||||
m_controller = new PIDController(p, i, d, f, m_source, m_output);
|
||||
@@ -89,7 +87,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
* @param f the feed forward value
|
||||
* @param period the time (in seconds) between calculations
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDSubsystem(String name, double p, double i, double d, double f, double period) {
|
||||
super(name);
|
||||
m_controller = new PIDController(p, i, d, f, m_source, m_output, period);
|
||||
@@ -104,7 +101,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
* @param i the integral value
|
||||
* @param d the derivative value
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDSubsystem(double p, double i, double d) {
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output);
|
||||
addChild("PIDController", m_controller);
|
||||
@@ -121,7 +117,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
* @param f the feed forward coefficient
|
||||
* @param period the time (in seconds) between calculations
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDSubsystem(double p, double i, double d, double f, double period) {
|
||||
m_controller = new PIDController(p, i, d, f, m_source, m_output, period);
|
||||
addChild("PIDController", m_controller);
|
||||
@@ -137,7 +132,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
* @param d the derivative value
|
||||
* @param period the time (in seconds) between calculations
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDSubsystem(double p, double i, double d, double period) {
|
||||
m_controller = new PIDController(p, i, d, m_source, m_output, period);
|
||||
addChild("PIDController", m_controller);
|
||||
@@ -219,7 +213,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
*
|
||||
* @param t the absolute tolerance
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public void setAbsoluteTolerance(double t) {
|
||||
m_controller.setAbsoluteTolerance(t);
|
||||
}
|
||||
@@ -230,7 +223,6 @@ public abstract class PIDSubsystem extends Subsystem {
|
||||
*
|
||||
* @param p the percent tolerance
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public void setPercentTolerance(double p) {
|
||||
m_controller.setPercentTolerance(p);
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ public class ShuffleboardTabTest {
|
||||
Sendable sendable = new InstantCommand("Command");
|
||||
String widgetType = "Command Widget";
|
||||
m_tab.add(sendable)
|
||||
.withWidget(widgetType)
|
||||
.withProperties(mapOf("foo", 1234, "bar", "baz"));
|
||||
.withWidget(widgetType)
|
||||
.withProperties(mapOf("foo", 1234, "bar", "baz"));
|
||||
|
||||
m_instance.update();
|
||||
String meta = "/Shuffleboard/.metadata/Tab/Command";
|
||||
|
||||
@@ -50,7 +50,6 @@ public class ADXL345_SPI implements Accelerometer, Sendable, AutoCloseable {
|
||||
/**
|
||||
* The integer value representing this enumeration.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public final byte value;
|
||||
|
||||
Axes(byte value) {
|
||||
|
||||
@@ -46,7 +46,6 @@ public class ADXL362 implements Accelerometer, Sendable, AutoCloseable {
|
||||
kY((byte) 0x02),
|
||||
kZ((byte) 0x04);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final byte value;
|
||||
|
||||
Axes(byte value) {
|
||||
|
||||
@@ -112,7 +112,6 @@ public class AnalogTriggerOutput extends DigitalSource implements Sendable {
|
||||
kRisingPulse(AnalogJNI.AnalogTriggerType.kRisingPulse),
|
||||
kFallingPulse(AnalogJNI.AnalogTriggerType.kFallingPulse);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private final int value;
|
||||
|
||||
AnalogTriggerType(int value) {
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class CameraServer {
|
||||
private int m_nextPort;
|
||||
private String[] m_addresses;
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String makeSourceValue(int source) {
|
||||
switch (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))) {
|
||||
case kUsb:
|
||||
@@ -93,12 +93,12 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String makeStreamValue(String address, int port) {
|
||||
return "mjpg:http://" + address + ":" + port + "/?action=stream";
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
private synchronized String[] getSinkStreamValues(int sink) {
|
||||
// Ignore all but MjpegServer
|
||||
if (VideoSink.getKindFromInt(CameraServerJNI.getSinkKind(sink)) != VideoSink.Kind.kMjpeg) {
|
||||
@@ -128,7 +128,7 @@ public final class CameraServer {
|
||||
return values.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
private synchronized String[] getSourceStreamValues(int source) {
|
||||
// Ignore all but HttpCamera
|
||||
if (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))
|
||||
@@ -163,7 +163,7 @@ public final class CameraServer {
|
||||
return values;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.AvoidUsingHardCodedIP"})
|
||||
private synchronized void updateStreamValues() {
|
||||
// Over all the sinks...
|
||||
for (VideoSink i : m_sinks.values()) {
|
||||
@@ -206,7 +206,7 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String pixelFormatToString(PixelFormat pixelFormat) {
|
||||
switch (pixelFormat) {
|
||||
case kMJPEG:
|
||||
@@ -226,13 +226,13 @@ public final class CameraServer {
|
||||
|
||||
/// Provide string description of video mode.
|
||||
/// The returned string is "{width}x{height} {format} {fps} fps".
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String videoModeToString(VideoMode mode) {
|
||||
return mode.width + "x" + mode.height + " " + pixelFormatToString(mode.pixelFormat)
|
||||
+ " " + mode.fps + " fps";
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
private static String[] getSourceModeValues(int sourceHandle) {
|
||||
VideoMode[] modes = CameraServerJNI.enumerateSourceVideoModes(sourceHandle);
|
||||
String[] modeStrings = new String[modes.length];
|
||||
@@ -242,7 +242,7 @@ public final class CameraServer {
|
||||
return modeStrings;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.CyclomaticComplexity"})
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.CyclomaticComplexity"})
|
||||
private static void putSourcePropertyValue(NetworkTable table, VideoEvent event, boolean isNew) {
|
||||
String name;
|
||||
String infoName;
|
||||
@@ -295,7 +295,7 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.UnusedLocalVariable", "PMD.ExcessiveMethodLength",
|
||||
@SuppressWarnings({"MissingJavadocMethod", "PMD.UnusedLocalVariable", "PMD.ExcessiveMethodLength",
|
||||
"PMD.NPathComplexity"})
|
||||
private CameraServer() {
|
||||
m_defaultUsbDevice = new AtomicInteger();
|
||||
|
||||
@@ -49,7 +49,6 @@ public class Counter implements CounterBase, PIDSource, Sendable, AutoCloseable
|
||||
*/
|
||||
kExternalDirection(3);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Mode(int value) {
|
||||
|
||||
@@ -30,7 +30,6 @@ public interface CounterBase {
|
||||
*/
|
||||
k4X(2);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
EncodingType(int value) {
|
||||
|
||||
@@ -31,7 +31,6 @@ public class Encoder implements CounterBase, PIDSource, Sendable, AutoCloseable
|
||||
public enum IndexingType {
|
||||
kResetWhileHigh(0), kResetWhileLow(1), kResetOnFallingEdge(2), kResetOnRisingEdge(3);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
IndexingType(int value) {
|
||||
@@ -42,12 +41,10 @@ public class Encoder implements CounterBase, PIDSource, Sendable, AutoCloseable
|
||||
/**
|
||||
* The a source.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
protected DigitalSource m_aSource; // the A phase of the quad encoder
|
||||
/**
|
||||
* The b source.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
protected DigitalSource m_bSource; // the B phase of the quad encoder
|
||||
/**
|
||||
* The index source.
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.File;
|
||||
* the RoboRIO path /home/lvuser in a simulation-compatible way.</p>
|
||||
*/
|
||||
public final class Filesystem {
|
||||
private Filesystem() { }
|
||||
private Filesystem() {}
|
||||
|
||||
/**
|
||||
* Obtains the current working path that the program was launched with.
|
||||
|
||||
@@ -39,7 +39,6 @@ public abstract class GenericHID {
|
||||
kHIDFlight(23),
|
||||
kHID1stPerson(24);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
@SuppressWarnings("PMD.UseConcurrentHashMap")
|
||||
private static final Map<Integer, HIDType> map = new HashMap<>();
|
||||
@@ -65,7 +64,6 @@ public abstract class GenericHID {
|
||||
public enum Hand {
|
||||
kLeft(0), kRight(1);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Hand(int value) {
|
||||
|
||||
@@ -24,7 +24,6 @@ public class I2C implements AutoCloseable {
|
||||
public enum Port {
|
||||
kOnboard(0), kMXP(1);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Port(int value) {
|
||||
|
||||
@@ -14,11 +14,10 @@ import edu.wpi.first.hal.util.AllocationException;
|
||||
* Base for sensors to be used with interrupts.
|
||||
*/
|
||||
public abstract class InterruptableSensorBase implements AutoCloseable {
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public enum WaitResult {
|
||||
kTimeout(0x0), kRisingEdge(0x1), kFallingEdge(0x100), kBoth(0x101);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
WaitResult(int value) {
|
||||
|
||||
@@ -27,7 +27,6 @@ public class Joystick extends GenericHID {
|
||||
public enum AxisType {
|
||||
kX(0), kY(1), kZ(2), kTwist(3), kThrottle(4);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
AxisType(int value) {
|
||||
@@ -41,7 +40,6 @@ public class Joystick extends GenericHID {
|
||||
public enum ButtonType {
|
||||
kTrigger(1), kTop(2);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
ButtonType(int value) {
|
||||
@@ -55,7 +53,6 @@ public class Joystick extends GenericHID {
|
||||
private enum Button {
|
||||
kTrigger(1), kTop(2);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Button(int value) {
|
||||
@@ -69,7 +66,6 @@ public class Joystick extends GenericHID {
|
||||
private enum Axis {
|
||||
kX(0), kY(1), kZ(2), kTwist(3), kThrottle(4), kNumAxes(5);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Axis(int value) {
|
||||
|
||||
@@ -7,7 +7,6 @@ package edu.wpi.first.wpilibj;
|
||||
@Deprecated(since = "2020", forRemoval = true)
|
||||
@SuppressWarnings("SummaryJavadoc")
|
||||
public interface PIDInterface {
|
||||
@SuppressWarnings("ParameterName")
|
||||
void setPID(double p, double i, double d);
|
||||
|
||||
double getP();
|
||||
|
||||
@@ -267,7 +267,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
*/
|
||||
public abstract void endCompetition();
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static boolean getBooleanProperty(String name, boolean defaultValue) {
|
||||
String propVal = System.getProperty(name);
|
||||
if (propVal == null) {
|
||||
|
||||
@@ -30,7 +30,6 @@ public class RobotDrive extends MotorSafety implements AutoCloseable {
|
||||
public enum MotorType {
|
||||
kFrontLeft(0), kFrontRight(1), kRearLeft(2), kRearRight(3);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
MotorType(int value) {
|
||||
@@ -445,29 +444,24 @@ public class RobotDrive extends MotorSafety implements AutoCloseable {
|
||||
* @param gyroAngle The current angle reading from the gyro. Use this to implement field-oriented
|
||||
* controls.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public void mecanumDrive_Cartesian(double x, double y, double rotation, double gyroAngle) {
|
||||
if (!kMecanumCartesian_Reported) {
|
||||
HAL.report(tResourceType.kResourceType_RobotDrive, tInstances.kRobotDrive_MecanumCartesian,
|
||||
getNumMotors());
|
||||
kMecanumCartesian_Reported = true;
|
||||
}
|
||||
@SuppressWarnings("LocalVariableName")
|
||||
double xIn = x;
|
||||
@SuppressWarnings("LocalVariableName")
|
||||
double yIn = y;
|
||||
// Negate y for the joystick.
|
||||
yIn = -yIn;
|
||||
y = -y;
|
||||
// Compensate for gyro angle.
|
||||
double[] rotated = rotateVector(xIn, yIn, gyroAngle);
|
||||
xIn = rotated[0];
|
||||
yIn = rotated[1];
|
||||
double[] rotated = rotateVector(x, y, gyroAngle);
|
||||
x = rotated[0];
|
||||
y = rotated[1];
|
||||
|
||||
double[] wheelSpeeds = new double[kMaxNumberOfMotors];
|
||||
wheelSpeeds[MotorType.kFrontLeft.value] = xIn + yIn + rotation;
|
||||
wheelSpeeds[MotorType.kFrontRight.value] = -xIn + yIn - rotation;
|
||||
wheelSpeeds[MotorType.kRearLeft.value] = -xIn + yIn + rotation;
|
||||
wheelSpeeds[MotorType.kRearRight.value] = xIn + yIn - rotation;
|
||||
wheelSpeeds[MotorType.kFrontLeft.value] = x + y + rotation;
|
||||
wheelSpeeds[MotorType.kFrontRight.value] = -x + y - rotation;
|
||||
wheelSpeeds[MotorType.kRearLeft.value] = -x + y + rotation;
|
||||
wheelSpeeds[MotorType.kRearRight.value] = x + y - rotation;
|
||||
|
||||
normalize(wheelSpeeds);
|
||||
m_frontLeftMotor.set(wheelSpeeds[MotorType.kFrontLeft.value] * m_maxOutput);
|
||||
@@ -592,7 +586,6 @@ public class RobotDrive extends MotorSafety implements AutoCloseable {
|
||||
/**
|
||||
* Rotate a vector in Cartesian space.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
protected static double[] rotateVector(double x, double y, double angle) {
|
||||
double cosA = Math.cos(angle * (Math.PI / 180.0));
|
||||
double sinA = Math.sin(angle * (Math.PI / 180.0));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public final class RobotState {
|
||||
public static boolean isDisabled() {
|
||||
return DriverStation.getInstance().isDisabled();
|
||||
|
||||
@@ -21,7 +21,6 @@ public class SPI implements AutoCloseable {
|
||||
public enum Port {
|
||||
kOnboardCS0(0), kOnboardCS1(1), kOnboardCS2(2), kOnboardCS3(3), kMXP(4);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Port(int value) {
|
||||
|
||||
@@ -78,9 +78,9 @@ public final class SensorUtil {
|
||||
if (!SolenoidJNI.checkSolenoidModule(moduleNumber)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested solenoid module is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kPCMModules)
|
||||
.append(", Requested: ")
|
||||
.append(moduleNumber);
|
||||
.append(kPCMModules)
|
||||
.append(", Requested: ")
|
||||
.append(moduleNumber);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -95,9 +95,9 @@ public final class SensorUtil {
|
||||
if (!DIOJNI.checkDIOChannel(channel)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested DIO channel is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kDigitalChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
.append(kDigitalChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -112,9 +112,9 @@ public final class SensorUtil {
|
||||
if (!RelayJNI.checkRelayChannel(channel)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested relay channel is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kRelayChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
.append(kRelayChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -129,9 +129,9 @@ public final class SensorUtil {
|
||||
if (!PWMJNI.checkPWMChannel(channel)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested PWM channel is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kPwmChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
.append(kPwmChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -146,9 +146,9 @@ public final class SensorUtil {
|
||||
if (!AnalogJNI.checkAnalogInputChannel(channel)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested analog input channel is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kAnalogInputChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
.append(kAnalogInputChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -163,9 +163,9 @@ public final class SensorUtil {
|
||||
if (!AnalogJNI.checkAnalogOutputChannel(channel)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested analog output channel is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kAnalogOutputChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
.append(kAnalogOutputChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -179,9 +179,9 @@ public final class SensorUtil {
|
||||
if (!SolenoidJNI.checkSolenoidChannel(channel)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested solenoid channel is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kSolenoidChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
.append(kSolenoidChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -196,9 +196,9 @@ public final class SensorUtil {
|
||||
if (!PDPJNI.checkPDPChannel(channel)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested PDP channel is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kPDPChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
.append(kPDPChannels)
|
||||
.append(", Requested: ")
|
||||
.append(channel);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -212,9 +212,9 @@ public final class SensorUtil {
|
||||
if (!PDPJNI.checkPDPModule(module)) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("Requested PDP module is out of range. Minimum: 0, Maximum: ")
|
||||
.append(kPDPModules)
|
||||
.append(", Requested: ")
|
||||
.append(module);
|
||||
.append(kPDPModules)
|
||||
.append(", Requested: ")
|
||||
.append(module);
|
||||
throw new IllegalArgumentException(buf.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ public class SerialPort implements AutoCloseable {
|
||||
public enum Port {
|
||||
kOnboard(0), kMXP(1), kUSB(2), kUSB1(2), kUSB2(3);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Port(int value) {
|
||||
@@ -33,7 +32,6 @@ public class SerialPort implements AutoCloseable {
|
||||
public enum Parity {
|
||||
kNone(0), kOdd(1), kEven(2), kMark(3), kSpace(4);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
Parity(int value) {
|
||||
@@ -47,7 +45,6 @@ public class SerialPort implements AutoCloseable {
|
||||
public enum StopBits {
|
||||
kOne(10), kOnePointFive(15), kTwo(20);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
StopBits(int value) {
|
||||
@@ -61,7 +58,6 @@ public class SerialPort implements AutoCloseable {
|
||||
public enum FlowControl {
|
||||
kNone(0), kXonXoff(1), kRtsCts(2), kDtsDsr(4);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
FlowControl(int value) {
|
||||
@@ -75,7 +71,6 @@ public class SerialPort implements AutoCloseable {
|
||||
public enum WriteBufferMode {
|
||||
kFlushOnAccess(1), kFlushWhenFull(2);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
WriteBufferMode(int value) {
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Timer {
|
||||
*/
|
||||
private final Object m_lock = new Object();
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public Timer() {
|
||||
reset();
|
||||
}
|
||||
|
||||
@@ -19,16 +19,13 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
private static int instances;
|
||||
|
||||
// Factor for "proportional" control
|
||||
@SuppressWarnings("MemberName")
|
||||
private double m_Kp;
|
||||
private double m_kp;
|
||||
|
||||
// Factor for "integral" control
|
||||
@SuppressWarnings("MemberName")
|
||||
private double m_Ki;
|
||||
private double m_ki;
|
||||
|
||||
// Factor for "derivative" control
|
||||
@SuppressWarnings("MemberName")
|
||||
private double m_Kd;
|
||||
private double m_kd;
|
||||
|
||||
// The period (in seconds) of the loop that calls the controller
|
||||
private final double m_period;
|
||||
@@ -62,31 +59,29 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
private double m_measurement;
|
||||
|
||||
/**
|
||||
* Allocates a PIDController with the given constants for Kp, Ki, and Kd and a default period of
|
||||
* Allocates a PIDController with the given constants for kp, ki, and kd and a default period of
|
||||
* 0.02 seconds.
|
||||
*
|
||||
* @param Kp The proportional coefficient.
|
||||
* @param Ki The integral coefficient.
|
||||
* @param Kd The derivative coefficient.
|
||||
* @param kp The proportional coefficient.
|
||||
* @param ki The integral coefficient.
|
||||
* @param kd The derivative coefficient.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDController(double Kp, double Ki, double Kd) {
|
||||
this(Kp, Ki, Kd, 0.02);
|
||||
public PIDController(double kp, double ki, double kd) {
|
||||
this(kp, ki, kd, 0.02);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a PIDController with the given constants for Kp, Ki, and Kd.
|
||||
* Allocates a PIDController with the given constants for kp, ki, and kd.
|
||||
*
|
||||
* @param Kp The proportional coefficient.
|
||||
* @param Ki The integral coefficient.
|
||||
* @param Kd The derivative coefficient.
|
||||
* @param kp The proportional coefficient.
|
||||
* @param ki The integral coefficient.
|
||||
* @param kd The derivative coefficient.
|
||||
* @param period The period between controller updates in seconds.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public PIDController(double Kp, double Ki, double Kd, double period) {
|
||||
m_Kp = Kp;
|
||||
m_Ki = Ki;
|
||||
m_Kd = Kd;
|
||||
public PIDController(double kp, double ki, double kd, double period) {
|
||||
m_kp = kp;
|
||||
m_ki = ki;
|
||||
m_kd = kd;
|
||||
|
||||
m_period = period;
|
||||
|
||||
@@ -106,45 +101,41 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
*
|
||||
* <p>Set the proportional, integral, and differential coefficients.
|
||||
*
|
||||
* @param Kp The proportional coefficient.
|
||||
* @param Ki The integral coefficient.
|
||||
* @param Kd The derivative coefficient.
|
||||
* @param kp The proportional coefficient.
|
||||
* @param ki The integral coefficient.
|
||||
* @param kd The derivative coefficient.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public void setPID(double Kp, double Ki, double Kd) {
|
||||
m_Kp = Kp;
|
||||
m_Ki = Ki;
|
||||
m_Kd = Kd;
|
||||
public void setPID(double kp, double ki, double kd) {
|
||||
m_kp = kp;
|
||||
m_ki = ki;
|
||||
m_kd = kd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Proportional coefficient of the PID controller gain.
|
||||
*
|
||||
* @param Kp proportional coefficient
|
||||
* @param kp proportional coefficient
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public void setP(double Kp) {
|
||||
m_Kp = Kp;
|
||||
public void setP(double kp) {
|
||||
m_kp = kp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Integral coefficient of the PID controller gain.
|
||||
*
|
||||
* @param Ki integral coefficient
|
||||
* @param ki integral coefficient
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public void setI(double Ki) {
|
||||
m_Ki = Ki;
|
||||
public void setI(double ki) {
|
||||
m_ki = ki;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Differential coefficient of the PID controller gain.
|
||||
*
|
||||
* @param Kd differential coefficient
|
||||
* @param kd differential coefficient
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public void setD(double Kd) {
|
||||
m_Kd = Kd;
|
||||
public void setD(double kd) {
|
||||
m_kd = kd;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,7 +144,7 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
* @return proportional coefficient
|
||||
*/
|
||||
public double getP() {
|
||||
return m_Kp;
|
||||
return m_kp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,7 +153,7 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
* @return integral coefficient
|
||||
*/
|
||||
public double getI() {
|
||||
return m_Ki;
|
||||
return m_ki;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +162,7 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
* @return differential coefficient
|
||||
*/
|
||||
public double getD() {
|
||||
return m_Kd;
|
||||
return m_kd;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -333,12 +324,12 @@ public class PIDController implements Sendable, AutoCloseable {
|
||||
|
||||
m_velocityError = (m_positionError - m_prevError) / m_period;
|
||||
|
||||
if (m_Ki != 0) {
|
||||
if (m_ki != 0) {
|
||||
m_totalError = MathUtil.clamp(m_totalError + m_positionError * m_period,
|
||||
m_minimumIntegral / m_Ki, m_maximumIntegral / m_Ki);
|
||||
m_minimumIntegral / m_ki, m_maximumIntegral / m_ki);
|
||||
}
|
||||
|
||||
return m_Kp * m_positionError + m_Ki * m_totalError + m_Kd * m_velocityError;
|
||||
return m_kp * m_positionError + m_ki * m_totalError + m_kd * m_velocityError;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,6 @@ public abstract class RobotDriveBase extends MotorSafety {
|
||||
kFrontLeft(0), kFrontRight(1), kRearLeft(2), kRearRight(3), kLeft(0),
|
||||
kRight(1), kBack(2);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int value;
|
||||
|
||||
MotorType(int value) {
|
||||
|
||||
@@ -7,14 +7,14 @@ package edu.wpi.first.wpilibj.drive;
|
||||
/**
|
||||
* This is a 2D vector struct that supports basic vector operations.
|
||||
*/
|
||||
@SuppressWarnings("MemberName")
|
||||
public class Vector2d {
|
||||
@SuppressWarnings("MemberName")
|
||||
public double x;
|
||||
@SuppressWarnings("MemberName")
|
||||
public double y;
|
||||
|
||||
public Vector2d() {}
|
||||
|
||||
@SuppressWarnings("ParameterName")
|
||||
public Vector2d(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Robot extends TimedRobot {
|
||||
|
||||
private final DifferentialDrive m_myRobot
|
||||
= new DifferentialDrive(new PWMVictorSPX(kLeftMotorPort),
|
||||
new PWMVictorSPX(kRightMotorPort));
|
||||
new PWMVictorSPX(kRightMotorPort));
|
||||
private final AnalogGyro m_gyro = new AnalogGyro(kGyroPort);
|
||||
private final Joystick m_joystick = new Joystick(kJoystickPort);
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ public final class Constants {
|
||||
|
||||
public static final MecanumDriveKinematics kDriveKinematics =
|
||||
new MecanumDriveKinematics(
|
||||
new Translation2d(kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(kWheelBase / 2, -kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, -kTrackWidth / 2));
|
||||
new Translation2d(kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(kWheelBase / 2, -kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, -kTrackWidth / 2));
|
||||
|
||||
public static final int kEncoderCPR = 1024;
|
||||
public static final double kWheelDiameterMeters = 0.15;
|
||||
|
||||
@@ -65,8 +65,8 @@ public class RobotContainer {
|
||||
// Example of how to use the onboard IO
|
||||
Button onboardButtonA = new Button(m_onboardIO::getButtonAPressed);
|
||||
onboardButtonA
|
||||
.whenActive(new PrintCommand("Button A Pressed"))
|
||||
.whenInactive(new PrintCommand("Button A Released"));
|
||||
.whenActive(new PrintCommand("Button A Pressed"))
|
||||
.whenInactive(new PrintCommand("Button A Released"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ public class SwerveModule {
|
||||
|
||||
private final ProfiledPIDController m_turningPIDController
|
||||
= new ProfiledPIDController(1, 0, 0,
|
||||
new TrapezoidProfile.Constraints(kModuleMaxAngularVelocity, kModuleMaxAngularAcceleration));
|
||||
new TrapezoidProfile.Constraints(kModuleMaxAngularVelocity,
|
||||
kModuleMaxAngularAcceleration));
|
||||
|
||||
// Gains are for example purposes only - must be determined for your own robot!
|
||||
private final SimpleMotorFeedforward m_driveFeedforward = new SimpleMotorFeedforward(1, 3);
|
||||
|
||||
@@ -55,10 +55,10 @@ public final class Constants {
|
||||
//Distance between front and back wheels on robot
|
||||
public static final SwerveDriveKinematics kDriveKinematics =
|
||||
new SwerveDriveKinematics(
|
||||
new Translation2d(kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(kWheelBase / 2, -kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, -kTrackWidth / 2));
|
||||
new Translation2d(kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(kWheelBase / 2, -kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, kTrackWidth / 2),
|
||||
new Translation2d(-kWheelBase / 2, -kTrackWidth / 2));
|
||||
|
||||
public static final boolean kGyroReversed = false;
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ public class SwerveModule {
|
||||
|
||||
private final ProfiledPIDController m_turningPIDController
|
||||
= new ProfiledPIDController(1, 0, 0,
|
||||
new TrapezoidProfile.Constraints(kModuleMaxAngularVelocity, kModuleMaxAngularAcceleration));
|
||||
new TrapezoidProfile.Constraints(kModuleMaxAngularVelocity,
|
||||
kModuleMaxAngularAcceleration));
|
||||
|
||||
// Gains are for example purposes only - must be determined for your own robot!
|
||||
private final SimpleMotorFeedforward m_driveFeedforward = new SimpleMotorFeedforward(1, 3);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Robot extends TimedRobot {
|
||||
private final AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort);
|
||||
private final DifferentialDrive m_robotDrive
|
||||
= new DifferentialDrive(new PWMVictorSPX(kLeftMotorPort),
|
||||
new PWMVictorSPX(kRightMotorPort));
|
||||
new PWMVictorSPX(kRightMotorPort));
|
||||
|
||||
/**
|
||||
* Tells the robot to drive to a set distance (in inches) from an object
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Robot extends TimedRobot {
|
||||
private final AnalogInput m_ultrasonic = new AnalogInput(kUltrasonicPort);
|
||||
private final DifferentialDrive m_robotDrive
|
||||
= new DifferentialDrive(new PWMVictorSPX(kLeftMotorPort),
|
||||
new PWMVictorSPX(kRightMotorPort));
|
||||
new PWMVictorSPX(kRightMotorPort));
|
||||
private final PIDController m_pidController = new PIDController(kP, kI, kD);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MockDS {
|
||||
data[5] = 0x00; // red 1 station
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public void start() {
|
||||
m_thread = new Thread(() -> {
|
||||
DatagramSocket socket;
|
||||
@@ -65,7 +65,7 @@ public class MockDS {
|
||||
m_thread.start();
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public void stop() {
|
||||
if (m_thread == null) {
|
||||
return;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PDPTest extends AbstractComsSetup {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public PDPTest(MotorEncoderFixture<?> mef, Double expectedCurrentDraw) {
|
||||
logger.fine("Constructor with: " + mef.getType());
|
||||
if (me != null && !me.equals(mef)) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PIDTest extends AbstractComsSetup {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"ParameterName", "JavadocMethod"})
|
||||
@SuppressWarnings({"ParameterName", "MissingJavadocMethod"})
|
||||
public PIDTest(Double p, Double i, Double d, MotorEncoderFixture<?> mef) {
|
||||
logger.fine("Constructor with: " + mef.getType());
|
||||
if (PIDTest.me != null && !PIDTest.me.equals(mef)) {
|
||||
|
||||
@@ -218,7 +218,7 @@ public final class TestBench {
|
||||
return pairs;
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static AnalogCrossConnectFixture getAnalogCrossConnectFixture() {
|
||||
return new AnalogCrossConnectFixture() {
|
||||
@Override
|
||||
@@ -233,7 +233,7 @@ public final class TestBench {
|
||||
};
|
||||
}
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static RelayCrossConnectFixture getRelayCrossConnectFixture() {
|
||||
return new RelayCrossConnectFixture() {
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,6 @@ public final class AngleStatistics {
|
||||
* @param b A vector to subtract with.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> Matrix<S, N1> angleResidual(Matrix<S, N1> a, Matrix<S, N1> b,
|
||||
int angleStateIdx) {
|
||||
Matrix<S, N1> ret = a.minus(b);
|
||||
@@ -41,7 +40,6 @@ public final class AngleStatistics {
|
||||
*
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> BiFunction<Matrix<S, N1>, Matrix<S, N1>, Matrix<S, N1>>
|
||||
angleResidual(int angleStateIdx) {
|
||||
return (a, b) -> angleResidual(a, b, angleStateIdx);
|
||||
@@ -54,7 +52,6 @@ public final class AngleStatistics {
|
||||
* @param b A vector to add with.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> Matrix<S, N1> angleAdd(Matrix<S, N1> a, Matrix<S, N1> b,
|
||||
int angleStateIdx) {
|
||||
Matrix<S, N1> ret = a.plus(b);
|
||||
@@ -69,7 +66,6 @@ public final class AngleStatistics {
|
||||
*
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> BiFunction<Matrix<S, N1>, Matrix<S, N1>, Matrix<S, N1>>
|
||||
angleAdd(int angleStateIdx) {
|
||||
return (a, b) -> angleAdd(a, b, angleStateIdx);
|
||||
@@ -119,7 +115,7 @@ public final class AngleStatistics {
|
||||
*
|
||||
* @param angleStateIdx The row containing the angles.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
@SuppressWarnings("LambdaParameterName")
|
||||
public static <S extends Num> BiFunction<Matrix<S, ?>, Matrix<?, N1>, Matrix<S, N1>>
|
||||
angleMean(int angleStateIdx) {
|
||||
return (sigmas, Wm) -> angleMean(sigmas, Wm, angleStateIdx);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class DifferentialDrivePoseEstimator {
|
||||
|
||||
m_visionCorrect = (u, y) -> m_observer.correct(
|
||||
Nat.N3(), u, y,
|
||||
(x, u_) -> new Matrix<>(x.getStorage().extractMatrix(0, 3, 0, 1)),
|
||||
(x, u1) -> new Matrix<>(x.getStorage().extractMatrix(0, 3, 0, 1)),
|
||||
m_visionDiscreteR,
|
||||
AngleStatistics.angleMean(2),
|
||||
AngleStatistics.angleResidual(2),
|
||||
|
||||
@@ -117,8 +117,8 @@ public class MecanumDrivePoseEstimator {
|
||||
|
||||
m_observer = new UnscentedKalmanFilter<>(
|
||||
Nat.N3(), Nat.N1(),
|
||||
(x_, u) -> u,
|
||||
(x, u_) -> x.extractRowVector(2),
|
||||
(x, u) -> u,
|
||||
(x, u) -> x.extractRowVector(2),
|
||||
stateStdDevs,
|
||||
localMeasurementStdDevs,
|
||||
AngleStatistics.angleMean(2),
|
||||
@@ -136,7 +136,7 @@ public class MecanumDrivePoseEstimator {
|
||||
|
||||
m_visionCorrect = (u, y) -> m_observer.correct(
|
||||
Nat.N3(), u, y,
|
||||
(x, u_) -> x,
|
||||
(x, u1) -> x,
|
||||
m_visionDiscreteR,
|
||||
AngleStatistics.angleMean(2),
|
||||
AngleStatistics.angleResidual(2),
|
||||
|
||||
@@ -117,8 +117,8 @@ public class SwerveDrivePoseEstimator {
|
||||
|
||||
m_observer = new UnscentedKalmanFilter<>(
|
||||
Nat.N3(), Nat.N1(),
|
||||
(x_, u) -> u,
|
||||
(x, u_) -> x.extractRowVector(2),
|
||||
(x, u) -> u,
|
||||
(x, u) -> x.extractRowVector(2),
|
||||
stateStdDevs,
|
||||
localMeasurementStdDevs,
|
||||
AngleStatistics.angleMean(2),
|
||||
@@ -136,7 +136,7 @@ public class SwerveDrivePoseEstimator {
|
||||
|
||||
m_visionCorrect = (u, y) -> m_observer.correct(
|
||||
Nat.N3(), u, y,
|
||||
(x, u_) -> x,
|
||||
(x, u1) -> x,
|
||||
m_visionDiscreteR,
|
||||
AngleStatistics.angleMean(2),
|
||||
AngleStatistics.angleResidual(2),
|
||||
|
||||
@@ -66,7 +66,7 @@ public class UnscentedKalmanFilter<States extends Num, Inputs extends Num,
|
||||
* @param measurementStdDevs Standard deviations of measurements.
|
||||
* @param nominalDtSeconds Nominal discretization timestep.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
@SuppressWarnings("LambdaParameterName")
|
||||
public UnscentedKalmanFilter(Nat<States> states, Nat<Outputs> outputs,
|
||||
BiFunction<Matrix<States, N1>, Matrix<Inputs, N1>,
|
||||
Matrix<States, N1>> f,
|
||||
@@ -329,7 +329,7 @@ public class UnscentedKalmanFilter<States extends Num, Inputs extends Num,
|
||||
* @param h A vector-valued function of x and u that returns the measurement vector.
|
||||
* @param R Measurement noise covariance matrix.
|
||||
*/
|
||||
@SuppressWarnings({"ParameterName", "LocalVariableName"})
|
||||
@SuppressWarnings({"ParameterName", "LambdaParameterName", "LocalVariableName"})
|
||||
public <R extends Num> void correct(
|
||||
Nat<R> rows, Matrix<Inputs, N1> u,
|
||||
Matrix<R, N1> y,
|
||||
|
||||
@@ -50,7 +50,6 @@ public class Pose2d {
|
||||
* @param y The y component of the translational component of the pose.
|
||||
* @param rotation The rotational component of the pose.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public Pose2d(double x, double y, Rotation2d rotation) {
|
||||
m_translation = new Translation2d(x, y);
|
||||
m_rotation = rotation;
|
||||
@@ -170,7 +169,6 @@ public class Pose2d {
|
||||
* the twist would be Twist2d{0.01, 0.0, toRadians(0.5)}
|
||||
* @return The new pose of the robot.
|
||||
*/
|
||||
@SuppressWarnings("LocalVariableName")
|
||||
public Pose2d exp(Twist2d twist) {
|
||||
double dx = twist.dx;
|
||||
double dy = twist.dy;
|
||||
|
||||
@@ -51,7 +51,6 @@ public class Rotation2d {
|
||||
* @param x The x component or cosine of the rotation.
|
||||
* @param y The y component or sine of the rotation.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public Rotation2d(double x, double y) {
|
||||
double magnitude = Math.hypot(x, y);
|
||||
if (magnitude > 1e-6) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CubicHermiteSpline extends Spline {
|
||||
-3.0, -2.0, +3.0, -1.0,
|
||||
+0.0, +1.0, +0.0, +0.0,
|
||||
+1.0, +0.0, +0.0, +0.0
|
||||
});
|
||||
});
|
||||
}
|
||||
return hermiteBasis;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class QuinticHermiteSpline extends Spline {
|
||||
+00.0, +00.0, +00.5, +00.0, +00.0, +00.0,
|
||||
+00.0, +01.0, +00.0, +00.0, +00.0, +00.0,
|
||||
+01.0, +00.0, +00.0, +00.0, +00.0, +00.0
|
||||
});
|
||||
});
|
||||
}
|
||||
return hermiteBasis;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public final class NumericalJacobian {
|
||||
* @param u Input vector.
|
||||
* @return The numerical Jacobian with respect to x for f(x, u, ...).
|
||||
*/
|
||||
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
|
||||
@SuppressWarnings({"LambdaParameterName", "MethodTypeParameterName"})
|
||||
public static <Rows extends Num, States extends Num, Inputs extends Num, Outputs extends Num>
|
||||
Matrix<Rows, States> numericalJacobianX(
|
||||
Nat<Rows> rows,
|
||||
@@ -94,7 +94,7 @@ public final class NumericalJacobian {
|
||||
* @param u Input vector.
|
||||
* @return the numerical Jacobian with respect to u for f(x, u).
|
||||
*/
|
||||
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
|
||||
@SuppressWarnings({"LambdaParameterName", "MethodTypeParameterName"})
|
||||
public static <Rows extends Num, States extends Num, Inputs extends Num> Matrix<Rows, Inputs>
|
||||
numericalJacobianU(
|
||||
Nat<Rows> rows,
|
||||
|
||||
@@ -168,7 +168,6 @@ public class TrapezoidProfile {
|
||||
*
|
||||
* @param t The time since the beginning of the profile.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public State calculate(double t) {
|
||||
State result = new State(m_initial.position, m_initial.velocity);
|
||||
|
||||
@@ -274,7 +273,6 @@ public class TrapezoidProfile {
|
||||
*
|
||||
* @param t The time since the beginning of the profile.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public boolean isFinished(double t) {
|
||||
return t >= totalTime();
|
||||
}
|
||||
|
||||
@@ -29,12 +29,10 @@ class LinearFilterTest {
|
||||
private static final double kHighPassExpectedOutput = 10.074717;
|
||||
private static final double kMovAvgExpectedOutput = -10.191644;
|
||||
|
||||
@SuppressWarnings("ParameterName")
|
||||
private static double getData(double t) {
|
||||
return 100.0 * Math.sin(2.0 * Math.PI * t) + 20.0 * Math.cos(50.0 * Math.PI * t);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ParameterName")
|
||||
private static double getPulseData(double t) {
|
||||
if (Math.abs(t - 1.0) < 0.001) {
|
||||
return 1.0;
|
||||
|
||||
@@ -203,7 +203,7 @@ class SwerveDriveKinematicsTest {
|
||||
new SwerveModuleState(23.43, Rotation2d.fromDegrees(-39.81)),
|
||||
new SwerveModuleState(54.08, Rotation2d.fromDegrees(-109.44)),
|
||||
new SwerveModuleState(54.08, Rotation2d.fromDegrees(-70.56))
|
||||
};
|
||||
};
|
||||
var stateTolerance = new SwerveModuleState(0.1, Rotation2d.fromDegrees(0.1));
|
||||
|
||||
for (int i = 0; i < expectedStates.length; i++) {
|
||||
|
||||
@@ -33,7 +33,7 @@ class SwerveDriveOdometryTest {
|
||||
new SwerveModuleState(5, Rotation2d.fromDegrees(0)),
|
||||
new SwerveModuleState(5, Rotation2d.fromDegrees(0)),
|
||||
new SwerveModuleState(5, Rotation2d.fromDegrees(0))
|
||||
};
|
||||
};
|
||||
|
||||
m_odometry.updateWithTime(0.0, new Rotation2d(),
|
||||
new SwerveModuleState(), new SwerveModuleState(),
|
||||
@@ -60,7 +60,7 @@ class SwerveDriveOdometryTest {
|
||||
new SwerveModuleState(42.15, Rotation2d.fromDegrees(26.565)),
|
||||
new SwerveModuleState(18.85, Rotation2d.fromDegrees(-90)),
|
||||
new SwerveModuleState(42.15, Rotation2d.fromDegrees(-26.565))
|
||||
};
|
||||
};
|
||||
final var zero = new SwerveModuleState();
|
||||
|
||||
m_odometry.updateWithTime(0.0, new Rotation2d(), zero, zero, zero, zero);
|
||||
|
||||
@@ -51,12 +51,12 @@ public final class RuntimeLoader<T> {
|
||||
private String getLoadErrorMessage(UnsatisfiedLinkError ule) {
|
||||
StringBuilder msg = new StringBuilder(512);
|
||||
msg.append(m_libraryName)
|
||||
.append(" could not be loaded from path or an embedded resource.\n"
|
||||
+ "\tattempted to load for platform ")
|
||||
.append(RuntimeDetector.getPlatformPath())
|
||||
.append("\nLast Load Error: \n")
|
||||
.append(ule.getMessage())
|
||||
.append('\n');
|
||||
.append(" could not be loaded from path or an embedded resource.\n"
|
||||
+ "\tattempted to load for platform ")
|
||||
.append(RuntimeDetector.getPlatformPath())
|
||||
.append("\nLast Load Error: \n")
|
||||
.append(ule.getMessage())
|
||||
.append('\n');
|
||||
if (RuntimeDetector.isWindows()) {
|
||||
msg.append("A common cause of this error is missing the C++ runtime.\n"
|
||||
+ "Download the latest at https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads\n");
|
||||
|
||||
Reference in New Issue
Block a user