mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Fix documentation warnings generated by JavaDoc (NFC) (#3428)
Some C++ Doxygen comments were updated to reflect any wording changes. See `rg "(@return|@param \w+) TODO" | less` for list of incomplete docs.
This commit is contained in:
@@ -36,10 +36,13 @@ public final class Discretization {
|
||||
* taylor series to several terms and still be substantially cheaper than taking the big
|
||||
* exponential.
|
||||
*
|
||||
* @param <States> Number of states.
|
||||
* @param <Inputs> Number of inputs.
|
||||
* @param states Nat representing the states of the system.
|
||||
* @param contA Continuous system matrix.
|
||||
* @param contB Continuous input matrix.
|
||||
* @param dtseconds Discretization timestep.
|
||||
* @return Pair containing discretized A and B matrices.
|
||||
*/
|
||||
public static <States extends Num, Inputs extends Num>
|
||||
Pair<Matrix<States, States>, Matrix<States, Inputs>> discretizeABTaylor(
|
||||
|
||||
@@ -36,6 +36,8 @@ public final class Drake {
|
||||
/**
|
||||
* Solves the discrete alegebraic Riccati equation.
|
||||
*
|
||||
* @param <States> Number of states.
|
||||
* @param <Inputs> Number of inputs.
|
||||
* @param A System matrix.
|
||||
* @param B Input matrix.
|
||||
* @param Q State cost matrix.
|
||||
@@ -88,6 +90,8 @@ public final class Drake {
|
||||
/**
|
||||
* Solves the discrete alegebraic Riccati equation.
|
||||
*
|
||||
* @param <States> Number of states.
|
||||
* @param <Inputs> Number of inputs.
|
||||
* @param A System matrix.
|
||||
* @param B Input matrix.
|
||||
* @param Q State cost matrix.
|
||||
|
||||
@@ -9,6 +9,7 @@ public interface MathShared {
|
||||
* Report an error.
|
||||
*
|
||||
* @param error the error to set
|
||||
* @param stackTrace array of stacktrace elements
|
||||
*/
|
||||
void reportError(String error, StackTraceElement[] stackTrace);
|
||||
|
||||
|
||||
@@ -9,7 +9,11 @@ public final class MathSharedStore {
|
||||
|
||||
private MathSharedStore() {}
|
||||
|
||||
/** get the MathShared object. */
|
||||
/**
|
||||
* Get the MathShared object.
|
||||
*
|
||||
* @return The MathShared object.
|
||||
*/
|
||||
public static synchronized MathShared getMathShared() {
|
||||
if (mathShared == null) {
|
||||
mathShared =
|
||||
@@ -24,7 +28,11 @@ public final class MathSharedStore {
|
||||
return mathShared;
|
||||
}
|
||||
|
||||
/** set the MathShared object. */
|
||||
/**
|
||||
* Set the MathShared object.
|
||||
*
|
||||
* @param shared The MathShared object.
|
||||
*/
|
||||
public static synchronized void setMathShared(MathShared shared) {
|
||||
mathShared = shared;
|
||||
}
|
||||
@@ -33,6 +41,7 @@ public final class MathSharedStore {
|
||||
* Report an error.
|
||||
*
|
||||
* @param error the error to set
|
||||
* @param stackTrace array of stacktrace elements
|
||||
*/
|
||||
public static void reportError(String error, StackTraceElement[] stackTrace) {
|
||||
getMathShared().reportError(error, stackTrace);
|
||||
|
||||
@@ -15,6 +15,7 @@ public final class MathUtil {
|
||||
* @param value Value to clamp.
|
||||
* @param low The lower boundary to which to clamp value.
|
||||
* @param high The higher boundary to which to clamp value.
|
||||
* @return The clamped value.
|
||||
*/
|
||||
public static int clamp(int value, int low, int high) {
|
||||
return Math.max(low, Math.min(value, high));
|
||||
@@ -26,6 +27,7 @@ public final class MathUtil {
|
||||
* @param value Value to clamp.
|
||||
* @param low The lower boundary to which to clamp value.
|
||||
* @param high The higher boundary to which to clamp value.
|
||||
* @return The clamped value.
|
||||
*/
|
||||
public static double clamp(double value, double low, double high) {
|
||||
return Math.max(low, Math.min(value, high));
|
||||
@@ -37,6 +39,7 @@ public final class MathUtil {
|
||||
* @param input Input value to wrap.
|
||||
* @param minimumInput The minimum value expected from the input.
|
||||
* @param maximumInput The maximum value expected from the input.
|
||||
* @return The wrapped value.
|
||||
*/
|
||||
public static double inputModulus(double input, double minimumInput, double maximumInput) {
|
||||
double modulus = maximumInput - minimumInput;
|
||||
@@ -56,6 +59,7 @@ public final class MathUtil {
|
||||
* Wraps an angle to the range -pi to pi radians.
|
||||
*
|
||||
* @param angleRadians Angle to wrap in radians.
|
||||
* @return The wrapped angle.
|
||||
*/
|
||||
public static double angleModulus(double angleRadians) {
|
||||
return inputModulus(angleRadians, -Math.PI, Math.PI);
|
||||
|
||||
@@ -323,6 +323,7 @@ public class Matrix<R extends Num, C extends Num> {
|
||||
* <p>The matrix equation could also be written as x = A<sup>-1</sup>b. Where the pseudo inverse
|
||||
* is used if A is not square.
|
||||
*
|
||||
* @param <C2> Columns in b.
|
||||
* @param b The right-hand side of the equation to solve.
|
||||
* @return The solution to the linear system.
|
||||
*/
|
||||
@@ -477,6 +478,8 @@ public class Matrix<R extends Num, C extends Num> {
|
||||
/**
|
||||
* Extracts a matrix of a given size and start position with new underlying storage.
|
||||
*
|
||||
* @param <R2> Number of rows to extract.
|
||||
* @param <C2> Number of columns to extract.
|
||||
* @param height The number of rows of the extracted matrix.
|
||||
* @param width The number of columns of the extracted matrix.
|
||||
* @param startingRow The starting row of the extracted matrix.
|
||||
@@ -496,6 +499,8 @@ public class Matrix<R extends Num, C extends Num> {
|
||||
/**
|
||||
* Assign a matrix of a given size and start position.
|
||||
*
|
||||
* @param <R2> Rows in block assignment.
|
||||
* @param <C2> Columns in block assignment.
|
||||
* @param startingRow The row to start at.
|
||||
* @param startingCol The column to start at.
|
||||
* @param other The matrix to assign the block to.
|
||||
@@ -510,6 +515,8 @@ public class Matrix<R extends Num, C extends Num> {
|
||||
* Extracts a submatrix from the supplied matrix and inserts it in a submatrix in "this". The
|
||||
* shape of "this" is used to determine the size of the matrix extracted.
|
||||
*
|
||||
* @param <R2> Number of rows to extract.
|
||||
* @param <C2> Number of columns to extract.
|
||||
* @param startingRow The starting row in the supplied matrix to extract the submatrix.
|
||||
* @param startingCol The starting column in the supplied matrix to extract the submatrix.
|
||||
* @param other The matrix to extract the submatrix from.
|
||||
@@ -603,6 +610,8 @@ public class Matrix<R extends Num, C extends Num> {
|
||||
* Reassigns dimensions of a {@link Matrix} to allow for operations with other matrices that have
|
||||
* wildcard dimensions.
|
||||
*
|
||||
* @param <R1> Row dimension to assign.
|
||||
* @param <C1> Column dimension to assign.
|
||||
* @param mat The {@link Matrix} to remove the dimensions from.
|
||||
* @return The matrix with reassigned dimensions.
|
||||
*/
|
||||
|
||||
@@ -157,6 +157,7 @@ public final class StateSpaceUtil {
|
||||
* radians.
|
||||
*
|
||||
* @param pose A pose to convert to a vector.
|
||||
* @return The given pose in as a 4x1 vector of x, y, cos(theta), and sin(theta).
|
||||
*/
|
||||
public static Matrix<N4, N1> poseTo4dVector(Pose2d pose) {
|
||||
return VecBuilder.fill(
|
||||
|
||||
@@ -33,6 +33,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* Returns a 1x1 vector containing the given elements.
|
||||
*
|
||||
* @param n1 the first element.
|
||||
* @return 1x1 vector
|
||||
*/
|
||||
public static Vector<N1> fill(double n1) {
|
||||
return new VecBuilder<>(Nat.N1()).fillVec(n1);
|
||||
@@ -43,6 +44,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
*
|
||||
* @param n1 the first element.
|
||||
* @param n2 the second element.
|
||||
* @return 2x1 vector
|
||||
*/
|
||||
public static Vector<N2> fill(double n1, double n2) {
|
||||
return new VecBuilder<>(Nat.N2()).fillVec(n1, n2);
|
||||
@@ -54,6 +56,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n1 the first element.
|
||||
* @param n2 the second element.
|
||||
* @param n3 the third element.
|
||||
* @return 3x1 vector
|
||||
*/
|
||||
public static Vector<N3> fill(double n1, double n2, double n3) {
|
||||
return new VecBuilder<>(Nat.N3()).fillVec(n1, n2, n3);
|
||||
@@ -66,6 +69,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n2 the second element.
|
||||
* @param n3 the third element.
|
||||
* @param n4 the fourth element.
|
||||
* @return 4x1 vector
|
||||
*/
|
||||
public static Vector<N4> fill(double n1, double n2, double n3, double n4) {
|
||||
return new VecBuilder<>(Nat.N4()).fillVec(n1, n2, n3, n4);
|
||||
@@ -79,6 +83,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n3 the third element.
|
||||
* @param n4 the fourth element.
|
||||
* @param n5 the fifth element.
|
||||
* @return 5x1 vector
|
||||
*/
|
||||
public static Vector<N5> fill(double n1, double n2, double n3, double n4, double n5) {
|
||||
return new VecBuilder<>(Nat.N5()).fillVec(n1, n2, n3, n4, n5);
|
||||
@@ -93,6 +98,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n4 the fourth element.
|
||||
* @param n5 the fifth element.
|
||||
* @param n6 the sixth element.
|
||||
* @return 6x1 vector
|
||||
*/
|
||||
public static Vector<N6> fill(double n1, double n2, double n3, double n4, double n5, double n6) {
|
||||
return new VecBuilder<>(Nat.N6()).fillVec(n1, n2, n3, n4, n5, n6);
|
||||
@@ -108,6 +114,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n5 the fifth element.
|
||||
* @param n6 the sixth element.
|
||||
* @param n7 the seventh element.
|
||||
* @return 7x1 vector
|
||||
*/
|
||||
public static Vector<N7> fill(
|
||||
double n1, double n2, double n3, double n4, double n5, double n6, double n7) {
|
||||
@@ -125,6 +132,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n6 the sixth element.
|
||||
* @param n7 the seventh element.
|
||||
* @param n8 the eighth element.
|
||||
* @return 8x1 vector
|
||||
*/
|
||||
public static Vector<N8> fill(
|
||||
double n1, double n2, double n3, double n4, double n5, double n6, double n7, double n8) {
|
||||
@@ -143,6 +151,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n7 the seventh element.
|
||||
* @param n8 the eighth element.
|
||||
* @param n9 the ninth element.
|
||||
* @return 9x1 vector
|
||||
*/
|
||||
public static Vector<N9> fill(
|
||||
double n1,
|
||||
@@ -170,6 +179,7 @@ public class VecBuilder<N extends Num> extends MatBuilder<N, N1> {
|
||||
* @param n8 the eighth element.
|
||||
* @param n9 the ninth element.
|
||||
* @param n10 the tenth element.
|
||||
* @return 10x1 vector
|
||||
*/
|
||||
public static Vector<N10> fill(
|
||||
double n1,
|
||||
|
||||
@@ -96,6 +96,7 @@ public final class WPIMathJNI {
|
||||
*
|
||||
* @param path The path to the JSON.
|
||||
* @return A double array with the trajectory states from the JSON.
|
||||
* @throws IOException if the JSON could not be read.
|
||||
*/
|
||||
public static native double[] fromPathweaverJson(String path) throws IOException;
|
||||
|
||||
@@ -104,6 +105,7 @@ public final class WPIMathJNI {
|
||||
*
|
||||
* @param elements The elements of the trajectory.
|
||||
* @param path The location to save the JSON to.
|
||||
* @throws IOException if the JSON could not be written.
|
||||
*/
|
||||
public static native void toPathweaverJson(double[] elements, String path) throws IOException;
|
||||
|
||||
|
||||
@@ -222,6 +222,7 @@ public class LinearQuadraticRegulator<States extends Num, Inputs extends Num, Ou
|
||||
* Returns the next output of the controller.
|
||||
*
|
||||
* @param x The current state x.
|
||||
* @return The next controller output.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public Matrix<Inputs, N1> calculate(Matrix<States, N1> x) {
|
||||
@@ -234,6 +235,7 @@ public class LinearQuadraticRegulator<States extends Num, Inputs extends Num, Ou
|
||||
*
|
||||
* @param x The current state x.
|
||||
* @param nextR the next reference vector r.
|
||||
* @return The next controller output.
|
||||
*/
|
||||
@SuppressWarnings("ParameterName")
|
||||
public Matrix<Inputs, N1> calculate(Matrix<States, N1> x, Matrix<States, N1> nextR) {
|
||||
|
||||
@@ -65,7 +65,11 @@ public class RamseteController {
|
||||
this(2.0, 0.7);
|
||||
}
|
||||
|
||||
/** Returns true if the pose error is within tolerance of the reference. */
|
||||
/**
|
||||
* Returns true if the pose error is within tolerance of the reference.
|
||||
*
|
||||
* @return True if the pose error is within tolerance of the reference.
|
||||
*/
|
||||
public boolean atReference() {
|
||||
final var eTranslate = m_poseError.getTranslation();
|
||||
final var eRotate = m_poseError.getRotation();
|
||||
@@ -95,6 +99,7 @@ public class RamseteController {
|
||||
* @param poseRef The desired pose.
|
||||
* @param linearVelocityRefMeters The desired linear velocity in meters per second.
|
||||
* @param angularVelocityRefRadiansPerSecond The desired angular velocity in radians per second.
|
||||
* @return The next controller output.
|
||||
*/
|
||||
@SuppressWarnings("LocalVariableName")
|
||||
public ChassisSpeeds calculate(
|
||||
@@ -131,6 +136,7 @@ public class RamseteController {
|
||||
*
|
||||
* @param currentPose The current pose.
|
||||
* @param desiredState The desired pose, linear velocity, and angular velocity from a trajectory.
|
||||
* @return The next controller output.
|
||||
*/
|
||||
@SuppressWarnings("LocalVariableName")
|
||||
public ChassisSpeeds calculate(Pose2d currentPose, Trajectory.State desiredState) {
|
||||
|
||||
@@ -20,9 +20,11 @@ public final class AngleStatistics {
|
||||
* Subtracts a and b while normalizing the resulting value in the selected row as if it were an
|
||||
* angle.
|
||||
*
|
||||
* @param <S> Number of rows in vector.
|
||||
* @param a A vector to subtract from.
|
||||
* @param b A vector to subtract with.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
* @return Difference of two vectors with angle at the given index normalized.
|
||||
*/
|
||||
public static <S extends Num> Matrix<S, N1> angleResidual(
|
||||
Matrix<S, N1> a, Matrix<S, N1> b, int angleStateIdx) {
|
||||
@@ -36,7 +38,9 @@ public final class AngleStatistics {
|
||||
* Returns a function that subtracts two vectors while normalizing the resulting value in the
|
||||
* selected row as if it were an angle.
|
||||
*
|
||||
* @param <S> Number of rows in vector.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
* @return Function returning difference of two vectors with angle at the given index normalized.
|
||||
*/
|
||||
public static <S extends Num>
|
||||
BiFunction<Matrix<S, N1>, Matrix<S, N1>, Matrix<S, N1>> angleResidual(int angleStateIdx) {
|
||||
@@ -46,9 +50,11 @@ public final class AngleStatistics {
|
||||
/**
|
||||
* Adds a and b while normalizing the resulting value in the selected row as an angle.
|
||||
*
|
||||
* @param <S> Number of rows in vector.
|
||||
* @param a A vector to add with.
|
||||
* @param b A vector to add with.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
* @return Sum of two vectors with angle at the given index normalized.
|
||||
*/
|
||||
public static <S extends Num> Matrix<S, N1> angleAdd(
|
||||
Matrix<S, N1> a, Matrix<S, N1> b, int angleStateIdx) {
|
||||
@@ -62,7 +68,9 @@ public final class AngleStatistics {
|
||||
* Returns a function that adds two vectors while normalizing the resulting value in the selected
|
||||
* row as an angle.
|
||||
*
|
||||
* @param <S> Number of rows in vector.
|
||||
* @param angleStateIdx The row containing angles to be normalized.
|
||||
* @return Function returning of two vectors with angle at the given index normalized.
|
||||
*/
|
||||
public static <S extends Num> BiFunction<Matrix<S, N1>, Matrix<S, N1>, Matrix<S, N1>> angleAdd(
|
||||
int angleStateIdx) {
|
||||
@@ -73,9 +81,11 @@ public final class AngleStatistics {
|
||||
* Computes the mean of sigmas with the weights Wm while computing a special angle mean for a
|
||||
* select row.
|
||||
*
|
||||
* @param <S> Number of rows in sigma point matrix.
|
||||
* @param sigmas Sigma points.
|
||||
* @param Wm Weights for the mean.
|
||||
* @param angleStateIdx The row containing the angles.
|
||||
* @return Mean of sigma points.
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:ParameterName")
|
||||
public static <S extends Num> Matrix<S, N1> angleMean(
|
||||
@@ -101,7 +111,9 @@ public final class AngleStatistics {
|
||||
* Returns a function that computes the mean of sigmas with the weights Wm while computing a
|
||||
* special angle mean for a select row.
|
||||
*
|
||||
* @param <S> Number of rows in sigma point matrix.
|
||||
* @param angleStateIdx The row containing the angles.
|
||||
* @return Function returning mean of sigma points.
|
||||
*/
|
||||
@SuppressWarnings("LambdaParameterName")
|
||||
public static <S extends Num> BiFunction<Matrix<S, ?>, Matrix<?, N1>, Matrix<S, N1>> angleMean(
|
||||
|
||||
@@ -329,6 +329,8 @@ public class UnscentedKalmanFilter<States extends Num, Inputs extends Num, Outpu
|
||||
* The h(x, u) passed to the constructor is used if one is not provided (the two-argument version
|
||||
* of this function).
|
||||
*
|
||||
* @param <R> Number of measurements in y.
|
||||
* @param rows Number of rows in y.
|
||||
* @param u Same control input used in the predict step.
|
||||
* @param y Measurement vector.
|
||||
* @param h A vector-valued function of x and u that returns the measurement vector.
|
||||
@@ -357,6 +359,8 @@ public class UnscentedKalmanFilter<States extends Num, Inputs extends Num, Outpu
|
||||
* The h(x, u) passed to the constructor is used if one is not provided (the two-argument version
|
||||
* of this function).
|
||||
*
|
||||
* @param <R> Number of measurements in y.
|
||||
* @param rows Number of rows in y.
|
||||
* @param u Same control input used in the predict step.
|
||||
* @param y Measurement vector.
|
||||
* @param h A vector-valued function of x and u that returns the measurement vector.
|
||||
|
||||
@@ -81,6 +81,7 @@ public class LinearFilter {
|
||||
*
|
||||
* @param timeConstant The discrete-time time constant in seconds.
|
||||
* @param period The period in seconds between samples taken by the user.
|
||||
* @return Linear filter.
|
||||
*/
|
||||
public static LinearFilter singlePoleIIR(double timeConstant, double period) {
|
||||
double gain = Math.exp(-period / timeConstant);
|
||||
@@ -101,6 +102,7 @@ public class LinearFilter {
|
||||
*
|
||||
* @param timeConstant The discrete-time time constant in seconds.
|
||||
* @param period The period in seconds between samples taken by the user.
|
||||
* @return Linear filter.
|
||||
*/
|
||||
public static LinearFilter highPass(double timeConstant, double period) {
|
||||
double gain = Math.exp(-period / timeConstant);
|
||||
@@ -117,6 +119,7 @@ public class LinearFilter {
|
||||
* <p>This filter is always stable.
|
||||
*
|
||||
* @param taps The number of samples to average over. Higher = smoother but slower.
|
||||
* @return Linear filter.
|
||||
* @throws IllegalArgumentException if number of taps is less than 1.
|
||||
*/
|
||||
public static LinearFilter movingAverage(int taps) {
|
||||
|
||||
@@ -56,6 +56,7 @@ public class SwerveModuleState implements Comparable<SwerveModuleState> {
|
||||
*
|
||||
* @param desiredState The desired state.
|
||||
* @param currentAngle The current module angle.
|
||||
* @return Optimized swerve module state.
|
||||
*/
|
||||
public static SwerveModuleState optimize(
|
||||
SwerveModuleState desiredState, Rotation2d currentAngle) {
|
||||
|
||||
@@ -302,7 +302,11 @@ public class LinearSystemLoop<States extends Num, Inputs extends Num, Outputs ex
|
||||
return m_clampFunction;
|
||||
}
|
||||
|
||||
/** Set the clamping function used to clamp inputs. */
|
||||
/**
|
||||
* Set the clamping function used to clamp inputs.
|
||||
*
|
||||
* @param clampFunction The clamping function.
|
||||
*/
|
||||
public void setClampFunction(Function<Matrix<Inputs, N1>, Matrix<Inputs, N1>> clampFunction) {
|
||||
this.m_clampFunction = clampFunction;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public class DCMotor {
|
||||
*
|
||||
* @param speedRadiansPerSec The speed of the rotor.
|
||||
* @param voltageInputVolts The input voltage.
|
||||
* @return The estimated current.
|
||||
*/
|
||||
public double getCurrent(double speedRadiansPerSec, double voltageInputVolts) {
|
||||
return -1.0 / KvRadPerSecPerVolt / rOhms * speedRadiansPerSec + 1.0 / rOhms * voltageInputVolts;
|
||||
@@ -75,6 +76,7 @@ public class DCMotor {
|
||||
* Return a gearbox of CIM motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of CIM motors.
|
||||
*/
|
||||
public static DCMotor getCIM(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -85,6 +87,7 @@ public class DCMotor {
|
||||
* Return a gearbox of 775Pro motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of 775Pro motors.
|
||||
*/
|
||||
public static DCMotor getVex775Pro(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -95,6 +98,7 @@ public class DCMotor {
|
||||
* Return a gearbox of NEO motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of NEO motors.
|
||||
*/
|
||||
public static DCMotor getNEO(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -105,6 +109,7 @@ public class DCMotor {
|
||||
* Return a gearbox of MiniCIM motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of MiniCIM motors.
|
||||
*/
|
||||
public static DCMotor getMiniCIM(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -115,6 +120,7 @@ public class DCMotor {
|
||||
* Return a gearbox of Bag motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of Bag motors.
|
||||
*/
|
||||
public static DCMotor getBag(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -125,6 +131,7 @@ public class DCMotor {
|
||||
* Return a gearbox of Andymark RS775-125 motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of Andymark RS775-125 motors.
|
||||
*/
|
||||
public static DCMotor getAndymarkRs775_125(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -135,6 +142,7 @@ public class DCMotor {
|
||||
* Return a gearbox of Banebots RS775 motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of Banebots RS775 motors.
|
||||
*/
|
||||
public static DCMotor getBanebotsRs775(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -145,6 +153,7 @@ public class DCMotor {
|
||||
* Return a gearbox of Andymark 9015 motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of Andymark 9015 motors.
|
||||
*/
|
||||
public static DCMotor getAndymark9015(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -155,6 +164,7 @@ public class DCMotor {
|
||||
* Return a gearbox of Banebots RS 550 motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of Banebots RS 550 motors.
|
||||
*/
|
||||
public static DCMotor getBanebotsRs550(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -162,9 +172,10 @@ public class DCMotor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a gearbox of Neo 550 motors.
|
||||
* Return a gearbox of NEO 550 motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of NEO 550 motors.
|
||||
*/
|
||||
public static DCMotor getNeo550(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -175,6 +186,7 @@ public class DCMotor {
|
||||
* Return a gearbox of Falcon 500 motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of Falcon 500 motors.
|
||||
*/
|
||||
public static DCMotor getFalcon500(int numMotors) {
|
||||
return new DCMotor(
|
||||
@@ -185,6 +197,7 @@ public class DCMotor {
|
||||
* Return a gearbox of Romi/TI_RSLK MAX motors.
|
||||
*
|
||||
* @param numMotors Number of motors in the gearbox.
|
||||
* @return A gearbox of Romi/TI_RSLK MAX motors.
|
||||
*/
|
||||
public static DCMotor getRomiBuiltIn(int numMotors) {
|
||||
// From https://www.pololu.com/product/1520/specs
|
||||
|
||||
@@ -166,6 +166,7 @@ public class TrapezoidProfile {
|
||||
* the profile was at time t = 0.
|
||||
*
|
||||
* @param t The time since the beginning of the profile.
|
||||
* @return The position and velocity of the profile at time t.
|
||||
*/
|
||||
public State calculate(double t) {
|
||||
State result = new State(m_initial.position, m_initial.velocity);
|
||||
@@ -195,6 +196,7 @@ public class TrapezoidProfile {
|
||||
* Returns the time left until a target distance in the profile is reached.
|
||||
*
|
||||
* @param target The target distance.
|
||||
* @return The time left until a target distance in the profile is reached.
|
||||
*/
|
||||
public double timeLeftUntil(double target) {
|
||||
double position = m_initial.position * m_direction;
|
||||
@@ -263,7 +265,11 @@ public class TrapezoidProfile {
|
||||
return accelTime + fullSpeedTime + deccelTime;
|
||||
}
|
||||
|
||||
/** Returns the total time the profile takes to reach the goal. */
|
||||
/**
|
||||
* Returns the total time the profile takes to reach the goal.
|
||||
*
|
||||
* @return The total time the profile takes to reach the goal.
|
||||
*/
|
||||
public double totalTime() {
|
||||
return m_endDeccel;
|
||||
}
|
||||
@@ -275,6 +281,7 @@ public class TrapezoidProfile {
|
||||
* profile's total time.
|
||||
*
|
||||
* @param t The time since the beginning of the profile.
|
||||
* @return True if the profile has reached the goal.
|
||||
*/
|
||||
public boolean isFinished(double t) {
|
||||
return t >= totalTime();
|
||||
|
||||
@@ -18,8 +18,9 @@ public class MecanumDriveKinematicsConstraint implements TrajectoryConstraint {
|
||||
private final MecanumDriveKinematics m_kinematics;
|
||||
|
||||
/**
|
||||
* Constructs a mecanum drive dynamics constraint.
|
||||
* Constructs a mecanum drive kinematics constraint.
|
||||
*
|
||||
* @param kinematics Mecanum drive kinematics.
|
||||
* @param maxSpeedMetersPerSecond The max speed that a side of the robot can travel at.
|
||||
*/
|
||||
public MecanumDriveKinematicsConstraint(
|
||||
|
||||
@@ -18,8 +18,9 @@ public class SwerveDriveKinematicsConstraint implements TrajectoryConstraint {
|
||||
private final SwerveDriveKinematics m_kinematics;
|
||||
|
||||
/**
|
||||
* Constructs a swerve drive dynamics constraint.
|
||||
* Constructs a swerve drive kinematics constraint.
|
||||
*
|
||||
* @param kinematics Swerve drive kinematics.
|
||||
* @param maxSpeedMetersPerSecond The max speed that a side of the robot can travel at.
|
||||
*/
|
||||
public SwerveDriveKinematicsConstraint(
|
||||
|
||||
Reference in New Issue
Block a user