From a541d419037253216f50fa358412f696e2856556 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sat, 21 Oct 2023 20:17:55 -0700 Subject: [PATCH] [docs] Add missing JavaDocs --- .../java/edu/wpi/first/apriltag/AprilTag.java | 9 ++ .../wpi/first/apriltag/AprilTagDetector.java | 1 + .../wpi/first/apriltag/jni/AprilTagJNI.java | 18 +++ .../native/include/frc/apriltag/AprilTag.h | 8 +- .../edu/wpi/first/vision/VisionRunner.java | 1 + .../wpi/first/cscore/CameraServerCvJNI.java | 18 +++ .../edu/wpi/first/cscore/CameraServerJNI.java | 18 +++ .../edu/wpi/first/hal/AccelerometerJNI.java | 3 + .../edu/wpi/first/hal/AccumulatorResult.java | 3 + .../edu/wpi/first/hal/AddressableLEDJNI.java | 3 + .../edu/wpi/first/hal/AllianceStationID.java | 8 + .../java/edu/wpi/first/hal/AnalogGyroJNI.java | 3 + .../java/edu/wpi/first/hal/AnalogJNI.java | 3 + .../java/edu/wpi/first/hal/CANAPIJNI.java | 3 + .../java/edu/wpi/first/hal/CTREPCMJNI.java | 3 + .../java/edu/wpi/first/hal/ConstantsJNI.java | 3 + .../java/edu/wpi/first/hal/CounterJNI.java | 3 + .../main/java/edu/wpi/first/hal/DIOJNI.java | 3 + .../main/java/edu/wpi/first/hal/DMAJNI.java | 3 + .../wpi/first/hal/DigitalGlitchFilterJNI.java | 3 + .../edu/wpi/first/hal/DriverStationJNI.java | 1 + .../java/edu/wpi/first/hal/DutyCycleJNI.java | 3 + .../java/edu/wpi/first/hal/EncoderJNI.java | 3 + .../main/java/edu/wpi/first/hal/I2CJNI.java | 3 + .../java/edu/wpi/first/hal/InterruptJNI.java | 3 + .../java/edu/wpi/first/hal/JNIWrapper.java | 17 +++ .../main/java/edu/wpi/first/hal/LEDJNI.java | 3 + .../java/edu/wpi/first/hal/NotifierJNI.java | 3 + .../main/java/edu/wpi/first/hal/PWMJNI.java | 3 + .../main/java/edu/wpi/first/hal/PortsJNI.java | 3 + .../wpi/first/hal/PowerDistributionJNI.java | 3 + .../main/java/edu/wpi/first/hal/PowerJNI.java | 3 + .../main/java/edu/wpi/first/hal/REVPHJNI.java | 3 + .../main/java/edu/wpi/first/hal/RelayJNI.java | 3 + .../main/java/edu/wpi/first/hal/SPIJNI.java | 3 + .../java/edu/wpi/first/hal/SerialPortJNI.java | 3 + .../java/edu/wpi/first/hal/SimDeviceJNI.java | 3 + .../java/edu/wpi/first/hal/ThreadsJNI.java | 3 + .../hal/can/CANStreamOverflowException.java | 3 + .../hal/simulation/AccelerometerDataJNI.java | 12 ++ .../hal/simulation/AddressableLEDDataJNI.java | 4 + .../hal/simulation/AnalogGyroDataJNI.java | 4 + .../first/hal/simulation/AnalogInDataJNI.java | 4 + .../hal/simulation/AnalogOutDataJNI.java | 4 + .../hal/simulation/AnalogTriggerDataJNI.java | 4 + .../first/hal/simulation/CTREPCMDataJNI.java | 4 + .../wpi/first/hal/simulation/DIODataJNI.java | 4 + .../hal/simulation/DigitalPWMDataJNI.java | 4 + .../hal/simulation/DriverStationDataJNI.java | 4 + .../hal/simulation/DutyCycleDataJNI.java | 4 + .../first/hal/simulation/EncoderDataJNI.java | 4 + .../wpi/first/hal/simulation/I2CDataJNI.java | 4 + .../first/hal/simulation/NotifierDataJNI.java | 4 + .../wpi/first/hal/simulation/PWMDataJNI.java | 4 + .../simulation/PowerDistributionDataJNI.java | 4 + .../first/hal/simulation/REVPHDataJNI.java | 4 + .../first/hal/simulation/RelayDataJNI.java | 4 + .../first/hal/simulation/RoboRioDataJNI.java | 4 + .../simulation/SPIAccelerometerDataJNI.java | 4 + .../wpi/first/hal/simulation/SPIDataJNI.java | 4 + .../hal/simulation/SimDeviceDataJNI.java | 4 + .../first/hal/simulation/SimulatorJNI.java | 4 + .../hal/util/UncleanStatusException.java | 1 + .../main/java/NetworkTablesJNI.java.jinja | 17 +++ .../first/networktables/NetworkTablesJNI.java | 17 +++ .../networktables/TimestampedObject.java | 6 +- styleguide/spotbugs-exclude.xml | 4 + .../wpilibj2/command/WrapperCommand.java | 1 + .../include/frc2/command/WrapperCommand.h | 1 + wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp | 15 +- wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp | 29 ++-- .../main/native/include/frc/ADIS16448_IMU.h | 70 ++++++++- .../main/native/include/frc/ADIS16470_IMU.h | 96 ++++++++++-- .../src/main/native/include/frc/ADXL345_I2C.h | 55 +++++-- .../src/main/native/include/frc/ADXL345_SPI.h | 55 +++++-- wpilibc/src/main/native/include/frc/ADXL362.h | 37 ++++- .../src/main/native/include/frc/AnalogGyro.h | 4 +- .../main/native/include/frc/AnalogOutput.h | 6 +- .../native/include/frc/AnalogTriggerType.h | 5 + .../native/include/frc/BuiltInAccelerometer.h | 12 +- .../main/native/include/frc/XboxController.h | 18 +++ .../include/frc/interfaces/Accelerometer.h | 22 ++- .../include/frc/simulation/ADXL345Sim.h | 2 +- .../include/frc/simulation/ADXL362Sim.h | 2 +- .../include/frc/simulation/LinearSystemSim.h | 6 +- .../edu/wpi/first/wpilibj/ADIS16448_IMU.java | 143 ++++++++++++++---- .../edu/wpi/first/wpilibj/ADIS16470_IMU.java | 117 ++++++++------ .../edu/wpi/first/wpilibj/ADXL345_I2C.java | 40 ++++- .../edu/wpi/first/wpilibj/ADXL345_SPI.java | 35 ++++- .../java/edu/wpi/first/wpilibj/ADXL362.java | 23 +++ .../edu/wpi/first/wpilibj/AnalogEncoder.java | 6 +- .../edu/wpi/first/wpilibj/AnalogGyro.java | 2 +- .../edu/wpi/first/wpilibj/AnalogOutput.java | 10 ++ .../edu/wpi/first/wpilibj/AnalogTrigger.java | 9 +- .../first/wpilibj/AnalogTriggerOutput.java | 4 + .../first/wpilibj/BuiltInAccelerometer.java | 4 + .../edu/wpi/first/wpilibj/DigitalSource.java | 10 ++ .../edu/wpi/first/wpilibj/XboxController.java | 18 +++ .../wpilibj/interfaces/Accelerometer.java | 5 + .../first/wpilibj/simulation/ADXL345Sim.java | 34 +++-- .../first/wpilibj/simulation/ADXL362Sim.java | 34 +++-- .../wpilibj/simulation/LinearSystemSim.java | 6 +- .../math/InterpolatingMatrixTreeMap.java | 4 + .../edu/wpi/first/math/StateSpaceUtil.java | 4 +- .../java/edu/wpi/first/math/WPIMathJNI.java | 18 +++ ...ontrolAffinePlantInversionFeedforward.java | 3 + .../controller/ImplicitModelFollower.java | 4 + .../LinearPlantInversionFeedforward.java | 4 + .../controller/LinearQuadraticRegulator.java | 4 + .../first/math/estimator/AngleStatistics.java | 6 +- .../math/estimator/ExtendedKalmanFilter.java | 4 + .../first/math/estimator/KalmanFilter.java | 4 + .../estimator/MerweScaledSigmaPoints.java | 2 + .../first/math/estimator/PoseEstimator.java | 2 + .../estimator/SteadyStateKalmanFilter.java | 4 + .../math/estimator/UnscentedKalmanFilter.java | 4 + .../wpi/first/math/kinematics/Odometry.java | 2 + .../first/math/system/LinearSystemLoop.java | 4 + .../main/native/include/frc/StateSpaceUtil.h | 12 +- .../ControlAffinePlantInversionFeedforward.h | 4 +- .../frc/controller/ImplicitModelFollower.h | 3 + .../LinearPlantInversionFeedforward.h | 6 +- .../frc/controller/LinearQuadraticRegulator.h | 1 + .../include/frc/estimator/AngleStatistics.h | 12 +- .../frc/estimator/ExtendedKalmanFilter.h | 6 +- .../include/frc/estimator/KalmanFilter.h | 6 +- .../frc/estimator/MerweScaledSigmaPoints.h | 4 +- .../include/frc/estimator/PoseEstimator.h | 3 + .../frc/estimator/SteadyStateKalmanFilter.h | 6 +- .../frc/estimator/UnscentedKalmanFilter.h | 6 +- .../native/include/frc/kinematics/Odometry.h | 3 + .../java/edu/wpi/first/net/WPINetJNI.java | 18 +++ .../edu/wpi/first/util/CircularBuffer.java | 8 +- .../wpi/first/util/InterpolatingTreeMap.java | 2 + .../java/edu/wpi/first/util/WPIUtilJNI.java | 18 +++ .../first/util/struct/BadSchemaException.java | 1 + .../first/util/struct/StructSerializable.java | 2 + .../util/struct/parser/ParseException.java | 1 + .../main/native/include/wpi/circular_buffer.h | 7 + .../include/wpi/static_circular_buffer.h | 3 + 140 files changed, 1236 insertions(+), 236 deletions(-) diff --git a/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTag.java b/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTag.java index 2c9be4a6866..9ee0207fedc 100644 --- a/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTag.java +++ b/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTag.java @@ -11,14 +11,23 @@ import edu.wpi.first.util.RawFrame; import java.util.Objects; +/** Represents an AprilTag's metadata. */ @SuppressWarnings("MemberName") public class AprilTag { + /** The tag's ID. */ @JsonProperty(value = "ID") public int ID; + /** The tag's pose. */ @JsonProperty(value = "pose") public Pose3d pose; + /** + * Constructs an AprilTag. + * + * @param ID The tag's ID. + * @param pose The tag's pose. + */ @SuppressWarnings("ParameterName") @JsonCreator public AprilTag( diff --git a/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java b/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java index c62edfa5076..61756854a9b 100644 --- a/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java +++ b/apriltag/src/main/java/edu/wpi/first/apriltag/AprilTagDetector.java @@ -182,6 +182,7 @@ public boolean equals(Object obj) { } } + /** Constructs an AprilTagDetector. */ public AprilTagDetector() { m_native = AprilTagJNI.createDetector(); } diff --git a/apriltag/src/main/java/edu/wpi/first/apriltag/jni/AprilTagJNI.java b/apriltag/src/main/java/edu/wpi/first/apriltag/jni/AprilTagJNI.java index d03169b8b96..d1f816837dd 100644 --- a/apriltag/src/main/java/edu/wpi/first/apriltag/jni/AprilTagJNI.java +++ b/apriltag/src/main/java/edu/wpi/first/apriltag/jni/AprilTagJNI.java @@ -13,21 +13,36 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; +/** AprilTag JNI. */ public class AprilTagJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -194,4 +209,7 @@ public static native Transform3d estimatePose( public static native void generate16h5AprilTagImage(RawFrame frameObj, long frame, int id); public static native void generate36h11AprilTagImage(RawFrame frameObj, long frame, int id); + + /** Utility class. */ + private AprilTagJNI() {} } diff --git a/apriltag/src/main/native/include/frc/apriltag/AprilTag.h b/apriltag/src/main/native/include/frc/apriltag/AprilTag.h index abb8ac59371..a9ef78cc458 100644 --- a/apriltag/src/main/native/include/frc/apriltag/AprilTag.h +++ b/apriltag/src/main/native/include/frc/apriltag/AprilTag.h @@ -12,14 +12,16 @@ namespace frc { +/** + * Represents an AprilTag's metadata. + */ struct WPILIB_DLLEXPORT AprilTag { + /// The tag's ID. int ID; + /// The tag's pose. Pose3d pose; - /** - * Checks equality between this AprilTag and another object. - */ bool operator==(const AprilTag&) const = default; static bool Generate36h11AprilTagImage(wpi::RawFrame* frame, int id); diff --git a/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java b/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java index ab7072f6c99..b9459cb00c4 100644 --- a/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java +++ b/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java @@ -14,6 +14,7 @@ * code. The easiest way to use this is to run it in a {@link VisionThread} and use the listener to * take snapshots of the pipeline's outputs. * + * @param

Vision pipeline type. * @see VisionPipeline * @see VisionThread * @see vision diff --git a/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java b/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java index 2259582f847..fdbfe611df1 100644 --- a/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java +++ b/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java @@ -9,21 +9,36 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.opencv.core.Core; +/** CameraServer CV JNI. */ public class CameraServerCvJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -72,4 +87,7 @@ public static native int createCvSource( public static native long grabSinkFrame(int sink, long imageNativeObj); public static native long grabSinkFrameTimeout(int sink, long imageNativeObj, double timeout); + + /** Utility class. */ + private CameraServerCvJNI() {} } diff --git a/cscore/src/main/java/edu/wpi/first/cscore/CameraServerJNI.java b/cscore/src/main/java/edu/wpi/first/cscore/CameraServerJNI.java index ae075bc83a6..3dcf66f79e9 100644 --- a/cscore/src/main/java/edu/wpi/first/cscore/CameraServerJNI.java +++ b/cscore/src/main/java/edu/wpi/first/cscore/CameraServerJNI.java @@ -11,21 +11,36 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; +/** CameraServer JNI. */ public class CameraServerJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -347,4 +362,7 @@ public interface LoggerFunction { public static native int runMainRunLoopTimeout(double timeoutSeconds); public static native void stopMainRunLoop(); + + /** Utility class. */ + private CameraServerJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/AccelerometerJNI.java b/hal/src/main/java/edu/wpi/first/hal/AccelerometerJNI.java index 5f34924eb54..fc1bbb588f8 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AccelerometerJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/AccelerometerJNI.java @@ -59,4 +59,7 @@ public class AccelerometerJNI extends JNIWrapper { * @return the Z acceleration */ public static native double getAccelerometerZ(); + + /** Utility class. */ + private AccelerometerJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java b/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java index f416ff8192d..569c94b00ae 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java +++ b/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java @@ -13,6 +13,9 @@ public class AccumulatorResult { /** The number of sample value was accumulated over. */ public long count; + /** Constructs an AccumulatorResult. */ + public AccumulatorResult() {} + /** * Set the value and count. * diff --git a/hal/src/main/java/edu/wpi/first/hal/AddressableLEDJNI.java b/hal/src/main/java/edu/wpi/first/hal/AddressableLEDJNI.java index b2695a38274..a7a355237b0 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AddressableLEDJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/AddressableLEDJNI.java @@ -97,4 +97,7 @@ public static native void setBitTiming( * @see "HAL_StopAddressableLEDOutput" */ public static native void stop(int handle); + + /** Utility class. */ + private AddressableLEDJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/AllianceStationID.java b/hal/src/main/java/edu/wpi/first/hal/AllianceStationID.java index 56c2143c818..6b1fd84ced6 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AllianceStationID.java +++ b/hal/src/main/java/edu/wpi/first/hal/AllianceStationID.java @@ -4,12 +4,20 @@ package edu.wpi.first.hal; +/** Alliance station ID. */ public enum AllianceStationID { + /** Unknown. */ Unknown, + /** Red 1. */ Red1, + /** Red 2. */ Red2, + /** Red 3. */ Red3, + /** Blue 1. */ Blue1, + /** Blue 2. */ Blue2, + /** Blue 3. */ Blue3 } diff --git a/hal/src/main/java/edu/wpi/first/hal/AnalogGyroJNI.java b/hal/src/main/java/edu/wpi/first/hal/AnalogGyroJNI.java index cbc3d4f8e57..5d483f9c8a9 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AnalogGyroJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/AnalogGyroJNI.java @@ -126,4 +126,7 @@ public static native void setAnalogGyroVoltsPerDegreePerSecond( * @see "HAL_GetAnalogGyroCenter" */ public static native int getAnalogGyroCenter(int handle); + + /** Utility class. */ + private AnalogGyroJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java b/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java index bf8b27f4927..400fd5911d9 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java @@ -497,4 +497,7 @@ public static native void setAnalogTriggerFiltered( * @see "HAL_GetAnalogTriggerFPGAIndex" */ public static native int getAnalogTriggerFPGAIndex(int analogTriggerHandle); + + /** Utility class. */ + private AnalogJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/CANAPIJNI.java b/hal/src/main/java/edu/wpi/first/hal/CANAPIJNI.java index b42def47ea9..90b16889054 100644 --- a/hal/src/main/java/edu/wpi/first/hal/CANAPIJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/CANAPIJNI.java @@ -177,4 +177,7 @@ public static native int writeCANPacketRepeatingNoThrow( */ public static native boolean readCANPacketTimeout( int handle, int apiId, int timeoutMs, CANData data); + + /** Utility class. */ + private CANAPIJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/CTREPCMJNI.java b/hal/src/main/java/edu/wpi/first/hal/CTREPCMJNI.java index b657da592e2..0abe084dd94 100644 --- a/hal/src/main/java/edu/wpi/first/hal/CTREPCMJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/CTREPCMJNI.java @@ -221,4 +221,7 @@ public class CTREPCMJNI extends JNIWrapper { * @see "HAL_SetCTREPCMOneShotDuration" */ public static native void setOneShotDuration(int handle, int index, int durMs); + + /** Utility class. */ + private CTREPCMJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/ConstantsJNI.java b/hal/src/main/java/edu/wpi/first/hal/ConstantsJNI.java index 48434499ffe..2ccef74db35 100644 --- a/hal/src/main/java/edu/wpi/first/hal/ConstantsJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/ConstantsJNI.java @@ -17,4 +17,7 @@ public class ConstantsJNI extends JNIWrapper { * @see "HAL_GetSystemClockTicksPerMicrosecond" */ public static native int getSystemClockTicksPerMicrosecond(); + + /** Utility class. */ + private ConstantsJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/CounterJNI.java b/hal/src/main/java/edu/wpi/first/hal/CounterJNI.java index ebc4cffe265..6823185137c 100644 --- a/hal/src/main/java/edu/wpi/first/hal/CounterJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/CounterJNI.java @@ -279,4 +279,7 @@ public static native void setCounterDownSourceEdge( * @see "HAL_SetCounterReverseDirection" */ public static native void setCounterReverseDirection(int counterHandle, boolean reverseDirection); + + /** Utility class. */ + private CounterJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java b/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java index 3330f4ad3c5..4d597cccddc 100644 --- a/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/DIOJNI.java @@ -178,4 +178,7 @@ public class DIOJNI extends JNIWrapper { * @see "HAL_SetDigitalPWMOutputChannel" */ public static native void setDigitalPWMOutputChannel(int pwmGenerator, int channel); + + /** Utility class. */ + DIOJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/DMAJNI.java b/hal/src/main/java/edu/wpi/first/hal/DMAJNI.java index 00000d2f2b9..77eebf014ff 100644 --- a/hal/src/main/java/edu/wpi/first/hal/DMAJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/DMAJNI.java @@ -245,4 +245,7 @@ public static native long readDMA( * @return The DMA sample */ public static native DMAJNISample.BaseStore getSensorReadData(int handle); + + /** Utility class. */ + private DMAJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/DigitalGlitchFilterJNI.java b/hal/src/main/java/edu/wpi/first/hal/DigitalGlitchFilterJNI.java index 9a16984d89b..ececa130c55 100644 --- a/hal/src/main/java/edu/wpi/first/hal/DigitalGlitchFilterJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/DigitalGlitchFilterJNI.java @@ -59,4 +59,7 @@ public class DigitalGlitchFilterJNI extends JNIWrapper { * @see "HAL_GetFilterPeriod" */ public static native int getFilterPeriod(int filterIndex); + + /** Utility class. */ + private DigitalGlitchFilterJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/DriverStationJNI.java b/hal/src/main/java/edu/wpi/first/hal/DriverStationJNI.java index 4a46b525e16..a7ec9f53431 100644 --- a/hal/src/main/java/edu/wpi/first/hal/DriverStationJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/DriverStationJNI.java @@ -372,5 +372,6 @@ public static native int sendError( */ public static native boolean getOutputsActive(); + /** Utility class. */ private DriverStationJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java b/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java index 1e7dfa0ccc6..6920b2970fb 100644 --- a/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/DutyCycleJNI.java @@ -78,4 +78,7 @@ public class DutyCycleJNI extends JNIWrapper { * @see "HAL_GetDutyCycleFPGAIndex" */ public static native int getFPGAIndex(int handle); + + /** Utility class. */ + private DutyCycleJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/EncoderJNI.java b/hal/src/main/java/edu/wpi/first/hal/EncoderJNI.java index d219db056bd..59503f8c43e 100644 --- a/hal/src/main/java/edu/wpi/first/hal/EncoderJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/EncoderJNI.java @@ -275,4 +275,7 @@ public static native void setEncoderIndexSource( * @see "HAL_GetEncoderEncodingType" */ public static native int getEncoderEncodingType(int encoderHandle); + + /** Utility class. */ + private EncoderJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/I2CJNI.java b/hal/src/main/java/edu/wpi/first/hal/I2CJNI.java index 90e8ddb4d8f..1b729af805c 100644 --- a/hal/src/main/java/edu/wpi/first/hal/I2CJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/I2CJNI.java @@ -135,4 +135,7 @@ public static native int i2CRead( * @see "HAL_CloseI2C" */ public static native void i2CClose(int port); + + /** Utility class. */ + private I2CJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/InterruptJNI.java b/hal/src/main/java/edu/wpi/first/hal/InterruptJNI.java index c60543566bd..ec60b839236 100644 --- a/hal/src/main/java/edu/wpi/first/hal/InterruptJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/InterruptJNI.java @@ -113,4 +113,7 @@ public static native void setInterruptUpSourceEdge( * @see "HAL_ReleaseWaitingInterrupt" */ public static native void releaseWaitingInterrupt(int interruptHandle); + + /** Utility class. */ + private InterruptJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/JNIWrapper.java b/hal/src/main/java/edu/wpi/first/hal/JNIWrapper.java index 6826cd80743..49bcb4a5ec8 100644 --- a/hal/src/main/java/edu/wpi/first/hal/JNIWrapper.java +++ b/hal/src/main/java/edu/wpi/first/hal/JNIWrapper.java @@ -13,16 +13,30 @@ public class JNIWrapper { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -57,4 +71,7 @@ public static synchronized void forceLoad() throws IOException { } public static void suppressUnused(Object object) {} + + /** Utility class. */ + public JNIWrapper() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/LEDJNI.java b/hal/src/main/java/edu/wpi/first/hal/LEDJNI.java index bdb4b02d39f..397328eac47 100644 --- a/hal/src/main/java/edu/wpi/first/hal/LEDJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/LEDJNI.java @@ -25,4 +25,7 @@ public class LEDJNI extends JNIWrapper { * @see "HAL_GetRadioLEDState" */ public static native int getRadioLEDState(); + + /** Utility class. */ + private LEDJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/NotifierJNI.java b/hal/src/main/java/edu/wpi/first/hal/NotifierJNI.java index 5620f032dee..04784bcf4d5 100644 --- a/hal/src/main/java/edu/wpi/first/hal/NotifierJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/NotifierJNI.java @@ -101,4 +101,7 @@ public class NotifierJNI extends JNIWrapper { * @return the FPGA time the notifier returned */ public static native long waitForNotifierAlarm(int notifierHandle); + + /** Utility class. */ + private NotifierJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java b/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java index dc2abc10768..5166248839a 100644 --- a/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/PWMJNI.java @@ -44,4 +44,7 @@ public static native void setPWMConfigMicroseconds( public static native void setAlwaysHighMode(int pwmPortHandle); public static native void setPWMPeriodScale(int pwmPortHandle, int squelchMask); + + /** Utility class. */ + private PWMJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/PortsJNI.java b/hal/src/main/java/edu/wpi/first/hal/PortsJNI.java index 20f9b42110d..b47697b0e62 100644 --- a/hal/src/main/java/edu/wpi/first/hal/PortsJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/PortsJNI.java @@ -185,4 +185,7 @@ public class PortsJNI extends JNIWrapper { * @see "HAL_GetNumREVPHChannels" */ public static native int getNumREVPHChannels(); + + /** Utility class. */ + private PortsJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/PowerDistributionJNI.java b/hal/src/main/java/edu/wpi/first/hal/PowerDistributionJNI.java index bc7060d2b4b..93f9a3dccac 100644 --- a/hal/src/main/java/edu/wpi/first/hal/PowerDistributionJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/PowerDistributionJNI.java @@ -282,4 +282,7 @@ public static PowerDistributionStickyFaults getStickyFaults(int handle) { * @see "HAL_GetPowerDistributionVersion" */ public static native PowerDistributionVersion getVersion(int handle); + + /** Utility class. */ + private PowerDistributionJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/PowerJNI.java b/hal/src/main/java/edu/wpi/first/hal/PowerJNI.java index 8dd9548cca5..900b423f344 100644 --- a/hal/src/main/java/edu/wpi/first/hal/PowerJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/PowerJNI.java @@ -167,4 +167,7 @@ public class PowerJNI extends JNIWrapper { * @return current CPU temperature in degrees Celsius */ public static native double getCPUTemp(); + + /** Utility class. */ + private PowerJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java b/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java index b1935b2f983..1180b9b107c 100644 --- a/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java @@ -286,4 +286,7 @@ public static REVPHFaults getFaults(int handle) { * @see "HAL_GetREVPHVersion" */ public static native REVPHVersion getVersion(int handle); + + /** Utility class. */ + private REVPHJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/RelayJNI.java b/hal/src/main/java/edu/wpi/first/hal/RelayJNI.java index 10a39b4884e..abe146e1a6c 100644 --- a/hal/src/main/java/edu/wpi/first/hal/RelayJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/RelayJNI.java @@ -57,4 +57,7 @@ public class RelayJNI extends DIOJNI { * @see "HAL_GetRelay" */ public static native boolean getRelay(int relayPortHandle); + + /** Utility class. */ + private RelayJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/SPIJNI.java b/hal/src/main/java/edu/wpi/first/hal/SPIJNI.java index 82b9fed1602..18a0a8e7672 100644 --- a/hal/src/main/java/edu/wpi/first/hal/SPIJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/SPIJNI.java @@ -302,4 +302,7 @@ public static native int spiReadAutoReceivedData( */ public static native void spiConfigureAutoStall( int port, int csToSclkTicks, int stallTicks, int pow2BytesPerRead); + + /** Utility class. */ + private SPIJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/SerialPortJNI.java b/hal/src/main/java/edu/wpi/first/hal/SerialPortJNI.java index e156f3a0a67..052218fbe79 100644 --- a/hal/src/main/java/edu/wpi/first/hal/SerialPortJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/SerialPortJNI.java @@ -205,4 +205,7 @@ public class SerialPortJNI extends JNIWrapper { * @see "HAL_CloseSerial" */ public static native void serialClose(int handle); + + /** Utility class. */ + private SerialPortJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/SimDeviceJNI.java b/hal/src/main/java/edu/wpi/first/hal/SimDeviceJNI.java index 4352a2df481..fdf09b4435b 100644 --- a/hal/src/main/java/edu/wpi/first/hal/SimDeviceJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/SimDeviceJNI.java @@ -286,4 +286,7 @@ public static void setSimValueBoolean(int handle, boolean value) { * @param handle simulated value handle */ public static native void resetSimValue(int handle); + + /** Utility class. */ + private SimDeviceJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/ThreadsJNI.java b/hal/src/main/java/edu/wpi/first/hal/ThreadsJNI.java index 2ccc8085603..2183ae3d557 100644 --- a/hal/src/main/java/edu/wpi/first/hal/ThreadsJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/ThreadsJNI.java @@ -37,4 +37,7 @@ public class ThreadsJNI extends JNIWrapper { * @see "HAL_SetCurrentThreadPriority" */ public static native boolean setCurrentThreadPriority(boolean realTime, int priority); + + /** Utility class. */ + private ThreadsJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/can/CANStreamOverflowException.java b/hal/src/main/java/edu/wpi/first/hal/can/CANStreamOverflowException.java index 41d2bb56a2d..f5e2f21358c 100644 --- a/hal/src/main/java/edu/wpi/first/hal/can/CANStreamOverflowException.java +++ b/hal/src/main/java/edu/wpi/first/hal/can/CANStreamOverflowException.java @@ -8,7 +8,10 @@ import java.io.IOException; public class CANStreamOverflowException extends IOException { + /** The messages. */ private final CANStreamMessage[] m_messages; + + /** The length of messages read. */ private final int m_messagesRead; /** diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/AccelerometerDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/AccelerometerDataJNI.java index 5ea3726eb75..26975c08404 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/AccelerometerDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/AccelerometerDataJNI.java @@ -6,7 +6,16 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for accelerometer data. */ public class AccelerometerDataJNI extends JNIWrapper { + /** + * Register a callback to be run when this accelerometer activates. + * + * @param index the index + * @param callback the callback + * @param initialNotify whether to run the callback with the initial state + * @return the CallbackStore object associated with this callback + */ public static native int registerActiveCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -53,4 +62,7 @@ public static native int registerZCallback( public static native void setZ(int index, double z); public static native void resetData(int index); + + /** Utility class. */ + private AccelerometerDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/AddressableLEDDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/AddressableLEDDataJNI.java index 8ba0e94c7b5..b1465352cb8 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/AddressableLEDDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/AddressableLEDDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for addressable LED data. */ public class AddressableLEDDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -54,4 +55,7 @@ public static native int registerRunningCallback( public static native void resetData(int index); public static native int findForChannel(int channel); + + /** Utility class. */ + private AddressableLEDDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogGyroDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogGyroDataJNI.java index a6acc9aa0da..b369dcda15a 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogGyroDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogGyroDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for analog gyro data. */ public class AnalogGyroDataJNI extends JNIWrapper { public static native int registerAngleCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -35,4 +36,7 @@ public static native int registerInitializedCallback( public static native void setInitialized(int index, boolean initialized); public static native void resetData(int index); + + /** Utility class. */ + private AnalogGyroDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogInDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogInDataJNI.java index 4229c09574d..b3dde0e176a 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogInDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogInDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for analog input data. */ public class AnalogInDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -89,4 +90,7 @@ public static native int registerAccumulatorDeadbandCallback( public static native void setAccumulatorDeadband(int index, int AccumulatorDeadband); public static native void resetData(int index); + + /** Utility class. */ + private AnalogInDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogOutDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogOutDataJNI.java index 6af16a0957c..f8e4eeccd1e 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogOutDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogOutDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for analog output data. */ public class AnalogOutDataJNI extends JNIWrapper { public static native int registerVoltageCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -26,4 +27,7 @@ public static native int registerInitializedCallback( public static native void setInitialized(int index, boolean initialized); public static native void resetData(int index); + + /** Utility class. */ + private AnalogOutDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogTriggerDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogTriggerDataJNI.java index 67b65b50c93..681e5bd8c7a 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogTriggerDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/AnalogTriggerDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for analog trigger data. */ public class AnalogTriggerDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -37,4 +38,7 @@ public static native int registerTriggerUpperBoundCallback( public static native void resetData(int index); public static native int findForChannel(int channel); + + /** Utility class. */ + private AnalogTriggerDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/CTREPCMDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/CTREPCMDataJNI.java index 6d94438d999..265edd036bd 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/CTREPCMDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/CTREPCMDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for CTRE PCM data. */ public class CTREPCMDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -68,4 +69,7 @@ public static native void registerAllSolenoidCallbacks( int index, int channel, NotifyCallback callback, boolean initialNotify); public static native void resetData(int index); + + /** Utility class. */ + private CTREPCMDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/DIODataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/DIODataJNI.java index 0c59415ee1e..dbbab99a510 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/DIODataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/DIODataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for DIO data. */ public class DIODataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -53,4 +54,7 @@ public static native int registerFilterIndexCallback( public static native void setFilterIndex(int index, int filterIndex); public static native void resetData(int index); + + /** Utility class. */ + private DIODataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/DigitalPWMDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/DigitalPWMDataJNI.java index addcffcd126..e72a2337b9d 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/DigitalPWMDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/DigitalPWMDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for digital PWM data. */ public class DigitalPWMDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -37,4 +38,7 @@ public static native int registerPinCallback( public static native void resetData(int index); public static native int findForChannel(int channel); + + /** Utility class. */ + private DigitalPWMDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/DriverStationDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/DriverStationDataJNI.java index 196f0174aea..e310b14d797 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/DriverStationDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/DriverStationDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for Driver Station data. */ public class DriverStationDataJNI extends JNIWrapper { public static native int registerEnabledCallback(NotifyCallback callback, boolean initialNotify); @@ -134,4 +135,7 @@ public static native void setMatchInfo( public static native void setReplayNumber(int replayNumber); public static native void resetData(); + + /** Utility class. */ + private DriverStationDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/DutyCycleDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/DutyCycleDataJNI.java index 8f244cac455..e2ed8735827 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/DutyCycleDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/DutyCycleDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for duty cycle data. */ public class DutyCycleDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -37,4 +38,7 @@ public static native int registerOutputCallback( public static native void resetData(int index); public static native int findForChannel(int channel); + + /** Utility class. */ + private DutyCycleDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/EncoderDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/EncoderDataJNI.java index e48607a8c15..d853d00508a 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/EncoderDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/EncoderDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for encoder data. */ public class EncoderDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -99,4 +100,7 @@ public static native int registerDistancePerPulseCallback( public static native void resetData(int index); public static native int findForChannel(int channel); + + /** Utility class. */ + private EncoderDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/I2CDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/I2CDataJNI.java index ebe15ebb8e2..f74d63e074c 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/I2CDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/I2CDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for I2C data. */ public class I2CDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -25,4 +26,7 @@ public static native int registerInitializedCallback( public static native void cancelWriteCallback(int index, int uid); public static native void resetData(int index); + + /** Utility class. */ + private I2CDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/NotifierDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/NotifierDataJNI.java index 9c7b0a271e7..9323d1afa01 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/NotifierDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/NotifierDataJNI.java @@ -6,8 +6,12 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for notifier data. */ public class NotifierDataJNI extends JNIWrapper { public static native long getNextTimeout(); public static native int getNumNotifiers(); + + /** Utility class. */ + private NotifierDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/PWMDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/PWMDataJNI.java index d66256bbc8e..10f8b6669a7 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/PWMDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/PWMDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for PWM data. */ public class PWMDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -62,4 +63,7 @@ public static native int registerZeroLatchCallback( public static native void setZeroLatch(int index, boolean zeroLatch); public static native void resetData(int index); + + /** Utility class. */ + private PWMDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/PowerDistributionDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/PowerDistributionDataJNI.java index c17da137a19..80a7e46b1e9 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/PowerDistributionDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/PowerDistributionDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for power distribution data. */ public class PowerDistributionDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -44,4 +45,7 @@ public static native int registerCurrentCallback( public static native void setCurrent(int index, int channel, double current); public static native void resetData(int index); + + /** Utility class. */ + private PowerDistributionDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/REVPHDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/REVPHDataJNI.java index 96b9701c272..9609f3dc22f 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/REVPHDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/REVPHDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for REV PH data. */ public class REVPHDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -68,4 +69,7 @@ public static native void registerAllSolenoidCallbacks( int index, int channel, NotifyCallback callback, boolean initialNotify); public static native void resetData(int index); + + /** Utility class. */ + private REVPHDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/RelayDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/RelayDataJNI.java index 3b165e2754d..734371522b6 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/RelayDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/RelayDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for relay data. */ public class RelayDataJNI extends JNIWrapper { public static native int registerInitializedForwardCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -44,4 +45,7 @@ public static native int registerReverseCallback( public static native void setReverse(int index, boolean reverse); public static native void resetData(int index); + + /** Utility class. */ + private RelayDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/RoboRioDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/RoboRioDataJNI.java index f5362279163..83d599db2f1 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/RoboRioDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/RoboRioDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for roboRIO data. */ public class RoboRioDataJNI extends JNIWrapper { public static native int registerFPGAButtonCallback( NotifyCallback callback, boolean initialNotify); @@ -186,4 +187,7 @@ public static native int registerRadioLEDStateCallback( public static native void setRadioLEDState(int state); public static native void resetData(); + + /** Utility class. */ + private RoboRioDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/SPIAccelerometerDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/SPIAccelerometerDataJNI.java index 9ceaad8c403..b38fb553314 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/SPIAccelerometerDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/SPIAccelerometerDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for SPI accelerometer data. */ public class SPIAccelerometerDataJNI extends JNIWrapper { public static native int registerActiveCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -53,4 +54,7 @@ public static native int registerZCallback( public static native void setZ(int index, double z); public static native void resetData(int index); + + /** Utility class. */ + private SPIAccelerometerDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/SPIDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/SPIDataJNI.java index 11b777e2621..fa8df895df2 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/SPIDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/SPIDataJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for SPI data. */ public class SPIDataJNI extends JNIWrapper { public static native int registerInitializedCallback( int index, NotifyCallback callback, boolean initialNotify); @@ -30,4 +31,7 @@ public static native int registerReadAutoReceiveBufferCallback( public static native void cancelReadAutoReceiveBufferCallback(int index, int uid); public static native void resetData(int index); + + /** Utility class. */ + private SPIDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/SimDeviceDataJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/SimDeviceDataJNI.java index 092b955dc68..b4abb3306e8 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/SimDeviceDataJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/SimDeviceDataJNI.java @@ -7,6 +7,7 @@ import edu.wpi.first.hal.HALValue; import edu.wpi.first.hal.JNIWrapper; +/** JNI for sim device data. */ public class SimDeviceDataJNI extends JNIWrapper { public static native void setSimDeviceEnabled(String prefix, boolean enabled); @@ -106,4 +107,7 @@ public SimValueInfo( public static native double[] getSimValueEnumDoubleValues(int handle); public static native void resetSimDeviceData(); + + /** Utility class. */ + private SimDeviceDataJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/simulation/SimulatorJNI.java b/hal/src/main/java/edu/wpi/first/hal/simulation/SimulatorJNI.java index 3dfeb068a98..298929c06f8 100644 --- a/hal/src/main/java/edu/wpi/first/hal/simulation/SimulatorJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/simulation/SimulatorJNI.java @@ -6,6 +6,7 @@ import edu.wpi.first.hal.JNIWrapper; +/** JNI for simulator. */ public class SimulatorJNI extends JNIWrapper { public static native void setRuntimeType(int type); @@ -28,4 +29,7 @@ public class SimulatorJNI extends JNIWrapper { public static native void stepTimingAsync(long delta); public static native void resetHandles(); + + /** Utility class. */ + private SimulatorJNI() {} } diff --git a/hal/src/main/java/edu/wpi/first/hal/util/UncleanStatusException.java b/hal/src/main/java/edu/wpi/first/hal/util/UncleanStatusException.java index 7be73b4f1bb..6c188d3752b 100644 --- a/hal/src/main/java/edu/wpi/first/hal/util/UncleanStatusException.java +++ b/hal/src/main/java/edu/wpi/first/hal/util/UncleanStatusException.java @@ -6,6 +6,7 @@ /** Exception for bad status codes from the chip object. */ public final class UncleanStatusException extends IllegalStateException { + /** The status code from the chip object. */ private final int m_statusCode; /** diff --git a/ntcore/src/generate/main/java/NetworkTablesJNI.java.jinja b/ntcore/src/generate/main/java/NetworkTablesJNI.java.jinja index 17e95dd4836..e16dbd2de9a 100644 --- a/ntcore/src/generate/main/java/NetworkTablesJNI.java.jinja +++ b/ntcore/src/generate/main/java/NetworkTablesJNI.java.jinja @@ -18,16 +18,30 @@ public final class NetworkTablesJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -358,5 +372,8 @@ public final class NetworkTablesJNI { public static native void stopConnectionDataLog(int logger); public static native int addLogger(int poller, int minLevel, int maxLevel); + + /** Utility class. */ + private NetworkTablesJNI() {} } diff --git a/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTablesJNI.java b/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTablesJNI.java index b65b8d97342..5aa40609447 100644 --- a/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTablesJNI.java +++ b/ntcore/src/generated/main/java/edu/wpi/first/networktables/NetworkTablesJNI.java @@ -18,16 +18,30 @@ public final class NetworkTablesJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -494,4 +508,7 @@ public static int startConnectionDataLog(int inst, DataLog log, String name) { public static native void stopConnectionDataLog(int logger); public static native int addLogger(int poller, int minLevel, int maxLevel); + + /** Utility class. */ + private NetworkTablesJNI() {} } diff --git a/ntcore/src/main/java/edu/wpi/first/networktables/TimestampedObject.java b/ntcore/src/main/java/edu/wpi/first/networktables/TimestampedObject.java index 37c15447936..896ec795a3b 100644 --- a/ntcore/src/main/java/edu/wpi/first/networktables/TimestampedObject.java +++ b/ntcore/src/main/java/edu/wpi/first/networktables/TimestampedObject.java @@ -4,7 +4,11 @@ package edu.wpi.first.networktables; -/** NetworkTables timestamped object. */ +/** + * NetworkTables timestamped object. + * + * @param Value type. + */ public final class TimestampedObject { /** * Create a timestamped value. diff --git a/styleguide/spotbugs-exclude.xml b/styleguide/spotbugs-exclude.xml index 9bee5c524d7..ba4feb2ffd6 100644 --- a/styleguide/spotbugs-exclude.xml +++ b/styleguide/spotbugs-exclude.xml @@ -138,6 +138,10 @@ + + + + diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/WrapperCommand.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/WrapperCommand.java index 5e1cb05a076..5e6ccaef82b 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/WrapperCommand.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/WrapperCommand.java @@ -15,6 +15,7 @@ * subsystems its components require. */ public abstract class WrapperCommand extends Command { + /** Command being wrapped. */ protected final Command m_command; /** diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/WrapperCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/WrapperCommand.h index 98e8b200820..97a8693dc0b 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/WrapperCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/WrapperCommand.h @@ -69,6 +69,7 @@ class WrapperCommand : public CommandHelper { wpi::SmallSet GetRequirements() const override; protected: + /// Command being wrapped. std::unique_ptr m_command; }; } // namespace frc2 diff --git a/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp b/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp index 14fd37fedc1..4ce419778a2 100644 --- a/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp +++ b/wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp @@ -679,8 +679,13 @@ double ADIS16448_IMU::CompFilterProcess(double compAngle, double accelAngle, return compAngle; } -int ADIS16448_IMU::ConfigDecRate(uint16_t DecimationSetting) { - uint16_t writeValue = DecimationSetting; +int ADIS16448_IMU::ConfigDecRate(uint16_t decimationRate) { + // Switches the active SPI port to standard SPI mode, writes a new value to + // the DECIMATE register in the IMU, and re-enables auto SPI. + // + // This function enters standard SPI mode, writes a new DECIMATE setting to + // the IMU, adjusts the sample scale factor, and re-enters auto SPI mode. + uint16_t writeValue = decimationRate; uint16_t readbackValue; if (!SwitchToStandardSPI()) { REPORT_ERROR("Failed to configure/reconfigure standard SPI."); @@ -688,14 +693,14 @@ int ADIS16448_IMU::ConfigDecRate(uint16_t DecimationSetting) { } /* Check max */ - if (DecimationSetting > 9) { + if (decimationRate > 9) { REPORT_ERROR( "Attempted to write an invalid decimation value. Capping at 9"); - DecimationSetting = 9; + decimationRate = 9; } /* Shift decimation setting to correct position and select internal sync */ - writeValue = (DecimationSetting << 8) | 0x1; + writeValue = (decimationRate << 8) | 0x1; /* Apply to IMU */ WriteRegister(SMPL_PRD, writeValue); diff --git a/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp b/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp index 4eaa7ccd609..1c5c7a16f5f 100644 --- a/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp +++ b/wpilibc/src/main/native/cpp/ADIS16470_IMU.cpp @@ -348,31 +348,22 @@ int ADIS16470_IMU::ConfigCalTime(CalibrationTime new_cal_time) { return 0; } -/** - * @brief Switches the active SPI port to standard SPI mode, writes a new value - *to the DECIMATE register in the IMU, and re-enables auto SPI. - * - * @param reg Decimation value to be set. - * - * @return An int indicating the success or failure of writing the new DECIMATE - *setting and returning to auto SPI mode. 0 = Success, 1 = No Change, 2 = - *Failure - * - * This function enters standard SPI mode, writes a new DECIMATE setting to the - *IMU, adjusts the sample scale factor, and re-enters auto SPI mode. - **/ -int ADIS16470_IMU::ConfigDecRate(uint16_t reg) { - uint16_t m_reg = reg; +int ADIS16470_IMU::ConfigDecRate(uint16_t decimationRate) { + // Switches the active SPI port to standard SPI mode, writes a new value to + // the DECIMATE register in the IMU, and re-enables auto SPI. + // + // This function enters standard SPI mode, writes a new DECIMATE setting to + // the IMU, adjusts the sample scale factor, and re-enters auto SPI mode. if (!SwitchToStandardSPI()) { REPORT_ERROR("Failed to configure/reconfigure standard SPI."); return 2; } - if (m_reg > 1999) { + if (decimationRate > 1999) { REPORT_ERROR("Attempted to write an invalid decimation value."); - m_reg = 1999; + decimationRate = 1999; } - m_scaled_sample_rate = (((m_reg + 1.0) / 2000.0) * 1000000.0); - WriteRegister(DEC_RATE, m_reg); + m_scaled_sample_rate = (((decimationRate + 1.0) / 2000.0) * 1000000.0); + WriteRegister(DEC_RATE, decimationRate); if (!SwitchToAutoSPI()) { REPORT_ERROR("Failed to configure/reconfigure auto SPI."); return 2; diff --git a/wpilibc/src/main/native/include/frc/ADIS16448_IMU.h b/wpilibc/src/main/native/include/frc/ADIS16448_IMU.h index 3f4a1c2ebda..41c66c110ff 100644 --- a/wpilibc/src/main/native/include/frc/ADIS16448_IMU.h +++ b/wpilibc/src/main/native/include/frc/ADIS16448_IMU.h @@ -56,23 +56,47 @@ namespace frc { class ADIS16448_IMU : public wpi::Sendable, public wpi::SendableHelper { public: - /* ADIS16448 Calibration Time Enum Class */ + /** + * ADIS16448 calibration times. + */ enum class CalibrationTime { + /// 32 ms calibration time. _32ms = 0, + /// 64 ms calibration time. _64ms = 1, + /// 128 ms calibration time. _128ms = 2, + /// 256 ms calibration time. _256ms = 3, + /// 512 ms calibration time. _512ms = 4, + /// 1 s calibration time. _1s = 5, + /// 2 s calibration time. _2s = 6, + /// 4 s calibration time. _4s = 7, + /// 8 s calibration time. _8s = 8, + /// 16 s calibration time. _16s = 9, + /// 32 s calibration time. _32s = 10, + /// 64 s calibration time. _64s = 11 }; - enum IMUAxis { kX, kY, kZ }; + /** + * IMU axes. + */ + enum IMUAxis { + /// The IMU's X axis. + kX, + /// The IMU's Y axis. + kY, + /// The IMU's Z axis. + kZ + }; /** * IMU constructor on onboard MXP CS0, Z-up orientation, and complementary @@ -183,31 +207,71 @@ class ADIS16448_IMU : public wpi::Sendable, */ units::meters_per_second_squared_t GetAccelZ() const; + /** + * Returns the complementary angle around the X axis computed from + * accelerometer and gyro rate measurements. + */ units::degree_t GetXComplementaryAngle() const; + /** + * Returns the complementary angle around the Y axis computed from + * accelerometer and gyro rate measurements. + */ units::degree_t GetYComplementaryAngle() const; + /** + * Returns the X-axis filtered acceleration angle. + */ units::degree_t GetXFilteredAccelAngle() const; + /** + * Returns the Y-axis filtered acceleration angle. + */ units::degree_t GetYFilteredAccelAngle() const; + /** + * Returns the magnetic field strength in the X axis. + */ units::tesla_t GetMagneticFieldX() const; + /** + * Returns the magnetic field strength in the Y axis. + */ units::tesla_t GetMagneticFieldY() const; + /** + * Returns the magnetic field strength in the Z axis. + */ units::tesla_t GetMagneticFieldZ() const; + /** + * Returns the barometric pressure. + */ units::pounds_per_square_inch_t GetBarometricPressure() const; + /** + * Returns the temperature. + */ units::celsius_t GetTemperature() const; IMUAxis GetYawAxis() const; int SetYawAxis(IMUAxis yaw_axis); + /** + * Checks the connection status of the IMU. + * + * @return True if the IMU is connected, false otherwise. + */ bool IsConnected() const; - int ConfigDecRate(uint16_t DecimationRate); + /** + * Configures the decimation rate of the IMU. + * + * @param decimationRate The new decimation value. + * @return 0 if success, 1 if no change, 2 if error. + */ + int ConfigDecRate(uint16_t decimationRate); /** * Get the SPI port number. diff --git a/wpilibc/src/main/native/include/frc/ADIS16470_IMU.h b/wpilibc/src/main/native/include/frc/ADIS16470_IMU.h index ad8baa0e048..f594c2bcd04 100644 --- a/wpilibc/src/main/native/include/frc/ADIS16470_IMU.h +++ b/wpilibc/src/main/native/include/frc/ADIS16470_IMU.h @@ -53,27 +53,93 @@ namespace frc { class ADIS16470_IMU : public wpi::Sendable, public wpi::SendableHelper { public: - /* ADIS16470 Calibration Time Enum Class */ + /** + * ADIS16470 calibration times. + */ enum class CalibrationTime { + /// 32 ms calibration time. _32ms = 0, + /// 64 ms calibration time. _64ms = 1, + /// 128 ms calibration time. _128ms = 2, + /// 256 ms calibration time. _256ms = 3, + /// 512 ms calibration time. _512ms = 4, + /// 1 s calibration time. _1s = 5, + /// 2 s calibration time. _2s = 6, + /// 4 s calibration time. _4s = 7, + /// 8 s calibration time. _8s = 8, + /// 16 s calibration time. _16s = 9, + /// 32 s calibration time. _32s = 10, + /// 64 s calibration time. _64s = 11 }; - enum IMUAxis { kX, kY, kZ, kYaw, kPitch, kRoll }; + /** + * IMU axes. + * + * kX, kY, and kZ refer to the IMU's X, Y, and Z axes respectively. kYaw, + * kPitch, and kRoll are configured by the user to refer to an X, Y, or Z + * axis. + */ + enum IMUAxis { + /// The IMU's X axis. + kX, + /// The IMU's Y axis. + kY, + /// The IMU's Z axis. + kZ, + /// The user-configured yaw axis. + kYaw, + /// The user-configured pitch axis. + kPitch, + /// The user-configured roll axis. + kRoll + }; + /** + * Creates a new ADIS16740 IMU object. + * + * The default setup is the onboard SPI port with a calibration time of 4 + * seconds. Yaw, pitch, and roll are kZ, kX, and kY respectively. + */ ADIS16470_IMU(); + + /** + * Creates a new ADIS16740 IMU object. + * + * The default setup is the onboard SPI port with a calibration time of 4 + * seconds. + * + * Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch,or kRoll + * will result in an error. + * + * @param yaw_axis The axis that measures the yaw + * @param pitch_axis The axis that measures the pitch + * @param roll_axis The axis that measures the roll + */ ADIS16470_IMU(IMUAxis yaw_axis, IMUAxis pitch_axis, IMUAxis roll_axis); + /** + * Creates a new ADIS16740 IMU object. + * + * Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch, or + * kRoll will result in an error. + * + * @param yaw_axis The axis that measures the yaw + * @param pitch_axis The axis that measures the pitch + * @param roll_axis The axis that measures the roll + * @param port The SPI Port the gyro is plugged into + * @param cal_time Calibration time + */ explicit ADIS16470_IMU(IMUAxis yaw_axis, IMUAxis pitch_axis, IMUAxis roll_axis, frc::SPI::Port port, CalibrationTime cal_time); @@ -84,9 +150,12 @@ class ADIS16470_IMU : public wpi::Sendable, ADIS16470_IMU& operator=(ADIS16470_IMU&&) = default; /** - * @brief Configures the decimation rate of the IMU. + * Configures the decimation rate of the IMU. + * + * @param decimationRate The new decimation value. + * @return 0 if success, 1 if no change, 2 if error. */ - int ConfigDecRate(uint16_t reg); + int ConfigDecRate(uint16_t decimationRate); /** * @brief Switches the active SPI port to standard SPI mode, writes the @@ -101,8 +170,11 @@ class ADIS16470_IMU : public wpi::Sendable, int ConfigCalTime(CalibrationTime new_cal_time); /** - * @brief Resets the gyro accumulations to a heading of zero. This can be used - * if the "zero" orientation of the sensor needs to be changed in runtime. + * Reset the gyro. + * + * Resets the gyro accumulations to a heading of zero. This can be used if + * there is significant drift in the gyro and it needs to be recalibrated + * after running. */ void Reset(); @@ -144,14 +216,18 @@ class ADIS16470_IMU : public wpi::Sendable, void SetGyroAngleZ(units::degree_t angle); /** - * @param axis The IMUAxis whose angle to return - * @return The axis angle (CCW positive) + * Returns the axis angle (CCW positive). + * + * @param axis The IMUAxis whose angle to return. + * @return The axis angle (CCW positive). */ units::degree_t GetAngle(IMUAxis axis) const; /** - * @param axis The IMUAxis whose rate to return - * @return Axis angular rate (CCW positive) + * Returns the axis angular rate (CCW positive). + * + * @param axis The IMUAxis whose rate to return. + * @return Axis angular rate (CCW positive). */ units::degrees_per_second_t GetRate(IMUAxis axis) const; diff --git a/wpilibc/src/main/native/include/frc/ADXL345_I2C.h b/wpilibc/src/main/native/include/frc/ADXL345_I2C.h index 2fe0da4a350..9b3312ef1c0 100644 --- a/wpilibc/src/main/native/include/frc/ADXL345_I2C.h +++ b/wpilibc/src/main/native/include/frc/ADXL345_I2C.h @@ -26,14 +26,42 @@ namespace frc { class ADXL345_I2C : public nt::NTSendable, public wpi::SendableHelper { public: - enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 }; + /** + * Accelerometer range. + */ + enum Range { + /// 2 Gs max. + kRange_2G = 0, + /// 4 Gs max. + kRange_4G = 1, + /// 8 Gs max. + kRange_8G = 2, + /// 16 Gs max. + kRange_16G = 3 + }; - enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 }; + /** + * Accelerometer axes. + */ + enum Axes { + /// X axis. + kAxis_X = 0x00, + /// Y axis. + kAxis_Y = 0x02, + /// Z axis. + kAxis_Z = 0x04 + }; + /** + * Container type for accelerations from all axes. + */ struct AllAxes { - double XAxis; - double YAxis; - double ZAxis; + /// Acceleration along the X axis in g-forces. + double XAxis = 0.0; + /// Acceleration along the Y axis in g-forces. + double YAxis = 0.0; + /// Acceleration along the Z axis in g-forces. + double ZAxis = 0.0; }; /** @@ -101,14 +129,6 @@ class ADXL345_I2C : public nt::NTSendable, void InitSendable(nt::NTSendableBuilder& builder) override; protected: - I2C m_i2c; - - hal::SimDevice m_simDevice; - hal::SimEnum m_simRange; - hal::SimDouble m_simX; - hal::SimDouble m_simY; - hal::SimDouble m_simZ; - static constexpr int kAddress = 0x1D; static constexpr int kPowerCtlRegister = 0x2D; static constexpr int kDataFormatRegister = 0x31; @@ -129,6 +149,15 @@ class ADXL345_I2C : public nt::NTSendable, kDataFormat_FullRes = 0x08, kDataFormat_Justify = 0x04 }; + + private: + I2C m_i2c; + + hal::SimDevice m_simDevice; + hal::SimEnum m_simRange; + hal::SimDouble m_simX; + hal::SimDouble m_simY; + hal::SimDouble m_simZ; }; } // namespace frc diff --git a/wpilibc/src/main/native/include/frc/ADXL345_SPI.h b/wpilibc/src/main/native/include/frc/ADXL345_SPI.h index 3f2d8aebab4..19eeb5213e7 100644 --- a/wpilibc/src/main/native/include/frc/ADXL345_SPI.h +++ b/wpilibc/src/main/native/include/frc/ADXL345_SPI.h @@ -21,14 +21,42 @@ namespace frc { class ADXL345_SPI : public nt::NTSendable, public wpi::SendableHelper { public: - enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 }; + /** + * Accelerometer range. + */ + enum Range { + /// 2 Gs max. + kRange_2G = 0, + /// 4 Gs max. + kRange_4G = 1, + /// 8 Gs max. + kRange_8G = 2, + /// 16 Gs max. + kRange_16G = 3 + }; - enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 }; + /** + * Accelerometer axes. + */ + enum Axes { + /// X axis. + kAxis_X = 0x00, + /// Y axis. + kAxis_Y = 0x02, + /// Z axis. + kAxis_Z = 0x04 + }; + /** + * Container type for accelerations from all axes. + */ struct AllAxes { - double XAxis; - double YAxis; - double ZAxis; + /// Acceleration along the X axis in g-forces. + double XAxis = 0.0; + /// Acceleration along the Y axis in g-forces. + double YAxis = 0.0; + /// Acceleration along the Z axis in g-forces. + double ZAxis = 0.0; }; /** @@ -94,14 +122,6 @@ class ADXL345_SPI : public nt::NTSendable, void InitSendable(nt::NTSendableBuilder& builder) override; protected: - SPI m_spi; - - hal::SimDevice m_simDevice; - hal::SimEnum m_simRange; - hal::SimDouble m_simX; - hal::SimDouble m_simY; - hal::SimDouble m_simZ; - static constexpr int kPowerCtlRegister = 0x2D; static constexpr int kDataFormatRegister = 0x31; static constexpr int kDataRegister = 0x32; @@ -123,6 +143,15 @@ class ADXL345_SPI : public nt::NTSendable, kDataFormat_FullRes = 0x08, kDataFormat_Justify = 0x04 }; + + private: + SPI m_spi; + + hal::SimDevice m_simDevice; + hal::SimEnum m_simRange; + hal::SimDouble m_simX; + hal::SimDouble m_simY; + hal::SimDouble m_simZ; }; } // namespace frc diff --git a/wpilibc/src/main/native/include/frc/ADXL362.h b/wpilibc/src/main/native/include/frc/ADXL362.h index ddf6ebed1a2..0332b3103fe 100644 --- a/wpilibc/src/main/native/include/frc/ADXL362.h +++ b/wpilibc/src/main/native/include/frc/ADXL362.h @@ -19,13 +19,40 @@ namespace frc { */ class ADXL362 : public nt::NTSendable, public wpi::SendableHelper { public: - enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2 }; + /** + * Accelerometer range. + */ + enum Range { + /// 2 Gs max. + kRange_2G = 0, + /// 4 Gs max. + kRange_4G = 1, + /// 8 Gs max. + kRange_8G = 2 + }; - enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 }; + /** + * Accelerometer axes. + */ + enum Axes { + /// X axis. + kAxis_X = 0x00, + /// Y axis. + kAxis_Y = 0x02, + /// Z axis. + kAxis_Z = 0x04 + }; + + /** + * Container type for accelerations from all axes. + */ struct AllAxes { - double XAxis; - double YAxis; - double ZAxis; + /// Acceleration along the X axis in g-forces. + double XAxis = 0.0; + /// Acceleration along the Y axis in g-forces. + double YAxis = 0.0; + /// Acceleration along the Z axis in g-forces. + double ZAxis = 0.0; }; public: diff --git a/wpilibc/src/main/native/include/frc/AnalogGyro.h b/wpilibc/src/main/native/include/frc/AnalogGyro.h index 0c472fbf7f8..3913b404884 100644 --- a/wpilibc/src/main/native/include/frc/AnalogGyro.h +++ b/wpilibc/src/main/native/include/frc/AnalogGyro.h @@ -218,10 +218,8 @@ class AnalogGyro : public wpi::Sendable, void InitSendable(wpi::SendableBuilder& builder) override; - protected: - std::shared_ptr m_analog; - private: + std::shared_ptr m_analog; hal::Handle m_gyroHandle; }; diff --git a/wpilibc/src/main/native/include/frc/AnalogOutput.h b/wpilibc/src/main/native/include/frc/AnalogOutput.h index ccb3c9c91fe..4151ae67557 100644 --- a/wpilibc/src/main/native/include/frc/AnalogOutput.h +++ b/wpilibc/src/main/native/include/frc/AnalogOutput.h @@ -33,14 +33,14 @@ class AnalogOutput : public wpi::Sendable, /** * Set the value of the analog output. * - * @param voltage The output value in Volts, from 0.0 to +5.0 + * @param voltage The output value in Volts, from 0.0 to +5.0. */ void SetVoltage(double voltage); /** - * Get the voltage of the analog output + * Get the voltage of the analog output. * - * @return The value in Volts, from 0.0 to +5.0 + * @return The value in Volts, from 0.0 to +5.0. */ double GetVoltage() const; diff --git a/wpilibc/src/main/native/include/frc/AnalogTriggerType.h b/wpilibc/src/main/native/include/frc/AnalogTriggerType.h index c706c344337..0db114d598a 100644 --- a/wpilibc/src/main/native/include/frc/AnalogTriggerType.h +++ b/wpilibc/src/main/native/include/frc/AnalogTriggerType.h @@ -6,10 +6,15 @@ namespace frc { +/** Defines the state in which the AnalogTrigger triggers. */ enum class AnalogTriggerType { + /// In window. kInWindow = 0, + /// State. kState = 1, + /// Rising Pulse. kRisingPulse = 2, + /// Falling pulse. kFallingPulse = 3 }; diff --git a/wpilibc/src/main/native/include/frc/BuiltInAccelerometer.h b/wpilibc/src/main/native/include/frc/BuiltInAccelerometer.h index a8f0adc4deb..270ed80d55c 100644 --- a/wpilibc/src/main/native/include/frc/BuiltInAccelerometer.h +++ b/wpilibc/src/main/native/include/frc/BuiltInAccelerometer.h @@ -17,7 +17,17 @@ namespace frc { class BuiltInAccelerometer : public wpi::Sendable, public wpi::SendableHelper { public: - enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2 }; + /** + * Accelerometer range. + */ + enum Range { + /// 2 Gs max. + kRange_2G = 0, + /// 4 Gs max. + kRange_4G = 1, + /// 8 Gs max. + kRange_8G = 2 + }; /** * Constructor. diff --git a/wpilibc/src/main/native/include/frc/XboxController.h b/wpilibc/src/main/native/include/frc/XboxController.h index 775e84d03b5..4b720c1fc72 100644 --- a/wpilibc/src/main/native/include/frc/XboxController.h +++ b/wpilibc/src/main/native/include/frc/XboxController.h @@ -426,25 +426,43 @@ class XboxController : public GenericHID { */ BooleanEvent RightTrigger(EventLoop* loop) const; + /** Represents a digital button on an XboxController. */ struct Button { + /// Left bumper. static constexpr int kLeftBumper = 5; + /// Right bumper. static constexpr int kRightBumper = 6; + /// Left stick. static constexpr int kLeftStick = 9; + /// Right stick. static constexpr int kRightStick = 10; + /// A. static constexpr int kA = 1; + /// B. static constexpr int kB = 2; + /// X. static constexpr int kX = 3; + /// Y. static constexpr int kY = 4; + /// Back. static constexpr int kBack = 7; + /// Start. static constexpr int kStart = 8; }; + /** Represents an axis on an XboxController. */ struct Axis { + /// Left X. static constexpr int kLeftX = 0; + /// Right X. static constexpr int kRightX = 4; + /// Left Y. static constexpr int kLeftY = 1; + /// Right Y. static constexpr int kRightY = 5; + /// Left trigger. static constexpr int kLeftTrigger = 2; + /// Right trigger. static constexpr int kRightTrigger = 3; }; }; diff --git a/wpilibc/src/main/native/include/frc/interfaces/Accelerometer.h b/wpilibc/src/main/native/include/frc/interfaces/Accelerometer.h index 77f1d5bc3bd..ceafeba581c 100644 --- a/wpilibc/src/main/native/include/frc/interfaces/Accelerometer.h +++ b/wpilibc/src/main/native/include/frc/interfaces/Accelerometer.h @@ -20,7 +20,27 @@ class [[deprecated( Accelerometer(Accelerometer&&) = default; Accelerometer& operator=(Accelerometer&&) = default; - enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 }; + /** + * Accelerometer range. + */ + enum Range { + /** + * 2 Gs max. + */ + kRange_2G = 0, + /** + * 4 Gs max. + */ + kRange_4G = 1, + /** + * 8 Gs max. + */ + kRange_8G = 2, + /** + * 16 Gs max. + */ + kRange_16G = 3 + }; /** * Common interface for setting the measuring range of an accelerometer. diff --git a/wpilibc/src/main/native/include/frc/simulation/ADXL345Sim.h b/wpilibc/src/main/native/include/frc/simulation/ADXL345Sim.h index af96b39e748..3cf6162a0a3 100644 --- a/wpilibc/src/main/native/include/frc/simulation/ADXL345Sim.h +++ b/wpilibc/src/main/native/include/frc/simulation/ADXL345Sim.h @@ -14,7 +14,7 @@ class ADXL345_I2C; namespace sim { /** - * Class to control a simulated ADXRS450 gyroscope. + * Class to control a simulated ADXL345. */ class ADXL345Sim { public: diff --git a/wpilibc/src/main/native/include/frc/simulation/ADXL362Sim.h b/wpilibc/src/main/native/include/frc/simulation/ADXL362Sim.h index 269732b3bfc..cc63af27843 100644 --- a/wpilibc/src/main/native/include/frc/simulation/ADXL362Sim.h +++ b/wpilibc/src/main/native/include/frc/simulation/ADXL362Sim.h @@ -13,7 +13,7 @@ class ADXL362; namespace sim { /** - * Class to control a simulated ADXRS450 gyroscope. + * Class to control a simulated ADXL362. */ class ADXL362Sim { public: diff --git a/wpilibc/src/main/native/include/frc/simulation/LinearSystemSim.h b/wpilibc/src/main/native/include/frc/simulation/LinearSystemSim.h index cfc87b29499..cd586437e42 100644 --- a/wpilibc/src/main/native/include/frc/simulation/LinearSystemSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/LinearSystemSim.h @@ -23,9 +23,9 @@ namespace frc::sim { * voltage). Call the Update() method to update the simulation. Set simulated * sensor readings with the simulated positions in the GetOutput() method. * - * @tparam States The number of states of the system. - * @tparam Inputs The number of inputs to the system. - * @tparam Outputs The number of outputs of the system. + * @tparam States Number of states of the system. + * @tparam Inputs Number of inputs to the system. + * @tparam Outputs Number of outputs of the system. */ template class LinearSystemSim { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16448_IMU.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16448_IMU.java index 0b11a447682..0b55105c233 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16448_IMU.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16448_IMU.java @@ -94,18 +94,31 @@ public class ADIS16448_IMU implements AutoCloseable, Sendable { private static final int PROD_ID = 0x56; // Product identifier private static final int SERIAL_NUM = 0x58; // Lot-specific serial number + /** ADIS16448 calibration times. */ public enum CalibrationTime { + /** 32 ms calibration time */ _32ms(0), + /** 64 ms calibration time */ _64ms(1), + /** 128 ms calibration time */ _128ms(2), + /** 256 ms calibration time */ _256ms(3), + /** 512 ms calibration time */ _512ms(4), + /** 1 s calibration time */ _1s(5), + /** 2 s calibration time */ _2s(6), + /** 4 s calibration time */ _4s(7), + /** 8 s calibration time */ _8s(8), + /** 16 s calibration time */ _16s(9), + /** 32 s calibration time */ _32s(10), + /** 64 s calibration time */ _64s(11); private final int value; @@ -115,9 +128,13 @@ public enum CalibrationTime { } } + /** IMU axes. */ public enum IMUAxis { + /** The IMU's X axis. */ kX, + /** The IMU's Y axis. */ kY, + /** The IMU's Z axis. */ kZ } @@ -248,11 +265,14 @@ public void run() { } } + /** Creates a new ADIS16448_IMU object. */ public ADIS16448_IMU() { this(IMUAxis.kZ, SPI.Port.kMXP, CalibrationTime._512ms); } /** + * Creates a new ADIS16448_IMU object. + * * @param yaw_axis The axis that measures the yaw * @param port The SPI Port the gyro is plugged into * @param cal_time Calibration time @@ -332,6 +352,11 @@ public ADIS16448_IMU(final IMUAxis yaw_axis, SPI.Port port, CalibrationTime cal_ m_connected = true; } + /** + * Checks the connection status of the IMU. + * + * @return True if the IMU is connected, false otherwise. + */ public boolean isConnected() { if (m_simConnected != null) { return m_simConnected.get(); @@ -339,7 +364,6 @@ public boolean isConnected() { return m_connected; } - /** */ private static int toUShort(byte[] buf) { return (((buf[0] & 0xFF) << 8) + ((buf[1] & 0xFF) << 0)); } @@ -348,7 +372,7 @@ private static int toUByte(int... buf) { return (buf[0] & 0xFF); } - public static int toUShort(int... buf) { + private static int toUShort(int... buf) { return (((buf[0] & 0xFF) << 8) + (buf[1] & 0xFF)); } @@ -481,7 +505,18 @@ boolean switchToAutoSPI() { return true; } - public int configDecRate(int m_decRate) { + /** + * Configures the decimation rate of the IMU. + * + * @param decimationRate The new decimation value. + * @return 0 if success, 1 if no change, 2 if error. + */ + public int configDecRate(int decimationRate) { + // Switches the active SPI port to standard SPI mode, writes a new value to + // the DECIMATE register in the IMU, and re-enables auto SPI. + // + // This function enters standard SPI mode, writes a new DECIMATE setting to + // the IMU, adjusts the sample scale factor, and re-enters auto SPI mode. int writeValue; int readbackValue; if (!switchToStandardSPI()) { @@ -490,19 +525,19 @@ public int configDecRate(int m_decRate) { } /* Check max */ - if (m_decRate > 9) { + if (decimationRate > 9) { DriverStation.reportError( "Attempted to write an invalid decimation value. Capping at 9", false); - m_decRate = 9; + decimationRate = 9; } - if (m_decRate < 0) { + if (decimationRate < 0) { DriverStation.reportError( "Attempted to write an invalid decimation value. Capping at 0", false); - m_decRate = 0; + decimationRate = 0; } /* Shift decimation setting to correct position and select internal sync */ - writeValue = (m_decRate << 8) | 0x1; + writeValue = (decimationRate << 8) | 0x1; /* Apply to IMU */ writeRegister(SMPL_PRD, writeValue); @@ -624,6 +659,12 @@ private void writeRegister(final int reg, final int val) { m_spi.write(buf, 2); } + /** + * Reset the gyro. + * + *

Resets the gyro accumulations to a heading of zero. This can be used if there is significant + * drift in the gyro and it needs to be recalibrated after running. + */ public void reset() { synchronized (this) { m_integ_gyro_angle_x = 0.0; @@ -957,7 +998,9 @@ private double compFilterProcess(double compAngle, double accelAngle, double ome } /** - * @return Yaw axis angle in degrees (CCW positive) + * Returns the yaw axis angle in degrees (CCW positive). + * + * @return Yaw axis angle in degrees (CCW positive). */ public synchronized double getAngle() { switch (m_yaw_axis) { @@ -973,7 +1016,9 @@ public synchronized double getAngle() { } /** - * @return Yaw axis angular rate in degrees per second (CCW positive) + * Returns the yaw axis angular rate in degrees per second (CCW positive). + * + * @return Yaw axis angular rate in degrees per second (CCW positive). */ public synchronized double getRate() { switch (m_yaw_axis) { @@ -989,14 +1034,18 @@ public synchronized double getRate() { } /** - * @return Yaw Axis + * Returns which axis, kX, kY, or kZ, is set to the yaw axis. + * + * @return IMUAxis Yaw Axis */ public IMUAxis getYawAxis() { return m_yaw_axis; } /** - * @return accumulated gyro angle in the X axis in degrees + * Returns the accumulated gyro angle in the X axis in degrees. + * + * @return The accumulated gyro angle in the X axis in degrees. */ public synchronized double getGyroAngleX() { if (m_simGyroAngleX != null) { @@ -1006,7 +1055,9 @@ public synchronized double getGyroAngleX() { } /** - * @return accumulated gyro angle in the Y axis in degrees + * Returns the accumulated gyro angle in the Y axis in degrees. + * + * @return The accumulated gyro angle in the Y axis in degrees. */ public synchronized double getGyroAngleY() { if (m_simGyroAngleY != null) { @@ -1016,7 +1067,9 @@ public synchronized double getGyroAngleY() { } /** - * @return accumulated gyro angle in the Z axis in degrees + * Returns the accumulated gyro angle in the Z axis in degrees. + * + * @return The accumulated gyro angle in the Z axis in degrees. */ public synchronized double getGyroAngleZ() { if (m_simGyroAngleZ != null) { @@ -1026,7 +1079,9 @@ public synchronized double getGyroAngleZ() { } /** - * @return gyro angular rate in the X axis in degrees per second + * Returns the gyro angular rate in the X axis in degrees per second. + * + * @return The gyro angular rate in the X axis in degrees per second. */ public synchronized double getGyroRateX() { if (m_simGyroRateX != null) { @@ -1036,7 +1091,9 @@ public synchronized double getGyroRateX() { } /** - * @return gyro angular rate in the Y axis in degrees per second + * Returns the gyro angular rate in the Y axis in degrees per second. + * + * @return The gyro angular rate in the Y axis in degrees per second. */ public synchronized double getGyroRateY() { if (m_simGyroRateY != null) { @@ -1046,7 +1103,9 @@ public synchronized double getGyroRateY() { } /** - * @return gyro angular rate in the Z axis in degrees per second + * Returns the gyro angular rate in the Z axis in degrees per second. + * + * @return The gyro angular rate in the Z axis in degrees per second. */ public synchronized double getGyroRateZ() { if (m_simGyroRateZ != null) { @@ -1056,7 +1115,9 @@ public synchronized double getGyroRateZ() { } /** - * @return urrent acceleration in the X axis in meters per second squared + * Returns the acceleration in the X axis in meters per second squared. + * + * @return The acceleration in the X axis in meters per second squared. */ public synchronized double getAccelX() { if (m_simAccelX != null) { @@ -1066,7 +1127,9 @@ public synchronized double getAccelX() { } /** - * @return current acceleration in the Y axis in meters per second squared + * Returns the acceleration in the Y axis in meters per second squared. + * + * @return The acceleration in the Y axis in meters per second squared. */ public synchronized double getAccelY() { if (m_simAccelY != null) { @@ -1076,7 +1139,9 @@ public synchronized double getAccelY() { } /** - * @return current acceleration in the Z axis in meters per second squared + * Returns the acceleration in the Z axis in meters per second squared. + * + * @return The acceleration in the Z axis in meters per second squared. */ public synchronized double getAccelZ() { if (m_simAccelZ != null) { @@ -1086,7 +1151,9 @@ public synchronized double getAccelZ() { } /** - * @return Magnetic field strength in the X axis in Tesla + * Returns the magnetic field strength in the X axis in Tesla. + * + * @return The magnetic field strength in the X axis in Tesla. */ public synchronized double getMagneticFieldX() { // mG to T @@ -1094,7 +1161,9 @@ public synchronized double getMagneticFieldX() { } /** - * @return Magnetic field strength in the Y axis in Tesla + * Returns the magnetic field strength in the Y axis in Tesla. + * + * @return The magnetic field strength in the Y axis in Tesla. */ public synchronized double getMagneticFieldY() { // mG to T @@ -1102,7 +1171,9 @@ public synchronized double getMagneticFieldY() { } /** - * @return Magnetic field strength in the Z axis in Tesla + * Returns the magnetic field strength in the Z axis in Tesla. + * + * @return The magnetic field strength in the Z axis in Tesla. */ public synchronized double getMagneticFieldZ() { // mG to T @@ -1110,35 +1181,47 @@ public synchronized double getMagneticFieldZ() { } /** - * @return X-axis complementary angle in degrees + * Returns the complementary angle around the X axis computed from accelerometer and gyro rate + * measurements. + * + * @return The X-axis complementary angle in degrees. */ public synchronized double getXComplementaryAngle() { return m_compAngleX; } /** - * @return Y-axis complementary angle in degrees + * Returns the complementary angle around the Y axis computed from accelerometer and gyro rate + * measurements. + * + * @return The Y-axis complementary angle in degrees. */ public synchronized double getYComplementaryAngle() { return m_compAngleY; } /** - * @return X-axis filtered acceleration angle in degrees + * Returns the X-axis filtered acceleration angle in degrees. + * + * @return The X-axis filtered acceleration angle in degrees. */ public synchronized double getXFilteredAccelAngle() { return m_accelAngleX; } /** - * @return Y-axis filtered acceleration angle in degrees + * Returns the Y-axis filtered acceleration angle in degrees. + * + * @return The Y-axis filtered acceleration angle in degrees. */ public synchronized double getYFilteredAccelAngle() { return m_accelAngleY; } /** - * @return Barometric Pressure in PSI + * Returns the barometric pressure in PSI. + * + * @return The barometric pressure in PSI. */ public synchronized double getBarometricPressure() { // mbar to PSI conversion @@ -1146,7 +1229,9 @@ public synchronized double getBarometricPressure() { } /** - * @return Temperature in degrees Celsius + * Returns the temperature in degrees Celsius. + * + * @return The temperature in degrees Celsius. */ public synchronized double getTemperature() { return m_temp; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16470_IMU.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16470_IMU.java index 8aec21b74ed..b7236a57eea 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16470_IMU.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADIS16470_IMU.java @@ -155,31 +155,31 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable { FLASH_CNT }; - /** Calibration times for the ADIS16470. */ + /** ADIS16470 calibration times. */ public enum CalibrationTime { - /** 32ms calibration */ + /** 32 ms calibration time */ _32ms(0), - /** 64ms calibration */ + /** 64 ms calibration time */ _64ms(1), - /** 128ms calibration */ + /** 128 ms calibration time */ _128ms(2), - /** 256ms calibration */ + /** 256 ms calibration time */ _256ms(3), - /** 512ms calibration */ + /** 512 ms calibration time */ _512ms(4), - /** 1 second calibration */ + /** 1 s calibration time */ _1s(5), - /** 2 second calibration */ + /** 2 s calibration time */ _2s(6), - /** 4 second calibration */ + /** 4 s calibration time */ _4s(7), - /** 8 second calibration */ + /** 8 s calibration time */ _8s(8), - /** 16 second calibration */ + /** 16 s calibration time */ _16s(9), - /** 32 second calibration */ + /** 32 s calibration time */ _32s(10), - /** 64 second calibration */ + /** 64 s calibration time */ _64s(11); private final int value; @@ -202,11 +202,11 @@ public enum IMUAxis { kY, /** The IMU's Z axis */ kZ, - /** The user configured yaw axis */ + /** The user-configured yaw axis */ kYaw, - /** The user configured pitch axis */ + /** The user-configured pitch axis */ kPitch, - /** The user configured roll axis */ + /** The user-configured roll axis */ kRoll, } @@ -290,19 +290,22 @@ public void run() { } /** - * Creates a new ADIS16740 IMU object. The default setup is the onboard SPI port with a - * calibration time of 4 seconds. Yaw, pitch, and roll are kZ, kX, and kY respectively. + * Creates a new ADIS16740 IMU object. + * + *

The default setup is the onboard SPI port with a calibration time of 4 seconds. Yaw, pitch, + * and roll are kZ, kX, and kY respectively. */ public ADIS16470_IMU() { this(IMUAxis.kZ, IMUAxis.kX, IMUAxis.kY, SPI.Port.kOnboardCS0, CalibrationTime._4s); } /** - * Creates a new ADIS16740 IMU object. The default setup is the onboard SPI port with a - * calibration time of 4 seconds. + * Creates a new ADIS16740 IMU object. + * + *

The default setup is the onboard SPI port with a calibration time of 4 seconds. * *

Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch,or kRoll will result in - * an error. + * an error. * * @param yaw_axis The axis that measures the yaw * @param pitch_axis The axis that measures the pitch @@ -315,8 +318,8 @@ public ADIS16470_IMU(IMUAxis yaw_axis, IMUAxis pitch_axis, IMUAxis roll_axis) { /** * Creates a new ADIS16740 IMU object. * - *

Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch,or kRoll will result in - * an error. + *

Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch,or kRoll will result in + * an error. * * @param yaw_axis The axis that measures the yaw * @param pitch_axis The axis that measures the pitch @@ -625,21 +628,25 @@ public int configCalTime(CalibrationTime new_cal_time) { /** * Configures the decimation rate of the IMU. * - * @param reg The new decimation value. - * @return 0 if OK, 2 if error + * @param decimationRate The new decimation value. + * @return 0 if success, 1 if no change, 2 if error. */ - public int configDecRate(int reg) { - int m_reg = reg; + public int configDecRate(int decimationRate) { + // Switches the active SPI port to standard SPI mode, writes a new value to + // the DECIMATE register in the IMU, and re-enables auto SPI. + // + // This function enters standard SPI mode, writes a new DECIMATE setting to + // the IMU, adjusts the sample scale factor, and re-enters auto SPI mode. if (!switchToStandardSPI()) { DriverStation.reportError("Failed to configure/reconfigure standard SPI.", false); return 2; } - if (m_reg > 1999) { + if (decimationRate > 1999) { DriverStation.reportError("Attempted to write an invalid decimation value.", false); - m_reg = 1999; + decimationRate = 1999; } - m_scaled_sample_rate = (((m_reg + 1.0) / 2000.0) * 1000000.0); - writeRegister(DEC_RATE, m_reg); + m_scaled_sample_rate = (((decimationRate + 1.0) / 2000.0) * 1000000.0); + writeRegister(DEC_RATE, decimationRate); System.out.println("Decimation register: " + readRegister(DEC_RATE)); if (!switchToAutoSPI()) { DriverStation.reportError("Failed to configure/reconfigure auto SPI.", false); @@ -1003,8 +1010,10 @@ private double compFilterProcess(double compAngle, double accelAngle, double ome } /** - * Resets the gyro accumulations to a heading of zero. This can be used if the "zero" orientation - * of the sensor needs to be changed in runtime. + * Reset the gyro. + * + *

Resets the gyro accumulations to a heading of zero. This can be used if there is significant + * drift in the gyro and it needs to be recalibrated after running. */ public void reset() { synchronized (this) { @@ -1086,8 +1095,10 @@ public void setGyroAngleZ(double angle) { } /** - * @param axis The IMUAxis whose angle to return - * @return The axis angle in degrees (CCW positive) + * Returns the axis angle in degrees (CCW positive). + * + * @param axis The IMUAxis whose angle to return. + * @return The axis angle in degrees (CCW positive). */ public synchronized double getAngle(IMUAxis axis) { switch (axis) { @@ -1126,8 +1137,10 @@ public synchronized double getAngle(IMUAxis axis) { } /** - * @param axis The IMUAxis whose rate to return - * @return Axis angular rate in degrees per second (CCW positive) + * Returns the axis angular rate in degrees per second (CCW positive). + * + * @param axis The IMUAxis whose rate to return. + * @return Axis angular rate in degrees per second (CCW positive). */ public synchronized double getRate(IMUAxis axis) { switch (axis) { @@ -1192,49 +1205,65 @@ public IMUAxis getRollAxis() { } /** - * @return The acceleration in the X axis + * Returns the acceleration in the X axis in meters per second squared. + * + * @return The acceleration in the X axis in meters per second squared. */ public synchronized double getAccelX() { return m_accel_x * 9.81; } /** - * @return The acceleration in the Y axis + * Returns the acceleration in the Y axis in meters per second squared. + * + * @return The acceleration in the Y axis in meters per second squared. */ public synchronized double getAccelY() { return m_accel_y * 9.81; } /** - * @return The acceleration in the Z axis + * Returns the acceleration in the Z axis in meters per second squared. + * + * @return The acceleration in the Z axis in meters per second squared. */ public synchronized double getAccelZ() { return m_accel_z * 9.81; } /** - * @return The X-axis complementary angle + * Returns the complementary angle around the X axis computed from accelerometer and gyro rate + * measurements. + * + * @return The X-axis complementary angle in degrees. */ public synchronized double getXComplementaryAngle() { return m_compAngleX; } /** - * @return The Y-axis complementary angle + * Returns the complementary angle around the Y axis computed from accelerometer and gyro rate + * measurements. + * + * @return The Y-axis complementary angle in degrees. */ public synchronized double getYComplementaryAngle() { return m_compAngleY; } /** - * @return The X-axis filtered acceleration angle + * Returns the X-axis filtered acceleration angle in degrees. + * + * @return The X-axis filtered acceleration angle in degrees. */ public synchronized double getXFilteredAccelAngle() { return m_accelAngleX; } /** - * @return The Y-axis filtered acceleration angle + * Returns the Y-axis filtered acceleration angle in degrees. + * + * @return The Y-axis filtered acceleration angle in degrees. */ public synchronized double getYFilteredAccelAngle() { return m_accelAngleY; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java index e96151bd769..d59f6821418 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java @@ -43,16 +43,25 @@ public class ADXL345_I2C implements NTSendable, AutoCloseable { private static final byte kDataFormat_FullRes = 0x08; private static final byte kDataFormat_Justify = 0x04; + /** Accelerometer range. */ public enum Range { + /** 2 Gs max. */ k2G, + /** 4 Gs max. */ k4G, + /** 8 Gs max. */ k8G, + /** 16 Gs max. */ k16G } + /** Accelerometer axes. */ public enum Axes { + /** X axis. */ kX((byte) 0x00), + /** Y axis. */ kY((byte) 0x02), + /** Z axis. */ kZ((byte) 0x04); /** The integer value representing this enumeration. */ @@ -63,20 +72,29 @@ public enum Axes { } } + /** Container type for accelerations from all axes. */ @SuppressWarnings("MemberName") public static class AllAxes { + /** Acceleration along the X axis in g-forces. */ public double XAxis; + + /** Acceleration along the Y axis in g-forces. */ public double YAxis; + + /** Acceleration along the Z axis in g-forces. */ public double ZAxis; + + /** Default constructor. */ + public AllAxes() {} } - protected I2C m_i2c; + private I2C m_i2c; - protected SimDevice m_simDevice; - protected SimEnum m_simRange; - protected SimDouble m_simX; - protected SimDouble m_simY; - protected SimDouble m_simZ; + private SimDevice m_simDevice; + private SimEnum m_simRange; + private SimDouble m_simX; + private SimDouble m_simY; + private SimDouble m_simZ; /** * Constructs the ADXL345 Accelerometer with I2C address 0x1D. @@ -123,10 +141,20 @@ public ADXL345_I2C(I2C.Port port, Range range, int deviceAddress) { SendableRegistry.addLW(this, "ADXL345_I2C", port.value); } + /** + * Returns the I2C port. + * + * @return The I2C port. + */ public int getPort() { return m_i2c.getPort(); } + /** + * Returns the I2C device address. + * + * @return The I2C device address. + */ public int getDeviceAddress() { return m_i2c.getDeviceAddress(); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java index b98b917f431..4c8435a00b1 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java @@ -40,16 +40,25 @@ public class ADXL345_SPI implements NTSendable, AutoCloseable { private static final int kDataFormat_FullRes = 0x08; private static final int kDataFormat_Justify = 0x04; + /** Accelerometer range. */ public enum Range { + /** 2 Gs max. */ k2G, + /** 4 Gs max. */ k4G, + /** 8 Gs max. */ k8G, + /** 16 Gs max. */ k16G } + /** Accelerometer axes. */ public enum Axes { + /** X axis. */ kX((byte) 0x00), + /** Y axis. */ kY((byte) 0x02), + /** Z axis. */ kZ((byte) 0x04); /** The integer value representing this enumeration. */ @@ -60,20 +69,29 @@ public enum Axes { } } + /** Container type for accelerations from all axes. */ @SuppressWarnings("MemberName") public static class AllAxes { + /** Acceleration along the X axis in g-forces. */ public double XAxis; + + /** Acceleration along the Y axis in g-forces. */ public double YAxis; + + /** Acceleration along the Z axis in g-forces. */ public double ZAxis; + + /** Default constructor. */ + public AllAxes() {} } - protected SPI m_spi; + private SPI m_spi; - protected SimDevice m_simDevice; - protected SimEnum m_simRange; - protected SimDouble m_simX; - protected SimDouble m_simY; - protected SimDouble m_simZ; + private SimDevice m_simDevice; + private SimEnum m_simRange; + private SimDouble m_simX; + private SimDouble m_simY; + private SimDouble m_simZ; /** * Constructor. @@ -102,6 +120,11 @@ public ADXL345_SPI(SPI.Port port, Range range) { SendableRegistry.addLW(this, "ADXL345_SPI", port.value); } + /** + * Returns the SPI port. + * + * @return The SPI port. + */ public int getPort() { return m_spi.getPort(); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java index b4950682b16..c3de6dd704e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java @@ -43,17 +43,26 @@ public class ADXL362 implements NTSendable, AutoCloseable { private static final byte kPowerCtl_Measure = 0x02; + /** Accelerometer range. */ public enum Range { + /** 2 Gs max. */ k2G, + /** 4 Gs max. */ k4G, + /** 8 Gs max. */ k8G } + /** Accelerometer axes. */ public enum Axes { + /** X axis. */ kX((byte) 0x00), + /** Y axis. */ kY((byte) 0x02), + /** Z axis. */ kZ((byte) 0x04); + /** Axis value. */ public final byte value; Axes(byte value) { @@ -61,11 +70,20 @@ public enum Axes { } } + /** Container type for accelerations from all axes. */ @SuppressWarnings("MemberName") public static class AllAxes { + /** Acceleration along the X axis in g-forces. */ public double XAxis; + + /** Acceleration along the Y axis in g-forces. */ public double YAxis; + + /** Acceleration along the Z axis in g-forces. */ public double ZAxis; + + /** Default constructor. */ + public AllAxes() {} } private SPI m_spi; @@ -142,6 +160,11 @@ public ADXL362(SPI.Port port, Range range) { SendableRegistry.addLW(this, "ADXL362", port.value); } + /** + * Returns the SPI port. + * + * @return The SPI port. + */ public int getPort() { return m_spi.getPort(); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogEncoder.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogEncoder.java index dc8b668bffa..727ad2cd3de 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogEncoder.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogEncoder.java @@ -22,9 +22,9 @@ public class AnalogEncoder implements Sendable, AutoCloseable { private double m_distancePerRotation = 1.0; private double m_lastPosition; - protected SimDevice m_simDevice; - protected SimDouble m_simPosition; - protected SimDouble m_simAbsolutePosition; + private SimDevice m_simDevice; + private SimDouble m_simPosition; + private SimDouble m_simAbsolutePosition; /** * Construct a new AnalogEncoder attached to a specific AnalogIn channel. diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogGyro.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogGyro.java index 198283e34f4..29a17bbed0e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogGyro.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogGyro.java @@ -25,7 +25,7 @@ */ public class AnalogGyro implements Sendable, AutoCloseable { private static final double kDefaultVoltsPerDegreePerSecond = 0.007; - protected AnalogInput m_analog; + private AnalogInput m_analog; private boolean m_channelAllocated; private int m_gyroHandle; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java index 10f143c8fec..354cedc038d 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java @@ -50,10 +50,20 @@ public int getChannel() { return m_channel; } + /** + * Set the value of the analog output. + * + * @param voltage The output value in Volts, from 0.0 to +5.0. + */ public void setVoltage(double voltage) { AnalogJNI.setAnalogOutput(m_port, voltage); } + /** + * Get the voltage of the analog output. + * + * @return The value in Volts, from 0.0 to +5.0. + */ public double getVoltage() { return AnalogJNI.getAnalogOutput(m_port); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java index 77f8381608b..203a0544b56 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTrigger.java @@ -30,9 +30,12 @@ public AnalogTriggerException(String message) { /** Where the analog trigger is attached. */ protected int m_port; - protected AnalogInput m_analogInput; - protected DutyCycle m_dutyCycle; - protected boolean m_ownsAnalog; + private AnalogInput m_analogInput; + + @SuppressWarnings({"PMD.SingularField", "PMD.UnusedPrivateField"}) + private DutyCycle m_dutyCycle; + + private boolean m_ownsAnalog; /** * Constructor for an analog trigger given a channel number. diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java index c80179b5c4d..4d459fc2c43 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogTriggerOutput.java @@ -106,9 +106,13 @@ public boolean isAnalogTrigger() { /** Defines the state in which the AnalogTrigger triggers. */ public enum AnalogTriggerType { + /** In window. */ kInWindow(AnalogJNI.AnalogTriggerType.kInWindow), + /** State. */ kState(AnalogJNI.AnalogTriggerType.kState), + /** Rising pulse. */ kRisingPulse(AnalogJNI.AnalogTriggerType.kRisingPulse), + /** Falling pulse. */ kFallingPulse(AnalogJNI.AnalogTriggerType.kFallingPulse); private final int value; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java index 0b2654b4782..522ab88476a 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java @@ -17,9 +17,13 @@ *

This class allows access to the roboRIO's internal accelerometer. */ public class BuiltInAccelerometer implements Sendable, AutoCloseable { + /** Accelerometer range. */ public enum Range { + /** 2 Gs max. */ k2G, + /** 4 Gs max. */ k4G, + /** 8 Gs max. */ k8G } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java index cb8b02475bb..ba3ac83f901 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalSource.java @@ -11,8 +11,18 @@ * source. The source can either be a digital input or analog trigger but not both. */ public abstract class DigitalSource implements AutoCloseable { + /** + * Returns true if this DigitalSource is an AnalogTrigger. + * + * @return True if this DigitalSource is an AnalogTrigger. + */ public abstract boolean isAnalogTrigger(); + /** + * The DigitalSource channel. + * + * @return The DigitalSource channel. + */ public abstract int getChannel(); /** diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/XboxController.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/XboxController.java index 6e3a0dfd545..5bd7a019274 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/XboxController.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/XboxController.java @@ -23,17 +23,28 @@ public class XboxController extends GenericHID { /** Represents a digital button on an XboxController. */ public enum Button { + /** Left bumper. */ kLeftBumper(5), + /** Right bumper. */ kRightBumper(6), + /** Left stick. */ kLeftStick(9), + /** Right stick. */ kRightStick(10), + /** A. */ kA(1), + /** B. */ kB(2), + /** X. */ kX(3), + /** Y. */ kY(4), + /** Back. */ kBack(7), + /** Start. */ kStart(8); + /** Button value. */ public final int value; Button(int value) { @@ -60,13 +71,20 @@ public String toString() { /** Represents an axis on an XboxController. */ public enum Axis { + /** Left X. */ kLeftX(0), + /** Right X. */ kRightX(4), + /** Left Y. */ kLeftY(1), + /** Right Y. */ kRightY(5), + /** Left trigger. */ kLeftTrigger(2), + /** Right trigger. */ kRightTrigger(3); + /** Axis value. */ public final int value; Axis(int value) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Accelerometer.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Accelerometer.java index d33b7ae4c13..630d45c6b79 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Accelerometer.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/interfaces/Accelerometer.java @@ -11,10 +11,15 @@ */ @Deprecated(since = "2024", forRemoval = true) public interface Accelerometer { + /** Accelerometer range. */ enum Range { + /** 2 Gs max. */ k2G, + /** 4 Gs max. */ k4G, + /** 8 Gs max. */ k8G, + /** 16 Gs max. */ k16G } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL345Sim.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL345Sim.java index c50c2f8124b..bcbf3e297d6 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL345Sim.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL345Sim.java @@ -9,10 +9,11 @@ import edu.wpi.first.wpilibj.ADXL345_SPI; import java.util.Objects; +/** Class to control a simulated ADXL345. */ public class ADXL345Sim { - protected SimDouble m_simX; - protected SimDouble m_simY; - protected SimDouble m_simZ; + private SimDouble m_simX; + private SimDouble m_simY; + private SimDouble m_simZ; /** * Constructor. @@ -48,15 +49,30 @@ private void initSim(SimDeviceSim simDevice) { Objects.requireNonNull(m_simZ); } - public void setX(double x) { - m_simX.set(x); + /** + * Sets the X acceleration. + * + * @param accel The X acceleration. + */ + public void setX(double accel) { + m_simX.set(accel); } - public void setY(double y) { - m_simY.set(y); + /** + * Sets the Y acceleration. + * + * @param accel The Y acceleration. + */ + public void setY(double accel) { + m_simY.set(accel); } - public void setZ(double z) { - m_simZ.set(z); + /** + * Sets the Z acceleration. + * + * @param accel The Z acceleration. + */ + public void setZ(double accel) { + m_simZ.set(accel); } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL362Sim.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL362Sim.java index 76df8bd6096..148f914699e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL362Sim.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/ADXL362Sim.java @@ -8,10 +8,11 @@ import edu.wpi.first.wpilibj.ADXL362; import java.util.Objects; +/** Class to control a simulated ADXL362. */ public class ADXL362Sim { - protected SimDouble m_simX; - protected SimDouble m_simY; - protected SimDouble m_simZ; + private SimDouble m_simX; + private SimDouble m_simY; + private SimDouble m_simZ; /** * Constructor. @@ -34,15 +35,30 @@ private void initSim(SimDeviceSim wrappedSimDevice) { Objects.requireNonNull(m_simZ); } - public void setX(double x) { - m_simX.set(x); + /** + * Sets the X acceleration. + * + * @param accel The X acceleration. + */ + public void setX(double accel) { + m_simX.set(accel); } - public void setY(double y) { - m_simY.set(y); + /** + * Sets the Y acceleration. + * + * @param accel The Y acceleration. + */ + public void setY(double accel) { + m_simY.set(accel); } - public void setZ(double z) { - m_simZ.set(z); + /** + * Sets the Z acceleration. + * + * @param accel The Z acceleration. + */ + public void setZ(double accel) { + m_simZ.set(accel); } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/LinearSystemSim.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/LinearSystemSim.java index 73b1170eab4..3a6a4e7cfbf 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/LinearSystemSim.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/simulation/LinearSystemSim.java @@ -23,9 +23,9 @@ * *

Set simulated sensor readings with the simulated positions in {@link #getOutput()} * - * @param The number of states of the system. - * @param The number of inputs to the system. - * @param The number of outputs of the system. + * @param Number of states of the system. + * @param Number of inputs to the system. + * @param Number of outputs of the system. */ public class LinearSystemSim { // The plant that represents the linear system. diff --git a/wpimath/src/main/java/edu/wpi/first/math/InterpolatingMatrixTreeMap.java b/wpimath/src/main/java/edu/wpi/first/math/InterpolatingMatrixTreeMap.java index a7b922c9696..2980e92a056 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/InterpolatingMatrixTreeMap.java +++ b/wpimath/src/main/java/edu/wpi/first/math/InterpolatingMatrixTreeMap.java @@ -9,6 +9,10 @@ /** * Interpolating Tree Maps are used to get values at points that are not defined by making a guess * from points that are defined. This uses linear interpolation. + * + * @param Key type. + * @param Number of matrix rows. + * @param Number of matrix columns. */ public class InterpolatingMatrixTreeMap { private final TreeMap> m_map = new TreeMap<>(); diff --git a/wpimath/src/main/java/edu/wpi/first/math/StateSpaceUtil.java b/wpimath/src/main/java/edu/wpi/first/math/StateSpaceUtil.java index 27ed9e0bb09..77c5fb93dff 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/StateSpaceUtil.java +++ b/wpimath/src/main/java/edu/wpi/first/math/StateSpaceUtil.java @@ -139,7 +139,7 @@ public static Matrix poseToVector(Pose2d pose) { * @param u The input to clamp. * @param umin The minimum input magnitude. * @param umax The maximum input magnitude. - * @param The number of inputs. + * @param Number of inputs. * @return The clamped input. */ public static Matrix clampInputMaxMagnitude( @@ -157,7 +157,7 @@ public static Matrix clampInputMaxMagnitude( * * @param u The input vector. * @param maxMagnitude The maximum magnitude any input can have. - * @param The number of inputs. + * @param Number of inputs. * @return The normalizedInput */ public static Matrix desaturateInputVector( diff --git a/wpimath/src/main/java/edu/wpi/first/math/WPIMathJNI.java b/wpimath/src/main/java/edu/wpi/first/math/WPIMathJNI.java index ef47a3b3c24..a60bcbae5fc 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/WPIMathJNI.java +++ b/wpimath/src/main/java/edu/wpi/first/math/WPIMathJNI.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; +/** WPIMath JNI. */ public final class WPIMathJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; @@ -385,15 +386,32 @@ public static native double[] logPose3d( */ public static native String serializeTrajectory(double[] elements); + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } + + /** Utility class. */ + private WPIMathJNI() {} } diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ControlAffinePlantInversionFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ControlAffinePlantInversionFeedforward.java index 50ff576f952..04865009304 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ControlAffinePlantInversionFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ControlAffinePlantInversionFeedforward.java @@ -27,6 +27,9 @@ * *

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf. + * + * @param Number of states. + * @param Number of inputs. */ public class ControlAffinePlantInversionFeedforward { /** The current reference state. */ diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ImplicitModelFollower.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ImplicitModelFollower.java index de370e9af1a..29bf0a02be7 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ImplicitModelFollower.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ImplicitModelFollower.java @@ -19,6 +19,10 @@ * *

For more on the underlying math, read appendix B.3 in https://file.tavsys.net/control/controls-engineering-in-frc.pdf. + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class ImplicitModelFollower { // Computed controller output diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/LinearPlantInversionFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/LinearPlantInversionFeedforward.java index ba395aabbcc..f71465a82a2 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/LinearPlantInversionFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/LinearPlantInversionFeedforward.java @@ -19,6 +19,10 @@ * *

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf. + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class LinearPlantInversionFeedforward< States extends Num, Inputs extends Num, Outputs extends Num> { diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java b/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java index 800ea4007a6..660fa8fefac 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/LinearQuadraticRegulator.java @@ -21,6 +21,10 @@ * *

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf. + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class LinearQuadraticRegulator { /** The current reference state. */ diff --git a/wpimath/src/main/java/edu/wpi/first/math/estimator/AngleStatistics.java b/wpimath/src/main/java/edu/wpi/first/math/estimator/AngleStatistics.java index 0f91a1db83a..8a61526e8a1 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/estimator/AngleStatistics.java +++ b/wpimath/src/main/java/edu/wpi/first/math/estimator/AngleStatistics.java @@ -11,10 +11,10 @@ import java.util.function.BiFunction; import org.ejml.simple.SimpleMatrix; +/** Angle statistics functions. */ public final class AngleStatistics { - private AngleStatistics() { - // Utility class - } + /** Utility class. */ + private AngleStatistics() {} /** * Subtracts a and b while normalizing the resulting value in the selected row as if it were an diff --git a/wpimath/src/main/java/edu/wpi/first/math/estimator/ExtendedKalmanFilter.java b/wpimath/src/main/java/edu/wpi/first/math/estimator/ExtendedKalmanFilter.java index db246dcab3c..055bf9939af 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/estimator/ExtendedKalmanFilter.java +++ b/wpimath/src/main/java/edu/wpi/first/math/estimator/ExtendedKalmanFilter.java @@ -33,6 +33,10 @@ *

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf * chapter 9 "Stochastic control theory". + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class ExtendedKalmanFilter implements KalmanTypeFilter { diff --git a/wpimath/src/main/java/edu/wpi/first/math/estimator/KalmanFilter.java b/wpimath/src/main/java/edu/wpi/first/math/estimator/KalmanFilter.java index 8ca1db0a86f..9e286255df7 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/estimator/KalmanFilter.java +++ b/wpimath/src/main/java/edu/wpi/first/math/estimator/KalmanFilter.java @@ -28,6 +28,10 @@ *

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf * chapter 9 "Stochastic control theory". + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class KalmanFilter implements KalmanTypeFilter { diff --git a/wpimath/src/main/java/edu/wpi/first/math/estimator/MerweScaledSigmaPoints.java b/wpimath/src/main/java/edu/wpi/first/math/estimator/MerweScaledSigmaPoints.java index 24835f6c341..24fa771f339 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/estimator/MerweScaledSigmaPoints.java +++ b/wpimath/src/main/java/edu/wpi/first/math/estimator/MerweScaledSigmaPoints.java @@ -21,6 +21,8 @@ * *

[1] R. Van der Merwe "Sigma-Point Kalman Filters for Probabilitic Inference in Dynamic * State-Space Models" (Doctoral dissertation) + * + * @param The dimensionality of the state. 2 * States + 1 weights will be generated. */ public class MerweScaledSigmaPoints { private final double m_alpha; diff --git a/wpimath/src/main/java/edu/wpi/first/math/estimator/PoseEstimator.java b/wpimath/src/main/java/edu/wpi/first/math/estimator/PoseEstimator.java index 1d9a54b931a..14eee8f190a 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/estimator/PoseEstimator.java +++ b/wpimath/src/main/java/edu/wpi/first/math/estimator/PoseEstimator.java @@ -34,6 +34,8 @@ * *

{@link PoseEstimator#addVisionMeasurement} can be called as infrequently as you want; if you * never call it then this class will behave exactly like regular encoder odometry. + * + * @param Wheel positions type. */ public class PoseEstimator> { private final Kinematics m_kinematics; diff --git a/wpimath/src/main/java/edu/wpi/first/math/estimator/SteadyStateKalmanFilter.java b/wpimath/src/main/java/edu/wpi/first/math/estimator/SteadyStateKalmanFilter.java index 801c601143d..96e51bca75b 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/estimator/SteadyStateKalmanFilter.java +++ b/wpimath/src/main/java/edu/wpi/first/math/estimator/SteadyStateKalmanFilter.java @@ -31,6 +31,10 @@ *

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf * chapter 9 "Stochastic control theory". + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class SteadyStateKalmanFilter { private final Nat m_states; diff --git a/wpimath/src/main/java/edu/wpi/first/math/estimator/UnscentedKalmanFilter.java b/wpimath/src/main/java/edu/wpi/first/math/estimator/UnscentedKalmanFilter.java index c982d08450f..c64ec85cf9b 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/estimator/UnscentedKalmanFilter.java +++ b/wpimath/src/main/java/edu/wpi/first/math/estimator/UnscentedKalmanFilter.java @@ -38,6 +38,10 @@ *

This class implements a square-root-form unscented Kalman filter (SR-UKF). For more * information about the SR-UKF, see https://www.researchgate.net/publication/3908304. + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class UnscentedKalmanFilter implements KalmanTypeFilter { diff --git a/wpimath/src/main/java/edu/wpi/first/math/kinematics/Odometry.java b/wpimath/src/main/java/edu/wpi/first/math/kinematics/Odometry.java index b2e5054eb83..427c92d8a18 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/kinematics/Odometry.java +++ b/wpimath/src/main/java/edu/wpi/first/math/kinematics/Odometry.java @@ -15,6 +15,8 @@ * *

Teams can use odometry during the autonomous period for complex tasks like path following. * Furthermore, odometry can be used for latency compensation when using computer-vision systems. + * + * @param Wheel positions type. */ public class Odometry> { private final Kinematics m_kinematics; diff --git a/wpimath/src/main/java/edu/wpi/first/math/system/LinearSystemLoop.java b/wpimath/src/main/java/edu/wpi/first/math/system/LinearSystemLoop.java index 8bd6c15abf2..94017fc0bb2 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/system/LinearSystemLoop.java +++ b/wpimath/src/main/java/edu/wpi/first/math/system/LinearSystemLoop.java @@ -27,6 +27,10 @@ * *

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf. + * + * @param Number of states. + * @param Number of inputs. + * @param Number of outputs. */ public class LinearSystemLoop { private final LinearQuadraticRegulator m_controller; diff --git a/wpimath/src/main/native/include/frc/StateSpaceUtil.h b/wpimath/src/main/native/include/frc/StateSpaceUtil.h index e2b638ca24b..65bed6fb1d4 100644 --- a/wpimath/src/main/native/include/frc/StateSpaceUtil.h +++ b/wpimath/src/main/native/include/frc/StateSpaceUtil.h @@ -194,8 +194,8 @@ Eigen::Vector4d PoseTo4dVector(const Pose2d& pose); * any, have absolute values less than one, where an eigenvalue is * uncontrollable if rank([λI - A, B]) < n where n is the number of states. * - * @tparam States The number of states. - * @tparam Inputs The number of inputs. + * @tparam States Number of states. + * @tparam Inputs Number of inputs. * @param A System matrix. * @param B Input matrix. */ @@ -253,8 +253,8 @@ IsStabilizable(const Eigen::MatrixXd& A, * any, have absolute values less than one, where an eigenvalue is unobservable * if rank([λI - A; C]) < n where n is the number of states. * - * @tparam States The number of states. - * @tparam Outputs The number of outputs. + * @tparam States Number of states. + * @tparam Outputs Number of outputs. * @param A System matrix. * @param C Output matrix. */ @@ -277,7 +277,7 @@ Eigen::Vector3d PoseToVector(const Pose2d& pose); /** * Clamps input vector between system's minimum and maximum allowable input. * - * @tparam Inputs The number of inputs. + * @tparam Inputs Number of inputs. * @param u Input vector to clamp. * @param umin The minimum input magnitude. * @param umax The maximum input magnitude. @@ -298,7 +298,7 @@ Vectord ClampInputMaxMagnitude(const Vectord& u, * Renormalize all inputs if any exceeds the maximum magnitude. Useful for * systems such as differential drivetrains. * - * @tparam Inputs The number of inputs. + * @tparam Inputs Number of inputs. * @param u The input vector. * @param maxMagnitude The maximum magnitude any input can have. * @return The normalizedInput diff --git a/wpimath/src/main/native/include/frc/controller/ControlAffinePlantInversionFeedforward.h b/wpimath/src/main/native/include/frc/controller/ControlAffinePlantInversionFeedforward.h index 63064576557..c3c282d3e63 100644 --- a/wpimath/src/main/native/include/frc/controller/ControlAffinePlantInversionFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/ControlAffinePlantInversionFeedforward.h @@ -34,8 +34,8 @@ namespace frc { * For more on the underlying math, read * https://file.tavsys.net/control/controls-engineering-in-frc.pdf. * - * @tparam States The number of states. - * @tparam Inputs the number of inputs. + * @tparam States Number of states. + * @tparam Inputs Number of inputs. */ template class ControlAffinePlantInversionFeedforward { diff --git a/wpimath/src/main/native/include/frc/controller/ImplicitModelFollower.h b/wpimath/src/main/native/include/frc/controller/ImplicitModelFollower.h index 3a1230d4bcf..f030d4898c9 100644 --- a/wpimath/src/main/native/include/frc/controller/ImplicitModelFollower.h +++ b/wpimath/src/main/native/include/frc/controller/ImplicitModelFollower.h @@ -24,6 +24,9 @@ namespace frc { * * For more on the underlying math, read appendix B.3 in * https://file.tavsys.net/control/controls-engineering-in-frc.pdf. + * + * @tparam States Number of states. + * @tparam Inputs Number of inputs. */ template class ImplicitModelFollower { diff --git a/wpimath/src/main/native/include/frc/controller/LinearPlantInversionFeedforward.h b/wpimath/src/main/native/include/frc/controller/LinearPlantInversionFeedforward.h index 1d905e24ab2..fb46b030926 100644 --- a/wpimath/src/main/native/include/frc/controller/LinearPlantInversionFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/LinearPlantInversionFeedforward.h @@ -26,8 +26,8 @@ namespace frc { * For more on the underlying math, read * https://file.tavsys.net/control/controls-engineering-in-frc.pdf. * - * @tparam States The number of states. - * @tparam Inputs The number of inputs. + * @tparam States Number of states. + * @tparam Inputs Number of inputs. */ template class LinearPlantInversionFeedforward { @@ -38,7 +38,7 @@ class LinearPlantInversionFeedforward { /** * Constructs a feedforward with the given plant. * - * @tparam Outputs The number of outputs. + * @tparam Outputs Number of outputs. * @param plant The plant being controlled. * @param dt Discretization timestep. */ diff --git a/wpimath/src/main/native/include/frc/controller/LinearQuadraticRegulator.h b/wpimath/src/main/native/include/frc/controller/LinearQuadraticRegulator.h index 979e98a371f..8389a88a642 100644 --- a/wpimath/src/main/native/include/frc/controller/LinearQuadraticRegulator.h +++ b/wpimath/src/main/native/include/frc/controller/LinearQuadraticRegulator.h @@ -40,6 +40,7 @@ class LinearQuadraticRegulator { * https://docs.wpilib.org/en/stable/docs/software/advanced-controls/state-space/state-space-intro.html#lqr-tuning * for how to select the tolerances. * + * @tparam Outputs Number of outputs. * @param plant The plant being controlled. * @param Qelems The maximum desired error tolerance for each state. * @param Relems The maximum desired control effort for each input. diff --git a/wpimath/src/main/native/include/frc/estimator/AngleStatistics.h b/wpimath/src/main/native/include/frc/estimator/AngleStatistics.h index 026cc678812..de0de37e960 100644 --- a/wpimath/src/main/native/include/frc/estimator/AngleStatistics.h +++ b/wpimath/src/main/native/include/frc/estimator/AngleStatistics.h @@ -16,7 +16,7 @@ namespace frc { * Subtracts a and b while normalizing the resulting value in the selected row * as if it were an angle. * - * @tparam States The number of states. + * @tparam States Number of states. * @param a A vector to subtract from. * @param b A vector to subtract with. * @param angleStateIdx The row containing angles to be normalized. @@ -34,7 +34,7 @@ Vectord AngleResidual(const Vectord& a, * Returns a function that subtracts two vectors while normalizing the resulting * value in the selected row as if it were an angle. * - * @tparam States The number of states. + * @tparam States Number of states. * @param angleStateIdx The row containing angles to be normalized. */ template @@ -49,7 +49,7 @@ AngleResidual(int angleStateIdx) { * Adds a and b while normalizing the resulting value in the selected row as an * angle. * - * @tparam States The number of states. + * @tparam States Number of states. * @param a A vector to add with. * @param b A vector to add with. * @param angleStateIdx The row containing angles to be normalized. @@ -67,7 +67,7 @@ Vectord AngleAdd(const Vectord& a, const Vectord& b, * Returns a function that adds two vectors while normalizing the resulting * value in the selected row as an angle. * - * @tparam States The number of states. + * @tparam States Number of states. * @param angleStateIdx The row containing angles to be normalized. */ template @@ -82,7 +82,7 @@ AngleAdd(int angleStateIdx) { * * @tparam CovDim Dimension of covariance of sigma points after passing through * the transform. - * @tparam States The number of states. + * @tparam States Number of states. * @param sigmas Sigma points. * @param Wm Weights for the mean. * @param angleStatesIdx The row containing the angles. @@ -113,7 +113,7 @@ Vectord AngleMean(const Matrixd& sigmas, * * @tparam CovDim Dimension of covariance of sigma points after passing through * the transform. - * @tparam States The number of states. + * @tparam States Number of states. * @param angleStateIdx The row containing the angles. */ template diff --git a/wpimath/src/main/native/include/frc/estimator/ExtendedKalmanFilter.h b/wpimath/src/main/native/include/frc/estimator/ExtendedKalmanFilter.h index 32ed558f71b..68eb75b8818 100644 --- a/wpimath/src/main/native/include/frc/estimator/ExtendedKalmanFilter.h +++ b/wpimath/src/main/native/include/frc/estimator/ExtendedKalmanFilter.h @@ -33,9 +33,9 @@ namespace frc { * https://file.tavsys.net/control/controls-engineering-in-frc.pdf chapter 9 * "Stochastic control theory". * - * @tparam States The number of states. - * @tparam Inputs The number of inputs. - * @tparam Outputs The number of outputs. + * @tparam States Number of states. + * @tparam Inputs Number of inputs. + * @tparam Outputs Number of outputs. */ template class ExtendedKalmanFilter { diff --git a/wpimath/src/main/native/include/frc/estimator/KalmanFilter.h b/wpimath/src/main/native/include/frc/estimator/KalmanFilter.h index 3f9443d72b7..56dce0c11ca 100644 --- a/wpimath/src/main/native/include/frc/estimator/KalmanFilter.h +++ b/wpimath/src/main/native/include/frc/estimator/KalmanFilter.h @@ -28,9 +28,9 @@ namespace frc { * https://file.tavsys.net/control/controls-engineering-in-frc.pdf chapter 9 * "Stochastic control theory". * - * @tparam States The number of states. - * @tparam Inputs The number of inputs. - * @tparam Outputs The number of outputs. + * @tparam States Number of states. + * @tparam Inputs Number of inputs. + * @tparam Outputs Number of outputs. */ template class KalmanFilter { diff --git a/wpimath/src/main/native/include/frc/estimator/MerweScaledSigmaPoints.h b/wpimath/src/main/native/include/frc/estimator/MerweScaledSigmaPoints.h index b2e0e458ca3..6395d8d3f1e 100644 --- a/wpimath/src/main/native/include/frc/estimator/MerweScaledSigmaPoints.h +++ b/wpimath/src/main/native/include/frc/estimator/MerweScaledSigmaPoints.h @@ -21,8 +21,8 @@ namespace frc { * [1] R. Van der Merwe "Sigma-Point Kalman Filters for Probabilitic * Inference in Dynamic State-Space Models" (Doctoral dissertation) * - * @tparam States The dimensionality of the state. 2*States+1 weights will be - * generated. + * @tparam States The dimensionality of the state. 2 * States + 1 weights will + * be generated. */ template class MerweScaledSigmaPoints { diff --git a/wpimath/src/main/native/include/frc/estimator/PoseEstimator.h b/wpimath/src/main/native/include/frc/estimator/PoseEstimator.h index eb437a40f7e..6e38d8c65fb 100644 --- a/wpimath/src/main/native/include/frc/estimator/PoseEstimator.h +++ b/wpimath/src/main/native/include/frc/estimator/PoseEstimator.h @@ -30,6 +30,9 @@ namespace frc { * * AddVisionMeasurement() can be called as infrequently as you want; if you * never call it, then this class will behave like regular encoder odometry. + * + * @tparam WheelSpeeds Wheel speeds type. + * @tparam WheelPositions Wheel positions type. */ template class WPILIB_DLLEXPORT PoseEstimator { diff --git a/wpimath/src/main/native/include/frc/estimator/SteadyStateKalmanFilter.h b/wpimath/src/main/native/include/frc/estimator/SteadyStateKalmanFilter.h index 6548b45660f..64b1782b97c 100644 --- a/wpimath/src/main/native/include/frc/estimator/SteadyStateKalmanFilter.h +++ b/wpimath/src/main/native/include/frc/estimator/SteadyStateKalmanFilter.h @@ -33,9 +33,9 @@ namespace frc { * https://file.tavsys.net/control/controls-engineering-in-frc.pdf chapter 9 * "Stochastic control theory". * - * @tparam States The number of states. - * @tparam Inputs The number of inputs. - * @tparam Outputs The number of outputs. + * @tparam States Number of states. + * @tparam Inputs Number of inputs. + * @tparam Outputs Number of outputs. */ template class SteadyStateKalmanFilter { diff --git a/wpimath/src/main/native/include/frc/estimator/UnscentedKalmanFilter.h b/wpimath/src/main/native/include/frc/estimator/UnscentedKalmanFilter.h index 9526f0cb489..df68e151606 100644 --- a/wpimath/src/main/native/include/frc/estimator/UnscentedKalmanFilter.h +++ b/wpimath/src/main/native/include/frc/estimator/UnscentedKalmanFilter.h @@ -39,9 +39,9 @@ namespace frc { * (SR-UKF). For more information about the SR-UKF, see * https://www.researchgate.net/publication/3908304. * - * @tparam States The number of states. - * @tparam Inputs The number of inputs. - * @tparam Outputs The number of outputs. + * @tparam States Number of states. + * @tparam Inputs Number of inputs. + * @tparam Outputs Number of outputs. */ template class UnscentedKalmanFilter { diff --git a/wpimath/src/main/native/include/frc/kinematics/Odometry.h b/wpimath/src/main/native/include/frc/kinematics/Odometry.h index 55c074c02fa..9e242e2586f 100644 --- a/wpimath/src/main/native/include/frc/kinematics/Odometry.h +++ b/wpimath/src/main/native/include/frc/kinematics/Odometry.h @@ -20,6 +20,9 @@ namespace frc { * Teams can use odometry during the autonomous period for complex tasks like * path following. Furthermore, odometry can be used for latency compensation * when using computer-vision systems. + * + * @tparam WheelSpeeds Wheel speeds type. + * @tparam WheelPositions Wheel positions type. */ template class WPILIB_DLLEXPORT Odometry { diff --git a/wpinet/src/main/java/edu/wpi/first/net/WPINetJNI.java b/wpinet/src/main/java/edu/wpi/first/net/WPINetJNI.java index d0bcf7d4a9a..8e79cdc2e5c 100644 --- a/wpinet/src/main/java/edu/wpi/first/net/WPINetJNI.java +++ b/wpinet/src/main/java/edu/wpi/first/net/WPINetJNI.java @@ -8,20 +8,35 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; +/** WPINet JNI. */ public class WPINetJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -82,4 +97,7 @@ public static native int createMulticastServiceAnnouncer( public static native int getMulticastServiceResolverEventHandle(int handle); public static native ServiceData[] getMulticastServiceResolverData(int handle); + + /** Utility class. */ + private WPINetJNI() {} } diff --git a/wpiutil/src/main/java/edu/wpi/first/util/CircularBuffer.java b/wpiutil/src/main/java/edu/wpi/first/util/CircularBuffer.java index 6041e44253e..ff68d4d9ac5 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/CircularBuffer.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/CircularBuffer.java @@ -4,7 +4,11 @@ package edu.wpi.first.util; -/** This is a simple circular buffer so we don't need to "bucket brigade" copy old values. */ +/** + * This is a simple circular buffer so we don't need to "bucket brigade" copy old values. + * + * @param Buffer element type. + */ public class CircularBuffer { private T[] m_data; @@ -17,7 +21,7 @@ public class CircularBuffer { /** * Create a CircularBuffer with the provided size. * - * @param size The size of the circular buffer. + * @param size Maximum number of buffer elements. */ @SuppressWarnings("unchecked") public CircularBuffer(int size) { diff --git a/wpiutil/src/main/java/edu/wpi/first/util/InterpolatingTreeMap.java b/wpiutil/src/main/java/edu/wpi/first/util/InterpolatingTreeMap.java index 2c54d00ca41..7810afd7878 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/InterpolatingTreeMap.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/InterpolatingTreeMap.java @@ -10,6 +10,8 @@ * Interpolating Tree Maps are used to get values at points that are not defined by making a guess * from points that are defined. This uses linear interpolation. * + * @param Key type. + * @param Value type. * @deprecated Use {@link edu.wpi.first.math.interpolation.InterpolatingDoubleTreeMap} instead */ @Deprecated(forRemoval = true, since = "2024") diff --git a/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java b/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java index 12a0815e13b..96e693dfea7 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/WPIUtilJNI.java @@ -8,20 +8,35 @@ import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicBoolean; +/** WPIUtil JNI. */ public class WPIUtilJNI { static boolean libraryLoaded = false; static RuntimeLoader loader = null; + /** Sets whether JNI should be loaded in the static block. */ public static class Helper { private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true); + /** + * Returns true if the JNI should be loaded in the static block. + * + * @return True if the JNI should be loaded in the static block. + */ public static boolean getExtractOnStaticLoad() { return extractOnStaticLoad.get(); } + /** + * Sets whether the JNI should be loaded in the static block. + * + * @param load Whether the JNI should be loaded in the static block. + */ public static void setExtractOnStaticLoad(boolean load) { extractOnStaticLoad.set(load); } + + /** Utility class. */ + private Helper() {} } static { @@ -137,4 +152,7 @@ public static native boolean waitForObjectTimeout(int handle, double timeout) */ public static native int[] waitForObjectsTimeout(int[] handles, double timeout) throws InterruptedException; + + /** Utility class. */ + protected WPIUtilJNI() {} } diff --git a/wpiutil/src/main/java/edu/wpi/first/util/struct/BadSchemaException.java b/wpiutil/src/main/java/edu/wpi/first/util/struct/BadSchemaException.java index 6ff22369615..5815cfec009 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/struct/BadSchemaException.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/struct/BadSchemaException.java @@ -5,6 +5,7 @@ package edu.wpi.first.util.struct; public class BadSchemaException extends Exception { + /** The bad schema field. */ private final String m_field; public BadSchemaException(String s) { diff --git a/wpiutil/src/main/java/edu/wpi/first/util/struct/StructSerializable.java b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructSerializable.java index a8d1fdd8078..71ab2d6b0bf 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/struct/StructSerializable.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructSerializable.java @@ -11,5 +11,7 @@ * *

While this cannot be enforced by the interface, any class implementing this interface should * provide a public final static `struct` member variable. + * + * @param Serializable type. */ public interface StructSerializable extends WPISerializable {} diff --git a/wpiutil/src/main/java/edu/wpi/first/util/struct/parser/ParseException.java b/wpiutil/src/main/java/edu/wpi/first/util/struct/parser/ParseException.java index 9fa843ca70e..7ce4a08621c 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/struct/parser/ParseException.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/struct/parser/ParseException.java @@ -5,6 +5,7 @@ package edu.wpi.first.util.struct.parser; public class ParseException extends Exception { + /** The parser position. */ private final int m_pos; public ParseException(int pos, String s) { diff --git a/wpiutil/src/main/native/include/wpi/circular_buffer.h b/wpiutil/src/main/native/include/wpi/circular_buffer.h index f0a792b956c..a40a627db41 100644 --- a/wpiutil/src/main/native/include/wpi/circular_buffer.h +++ b/wpiutil/src/main/native/include/wpi/circular_buffer.h @@ -13,10 +13,17 @@ namespace wpi { /** * This is a simple circular buffer so we don't need to "bucket brigade" copy * old values. + * + * @tparam T Buffer element type. */ template class circular_buffer { public: + /** + * Constructs a circular buffer. + * + * @param size Maximum number of buffer elements. + */ explicit circular_buffer(size_t size) : m_data(size, T{}) {} circular_buffer(const circular_buffer&) = default; diff --git a/wpiutil/src/main/native/include/wpi/static_circular_buffer.h b/wpiutil/src/main/native/include/wpi/static_circular_buffer.h index 09446dfcb5e..0d38f25ebea 100644 --- a/wpiutil/src/main/native/include/wpi/static_circular_buffer.h +++ b/wpiutil/src/main/native/include/wpi/static_circular_buffer.h @@ -13,6 +13,9 @@ namespace wpi { /** * This is a simple circular buffer so we don't need to "bucket brigade" copy * old values. + * + * @tparam T Buffer element type. + * @tparam N Maximum number of buffer elements. */ template class static_circular_buffer {