diff --git a/build.gradle b/build.gradle
index 0fc3980b6..993f29246 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,6 @@
plugins {
- id "com.diffplug.spotless" version "6.0.5"
- id "com.github.johnrengelman.shadow" version "7.1.1"
+ id "com.diffplug.spotless" version "6.1.2"
+ id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.github.node-gradle.node" version "3.1.1" apply false
id "edu.wpi.first.GradleJni" version "1.0.0"
id "edu.wpi.first.GradleVsCode" version "1.1.0"
diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java
index 3b1f26e1a..d8b3d7699 100644
--- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java
+++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioException.java
@@ -19,11 +19,11 @@ package org.photonvision.common.hardware.GPIO.pi;
import java.util.HashMap;
/**
-* A class that defines the exceptions that can be thrown by Pigpio.
-*
-*
Credit to nkolban
-* https://github.com/nkolban/jpigpio/blob/master/JPigpio/src/jpigpio/PigpioException.java
-*/
+ * A class that defines the exceptions that can be thrown by Pigpio.
+ *
+ *
Credit to nkolban
+ * https://github.com/nkolban/jpigpio/blob/master/JPigpio/src/jpigpio/PigpioException.java
+ */
@SuppressWarnings({"SpellCheckingInspection", "unused", "RedundantSuppression"})
public class PigpioException extends Exception {
private int rc = -99999999;
@@ -65,10 +65,10 @@ public class PigpioException extends Exception {
}
/**
- * Retrieve the error code that was returned by the underlying Pigpio call.
- *
- * @return The error code that was returned by the underlying Pigpio call.
- */
+ * Retrieve the error code that was returned by the underlying Pigpio call.
+ *
+ * @return The error code that was returned by the underlying Pigpio call.
+ */
public int getErrorCode() {
return rc;
} // End of getErrorCode
diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java
index e0b7897c9..dd66bb073 100644
--- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java
+++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioPulse.java
@@ -22,14 +22,14 @@ public class PigpioPulse {
int delayMicros;
/**
- * Initialises a pulse.
- *
- * @param gpioOn GPIO number to switch on at the start of the pulse. If zero, then no GPIO will be
- * switched on.
- * @param gpioOff GPIO number to switch off at the start of the pulse. If zero, then no GPIO will
- * be switched off.
- * @param delayMicros the delay in microseconds before the next pulse.
- */
+ * Initialises a pulse.
+ *
+ * @param gpioOn GPIO number to switch on at the start of the pulse. If zero, then no GPIO will be
+ * switched on.
+ * @param gpioOff GPIO number to switch off at the start of the pulse. If zero, then no GPIO will
+ * be switched off.
+ * @param delayMicros the delay in microseconds before the next pulse.
+ */
public PigpioPulse(int gpioOn, int gpioOff, int delayMicros) {
this.gpioOn = gpioOn != 0 ? 1 << gpioOn : 0;
this.gpioOff = gpioOff != 0 ? 1 << gpioOff : 0;
diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java
index 35c5dd459..5a3e8afb5 100644
--- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java
+++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocket.java
@@ -40,12 +40,12 @@ public class PigpioSocket {
}
/**
- * Creates and starts a socket connection to a pigpio daemon on a remote host with the specified
- * address and port
- *
- * @param addr Address of remote pigpio daemon
- * @param port Port of remote pigpio daemon
- */
+ * Creates and starts a socket connection to a pigpio daemon on a remote host with the specified
+ * address and port
+ *
+ * @param addr Address of remote pigpio daemon
+ * @param port Port of remote pigpio daemon
+ */
public PigpioSocket(String addr, int port) {
try {
commandSocket = new PigpioSocketLock(addr, port);
@@ -55,10 +55,10 @@ public class PigpioSocket {
}
/**
- * Reconnects to the pigpio daemon
- *
- * @throws PigpioException on failure
- */
+ * Reconnects to the pigpio daemon
+ *
+ * @throws PigpioException on failure
+ */
public void reconnect() throws PigpioException {
try {
commandSocket.reconnect();
@@ -69,10 +69,10 @@ public class PigpioSocket {
}
/**
- * Terminates the connection to the pigpio daemon
- *
- * @throws PigpioException on failure
- */
+ * Terminates the connection to the pigpio daemon
+ *
+ * @throws PigpioException on failure
+ */
public void gpioTerminate() throws PigpioException {
try {
commandSocket.terminate();
@@ -83,12 +83,12 @@ public class PigpioSocket {
}
/**
- * Read the GPIO level
- *
- * @param pin Pin to read from
- * @return Value of the pin
- * @throws PigpioException on failure
- */
+ * Read the GPIO level
+ *
+ * @param pin Pin to read from
+ * @return Value of the pin
+ * @throws PigpioException on failure
+ */
public boolean gpioRead(int pin) throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_READ.value, pin);
@@ -101,12 +101,12 @@ public class PigpioSocket {
}
/**
- * Write the GPIO level
- *
- * @param pin Pin to write to
- * @param value Value to write
- * @throws PigpioException on failure
- */
+ * Write the GPIO level
+ *
+ * @param pin Pin to write to
+ * @param value Value to write
+ * @throws PigpioException on failure
+ */
public void gpioWrite(int pin, boolean value) throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_WRITE.value, pin, value ? 1 : 0);
@@ -118,10 +118,10 @@ public class PigpioSocket {
}
/**
- * Clears all waveforms and any data added by calls to {@link #waveAddGeneric(ArrayList)}
- *
- * @throws PigpioException on failure
- */
+ * Clears all waveforms and any data added by calls to {@link #waveAddGeneric(ArrayList)}
+ *
+ * @throws PigpioException on failure
+ */
public void waveClear() throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_WVCLR.value);
@@ -133,12 +133,12 @@ public class PigpioSocket {
}
/**
- * Adds a number of pulses to the current waveform
- *
- * @param pulses ArrayList of pulses to add
- * @return the new total number of pulses in the current waveform
- * @throws PigpioException on failure
- */
+ * Adds a number of pulses to the current waveform
+ *
+ * @param pulses ArrayList of pulses to add
+ * @return the new total number of pulses in the current waveform
+ * @throws PigpioException on failure
+ */
private int waveAddGeneric(ArrayList pulses) throws PigpioException {
// pigpio wave message format
@@ -174,12 +174,12 @@ public class PigpioSocket {
}
/**
- * Creates pulses and adds them to the current waveform
- *
- * @param pulseTimeMillis Pulse length in milliseconds
- * @param blinks Number of times to pulse. -1 for repeat
- * @param pinNo Pin to pulse
- */
+ * Creates pulses and adds them to the current waveform
+ *
+ * @param pulseTimeMillis Pulse length in milliseconds
+ * @param blinks Number of times to pulse. -1 for repeat
+ * @param pinNo Pin to pulse
+ */
private void addBlinkPulsesToWaveform(int pulseTimeMillis, int blinks, int pinNo) {
boolean repeat = blinks == -1;
@@ -207,13 +207,13 @@ public class PigpioSocket {
}
/**
- * Generates and sends a waveform to the given pins with the specified parameters.
- *
- * @param pulseTimeMillis Pulse length in milliseconds
- * @param blinks Number of times to pulse. -1 for repeat
- * @param pins Pins to pulse
- * @throws PigpioException on failure
- */
+ * Generates and sends a waveform to the given pins with the specified parameters.
+ *
+ * @param pulseTimeMillis Pulse length in milliseconds
+ * @param blinks Number of times to pulse. -1 for repeat
+ * @param pins Pins to pulse
+ * @throws PigpioException on failure
+ */
public void generateAndSendWaveform(int pulseTimeMillis, int blinks, int... pins)
throws PigpioException {
if (pins.length == 0) return;
@@ -262,11 +262,11 @@ public class PigpioSocket {
}
/**
- * Stops the transmission of the current waveform
- *
- * @return success
- * @throws PigpioException on failure
- */
+ * Stops the transmission of the current waveform
+ *
+ * @return success
+ * @throws PigpioException on failure
+ */
public boolean waveTxStop() throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_WVHLT.value);
@@ -279,12 +279,12 @@ public class PigpioSocket {
}
/**
- * Creates a waveform from the data provided by the prior calls to {@link
- * #waveAddGeneric(ArrayList)} Upon success a wave ID greater than or equal to 0 is returned
- *
- * @return ID of the created waveform
- * @throws PigpioException on failure
- */
+ * Creates a waveform from the data provided by the prior calls to {@link
+ * #waveAddGeneric(ArrayList)} Upon success a wave ID greater than or equal to 0 is returned
+ *
+ * @return ID of the created waveform
+ * @throws PigpioException on failure
+ */
public int waveCreate() throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_WVCRE.value);
@@ -297,11 +297,11 @@ public class PigpioSocket {
}
/**
- * Deletes the waveform with specified wave ID
- *
- * @param waveId ID of the waveform to delete
- * @throws PigpioException on failure
- */
+ * Deletes the waveform with specified wave ID
+ *
+ * @param waveId ID of the waveform to delete
+ * @throws PigpioException on failure
+ */
public void waveDelete(int waveId) throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_WVDEL.value, waveId);
@@ -313,12 +313,12 @@ public class PigpioSocket {
}
/**
- * Transmits the waveform with specified wave ID. The waveform is sent once
- *
- * @param waveId ID of the waveform to transmit
- * @return The number of DMA control blocks in the waveform
- * @throws PigpioException on failure
- */
+ * Transmits the waveform with specified wave ID. The waveform is sent once
+ *
+ * @param waveId ID of the waveform to transmit
+ * @return The number of DMA control blocks in the waveform
+ * @throws PigpioException on failure
+ */
public int waveSendOnce(int waveId) throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_WVTX.value, waveId);
@@ -330,13 +330,13 @@ public class PigpioSocket {
}
/**
- * Transmits the waveform with specified wave ID. The waveform cycles until cancelled (either by
- * the sending of a new waveform or {@link #waveTxStop()}
- *
- * @param waveId ID of the waveform to transmit
- * @return The number of DMA control blocks in the waveform
- * @throws PigpioException on failure
- */
+ * Transmits the waveform with specified wave ID. The waveform cycles until cancelled (either by
+ * the sending of a new waveform or {@link #waveTxStop()}
+ *
+ * @param waveId ID of the waveform to transmit
+ * @return The number of DMA control blocks in the waveform
+ * @throws PigpioException on failure
+ */
public int waveSendRepeat(int waveId) throws PigpioException {
try {
int retCode = commandSocket.sendCmd(PigpioCommand.PCMD_WVTXR.value, waveId);
@@ -348,14 +348,14 @@ public class PigpioSocket {
}
/**
- * Starts hardware PWM on a GPIO at the specified frequency and dutycycle
- *
- * @param pin GPIO pin to start PWM on
- * @param pwmFrequency Frequency to run at (1Hz-125MHz). Frequencies above 30MHz are unlikely to
- * work
- * @param pwmDuty Duty cycle to run at (0-1,000,000)
- * @throws PigpioException on failure
- */
+ * Starts hardware PWM on a GPIO at the specified frequency and dutycycle
+ *
+ * @param pin GPIO pin to start PWM on
+ * @param pwmFrequency Frequency to run at (1Hz-125MHz). Frequencies above 30MHz are unlikely to
+ * work
+ * @param pwmDuty Duty cycle to run at (0-1,000,000)
+ * @throws PigpioException on failure
+ */
public void hardwarePWM(int pin, int pwmFrequency, int pwmDuty) throws PigpioException {
try {
ByteBuffer bb = ByteBuffer.allocate(4);
diff --git a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java
index 528e77240..ec6fde58f 100644
--- a/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java
+++ b/photon-core/src/main/java/org/photonvision/common/hardware/GPIO/pi/PigpioSocketLock.java
@@ -23,9 +23,9 @@ import java.net.Socket;
import java.nio.ByteBuffer;
/**
-* Credit to nkolban
-* https://github.com/nkolban/jpigpio/blob/master/JPigpio/src/jpigpio/SocketLock.java
-*/
+ * Credit to nkolban
+ * https://github.com/nkolban/jpigpio/blob/master/JPigpio/src/jpigpio/SocketLock.java
+ */
final class PigpioSocketLock {
private static final int replyTimeoutMillis = 1000;
@@ -81,16 +81,16 @@ final class PigpioSocketLock {
}
/**
- * Send extended command to pigpiod and return result code
- *
- * @param cmd Command to send
- * @param p1 Command parameter 1
- * @param p2 Command parameter 2
- * @param p3 Command parameter 3 (usually length of extended data - see paramater ext)
- * @param ext Array of bytes containing extended data
- * @return Command result code
- * @throws IOException in case of network connection error
- */
+ * Send extended command to pigpiod and return result code
+ *
+ * @param cmd Command to send
+ * @param p1 Command parameter 1
+ * @param p2 Command parameter 2
+ * @param p3 Command parameter 3 (usually length of extended data - see paramater ext)
+ * @param ext Array of bytes containing extended data
+ * @return Command result code
+ * @throws IOException in case of network connection error
+ */
@SuppressWarnings("UnusedAssignment")
public synchronized int sendCmd(int cmd, int p1, int p2, int p3, byte[] ext) throws IOException {
ByteBuffer bb = ByteBuffer.allocate(16 + ext.length);
@@ -135,11 +135,11 @@ final class PigpioSocketLock {
}
/**
- * Read all remaining bytes coming from pigpiod
- *
- * @param data Array to store read bytes.
- * @throws IOException if unable to read from network
- */
+ * Read all remaining bytes coming from pigpiod
+ *
+ * @param data Array to store read bytes.
+ * @throws IOException if unable to read from network
+ */
public void readBytes(byte[] data) throws IOException {
in.readFully(data);
}
diff --git a/photon-core/src/main/java/org/photonvision/common/logging/Logger.java b/photon-core/src/main/java/org/photonvision/common/logging/Logger.java
index d6cb0c445..07c3d358b 100644
--- a/photon-core/src/main/java/org/photonvision/common/logging/Logger.java
+++ b/photon-core/src/main/java/org/photonvision/common/logging/Logger.java
@@ -232,12 +232,12 @@ public class Logger {
}
/**
- * Logs an error message with the stack trace of a Throwable. The stacktrace will only be printed
- * if the current LogLevel is TRACE
- *
- * @param message
- * @param t
- */
+ * Logs an error message with the stack trace of a Throwable. The stacktrace will only be printed
+ * if the current LogLevel is TRACE
+ *
+ * @param message
+ * @param t
+ */
public void error(String message, Throwable t) {
log(message, LogLevel.ERROR);
log(convertStackTraceToString(t), LogLevel.ERROR, LogLevel.DEBUG);
diff --git a/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java b/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java
index a0e5079be..c48300d2b 100644
--- a/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java
+++ b/photon-core/src/main/java/org/photonvision/common/util/ShellExec.java
@@ -43,12 +43,12 @@ public class ShellExec {
}
/**
- * Execute a bash command. We can handle complex bash commands including multiple executions (; |
- * and ||), quotes, expansions ($), escapes (\), e.g.: "cd /abc/def; mv ghi 'older ghi '$(whoami)"
- *
- * @param command Bash command to execute
- * @return true if bash got started, but your command may have failed.
- */
+ * Execute a bash command. We can handle complex bash commands including multiple executions (; |
+ * and ||), quotes, expansions ($), escapes (\), e.g.: "cd /abc/def; mv ghi 'older ghi '$(whoami)"
+ *
+ * @param command Bash command to execute
+ * @return true if bash got started, but your command may have failed.
+ */
public int executeBashCommand(String command, boolean wait) throws IOException {
logger.debug("Executing \"" + command + "\"");
@@ -71,25 +71,25 @@ public class ShellExec {
}
/**
- * Execute a command in current folder, and wait for process to end
- *
- * @param command command ("c:/some/folder/script.bat" or "some/folder/script.sh")
- * @param args 0..n command line arguments
- * @return process exit code
- */
+ * Execute a command in current folder, and wait for process to end
+ *
+ * @param command command ("c:/some/folder/script.bat" or "some/folder/script.sh")
+ * @param args 0..n command line arguments
+ * @return process exit code
+ */
public int execute(String command, String... args) throws IOException {
return execute(command, null, true, args);
}
/**
- * Execute a command.
- *
- * @param command command ("c:/some/folder/script.bat" or "some/folder/script.sh")
- * @param workdir working directory or NULL to use command folder
- * @param wait wait for process to end
- * @param args 0..n command line arguments
- * @return process exit code
- */
+ * Execute a command.
+ *
+ * @param command command ("c:/some/folder/script.bat" or "some/folder/script.sh")
+ * @param workdir working directory or NULL to use command folder
+ * @param wait wait for process to end
+ * @param args 0..n command line arguments
+ * @return process exit code
+ */
public int execute(String command, String workdir, boolean wait, String... args)
throws IOException {
String[] cmdArr;
@@ -153,10 +153,10 @@ public class ShellExec {
// ********************************************
/**
- * StreamGobbler reads inputstream to "gobble" it. This is used by Executor class when running a
- * commandline applications. Gobblers must read/purge INSTR and ERRSTR process streams.
- * http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
- */
+ * StreamGobbler reads inputstream to "gobble" it. This is used by Executor class when running a
+ * commandline applications. Gobblers must read/purge INSTR and ERRSTR process streams.
+ * http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
+ */
@SuppressWarnings("WeakerAccess")
private static class StreamGobbler extends Thread {
private InputStream is;
@@ -186,19 +186,19 @@ public class ShellExec {
}
/**
- * Get inputstream buffer or null if stream was not consumed.
- *
- * @return Output stream
- */
+ * Get inputstream buffer or null if stream was not consumed.
+ *
+ * @return Output stream
+ */
public String getOutput() {
return (output != null ? output.toString() : null);
}
/**
- * Is input stream completed.
- *
- * @return if input stream is completed
- */
+ * Is input stream completed.
+ *
+ * @return if input stream is completed
+ */
public boolean isCompleted() {
return completed;
}
diff --git a/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java b/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java
index 12d4eda26..66ca7eb7f 100644
--- a/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java
+++ b/photon-core/src/main/java/org/photonvision/common/util/math/MathUtils.java
@@ -64,13 +64,13 @@ public class MathUtils {
}
/**
- * Linearly interpolates between two values.
- *
- * @param startValue The start value.
- * @param endValue The end value.
- * @param t The fraction for interpolation.
- * @return The interpolated value.
- */
+ * Linearly interpolates between two values.
+ *
+ * @param startValue The start value.
+ * @param endValue The end value.
+ * @param t The fraction for interpolation.
+ * @return The interpolated value.
+ */
@SuppressWarnings("ParameterName")
public static double lerp(double startValue, double endValue, double t) {
return startValue + (endValue - startValue) * t;
diff --git a/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java b/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java
index 3d724e350..b25314aff 100644
--- a/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java
+++ b/photon-core/src/main/java/org/photonvision/common/util/numbers/NumberListUtils.java
@@ -25,9 +25,9 @@ import java.util.StringJoiner;
@SuppressWarnings("unused")
public class NumberListUtils {
/**
- * @param collection an ArrayList of Comparable objects
- * @return the median of collection
- */
+ * @param collection an ArrayList of Comparable objects
+ * @return the median of collection
+ */
public static double median(List collection, Comparator comp) {
double result;
int n = collection.size() / 2;
@@ -57,9 +57,9 @@ public class NumberListUtils {
}
/**
- * @param collection an ArrayList of Numbers
- * @return the mean of collection
- */
+ * @param collection an ArrayList of Numbers
+ * @return the mean of collection
+ */
public static double mean(final List extends Number> collection) {
BigDecimal sum = BigDecimal.ZERO;
for (final Number number : collection) {
@@ -69,11 +69,11 @@ public class NumberListUtils {
}
/**
- * @param collection a collection of Comparable objects
- * @param n the position of the desired object, using the ordering defined on the collection
- * elements
- * @return the nth smallest object
- */
+ * @param collection a collection of Comparable objects
+ * @param n the position of the desired object, using the ordering defined on the collection
+ * elements
+ * @return the nth smallest object
+ */
public static T nthSmallest(List collection, int n, Comparator comp) {
T result, pivot;
ArrayList underPivot = new ArrayList<>(),
diff --git a/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java b/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java
index c5fad364e..91c2be35c 100644
--- a/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java
+++ b/photon-core/src/main/java/org/photonvision/raspi/PicamJNI.java
@@ -116,18 +116,18 @@ public class PicamJNI {
// Everything here is static because multiple picams are unsupported at the hardware level
/**
- * Called once for each video mode change. Starts a native thread running MMAL that stays alive
- * until destroyCamera is called.
- *
- * @return true on error.
- */
+ * Called once for each video mode change. Starts a native thread running MMAL that stays alive
+ * until destroyCamera is called.
+ *
+ * @return true on error.
+ */
public static native boolean createCamera(int width, int height, int fps);
/**
- * Destroys MMAL and EGL contexts. Called once for each video mode change *before* createCamera.
- *
- * @return true on error.
- */
+ * Destroys MMAL and EGL contexts. Called once for each video mode change *before* createCamera.
+ *
+ * @return true on error.
+ */
public static native boolean destroyCamera();
public static native void setThresholds(
diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java
index a4e2da954..f987a74c4 100644
--- a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java
+++ b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java
@@ -42,24 +42,24 @@ public class QuirkyCamera {
public final HashMap quirks;
/**
- * Creates a QuirkyCamera that matches by USB VID/PID
- *
- * @param usbVid USB VID of camera
- * @param usbPid USB PID of camera
- * @param quirks Camera quirks
- */
+ * Creates a QuirkyCamera that matches by USB VID/PID
+ *
+ * @param usbVid USB VID of camera
+ * @param usbPid USB PID of camera
+ * @param quirks Camera quirks
+ */
private QuirkyCamera(int usbVid, int usbPid, CameraQuirk... quirks) {
this(usbVid, usbPid, "", quirks);
}
/**
- * Creates a QuirkyCamera that matches by USB VID/PID and name
- *
- * @param usbVid USB VID of camera
- * @param usbPid USB PID of camera
- * @param baseName CSCore name of camera
- * @param quirks Camera quirks
- */
+ * Creates a QuirkyCamera that matches by USB VID/PID and name
+ *
+ * @param usbVid USB VID of camera
+ * @param usbPid USB PID of camera
+ * @param baseName CSCore name of camera
+ * @param quirks Camera quirks
+ */
private QuirkyCamera(int usbVid, int usbPid, String baseName, CameraQuirk... quirks) {
this.usbVid = usbVid;
this.usbPid = usbPid;
diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java b/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java
index 4e30a786e..5239e84b1 100644
--- a/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java
+++ b/photon-core/src/main/java/org/photonvision/vision/camera/ZeroCopyPicamSource.java
@@ -56,13 +56,13 @@ public class ZeroCopyPicamSource extends VisionSource {
}
/**
- * On the OV5649 the actual FPS we want to request from the GPU can be higher than the FPS that we
- * can do after processing. On the IMX219 these FPSes match pretty closely, except for the
- * 1280x720 mode. We use this to present a rated FPS to the user that's lower than the actual FPS
- * we request from the GPU. This is important for setting user expectations, and is also used by
- * the frontend to detect and explain FPS drops. This class should ONLY be used by Picam video
- * modes! This is to make sure it shows up nice in the frontend
- */
+ * On the OV5649 the actual FPS we want to request from the GPU can be higher than the FPS that we
+ * can do after processing. On the IMX219 these FPSes match pretty closely, except for the
+ * 1280x720 mode. We use this to present a rated FPS to the user that's lower than the actual FPS
+ * we request from the GPU. This is important for setting user expectations, and is also used by
+ * the frontend to detect and explain FPS drops. This class should ONLY be used by Picam video
+ * modes! This is to make sure it shows up nice in the frontend
+ */
public static class FPSRatedVideoMode extends VideoMode {
public final int fpsActual;
public final double fovMultiplier;
diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java b/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java
index 0324e44a4..aa9e52c7b 100644
--- a/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java
+++ b/photon-core/src/main/java/org/photonvision/vision/frame/FrameStaticProperties.java
@@ -37,23 +37,23 @@ public class FrameStaticProperties {
public CameraCalibrationCoefficients cameraCalibration;
/**
- * Instantiates a new Frame static properties.
- *
- * @param mode The Video Mode of the camera.
- * @param fov The fov of the image.
- */
+ * Instantiates a new Frame static properties.
+ *
+ * @param mode The Video Mode of the camera.
+ * @param fov The fov of the image.
+ */
public FrameStaticProperties(
VideoMode mode, double fov, Rotation2d cameraPitch, CameraCalibrationCoefficients cal) {
this(mode != null ? mode.width : 1, mode != null ? mode.height : 1, fov, cameraPitch, cal);
}
/**
- * Instantiates a new Frame static properties.
- *
- * @param imageWidth The width of the image.
- * @param imageHeight The width of the image.
- * @param fov The fov of the image.
- */
+ * Instantiates a new Frame static properties.
+ *
+ * @param imageWidth The width of the image.
+ * @param imageHeight The width of the image.
+ * @param fov The fov of the image.
+ */
public FrameStaticProperties(
int imageWidth,
int imageHeight,
diff --git a/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java b/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java
index f31855674..99d60f014 100644
--- a/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java
+++ b/photon-core/src/main/java/org/photonvision/vision/frame/provider/FileFrameProvider.java
@@ -29,9 +29,9 @@ import org.photonvision.vision.frame.FrameStaticProperties;
import org.photonvision.vision.opencv.CVMat;
/**
-* A {@link FrameProvider} that will read and provide an image from a {@link java.nio.file.Path
-* path}.
-*/
+ * A {@link FrameProvider} that will read and provide an image from a {@link java.nio.file.Path
+ * path}.
+ */
public class FileFrameProvider implements FrameProvider {
public static final int MAX_FPS = 120;
private static int count = 0;
@@ -46,12 +46,12 @@ public class FileFrameProvider implements FrameProvider {
private long lastGetMillis = System.currentTimeMillis();
/**
- * Instantiates a new FileFrameProvider.
- *
- * @param path The path of the image to read from.
- * @param fov The fov of the image.
- * @param maxFPS The max framerate to provide the image at.
- */
+ * Instantiates a new FileFrameProvider.
+ *
+ * @param path The path of the image to read from.
+ * @param fov The fov of the image.
+ * @param maxFPS The max framerate to provide the image at.
+ */
public FileFrameProvider(Path path, double fov, int maxFPS) {
this(path, fov, maxFPS, null, null);
}
@@ -83,21 +83,21 @@ public class FileFrameProvider implements FrameProvider {
}
/**
- * Instantiates a new File frame provider.
- *
- * @param pathAsString The path of the image to read from as a string.
- * @param fov The fov of the image.
- */
+ * Instantiates a new File frame provider.
+ *
+ * @param pathAsString The path of the image to read from as a string.
+ * @param fov The fov of the image.
+ */
public FileFrameProvider(String pathAsString, double fov) {
this(Paths.get(pathAsString), fov, MAX_FPS);
}
/**
- * Instantiates a new File frame provider.
- *
- * @param path The path of the image to read from.
- * @param fov The fov of the image.
- */
+ * Instantiates a new File frame provider.
+ *
+ * @param path The path of the image to read from.
+ * @param fov The fov of the image.
+ */
public FileFrameProvider(Path path, double fov) {
this(path, fov, MAX_FPS);
}
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java
index c02604230..234abdef0 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/CVPipe.java
@@ -17,13 +17,13 @@
package org.photonvision.vision.pipe;
/**
-* Defines a pipe. A pipe is a single step in a pipeline. This class is to be extended, never used
-* on its own.
-*
-* @param Input type for the pipe
-* @param Output type for the pipe
-* @param Parameters type for the pipe
-*/
+ * Defines a pipe. A pipe is a single step in a pipeline. This class is to be extended, never used
+ * on its own.
+ *
+ * @param Input type for the pipe
+ * @param Output type for the pipe
+ * @param Parameters type for the pipe
+ */
public abstract class CVPipe {
protected CVPipeResult result = new CVPipeResult<>();
protected P params;
@@ -33,17 +33,17 @@ public abstract class CVPipe {
}
/**
- * Runs the process for the pipe.
- *
- * @param in Input for pipe processing.
- * @return Result of processing.
- */
+ * Runs the process for the pipe.
+ *
+ * @param in Input for pipe processing.
+ * @return Result of processing.
+ */
protected abstract O process(I in);
/**
- * @param in Input for pipe processing.
- * @return Result of processing.
- */
+ * @param in Input for pipe processing.
+ * @return Result of processing.
+ */
public CVPipeResult run(I in) {
long pipeStartNanos = System.nanoTime();
result.output = process(in);
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java
index 696f70c5a..2ec314f5f 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/BlurPipe.java
@@ -24,11 +24,11 @@ import org.photonvision.vision.pipe.MutatingPipe;
/** Represents a pipeline that blurs the image. */
public class BlurPipe extends MutatingPipe {
/**
- * Processes this pipe.
- *
- * @param in Input for pipe processing.
- * @return The processed frame.
- */
+ * Processes this pipe.
+ *
+ * @param in Input for pipe processing.
+ * @return The processed frame.
+ */
@Override
protected Void process(Mat in) {
Imgproc.blur(in, in, params.getBlurSize());
@@ -43,19 +43,19 @@ public class BlurPipe extends MutatingPipe {
private final int m_blurSize;
/**
- * Constructs a new BlurImageParams.
- *
- * @param blurSize The blur size.
- */
+ * Constructs a new BlurImageParams.
+ *
+ * @param blurSize The blur size.
+ */
public BlurParams(int blurSize) {
m_blurSize = blurSize;
}
/**
- * Returns the blur size.
- *
- * @return The blur size.
- */
+ * Returns the blur size.
+ *
+ * @return The blur size.
+ */
public Size getBlurSize() {
return new Size(m_blurSize, m_blurSize);
}
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java
index f23aac210..cd05ed34b 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Calibrate3dPipe.java
@@ -60,11 +60,11 @@ public class Calibrate3dPipe
private double calibrationAccuracy;
/**
- * Runs the process for the pipe.
- *
- * @param in Input for pipe processing. In the format (Input image, object points, image points)
- * @return Result of processing.
- */
+ * Runs the process for the pipe.
+ *
+ * @param in Input for pipe processing. In the format (Input image, object points, image points)
+ * @return Result of processing.
+ */
@Override
protected CameraCalibrationCoefficients process(List> in) {
in =
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java
index 9f7264fc3..ce5cebbba 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/Collect2dTargetsPipe.java
@@ -29,11 +29,11 @@ public class Collect2dTargetsPipe
extends CVPipe<
List, List, Collect2dTargetsPipe.Collect2dTargetsParams> {
/**
- * Processes this pipeline.
- *
- * @param in Input for pipe processing.
- * @return A list of tracked targets.
- */
+ * Processes this pipeline.
+ *
+ * @param in Input for pipe processing.
+ * @return A list of tracked targets.
+ */
@Override
protected List process(List in) {
List targets = new ArrayList<>();
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java
index 21098412c..564f3a7ff 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/CornerDetectionPipe.java
@@ -59,9 +59,9 @@ public class CornerDetectionPipe
}
/**
- * @param target the target to find the corners of.
- * @return the corners. left top, left bottom, right bottom, right top
- */
+ * @param target the target to find the corners of.
+ * @return the corners. left top, left bottom, right bottom, right top
+ */
private List findBoundingBoxCorners(TrackedTarget target) {
// extract the corners
var points = new Point[4];
@@ -88,30 +88,30 @@ public class CornerDetectionPipe
}
/**
- * @param a First point.
- * @param b Second point.
- * @return The straight line distance between them.
- */
+ * @param a First point.
+ * @param b Second point.
+ * @return The straight line distance between them.
+ */
private static double distanceBetween(Point a, Point b) {
return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
}
/**
- * @param a First point.
- * @param b Second point.
- * @return The straight line distance between them.
- */
+ * @param a First point.
+ * @param b Second point.
+ * @return The straight line distance between them.
+ */
private static double distanceBetween(Translation2d a, Translation2d b) {
return Math.sqrt(Math.pow(a.getX() - b.getX(), 2) + Math.pow(a.getY() - b.getY(), 2));
}
/**
- * Find the 4 most extreme corners,
- *
- * @param target the target to track.
- * @param convexHull weather to use the convex hull of the target.
- * @return the 4 extreme corners of the contour.
- */
+ * Find the 4 most extreme corners,
+ *
+ * @param target the target to track.
+ * @param convexHull weather to use the convex hull of the target.
+ * @return the 4 extreme corners of the contour.
+ */
private List detectExtremeCornersByApproxPolyDp(TrackedTarget target, boolean convexHull) {
var centroid = target.getMinAreaRect().center;
Comparator distanceProvider =
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java
index 9784930ef..0effe71b9 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FilterShapesPipe.java
@@ -28,11 +28,11 @@ public class FilterShapesPipe
List outputList = new ArrayList<>();
/**
- * Runs the process for the pipe.
- *
- * @param in Input for pipe processing.
- * @return Result of processing.
- */
+ * Runs the process for the pipe.
+ *
+ * @param in Input for pipe processing.
+ * @return Result of processing.
+ */
@Override
protected List process(List in) {
outputList.forEach(CVShape::release);
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java
index 6e2109d14..23fcf6a15 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindBoardCornersPipe.java
@@ -109,11 +109,11 @@ public class FindBoardCornersPipe
}
/**
- * Finds the corners in a given image and returns them
- *
- * @param in Input for pipe processing. Pair of input and output mat
- * @return All valid Mats for camera calibration
- */
+ * Finds the corners in a given image and returns them
+ *
+ * @param in Input for pipe processing. Pair of input and output mat
+ * @return All valid Mats for camera calibration
+ */
@Override
protected Triple process(Pair in) {
// Create the object points
@@ -123,12 +123,12 @@ public class FindBoardCornersPipe
}
/**
- * Figures out how much a frame or point cloud must be scaled down by to match the desired size at
- * which to run FindCorners
- *
- * @param inFrame
- * @return
- */
+ * Figures out how much a frame or point cloud must be scaled down by to match the desired size at
+ * which to run FindCorners
+ *
+ * @param inFrame
+ * @return
+ */
private double getFindCornersScaleFactor(Mat inFrame) {
if (inFrame.width() > FIND_CORNERS_WIDTH_PX) {
return ((double) FIND_CORNERS_WIDTH_PX) / inFrame.width();
@@ -138,21 +138,21 @@ public class FindBoardCornersPipe
}
/**
- * Finds the minimum spacing between a set of x/y points Currently only considers points whose
- * index is next to each other Which, currently, means it traverses one dimension. This is a rough
- * heuristic approach which could be refined in the future.
- *
- * Note that the current implementation can be fooled under the following conditions: (1) The
- * width of the image is an odd number, and the smallest distance was actually on the between the
- * last two points in a given row and (2) The smallest distance was actually in the direction
- * orthogonal to that which was getting traversed by iterating through the MatOfPoint2f in order.
- *
- *
I've chosen not to handle these for speed's sake, and because, really, you don't need the
- * exact answer for "min distance". you just need something fairly reasonable.
- *
- * @param inPoints point set to analyze. Must be a "tall" matrix.
- * @return min spacing between neighbors
- */
+ * Finds the minimum spacing between a set of x/y points Currently only considers points whose
+ * index is next to each other Which, currently, means it traverses one dimension. This is a rough
+ * heuristic approach which could be refined in the future.
+ *
+ *
Note that the current implementation can be fooled under the following conditions: (1) The
+ * width of the image is an odd number, and the smallest distance was actually on the between the
+ * last two points in a given row and (2) The smallest distance was actually in the direction
+ * orthogonal to that which was getting traversed by iterating through the MatOfPoint2f in order.
+ *
+ *
I've chosen not to handle these for speed's sake, and because, really, you don't need the
+ * exact answer for "min distance". you just need something fairly reasonable.
+ *
+ * @param inPoints point set to analyze. Must be a "tall" matrix.
+ * @return min spacing between neighbors
+ */
private double getApproxMinSpacing(MatOfPoint2f inPoints) {
double minSpacing = Double.MAX_VALUE;
for (int pointIdx = 0; pointIdx < inPoints.height() - 1; pointIdx += 2) {
@@ -169,24 +169,24 @@ public class FindBoardCornersPipe
}
/**
- * @param inFrame Full-size mat that is going to get scaled down before passing to
- * findBoardCorners
- * @return the size to scale the input mat to
- */
+ * @param inFrame Full-size mat that is going to get scaled down before passing to
+ * findBoardCorners
+ * @return the size to scale the input mat to
+ */
private Size getFindCornersImgSize(Mat inFrame) {
var findcorners_height = Math.round(inFrame.height() * getFindCornersScaleFactor(inFrame));
return new Size(FIND_CORNERS_WIDTH_PX, findcorners_height);
}
/**
- * Given an input frame and a set of points from the "smaller" findChessboardCorner analysis,
- * re-scale the points back to where they would have been in the input frame
- *
- * @param inPoints set of points derived from a call to findChessboardCorner on a shrunken mat.
- * Must be a "tall" matrix.
- * @param origFrame Original frame we're rescaling points back to
- * @param outPoints mat into which the output rescaled points get placed
- */
+ * Given an input frame and a set of points from the "smaller" findChessboardCorner analysis,
+ * re-scale the points back to where they would have been in the input frame
+ *
+ * @param inPoints set of points derived from a call to findChessboardCorner on a shrunken mat.
+ * Must be a "tall" matrix.
+ * @param origFrame Original frame we're rescaling points back to
+ * @param outPoints mat into which the output rescaled points get placed
+ */
private void rescalePointsToOrigFrame(
MatOfPoint2f inPoints, Mat origFrame, MatOfPoint2f outPoints) {
// Rescale boardCorners back up to the inproc image size
@@ -202,12 +202,12 @@ public class FindBoardCornersPipe
}
/**
- * Picks a window size for doing subpixel optimization based on the board type and spacing
- * observed between the corners or points in the image
- *
- * @param inPoints
- * @return
- */
+ * Picks a window size for doing subpixel optimization based on the board type and spacing
+ * observed between the corners or points in the image
+ *
+ * @param inPoints
+ * @return
+ */
private Size getWindowSize(MatOfPoint2f inPoints) {
double windowHalfWidth = 11; // Dot board uses fixed-size window half-width
if (params.type == UICalibrationData.BoardType.CHESSBOARD) {
@@ -219,10 +219,10 @@ public class FindBoardCornersPipe
}
/**
- * Find chessboard corners given a input mat and output mat to draw on
- *
- * @return Frame resolution, object points, board corners
- */
+ * Find chessboard corners given a input mat and output mat to draw on
+ *
+ * @return Frame resolution, object points, board corners
+ */
private Triple findBoardCorners(Pair in) {
createObjectPoints();
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java
index 36283a9c6..cdc5a746f 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindCirclesPipe.java
@@ -33,15 +33,15 @@ public class FindCirclesPipe
// (x,y,radius) or (x,y,radius,votes) .
private final Mat circles = new Mat();
/**
- * Runs the process for the pipe. The reason we need a separate pipe for circles is because if we
- * were to use the FindShapes pipe, we would have to assume that any shape more than 10-20+ sides
- * is a circle. Only issue with such approximation is that the user would no longer be able to
- * track shapes with 10-20+ sides. And hence, in order to overcome this edge case, we can use
- * HoughCircles which is more flexible and accurate for finding circles.
- *
- * @param in Input for pipe processing. 8-bit, single-channel, grayscale input image.
- * @return Result of processing.
- */
+ * Runs the process for the pipe. The reason we need a separate pipe for circles is because if we
+ * were to use the FindShapes pipe, we would have to assume that any shape more than 10-20+ sides
+ * is a circle. Only issue with such approximation is that the user would no longer be able to
+ * track shapes with 10-20+ sides. And hence, in order to overcome this edge case, we can use
+ * HoughCircles which is more flexible and accurate for finding circles.
+ *
+ * @param in Input for pipe processing. 8-bit, single-channel, grayscale input image.
+ * @return Result of processing.
+ */
@Override
protected List process(Pair> in) {
circles.release();
@@ -115,16 +115,16 @@ public class FindCirclesPipe
private final double diagonalLengthPx;
/*
- * @params minDist - Minimum distance between the centers of the detected circles.
- * If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed.
- *
- * @param maxCannyThresh -First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT, it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
- * Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value shough normally be higher, such as 300 or normally exposed and contrasty images.
- *
- *
- * @param allowableThreshold - When finding the corresponding contour, this is used to see how close a center should be to a contour for it to be considered THAT contour.
- * Should be increased with lower resolutions and decreased with higher resolution
- * */
+ * @params minDist - Minimum distance between the centers of the detected circles.
+ * If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed.
+ *
+ * @param maxCannyThresh -First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT, it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
+ * Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value shough normally be higher, such as 300 or normally exposed and contrasty images.
+ *
+ *
+ * @param allowableThreshold - When finding the corresponding contour, this is used to see how close a center should be to a contour for it to be considered THAT contour.
+ * Should be increased with lower resolutions and decreased with higher resolution
+ * */
public FindCirclePipeParams(
int allowableThreshold,
int minRadius,
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java
index 8ee392f8e..a40fc1010 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/FindPolygonPipe.java
@@ -30,11 +30,11 @@ public class FindPolygonPipe
List shapeList = new ArrayList<>();
/*
- * Runs the process for the pipe.
- *
- * @param in Input for pipe processing.
- * @return Result of processing.
- */
+ * Runs the process for the pipe.
+ *
+ * @param in Input for pipe processing.
+ * @return Result of processing.
+ */
@Override
protected List process(List in) {
shapeList.forEach(CVShape::release);
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java
index 227174815..84a7844a0 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/ResizeImagePipe.java
@@ -25,10 +25,10 @@ import org.photonvision.vision.pipe.MutatingPipe;
/** Pipe that resizes an image to a given resolution */
public class ResizeImagePipe extends MutatingPipe {
/**
- * Process this pipe
- *
- * @param in {@link Mat} to be resized
- */
+ * Process this pipe
+ *
+ * @param in {@link Mat} to be resized
+ */
@Override
protected Void process(Mat in) {
int width = in.cols() / params.getDivisor().value;
diff --git a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java
index 8fa7a471f..0efdca560 100644
--- a/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java
+++ b/photon-core/src/main/java/org/photonvision/vision/pipe/impl/RotateImagePipe.java
@@ -32,11 +32,11 @@ public class RotateImagePipe extends MutatingPipe
- *
- * Used only when switching from any of the built-in pipelines back to a user-created pipeline.
- */
+ * Index of the last active user-created pipeline.
+ *
+ * Used only when switching from any of the built-in pipelines back to a user-created pipeline.
+ */
private int lastPipelineIndex;
/**
- * Creates a PipelineManager with a DriverModePipeline, a Calibration3dPipeline, and all provided
- * pipelines.
- *
- * @param userPipelines Pipelines to add to the manager.
- */
+ * Creates a PipelineManager with a DriverModePipeline, a Calibration3dPipeline, and all provided
+ * pipelines.
+ *
+ * @param userPipelines Pipelines to add to the manager.
+ */
public PipelineManager(
DriverModePipelineSettings driverSettings, List userPipelines) {
this.userPipelineSettings = new ArrayList<>(userPipelines);
@@ -70,11 +70,11 @@ public class PipelineManager {
}
/**
- * Get the settings for a pipeline by index.
- *
- * @param index Index of pipeline whose settings need getting.
- * @return The gotten settings of the pipeline whose index was provided.
- */
+ * Get the settings for a pipeline by index.
+ *
+ * @param index Index of pipeline whose settings need getting.
+ * @return The gotten settings of the pipeline whose index was provided.
+ */
public CVPipelineSettings getPipelineSettings(int index) {
if (index < 0) {
switch (index) {
@@ -92,10 +92,10 @@ public class PipelineManager {
}
/**
- * Gets a list of nicknames for all user pipelines
- *
- * @return The list of nicknames for all user pipelines
- */
+ * Gets a list of nicknames for all user pipelines
+ *
+ * @return The list of nicknames for all user pipelines
+ */
public List getPipelineNicknames() {
List ret = new ArrayList<>();
for (var p : userPipelineSettings) {
@@ -105,19 +105,19 @@ public class PipelineManager {
}
/**
- * Gets the index of the currently active pipeline
- *
- * @return The index of the currently active pipeline
- */
+ * Gets the index of the currently active pipeline
+ *
+ * @return The index of the currently active pipeline
+ */
public int getCurrentPipelineIndex() {
return currentPipelineIndex;
}
/**
- * Get the currently active pipeline.
- *
- * @return The currently active pipeline.
- */
+ * Get the currently active pipeline.
+ *
+ * @return The currently active pipeline.
+ */
public CVPipeline getCurrentUserPipeline() {
if (currentPipelineIndex < 0) {
switch (currentPipelineIndex) {
@@ -149,22 +149,22 @@ public class PipelineManager {
}
/**
- * Get the currently active pipelines settings
- *
- * @return The currently active pipelines settings
- */
+ * Get the currently active pipelines settings
+ *
+ * @return The currently active pipelines settings
+ */
public CVPipelineSettings getCurrentPipelineSettings() {
return getPipelineSettings(currentPipelineIndex);
}
/**
- * Internal method for setting the active pipeline.
- *
- * All externally accessible methods that intend to change the active pipeline MUST go through
- * here to ensure all proper steps are taken.
- *
- * @param index Index of pipeline to be active
- */
+ * Internal method for setting the active pipeline.
+ *
+ * All externally accessible methods that intend to change the active pipeline MUST go through
+ * here to ensure all proper steps are taken.
+ *
+ * @param index Index of pipeline to be active
+ */
private void setPipelineInternal(int index) {
if (index < 0) {
lastPipelineIndex = currentPipelineIndex;
@@ -192,33 +192,33 @@ public class PipelineManager {
}
/**
- * Enters or exits calibration mode based on the parameter.
- *
- * Exiting returns to the last used user pipeline.
- *
- * @param wantsCalibration True to enter calibration mode, false to exit calibration mode.
- */
+ * Enters or exits calibration mode based on the parameter.
+ *
+ * Exiting returns to the last used user pipeline.
+ *
+ * @param wantsCalibration True to enter calibration mode, false to exit calibration mode.
+ */
public void setCalibrationMode(boolean wantsCalibration) {
if (!wantsCalibration) calibration3dPipeline.finishCalibration();
setPipelineInternal(wantsCalibration ? CAL_3D_INDEX : lastPipelineIndex);
}
/**
- * Enters or exits driver mode based on the parameter.
- *
- * Exiting returns to the last used user pipeline.
- *
- * @param state True to enter driver mode, false to exit driver mode.
- */
+ * Enters or exits driver mode based on the parameter.
+ *
+ * Exiting returns to the last used user pipeline.
+ *
+ * @param state True to enter driver mode, false to exit driver mode.
+ */
public void setDriverMode(boolean state) {
setPipelineInternal(state ? DRIVERMODE_INDEX : lastPipelineIndex);
}
/**
- * Returns whether or not driver mode is active.
- *
- * @return Whether or not driver mode is active.
- */
+ * Returns whether or not driver mode is active.
+ *
+ * @return Whether or not driver mode is active.
+ */
public boolean getDriverMode() {
return currentPipelineIndex == DRIVERMODE_INDEX;
}
@@ -227,10 +227,10 @@ public class PipelineManager {
Comparator.comparingInt(o -> o.pipelineIndex);
/**
- * Sorts the pipeline list by index, and reassigns their indexes to match the new order.
- *
- * I don't like this but I have no other ideas, and it works so ¯\_(ツ)_/¯
- */
+ * Sorts the pipeline list by index, and reassigns their indexes to match the new order.
+ *
+ * I don't like this but I have no other ideas, and it works so ¯\_(ツ)_/¯
+ */
private void reassignIndexes() {
userPipelineSettings.sort(PipelineSettingsIndexComparator);
for (int i = 0; i < userPipelineSettings.size(); i++) {
@@ -283,10 +283,10 @@ public class PipelineManager {
}
/**
- * Remove a pipeline settings at the given index and return the new current index
- *
- * @param index The idx to remove
- */
+ * Remove a pipeline settings at the given index and return the new current index
+ *
+ * @param index The idx to remove
+ */
private int removePipelineInternal(int index) {
userPipelineSettings.remove(index);
currentPipelineIndex = Math.min(index, userPipelineSettings.size() - 1);
@@ -311,11 +311,11 @@ public class PipelineManager {
}
/**
- * Duplicate a pipeline at a given index
- *
- * @param index the index of the target pipeline
- * @return The new index
- */
+ * Duplicate a pipeline at a given index
+ *
+ * @param index the index of the target pipeline
+ * @return The new index
+ */
public int duplicatePipeline(int index) {
var settings = userPipelineSettings.get(index);
var newSettings = settings.clone();
diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java
index 656c22c01..2a0097415 100644
--- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java
+++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java
@@ -50,11 +50,11 @@ import org.photonvision.vision.target.TargetModel;
import org.photonvision.vision.target.TrackedTarget;
/**
-* This is the God Class
-*
-* VisionModule has a pipeline manager, vision runner, and data providers. The data providers
-* provide info on settings changes. VisionModuleManager holds a list of all current vision modules.
-*/
+ * This is the God Class
+ *
+ *
VisionModule has a pipeline manager, vision runner, and data providers. The data providers
+ * provide info on settings changes. VisionModuleManager holds a list of all current vision modules.
+ */
public class VisionModule {
private static final int streamFPSCap = 30;
diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java
index 979dc4e5c..584469cec 100644
--- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java
+++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionRunner.java
@@ -39,13 +39,13 @@ public class VisionRunner {
private long loopCount;
/**
- * VisionRunner contains a thread to run a pipeline, given a frame, and will give the result to
- * the consumer.
- *
- * @param frameSupplier The supplier of the latest frame.
- * @param pipelineSupplier The supplier of the current pipeline.
- * @param pipelineResultConsumer The consumer of the latest result.
- */
+ * VisionRunner contains a thread to run a pipeline, given a frame, and will give the result to
+ * the consumer.
+ *
+ * @param frameSupplier The supplier of the latest frame.
+ * @param pipelineSupplier The supplier of the current pipeline.
+ * @param pipelineResultConsumer The consumer of the latest result.
+ */
public VisionRunner(
FrameProvider frameSupplier,
Supplier pipelineSupplier,
diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java
index f45480b34..0fbd0e8de 100644
--- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java
+++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java
@@ -61,11 +61,11 @@ public class VisionSourceManager {
}
/**
- * Register new camera configs loaded from disk. This will add them to the list of configs to try
- * to match, and also automatically spawn new vision processes as necessary.
- *
- * @param configs The loaded camera configs.
- */
+ * Register new camera configs loaded from disk. This will add them to the list of configs to try
+ * to match, and also automatically spawn new vision processes as necessary.
+ *
+ * @param configs The loaded camera configs.
+ */
public void registerLoadedConfigs(Collection configs) {
unmatchedLoadedConfigs.addAll(configs);
}
@@ -182,13 +182,13 @@ public class VisionSourceManager {
}
/**
- * Create {@link CameraConfiguration}s based on a list of detected USB cameras and the configs on
- * disk.
- *
- * @param detectedCamInfos Information about currently connected USB cameras.
- * @param loadedUsbCamConfigs The USB {@link CameraConfiguration}s loaded from disk.
- * @return the matched configurations.
- */
+ * Create {@link CameraConfiguration}s based on a list of detected USB cameras and the configs on
+ * disk.
+ *
+ * @param detectedCamInfos Information about currently connected USB cameras.
+ * @param loadedUsbCamConfigs The USB {@link CameraConfiguration}s loaded from disk.
+ * @return the matched configurations.
+ */
private List matchUSBCameras(
List detectedCamInfos, List loadedUsbCamConfigs) {
var detectedCameraList = new ArrayList<>(detectedCamInfos);
@@ -319,12 +319,12 @@ public class VisionSourceManager {
}
/**
- * Check if a given config list contains the given unique name.
- *
- * @param configList A list of camera configs.
- * @param uniqueName The unique name.
- * @return If the list of configs contains the unique name.
- */
+ * Check if a given config list contains the given unique name.
+ *
+ * @param configList A list of camera configs.
+ * @param uniqueName The unique name.
+ * @return If the list of configs contains the unique name.
+ */
private boolean containsName(
final List configList, final String uniqueName) {
return configList.stream()
diff --git a/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java b/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java
index ae7527e78..19c681307 100644
--- a/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java
+++ b/photon-core/src/main/java/org/photonvision/vision/target/TrackedTarget.java
@@ -57,10 +57,10 @@ public class TrackedTarget implements Releasable {
}
/**
- * Set the approximate bouding polygon.
- *
- * @param boundingPolygon List of points to copy. Not modified.
- */
+ * Set the approximate bouding polygon.
+ *
+ * @param boundingPolygon List of points to copy. Not modified.
+ */
public void setApproximateBoundingPolygon(MatOfPoint2f boundingPolygon) {
if (m_approximateBoundingPolygon == null) m_approximateBoundingPolygon = new MatOfPoint2f();
boundingPolygon.copyTo(m_approximateBoundingPolygon);
diff --git a/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java b/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java
index 61b3db7bf..d9205b394 100644
--- a/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java
+++ b/photon-core/src/test/java/org/photonvision/common/ShapeBenchmarkTest.java
@@ -16,21 +16,21 @@
*/
package org.photonvision.common;
/*
-* Copyright (C) 2020 Photon Vision.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*/
+ * Copyright (C) 2020 Photon Vision.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java b/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java
index 32e8ab195..f63753713 100644
--- a/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java
+++ b/photon-core/src/test/java/org/photonvision/vision/pipeline/Calibrate3dPipeTest.java
@@ -314,15 +314,15 @@ public class Calibrate3dPipeTest {
}
/**
- * Uses a given camera coefficents matrix set to "undistort" every image file found in a given
- * directory and display them. Provides an easy way to visually debug the results of the
- * calibration routine. Seems to play havoc with CI and takes a chunk of time, so shouldn't
- * usually be left active in tests.
- *
- * @param directoryListing
- * @param imgRes
- * @param cal
- */
+ * Uses a given camera coefficents matrix set to "undistort" every image file found in a given
+ * directory and display them. Provides an easy way to visually debug the results of the
+ * calibration routine. Seems to play havoc with CI and takes a chunk of time, so shouldn't
+ * usually be left active in tests.
+ *
+ * @param directoryListing
+ * @param imgRes
+ * @param cal
+ */
@SuppressWarnings("unused")
private void visuallyDebugDistortion(
File[] directoryListing, Size imgRes, CameraCalibrationCoefficients cal) {
diff --git a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java
index 7b844fb38..2ef002c57 100644
--- a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java
+++ b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java
@@ -40,10 +40,10 @@ public class PhotonCamera {
Packet packet = new Packet(1);
/**
- * Constructs a PhotonCamera from a root table.
- *
- * @param rootTable The root table that the camera is broadcasting information over.
- */
+ * Constructs a PhotonCamera from a root table.
+ *
+ * @param rootTable The root table that the camera is broadcasting information over.
+ */
public PhotonCamera(NetworkTable rootTable) {
path = rootTable.getPath();
rawBytesEntry = rootTable.getEntry("rawBytes");
@@ -56,19 +56,19 @@ public class PhotonCamera {
}
/**
- * Constructs a PhotonCamera from the name of the camera.
- *
- * @param cameraName The nickname of the camera (found in the PhotonVision UI).
- */
+ * Constructs a PhotonCamera from the name of the camera.
+ *
+ * @param cameraName The nickname of the camera (found in the PhotonVision UI).
+ */
public PhotonCamera(String cameraName) {
this(NetworkTableInstance.getDefault().getTable("photonvision").getSubTable(cameraName));
}
/**
- * Returns the latest pipeline result.
- *
- * @return The latest pipeline result.
- */
+ * Returns the latest pipeline result.
+ *
+ * @return The latest pipeline result.
+ */
public PhotonPipelineResult getLatestResult() {
verifyVersion();
@@ -88,66 +88,66 @@ public class PhotonCamera {
}
/**
- * Returns whether the camera is in driver mode.
- *
- * @return Whether the camera is in driver mode.
- */
+ * Returns whether the camera is in driver mode.
+ *
+ * @return Whether the camera is in driver mode.
+ */
public boolean getDriverMode() {
return driverModeEntry.getBoolean(false);
}
/**
- * Toggles driver mode.
- *
- * @param driverMode Whether to set driver mode.
- */
+ * Toggles driver mode.
+ *
+ * @param driverMode Whether to set driver mode.
+ */
public void setDriverMode(boolean driverMode) {
driverModeEntry.setBoolean(driverMode);
}
/**
- * Request the camera to save a new image file from the input camera stream with overlays. Images
- * take up space in the filesystem of the PhotonCamera. Calling it frequently will fill up disk
- * space and eventually cause the system to stop working. Clear out images in
- * /opt/photonvision/photonvision_config/imgSaves frequently to prevent issues.
- */
+ * Request the camera to save a new image file from the input camera stream with overlays. Images
+ * take up space in the filesystem of the PhotonCamera. Calling it frequently will fill up disk
+ * space and eventually cause the system to stop working. Clear out images in
+ * /opt/photonvision/photonvision_config/imgSaves frequently to prevent issues.
+ */
public void takeInputSnapshot() {
inputSaveImgEntry.setBoolean(true);
}
/**
- * Request the camera to save a new image file from the output stream with overlays. Images take
- * up space in the filesystem of the PhotonCamera. Calling it frequently will fill up disk space
- * and eventually cause the system to stop working. Clear out images in
- * /opt/photonvision/photonvision_config/imgSaves frequently to prevent issues.
- */
+ * Request the camera to save a new image file from the output stream with overlays. Images take
+ * up space in the filesystem of the PhotonCamera. Calling it frequently will fill up disk space
+ * and eventually cause the system to stop working. Clear out images in
+ * /opt/photonvision/photonvision_config/imgSaves frequently to prevent issues.
+ */
public void takeOutputSnapshot() {
outputSaveImgEntry.setBoolean(true);
}
/**
- * Returns the active pipeline index.
- *
- * @return The active pipeline index.
- */
+ * Returns the active pipeline index.
+ *
+ * @return The active pipeline index.
+ */
public int getPipelineIndex() {
return pipelineIndexEntry.getNumber(0).intValue();
}
/**
- * Allows the user to select the active pipeline index.
- *
- * @param index The active pipeline index.
- */
+ * Allows the user to select the active pipeline index.
+ *
+ * @param index The active pipeline index.
+ */
public void setPipelineIndex(int index) {
pipelineIndexEntry.setNumber(index);
}
/**
- * Returns the current LED mode.
- *
- * @return The current LED mode.
- */
+ * Returns the current LED mode.
+ *
+ * @return The current LED mode.
+ */
public VisionLEDMode getLEDMode() {
int value = ledModeEntry.getNumber(-1).intValue();
switch (value) {
@@ -164,22 +164,22 @@ public class PhotonCamera {
}
/**
- * Sets the LED mode.
- *
- * @param led The mode to set to.
- */
+ * Sets the LED mode.
+ *
+ * @param led The mode to set to.
+ */
public void setLED(VisionLEDMode led) {
ledModeEntry.setNumber(led.value);
}
/**
- * Returns whether the latest target result has targets.
- *
- * This method is deprecated; {@link PhotonPipelineResult#hasTargets()} should be used instead.
- *
- * @deprecated This method should be replaced with {@link PhotonPipelineResult#hasTargets()}
- * @return Whether the latest target result has targets.
- */
+ * Returns whether the latest target result has targets.
+ *
+ *
This method is deprecated; {@link PhotonPipelineResult#hasTargets()} should be used instead.
+ *
+ * @deprecated This method should be replaced with {@link PhotonPipelineResult#hasTargets()}
+ * @return Whether the latest target result has targets.
+ */
@Deprecated
public boolean hasTargets() {
return getLatestResult().hasTargets();
diff --git a/photon-lib/src/main/java/org/photonvision/PhotonUtils.java b/photon-lib/src/main/java/org/photonvision/PhotonUtils.java
index 753485e7f..2e1679878 100644
--- a/photon-lib/src/main/java/org/photonvision/PhotonUtils.java
+++ b/photon-lib/src/main/java/org/photonvision/PhotonUtils.java
@@ -27,25 +27,25 @@ public final class PhotonUtils {
}
/**
- * Algorithm from https://docs.limelightvision.io/en/latest/cs_estimating_distance.html Estimates
- * range to a target using the target's elevation. This method can produce more stable results
- * than SolvePNP when well tuned, if the full 6d robot pose is not required. Note that this method
- * requires the camera to have 0 roll (not be skewed clockwise or CCW relative to the floor), and
- * for there to exist a height differential between goal and camera. The larger this differential,
- * the more accurate the distance estimate will be.
- *
- *
Units can be converted using the {@link edu.wpi.first.math.util.Units} class.
- *
- * @param cameraHeightMeters The physical height of the camera off the floor in meters.
- * @param targetHeightMeters The physical height of the target off the floor in meters. This
- * should be the height of whatever is being targeted (i.e. if the targeting region is set to
- * top, this should be the height of the top of the target).
- * @param cameraPitchRadians The pitch of the camera from the horizontal plane in radians.
- * Positive values up.
- * @param targetPitchRadians The pitch of the target in the camera's lens in radians. Positive
- * values up.
- * @return The estimated distance to the target in meters.
- */
+ * Algorithm from https://docs.limelightvision.io/en/latest/cs_estimating_distance.html Estimates
+ * range to a target using the target's elevation. This method can produce more stable results
+ * than SolvePNP when well tuned, if the full 6d robot pose is not required. Note that this method
+ * requires the camera to have 0 roll (not be skewed clockwise or CCW relative to the floor), and
+ * for there to exist a height differential between goal and camera. The larger this differential,
+ * the more accurate the distance estimate will be.
+ *
+ *
Units can be converted using the {@link edu.wpi.first.math.util.Units} class.
+ *
+ * @param cameraHeightMeters The physical height of the camera off the floor in meters.
+ * @param targetHeightMeters The physical height of the target off the floor in meters. This
+ * should be the height of whatever is being targeted (i.e. if the targeting region is set to
+ * top, this should be the height of the top of the target).
+ * @param cameraPitchRadians The pitch of the camera from the horizontal plane in radians.
+ * Positive values up.
+ * @param targetPitchRadians The pitch of the target in the camera's lens in radians. Positive
+ * values up.
+ * @return The estimated distance to the target in meters.
+ */
public static double calculateDistanceToTargetMeters(
double cameraHeightMeters,
double targetHeightMeters,
@@ -56,12 +56,12 @@ public final class PhotonUtils {
}
/**
- * Estimate the {@link Translation2d} of the target relative to the camera.
- *
- * @param targetDistanceMeters The distance to the target in meters.
- * @param yaw The observed yaw of the target.
- * @return The target's camera-relative translation.
- */
+ * Estimate the {@link Translation2d} of the target relative to the camera.
+ *
+ * @param targetDistanceMeters The distance to the target in meters.
+ * @param yaw The observed yaw of the target.
+ * @return The target's camera-relative translation.
+ */
public static Translation2d estimateCameraToTargetTranslation(
double targetDistanceMeters, Rotation2d yaw) {
return new Translation2d(
@@ -69,25 +69,25 @@ public final class PhotonUtils {
}
/**
- * Estimate the position of the robot in the field.
- *
- * @param cameraHeightMeters The physical height of the camera off the floor in meters.
- * @param targetHeightMeters The physical height of the target off the floor in meters. This
- * should be the height of whatever is being targeted (i.e. if the targeting region is set to
- * top, this should be the height of the top of the target).
- * @param cameraPitchRadians The pitch of the camera from the horizontal plane in radians.
- * Positive values up.
- * @param targetPitchRadians The pitch of the target in the camera's lens in radians. Positive
- * values up.
- * @param targetYaw The observed yaw of the target. Note that this *must* be CCW-positive, and
- * Photon returns CW-positive.
- * @param gyroAngle The current robot gyro angle, likely from odometry.
- * @param fieldToTarget A Pose2d representing the target position in the field coordinate system.
- * @param cameraToRobot The position of the robot relative to the camera. If the camera was
- * mounted 3 inches behind the "origin" (usually physical center) of the robot, this would be
- * Transform2d(3 inches, 0 inches, 0 degrees).
- * @return The position of the robot in the field.
- */
+ * Estimate the position of the robot in the field.
+ *
+ * @param cameraHeightMeters The physical height of the camera off the floor in meters.
+ * @param targetHeightMeters The physical height of the target off the floor in meters. This
+ * should be the height of whatever is being targeted (i.e. if the targeting region is set to
+ * top, this should be the height of the top of the target).
+ * @param cameraPitchRadians The pitch of the camera from the horizontal plane in radians.
+ * Positive values up.
+ * @param targetPitchRadians The pitch of the target in the camera's lens in radians. Positive
+ * values up.
+ * @param targetYaw The observed yaw of the target. Note that this *must* be CCW-positive, and
+ * Photon returns CW-positive.
+ * @param gyroAngle The current robot gyro angle, likely from odometry.
+ * @param fieldToTarget A Pose2d representing the target position in the field coordinate system.
+ * @param cameraToRobot The position of the robot relative to the camera. If the camera was
+ * mounted 3 inches behind the "origin" (usually physical center) of the robot, this would be
+ * Transform2d(3 inches, 0 inches, 0 degrees).
+ * @return The position of the robot in the field.
+ */
public static Pose2d estimateFieldToRobot(
double cameraHeightMeters,
double targetHeightMeters,
@@ -110,17 +110,17 @@ public final class PhotonUtils {
}
/**
- * Estimates a {@link Transform2d} that maps the camera position to the target position, using the
- * robot's gyro. Note that the gyro angle provided *must* line up with the field coordinate system
- * -- that is, it should read zero degrees when pointed towards the opposing alliance station, and
- * increase as the robot rotates CCW.
- *
- * @param cameraToTargetTranslation A Translation2d that encodes the x/y position of the target
- * relative to the camera.
- * @param fieldToTarget A Pose2d representing the target position in the field coordinate system.
- * @param gyroAngle The current robot gyro angle, likely from odometry.
- * @return A Transform2d that takes us from the camera to the target.
- */
+ * Estimates a {@link Transform2d} that maps the camera position to the target position, using the
+ * robot's gyro. Note that the gyro angle provided *must* line up with the field coordinate system
+ * -- that is, it should read zero degrees when pointed towards the opposing alliance station, and
+ * increase as the robot rotates CCW.
+ *
+ * @param cameraToTargetTranslation A Translation2d that encodes the x/y position of the target
+ * relative to the camera.
+ * @param fieldToTarget A Pose2d representing the target position in the field coordinate system.
+ * @param gyroAngle The current robot gyro angle, likely from odometry.
+ * @return A Transform2d that takes us from the camera to the target.
+ */
public static Transform2d estimateCameraToTarget(
Translation2d cameraToTargetTranslation, Pose2d fieldToTarget, Rotation2d gyroAngle) {
// This pose maps our camera at the origin out to our target, in the robot
@@ -133,31 +133,31 @@ public final class PhotonUtils {
}
/**
- * Estimates the pose of the robot in the field coordinate system, given the position of the
- * target relative to the camera, the target relative to the field, and the robot relative to the
- * camera.
- *
- * @param cameraToTarget The position of the target relative to the camera.
- * @param fieldToTarget The position of the target in the field.
- * @param cameraToRobot The position of the robot relative to the camera. If the camera was
- * mounted 3 inches behind the "origin" (usually physical center) of the robot, this would be
- * Transform2d(3 inches, 0 inches, 0 degrees).
- * @return The position of the robot in the field.
- */
+ * Estimates the pose of the robot in the field coordinate system, given the position of the
+ * target relative to the camera, the target relative to the field, and the robot relative to the
+ * camera.
+ *
+ * @param cameraToTarget The position of the target relative to the camera.
+ * @param fieldToTarget The position of the target in the field.
+ * @param cameraToRobot The position of the robot relative to the camera. If the camera was
+ * mounted 3 inches behind the "origin" (usually physical center) of the robot, this would be
+ * Transform2d(3 inches, 0 inches, 0 degrees).
+ * @return The position of the robot in the field.
+ */
public static Pose2d estimateFieldToRobot(
Transform2d cameraToTarget, Pose2d fieldToTarget, Transform2d cameraToRobot) {
return estimateFieldToCamera(cameraToTarget, fieldToTarget).transformBy(cameraToRobot);
}
/**
- * Estimates the pose of the camera in the field coordinate system, given the position of the
- * target relative to the camera, and the target relative to the field. This *only* tracks the
- * position of the camera, not the position of the robot itself.
- *
- * @param cameraToTarget The position of the target relative to the camera.
- * @param fieldToTarget The position of the target in the field.
- * @return The position of the camera in the field.
- */
+ * Estimates the pose of the camera in the field coordinate system, given the position of the
+ * target relative to the camera, and the target relative to the field. This *only* tracks the
+ * position of the camera, not the position of the robot itself.
+ *
+ * @param cameraToTarget The position of the target relative to the camera.
+ * @param fieldToTarget The position of the target in the field.
+ * @return The position of the camera in the field.
+ */
public static Pose2d estimateFieldToCamera(Transform2d cameraToTarget, Pose2d fieldToTarget) {
var targetToCamera = cameraToTarget.inverse();
return fieldToTarget.transformBy(targetToCamera);
diff --git a/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java b/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java
index ce7369793..59bc4eded 100644
--- a/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java
+++ b/photon-lib/src/main/java/org/photonvision/SimPhotonCamera.java
@@ -36,10 +36,10 @@ public class SimPhotonCamera extends PhotonCamera {
private final NetworkTableEntry targetPoseEntry;
/**
- * Constructs a Simulated PhotonCamera from a root table.
- *
- * @param rootTable The root table that the camera is broadcasting information over.
- */
+ * Constructs a Simulated PhotonCamera from a root table.
+ *
+ * @param rootTable The root table that the camera is broadcasting information over.
+ */
public SimPhotonCamera(NetworkTable rootTable) {
super(rootTable);
@@ -53,53 +53,53 @@ public class SimPhotonCamera extends PhotonCamera {
}
/**
- * Constructs a Simulated PhotonCamera from the name of the camera.
- *
- * @param cameraName The nickname of the camera (found in the PhotonVision UI).
- */
+ * Constructs a Simulated PhotonCamera from the name of the camera.
+ *
+ * @param cameraName The nickname of the camera (found in the PhotonVision UI).
+ */
public SimPhotonCamera(String cameraName) {
this(NetworkTableInstance.getDefault().getTable("photonvision").getSubTable(cameraName));
}
/**
- * Simulate one processed frame of vision data, putting one result to NT.
- *
- * @param latencyMillis Latency of the provided frame
- * @param targets Each target detected
- */
+ * Simulate one processed frame of vision data, putting one result to NT.
+ *
+ * @param latencyMillis Latency of the provided frame
+ * @param targets Each target detected
+ */
public void submitProcessedFrame(double latencyMillis, PhotonTrackedTarget... targets) {
submitProcessedFrame(latencyMillis, Arrays.asList(targets));
}
/**
- * Simulate one processed frame of vision data, putting one result to NT.
- *
- * @param latencyMillis Latency of the provided frame
- * @param sortMode Order in which to sort targets
- * @param targets Each target detected
- */
+ * Simulate one processed frame of vision data, putting one result to NT.
+ *
+ * @param latencyMillis Latency of the provided frame
+ * @param sortMode Order in which to sort targets
+ * @param targets Each target detected
+ */
public void submitProcessedFrame(
double latencyMillis, PhotonTargetSortMode sortMode, PhotonTrackedTarget... targets) {
submitProcessedFrame(latencyMillis, sortMode, Arrays.asList(targets));
}
/**
- * Simulate one processed frame of vision data, putting one result to NT.
- *
- * @param latencyMillis Latency of the provided frame
- * @param targetList List of targets detected
- */
+ * Simulate one processed frame of vision data, putting one result to NT.
+ *
+ * @param latencyMillis Latency of the provided frame
+ * @param targetList List of targets detected
+ */
public void submitProcessedFrame(double latencyMillis, List targetList) {
submitProcessedFrame(latencyMillis, null, targetList);
}
/**
- * Simulate one processed frame of vision data, putting one result to NT.
- *
- * @param latencyMillis Latency of the provided frame
- * @param sortMode Order in which to sort targets
- * @param targetList List of targets detected
- */
+ * Simulate one processed frame of vision data, putting one result to NT.
+ *
+ * @param latencyMillis Latency of the provided frame
+ * @param sortMode Order in which to sort targets
+ * @param targetList List of targets detected
+ */
public void submitProcessedFrame(
double latencyMillis, PhotonTargetSortMode sortMode, List targetList) {
latencyMillisEntry.setDouble(latencyMillis);
diff --git a/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java b/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java
index 92c2c215f..bc0bd9936 100644
--- a/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java
+++ b/photon-lib/src/main/java/org/photonvision/SimVisionSystem.java
@@ -38,28 +38,28 @@ public class SimVisionSystem {
ArrayList tgtList;
/**
- * Create a simulated vision system involving a camera and coprocessor mounted on a mobile robot
- * running PhotonVision, detecting one or more targets scattered around the field. This assumes a
- * fairly simple and distortion-less pinhole camera model.
- *
- * @param camName Name of the PhotonVision camera to create. Align it with the settings you use in
- * the PhotonVision GUI.
- * @param camDiagFOVDegrees Diagonal Field of View of the camera used. Align it with the
- * manufacturer specifications, and/or whatever is configured in the PhotonVision Setting
- * page.
- * @param camPitchDegrees pitch of the camera's view axis back from horizontal. Make this the same
- * as whatever is configured in the PhotonVision Setting page.
- * @param cameraToRobot Pose Transform to move from the camera's mount position to the robot's
- * position
- * @param cameraHeightOffGroundMeters Height of the camera off the ground in meters
- * @param maxLEDRangeMeters Maximum distance at which your camera can illuminate the target and
- * make it visible. Set to 9000 or more if your vision system does not rely on LED's.
- * @param cameraResWidth Width of your camera's image sensor in pixels
- * @param cameraResHeight Height of your camera's image sensor in pixels
- * @param minTargetArea Minimum area that that the target should be before it's recognized as a
- * target by the camera. Match this with your contour filtering settings in the PhotonVision
- * GUI.
- */
+ * Create a simulated vision system involving a camera and coprocessor mounted on a mobile robot
+ * running PhotonVision, detecting one or more targets scattered around the field. This assumes a
+ * fairly simple and distortion-less pinhole camera model.
+ *
+ * @param camName Name of the PhotonVision camera to create. Align it with the settings you use in
+ * the PhotonVision GUI.
+ * @param camDiagFOVDegrees Diagonal Field of View of the camera used. Align it with the
+ * manufacturer specifications, and/or whatever is configured in the PhotonVision Setting
+ * page.
+ * @param camPitchDegrees pitch of the camera's view axis back from horizontal. Make this the same
+ * as whatever is configured in the PhotonVision Setting page.
+ * @param cameraToRobot Pose Transform to move from the camera's mount position to the robot's
+ * position
+ * @param cameraHeightOffGroundMeters Height of the camera off the ground in meters
+ * @param maxLEDRangeMeters Maximum distance at which your camera can illuminate the target and
+ * make it visible. Set to 9000 or more if your vision system does not rely on LED's.
+ * @param cameraResWidth Width of your camera's image sensor in pixels
+ * @param cameraResHeight Height of your camera's image sensor in pixels
+ * @param minTargetArea Minimum area that that the target should be before it's recognized as a
+ * target by the camera. Match this with your contour filtering settings in the PhotonVision
+ * GUI.
+ */
public SimVisionSystem(
String camName,
double camDiagFOVDegrees,
@@ -88,24 +88,24 @@ public class SimVisionSystem {
}
/**
- * Add a target on the field which your vision system is designed to detect. The PhotonCamera from
- * this system will report the location of the robot relative to the subset of these targets which
- * are visible from the given robot position.
- *
- * @param target Target to add to the simulated field
- */
+ * Add a target on the field which your vision system is designed to detect. The PhotonCamera from
+ * this system will report the location of the robot relative to the subset of these targets which
+ * are visible from the given robot position.
+ *
+ * @param target Target to add to the simulated field
+ */
public void addSimVisionTarget(SimVisionTarget target) {
tgtList.add(target);
}
/**
- * Adjust the camera position relative to the robot. Use this if your camera is on a gimbal or
- * turret or some other mobile platform.
- *
- * @param newCameraToRobot New Transform from the robot to the camera
- * @param newCamHeightMeters New height of the camera off the floor
- * @param newCamPitchDegrees New pitch of the camera axis back from horizontal
- */
+ * Adjust the camera position relative to the robot. Use this if your camera is on a gimbal or
+ * turret or some other mobile platform.
+ *
+ * @param newCameraToRobot New Transform from the robot to the camera
+ * @param newCamHeightMeters New height of the camera off the floor
+ * @param newCamPitchDegrees New pitch of the camera axis back from horizontal
+ */
public void moveCamera(
Transform2d newCameraToRobot, double newCamHeightMeters, double newCamPitchDegrees) {
this.cameraToRobot = newCameraToRobot;
@@ -114,13 +114,13 @@ public class SimVisionSystem {
}
/**
- * Periodic update. Call this once per frame of image data you wish to process and send to
- * NetworkTables
- *
- * @param robotPoseMeters current pose of the robot on the field. Will be used to calculate which
- * targets are actually in view, where they are at relative to the robot, and relevant
- * PhotonVision parameters.
- */
+ * Periodic update. Call this once per frame of image data you wish to process and send to
+ * NetworkTables
+ *
+ * @param robotPoseMeters current pose of the robot on the field. Will be used to calculate which
+ * targets are actually in view, where they are at relative to the robot, and relevant
+ * PhotonVision parameters.
+ */
public void processFrame(Pose2d robotPoseMeters) {
Pose2d cameraPos = robotPoseMeters.transformBy(cameraToRobot.inverse());
diff --git a/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java b/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java
index 332afe00e..9a6bb0a01 100644
--- a/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java
+++ b/photon-lib/src/main/java/org/photonvision/SimVisionTarget.java
@@ -26,15 +26,15 @@ public class SimVisionTarget {
double tgtAreaMeters2;
/**
- * Describes a vision target located somewhere on the field that your SimVisionSystem can detect.
- *
- * @param targetPos Pose2d of the target on the field. Define it such that, if you are standing on
- * the middle of the field facing the target, the Y axis points to your left, and the X axis
- * points away from you.
- * @param targetHeightAboveGroundMeters Height of the target above the field plane, in meters.
- * @param targetWidthMeters Width of the outer bounding box of the target in meters.
- * @param targetHeightMeters Pair Height of the outer bounding box of the target in meters.
- */
+ * Describes a vision target located somewhere on the field that your SimVisionSystem can detect.
+ *
+ * @param targetPos Pose2d of the target on the field. Define it such that, if you are standing on
+ * the middle of the field facing the target, the Y axis points to your left, and the X axis
+ * points away from you.
+ * @param targetHeightAboveGroundMeters Height of the target above the field plane, in meters.
+ * @param targetWidthMeters Width of the outer bounding box of the target in meters.
+ * @param targetHeightMeters Pair Height of the outer bounding box of the target in meters.
+ */
public SimVisionTarget(
Pose2d targetPos,
double targetHeightAboveGroundMeters,
diff --git a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java
index 6af230d54..b87eb0228 100644
--- a/photon-server/src/main/java/org/photonvision/server/RequestHandler.java
+++ b/photon-server/src/main/java/org/photonvision/server/RequestHandler.java
@@ -233,9 +233,9 @@ public class RequestHandler {
}
/**
- * Note that this doesn't actually restart the program itself -- instead, it relies on systemd or
- * an equivalent.
- */
+ * Note that this doesn't actually restart the program itself -- instead, it relies on systemd or
+ * an equivalent.
+ */
public static void restartProgramInternal() {
if (Platform.isRaspberryPi()) {
try {
diff --git a/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java b/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java
index 72561f369..7a22fe7d9 100644
--- a/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java
+++ b/photon-server/src/main/java/org/photonvision/server/UIOutboundSubscriber.java
@@ -29,8 +29,8 @@ import org.photonvision.common.logging.Logger;
@SuppressWarnings("rawtypes")
/*
-* DO NOT use logging in this class. If you do, the logs will recurse forever!
-*/
+ * DO NOT use logging in this class. If you do, the logs will recurse forever!
+ */
class UIOutboundSubscriber extends DataChangeSubscriber {
Logger logger = new Logger(UIOutboundSubscriber.class, LogGroup.WebServer);
diff --git a/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java b/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java
index cb8056f0b..f59445bce 100644
--- a/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java
+++ b/photon-targeting/src/main/java/org/photonvision/common/dataflow/structures/Packet.java
@@ -26,20 +26,20 @@ public class Packet {
int readPos, writePos;
/**
- * Constructs an empty packet.
- *
- * @param size The size of the packet buffer.
- */
+ * Constructs an empty packet.
+ *
+ * @param size The size of the packet buffer.
+ */
public Packet(int size) {
this.size = size;
packetData = new byte[size];
}
/**
- * Constructs a packet with the given data.
- *
- * @param data The packet data.
- */
+ * Constructs a packet with the given data.
+ *
+ * @param data The packet data.
+ */
public Packet(byte[] data) {
packetData = data;
size = packetData.length;
@@ -57,38 +57,38 @@ public class Packet {
}
/**
- * Returns the packet data.
- *
- * @return The packet data.
- */
+ * Returns the packet data.
+ *
+ * @return The packet data.
+ */
public byte[] getData() {
return packetData;
}
/**
- * Sets the packet data.
- *
- * @param data The packet data.
- */
+ * Sets the packet data.
+ *
+ * @param data The packet data.
+ */
public void setData(byte[] data) {
packetData = data;
size = data.length;
}
/**
- * Encodes the byte into the packet.
- *
- * @param src The byte to encode.
- */
+ * Encodes the byte into the packet.
+ *
+ * @param src The byte to encode.
+ */
public void encode(byte src) {
packetData[writePos++] = src;
}
/**
- * Encodes the integer into the packet.
- *
- * @param src The integer to encode.
- */
+ * Encodes the integer into the packet.
+ *
+ * @param src The integer to encode.
+ */
public void encode(int src) {
packetData[writePos++] = (byte) (src >>> 24);
packetData[writePos++] = (byte) (src >>> 16);
@@ -97,10 +97,10 @@ public class Packet {
}
/**
- * Encodes the double into the packet.
- *
- * @param src The double to encode.
- */
+ * Encodes the double into the packet.
+ *
+ * @param src The double to encode.
+ */
public void encode(double src) {
long data = Double.doubleToRawLongBits(src);
packetData[writePos++] = (byte) ((data >> 56) & 0xff);
@@ -114,28 +114,28 @@ public class Packet {
}
/**
- * Encodes the boolean into the packet.
- *
- * @param src The boolean to encode.
- */
+ * Encodes the boolean into the packet.
+ *
+ * @param src The boolean to encode.
+ */
public void encode(boolean src) {
packetData[writePos++] = src ? (byte) 1 : (byte) 0;
}
/**
- * Returns a decoded byte from the packet.
- *
- * @return A decoded byte from the packet.
- */
+ * Returns a decoded byte from the packet.
+ *
+ * @return A decoded byte from the packet.
+ */
public byte decodeByte() {
return packetData[readPos++];
}
/**
- * Returns a decoded int from the packet.
- *
- * @return A decoded int from the packet.
- */
+ * Returns a decoded int from the packet.
+ *
+ * @return A decoded int from the packet.
+ */
public int decodeInt() {
return (0xff & packetData[readPos++]) << 24
| (0xff & packetData[readPos++]) << 16
@@ -144,10 +144,10 @@ public class Packet {
}
/**
- * Returns a decoded double from the packet.
- *
- * @return A decoded double from the packet.
- */
+ * Returns a decoded double from the packet.
+ *
+ * @return A decoded double from the packet.
+ */
public double decodeDouble() {
long data =
(long) (0xff & packetData[readPos++]) << 56
@@ -162,10 +162,10 @@ public class Packet {
}
/**
- * Returns a decoded boolean from the packet.
- *
- * @return A decoded boolean from the packet.
- */
+ * Returns a decoded boolean from the packet.
+ *
+ * @return A decoded boolean from the packet.
+ */
public boolean decodeBoolean() {
return packetData[readPos++] == 1;
}
diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java
index d9dcc435a..8ae0bb199 100644
--- a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java
+++ b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonPipelineResult.java
@@ -35,31 +35,31 @@ public class PhotonPipelineResult {
public PhotonPipelineResult() {}
/**
- * Constructs a pipeline result.
- *
- * @param latencyMillis The latency in the pipeline.
- * @param targets The list of targets identified by the pipeline.
- */
+ * Constructs a pipeline result.
+ *
+ * @param latencyMillis The latency in the pipeline.
+ * @param targets The list of targets identified by the pipeline.
+ */
public PhotonPipelineResult(double latencyMillis, List targets) {
this.latencyMillis = latencyMillis;
this.targets.addAll(targets);
}
/**
- * Returns the size of the packet needed to store this pipeline result.
- *
- * @return The size of the packet needed to store this pipeline result.
- */
+ * Returns the size of the packet needed to store this pipeline result.
+ *
+ * @return The size of the packet needed to store this pipeline result.
+ */
public int getPacketSize() {
return targets.size() * PhotonTrackedTarget.PACK_SIZE_BYTES + 8 + 2;
}
/**
- * Returns the best target in this pipeline result. If there are no targets, this method will
- * return null. The best target is determined by the target sort mode in the PhotonVision UI.
- *
- * @return The best target of the pipeline result.
- */
+ * Returns the best target in this pipeline result. If there are no targets, this method will
+ * return null. The best target is determined by the target sort mode in the PhotonVision UI.
+ *
+ * @return The best target of the pipeline result.
+ */
public PhotonTrackedTarget getBestTarget() {
if (!hasTargets() && !HAS_WARNED) {
String errStr =
@@ -74,28 +74,28 @@ public class PhotonPipelineResult {
}
/**
- * Returns the latency in the pipeline.
- *
- * @return The latency in the pipeline.
- */
+ * Returns the latency in the pipeline.
+ *
+ * @return The latency in the pipeline.
+ */
public double getLatencyMillis() {
return latencyMillis;
}
/**
- * Returns whether the pipeline has targets.
- *
- * @return Whether the pipeline has targets.
- */
+ * Returns whether the pipeline has targets.
+ *
+ * @return Whether the pipeline has targets.
+ */
public boolean hasTargets() {
return targets.size() > 0;
}
/**
- * Returns a copy of the vector of targets.
- *
- * @return A copy of the vector of targets.
- */
+ * Returns a copy of the vector of targets.
+ *
+ * @return A copy of the vector of targets.
+ */
public List getTargets() {
return new ArrayList<>(targets);
}
@@ -116,11 +116,11 @@ public class PhotonPipelineResult {
}
/**
- * Populates the fields of the pipeline result from the packet.
- *
- * @param packet The incoming packet.
- * @return The incoming packet.
- */
+ * Populates the fields of the pipeline result from the packet.
+ *
+ * @param packet The incoming packet.
+ * @return The incoming packet.
+ */
public Packet createFromPacket(Packet packet) {
// Decode latency, existence of targets, and number of targets.
latencyMillis = packet.decodeDouble();
@@ -139,11 +139,11 @@ public class PhotonPipelineResult {
}
/**
- * Populates the outgoing packet with information from this pipeline result.
- *
- * @param packet The outgoing packet.
- * @return The outgoing packet.
- */
+ * Populates the outgoing packet with information from this pipeline result.
+ *
+ * @param packet The outgoing packet.
+ * @return The outgoing packet.
+ */
public Packet populatePacket(Packet packet) {
// Encode latency, existence of targets, and number of targets.
packet.encode(latencyMillis);
diff --git a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java
index fa141884c..a6b1495b5 100644
--- a/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java
+++ b/photon-targeting/src/main/java/org/photonvision/targeting/PhotonTrackedTarget.java
@@ -78,11 +78,11 @@ public class PhotonTrackedTarget {
}
/**
- * Populates the fields of this class with information from the incoming packet.
- *
- * @param packet The incoming packet.
- * @return The incoming packet.
- */
+ * Populates the fields of this class with information from the incoming packet.
+ *
+ * @param packet The incoming packet.
+ * @return The incoming packet.
+ */
public Packet createFromPacket(Packet packet) {
yaw = packet.decodeDouble();
pitch = packet.decodeDouble();
@@ -99,11 +99,11 @@ public class PhotonTrackedTarget {
}
/**
- * Populates the outgoing packet with information from the current target.
- *
- * @param packet The outgoing packet.
- * @return The outgoing packet.
- */
+ * Populates the outgoing packet with information from the current target.
+ *
+ * @param packet The outgoing packet.
+ * @return The outgoing packet.
+ */
public Packet populatePacket(Packet packet) {
packet.encode(yaw);
packet.encode(pitch);
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java
index ed8fc7abf..c0da8ac4f 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Main.java
@@ -19,18 +19,18 @@ package org.photonlib.examples.aimandrange;
import edu.wpi.first.wpilibj.RobotBase;
/**
-* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
-* you are doing, do not modify this file except to change the parameter class to the startRobot
-* call.
-*/
+ * Do NOT add any static variables to this class, or any initialization at all. Unless you know what
+ * you are doing, do not modify this file except to change the parameter class to the startRobot
+ * call.
+ */
public final class Main {
private Main() {}
/**
- * Main initialization function. Do not perform any initialization here.
- *
- * If you change your main robot class, change the parameter type.
- */
+ * Main initialization function. Do not perform any initialization here.
+ *
+ *
If you change your main robot class, change the parameter type.
+ */
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java
index 112789fb0..572457567 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimandrange/Robot.java
@@ -26,11 +26,11 @@ import org.photonvision.PhotonCamera;
import org.photonvision.PhotonUtils;
/**
-* The VM is configured to automatically run this class, and to call the functions corresponding to
-* each mode, as described in the TimedRobot documentation. If you change the name of this class or
-* the package after creating this project, you must also update the build.gradle file in the
-* project.
-*/
+ * The VM is configured to automatically run this class, and to call the functions corresponding to
+ * each mode, as described in the TimedRobot documentation. If you change the name of this class or
+ * the package after creating this project, you must also update the build.gradle file in the
+ * project.
+ */
public class Robot extends TimedRobot {
// Constants such as camera and target height stored. Change per robot and goal!
final double CAMERA_HEIGHT_METERS = Units.inchesToMeters(24);
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java
index f9a9620ec..275267f0d 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Main.java
@@ -19,18 +19,18 @@ package org.photonlib.examples.aimattarget;
import edu.wpi.first.wpilibj.RobotBase;
/**
-* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
-* you are doing, do not modify this file except to change the parameter class to the startRobot
-* call.
-*/
+ * Do NOT add any static variables to this class, or any initialization at all. Unless you know what
+ * you are doing, do not modify this file except to change the parameter class to the startRobot
+ * call.
+ */
public final class Main {
private Main() {}
/**
- * Main initialization function. Do not perform any initialization here.
- *
- *
If you change your main robot class, change the parameter type.
- */
+ * Main initialization function. Do not perform any initialization here.
+ *
+ *
If you change your main robot class, change the parameter type.
+ */
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java
index 2c351995f..76c6ad0b9 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/aimattarget/Robot.java
@@ -25,11 +25,11 @@ import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX;
import org.photonvision.PhotonCamera;
/**
-* The VM is configured to automatically run this class, and to call the functions corresponding to
-* each mode, as described in the TimedRobot documentation. If you change the name of this class or
-* the package after creating this project, you must also update the build.gradle file in the
-* project.
-*/
+ * The VM is configured to automatically run this class, and to call the functions corresponding to
+ * each mode, as described in the TimedRobot documentation. If you change the name of this class or
+ * the package after creating this project, you must also update the build.gradle file in the
+ * project.
+ */
public class Robot extends TimedRobot {
// Constants such as camera and target height stored. Change per robot and goal!
final double CAMERA_HEIGHT_METERS = Units.inchesToMeters(24);
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java
index 0f5d6826e..55e96e5b6 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Main.java
@@ -19,18 +19,18 @@ package org.photonlib.examples.getinrange;
import edu.wpi.first.wpilibj.RobotBase;
/**
-* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
-* you are doing, do not modify this file except to change the parameter class to the startRobot
-* call.
-*/
+ * Do NOT add any static variables to this class, or any initialization at all. Unless you know what
+ * you are doing, do not modify this file except to change the parameter class to the startRobot
+ * call.
+ */
public final class Main {
private Main() {}
/**
- * Main initialization function. Do not perform any initialization here.
- *
- *
If you change your main robot class, change the parameter type.
- */
+ * Main initialization function. Do not perform any initialization here.
+ *
+ *
If you change your main robot class, change the parameter type.
+ */
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java
index 7df84185c..b0bee4128 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/getinrange/Robot.java
@@ -26,11 +26,11 @@ import org.photonvision.PhotonCamera;
import org.photonvision.PhotonUtils;
/**
-* The VM is configured to automatically run this class, and to call the functions corresponding to
-* each mode, as described in the TimedRobot documentation. If you change the name of this class or
-* the package after creating this project, you must also update the build.gradle file in the
-* project.
-*/
+ * The VM is configured to automatically run this class, and to call the functions corresponding to
+ * each mode, as described in the TimedRobot documentation. If you change the name of this class or
+ * the package after creating this project, you must also update the build.gradle file in the
+ * project.
+ */
public class Robot extends TimedRobot {
// Constants such as camera and target height stored. Change per robot and goal!
final double CAMERA_HEIGHT_METERS = Units.inchesToMeters(24);
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java
index 6254d005d..7e88e660c 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Main.java
@@ -19,18 +19,18 @@ package org.photonlib.examples.simaimandrange;
import edu.wpi.first.wpilibj.RobotBase;
/**
-* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
-* you are doing, do not modify this file except to change the parameter class to the startRobot
-* call.
-*/
+ * Do NOT add any static variables to this class, or any initialization at all. Unless you know what
+ * you are doing, do not modify this file except to change the parameter class to the startRobot
+ * call.
+ */
public final class Main {
private Main() {}
/**
- * Main initialization function. Do not perform any initialization here.
- *
- *
If you change your main robot class, change the parameter type.
- */
+ * Main initialization function. Do not perform any initialization here.
+ *
+ *
If you change your main robot class, change the parameter type.
+ */
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java
index 4f08f42c0..111b11dd8 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/Robot.java
@@ -27,11 +27,11 @@ import org.photonvision.PhotonCamera;
import org.photonvision.PhotonUtils;
/**
-* The VM is configured to automatically run this class, and to call the functions corresponding to
-* each mode, as described in the TimedRobot documentation. If you change the name of this class or
-* the package after creating this project, you must also update the build.gradle file in the
-* project.
-*/
+ * The VM is configured to automatically run this class, and to call the functions corresponding to
+ * each mode, as described in the TimedRobot documentation. If you change the name of this class or
+ * the package after creating this project, you must also update the build.gradle file in the
+ * project.
+ */
public class Robot extends TimedRobot {
// 2020 High goal target height above ground
public static final double TARGET_HEIGHT_METERS = Units.inchesToMeters(81.19);
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java
index 0e24b38a3..86c11f6ab 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simaimandrange/sim/DrivetrainSim.java
@@ -36,12 +36,12 @@ import org.photonvision.SimVisionSystem;
import org.photonvision.SimVisionTarget;
/**
-* Implementation of a simulation of robot physics, sensors, motor controllers Includes a Simulated
-* PhotonVision system and one vision target.
-*
-*
This class and its methods are only relevant during simulation. While on the real robot, the
-* real motors/sensors/physics are used instead.
-*/
+ * Implementation of a simulation of robot physics, sensors, motor controllers Includes a Simulated
+ * PhotonVision system and one vision target.
+ *
+ *
This class and its methods are only relevant during simulation. While on the real robot, the
+ * real motors/sensors/physics are used instead.
+ */
public class DrivetrainSim {
// Simulated Motor Controllers
PWMSim leftLeader = new PWMSim(0);
@@ -108,9 +108,9 @@ public class DrivetrainSim {
}
/**
- * Perform all periodic drivetrain simulation related tasks to advance our simulation of robot
- * physics forward by a single 20ms step.
- */
+ * Perform all periodic drivetrain simulation related tasks to advance our simulation of robot
+ * physics forward by a single 20ms step.
+ */
public void update() {
double leftMotorCmd = 0;
double rightMotorCmd = 0;
@@ -132,11 +132,11 @@ public class DrivetrainSim {
}
/**
- * Resets the simulation back to a pre-defined pose Useful to simulate the action of placing the
- * robot onto a specific spot in the field (IE, at the start of each match).
- *
- * @param pose
- */
+ * Resets the simulation back to a pre-defined pose Useful to simulate the action of placing the
+ * robot onto a specific spot in the field (IE, at the start of each match).
+ *
+ * @param pose
+ */
public void resetPose(Pose2d pose) {
drivetrainSimulator.setPose(pose);
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java
index 2349b4cd4..8d6228379 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/Main.java
@@ -20,18 +20,18 @@ import edu.wpi.first.wpilibj.RobotBase;
import org.photonlib.examples.simposeest.robot.Robot;
/**
-* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
-* you are doing, do not modify this file except to change the parameter class to the startRobot
-* call.
-*/
+ * Do NOT add any static variables to this class, or any initialization at all. Unless you know what
+ * you are doing, do not modify this file except to change the parameter class to the startRobot
+ * call.
+ */
public final class Main {
private Main() {}
/**
- * Main initialization function. Do not perform any initialization here.
- *
- *
If you change your main robot class, change the parameter type.
- */
+ * Main initialization function. Do not perform any initialization here.
+ *
+ *
If you change your main robot class, change the parameter type.
+ */
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java
index 6b9d1aba1..b096df54a 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/AutoController.java
@@ -27,11 +27,11 @@ import edu.wpi.first.wpilibj.Timer;
import java.util.List;
/**
-* Implements logic to convert a set of desired waypoints (ie, a trajectory) and the current
-* estimate of where the robot is at (ie, the estimated Pose) into motion commands for a drivetrain.
-* The Ramaste controller is used to smoothly move the robot from where it thinks it is to where it
-* thinks it ought to be.
-*/
+ * Implements logic to convert a set of desired waypoints (ie, a trajectory) and the current
+ * estimate of where the robot is at (ie, the estimated Pose) into motion commands for a drivetrain.
+ * The Ramaste controller is used to smoothly move the robot from where it thinks it is to where it
+ * thinks it ought to be.
+ */
public class AutoController {
private Trajectory trajectory;
@@ -72,13 +72,13 @@ public class AutoController {
}
/**
- * Given the current estimate of the robot's position, calculate drivetrain speed commands which
- * will best-execute the active trajectory. Be sure to call `startPath()` prior to calling this
- * method.
- *
- * @param curEstPose Current estimate of drivetrain pose on the field
- * @return The commanded drivetrain motion
- */
+ * Given the current estimate of the robot's position, calculate drivetrain speed commands which
+ * will best-execute the active trajectory. Be sure to call `startPath()` prior to calling this
+ * method.
+ *
+ * @param curEstPose Current estimate of drivetrain pose on the field
+ * @return The commanded drivetrain motion
+ */
public ChassisSpeeds getCurMotorCmds(Pose2d curEstPose) {
if (isRunning) {
double elapsed = timer.get();
@@ -91,9 +91,9 @@ public class AutoController {
}
/**
- * @return The position which the auto controller is attempting to move the drivetrain to right
- * now.
- */
+ * @return The position which the auto controller is attempting to move the drivetrain to right
+ * now.
+ */
public Pose2d getCurPose2d() {
return desiredDtState.poseMeters;
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java
index a47ff6a2f..ff49f3f94 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Constants.java
@@ -24,11 +24,11 @@ import edu.wpi.first.math.util.Units;
import org.photonvision.SimVisionTarget;
/**
-* Holding class for all physical constants that must be used throughout the codebase. These values
-* should be set by one of a few methods: 1) Talk to your mechanical and electrical teams and
-* determine how the physical robot is being built and configured. 2) Read the game manual and look
-* at the field drawings 3) Match with how your vision coprocessor is configured.
-*/
+ * Holding class for all physical constants that must be used throughout the codebase. These values
+ * should be set by one of a few methods: 1) Talk to your mechanical and electrical teams and
+ * determine how the physical robot is being built and configured. 2) Read the game manual and look
+ * at the field drawings 3) Match with how your vision coprocessor is configured.
+ */
public class Constants {
//////////////////////////////////////////////////////////////////
// Drivetrain Physical
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java
index ce042fe53..573bb3a56 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/Drivetrain.java
@@ -27,10 +27,10 @@ import edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup;
import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX;
/**
-* Implements a controller for the drivetrain. Converts a set of chassis motion commands into motor
-* controller PWM values which attempt to speed up or slow down the wheels to match the desired
-* speed.
-*/
+ * Implements a controller for the drivetrain. Converts a set of chassis motion commands into motor
+ * controller PWM values which attempt to speed up or slow down the wheels to match the desired
+ * speed.
+ */
public class Drivetrain {
// PWM motor controller output definitions
PWMVictorSPX leftLeader = new PWMVictorSPX(Constants.kDtLeftLeaderPin);
@@ -77,12 +77,12 @@ public class Drivetrain {
}
/**
- * Given a set of chassis (fwd/rev + rotate) speed commands, perform all periodic tasks to assign
- * new outputs to the motor controllers.
- *
- * @param xSpeed Desired chassis Forward or Reverse speed (in meters/sec). Positive is forward.
- * @param rot Desired chassis rotation speed in radians/sec. Positive is counter-clockwise.
- */
+ * Given a set of chassis (fwd/rev + rotate) speed commands, perform all periodic tasks to assign
+ * new outputs to the motor controllers.
+ *
+ * @param xSpeed Desired chassis Forward or Reverse speed (in meters/sec). Positive is forward.
+ * @param rot Desired chassis rotation speed in radians/sec. Positive is counter-clockwise.
+ */
public void drive(double xSpeed, double rot) {
// Convert our fwd/rev and rotate commands to wheel speed commands
DifferentialDriveWheelSpeeds speeds =
@@ -111,12 +111,12 @@ public class Drivetrain {
}
/**
- * Force the pose estimator and all sensors to a particular pose. This is useful for indicating to
- * the software when you have manually moved your robot in a particular position on the field (EX:
- * when you place it on the field at the start of the match).
- *
- * @param pose
- */
+ * Force the pose estimator and all sensors to a particular pose. This is useful for indicating to
+ * the software when you have manually moved your robot in a particular position on the field (EX:
+ * when you place it on the field at the start of the match).
+ *
+ * @param pose
+ */
public void resetOdometry(Pose2d pose) {
leftEncoder.reset();
rightEncoder.reset();
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java
index c1bf02169..933185edc 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java
@@ -31,10 +31,10 @@ import edu.wpi.first.wpilibj.Timer;
import org.photonvision.PhotonCamera;
/**
-* Performs estimation of the drivetrain's current position on the field, using a vision system,
-* drivetrain encoders, and a gyroscope. These sensor readings are fused together using a Kalman
-* filter. This in turn creates a best-guess at a Pose2d of where our drivetrain is currently at.
-*/
+ * Performs estimation of the drivetrain's current position on the field, using a vision system,
+ * drivetrain encoders, and a gyroscope. These sensor readings are fused together using a Kalman
+ * filter. This in turn creates a best-guess at a Pose2d of where our drivetrain is currently at.
+ */
public class DrivetrainPoseEstimator {
// Sensors used as part of the Pose Estimation
private final AnalogGyro gyro = new AnalogGyro(Constants.kGyroPin);
@@ -65,12 +65,12 @@ public class DrivetrainPoseEstimator {
public DrivetrainPoseEstimator() {}
/**
- * Perform all periodic pose estimation tasks.
- *
- * @param actWheelSpeeds Current Speeds (in m/s) of the drivetrain wheels
- * @param leftDist Distance (in m) the left wheel has traveled
- * @param rightDist Distance (in m) the right wheel has traveled
- */
+ * Perform all periodic pose estimation tasks.
+ *
+ * @param actWheelSpeeds Current Speeds (in m/s) of the drivetrain wheels
+ * @param leftDist Distance (in m) the left wheel has traveled
+ * @param rightDist Distance (in m) the right wheel has traveled
+ */
public void update(
DifferentialDriveWheelSpeeds actWheelSpeeds, double leftDist, double rightDist) {
m_poseEstimator.update(gyro.getRotation2d(), actWheelSpeeds, leftDist, rightDist);
@@ -86,12 +86,12 @@ public class DrivetrainPoseEstimator {
}
/**
- * Force the pose estimator to a particular pose. This is useful for indicating to the software
- * when you have manually moved your robot in a particular position on the field (EX: when you
- * place it on the field at the start of the match).
- *
- * @param pose
- */
+ * Force the pose estimator to a particular pose. This is useful for indicating to the software
+ * when you have manually moved your robot in a particular position on the field (EX: when you
+ * place it on the field at the start of the match).
+ *
+ * @param pose
+ */
public void resetToPose(Pose2d pose) {
m_poseEstimator.resetPosition(pose, gyro.getRotation2d());
}
diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java
index 1378a5aa4..cdc5741c2 100644
--- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java
+++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/sim/DrivetrainSim.java
@@ -34,12 +34,12 @@ import org.photonlib.examples.simposeest.robot.Constants;
import org.photonvision.SimVisionSystem;
/**
-* Implementation of a simulation of robot physics, sensors, motor controllers Includes a Simulated
-* PhotonVision system and one vision target.
-*
-*
This class and its methods are only relevant during simulation. While on the real robot, the
-* real motors/sensors/physics are used instead.
-*/
+ * Implementation of a simulation of robot physics, sensors, motor controllers Includes a Simulated
+ * PhotonVision system and one vision target.
+ *
+ *
This class and its methods are only relevant during simulation. While on the real robot, the
+ * real motors/sensors/physics are used instead.
+ */
public class DrivetrainSim {
// Simulated Sensors
AnalogGyroSim gyroSim = new AnalogGyroSim(Constants.kGyroPin);
@@ -94,9 +94,9 @@ public class DrivetrainSim {
}
/**
- * Perform all periodic drivetrain simulation related tasks to advance our simulation of robot
- * physics forward by a single 20ms step.
- */
+ * Perform all periodic drivetrain simulation related tasks to advance our simulation of robot
+ * physics forward by a single 20ms step.
+ */
public void update() {
double leftMotorCmd = 0;
double rightMotorCmd = 0;
@@ -135,11 +135,11 @@ public class DrivetrainSim {
}
/**
- * Resets the simulation back to a pre-defined pose Useful to simulate the action of placing the
- * robot onto a specific spot in the field (IE, at the start of each match).
- *
- * @param pose
- */
+ * Resets the simulation back to a pre-defined pose Useful to simulate the action of placing the
+ * robot onto a specific spot in the field (IE, at the start of each match).
+ *
+ * @param pose
+ */
public void resetPose(Pose2d pose) {
drivetrainSimulator.setPose(pose);
}
@@ -150,11 +150,11 @@ public class DrivetrainSim {
}
/**
- * For testing purposes only! Applies an unmodeled, undetected offset to the pose Similar to if
- * you magically kicked your robot to the side in a way the encoders and gyro didn't measure.
- *
- *
This distrubance should be corrected for once a vision target is in view.
- */
+ * For testing purposes only! Applies an unmodeled, undetected offset to the pose Similar to if
+ * you magically kicked your robot to the side in a way the encoders and gyro didn't measure.
+ *
+ *
This distrubance should be corrected for once a vision target is in view.
+ */
public void applyKick() {
Pose2d newPose =
drivetrainSimulator
diff --git a/shared/PhotonVersion.java.in b/shared/PhotonVersion.java.in
index 832801b9d..c26f5a15c 100644
--- a/shared/PhotonVersion.java.in
+++ b/shared/PhotonVersion.java.in
@@ -17,9 +17,9 @@
package org.photonvision;
/*
-* Autogenerated file! Do not manually edit this file. This version is regenerated
-* any time the publish task is run, or when this file is deleted.
-*/
+ * Autogenerated file! Do not manually edit this file. This version is regenerated
+ * any time the publish task is run, or when this file is deleted.
+ */
import java.util.regex.Matcher;
import java.util.regex.Pattern;