mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Java optimization and formatting fixes (#4857)
This commit is contained in:
@@ -19,6 +19,7 @@ import edu.wpi.first.math.kinematics.SwerveModulePosition;
|
||||
import edu.wpi.first.math.numbers.N1;
|
||||
import edu.wpi.first.math.numbers.N3;
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -371,13 +372,13 @@ public class SwerveDrivePoseEstimator {
|
||||
}
|
||||
InterpolationRecord record = (InterpolationRecord) obj;
|
||||
return Objects.equals(gyroAngle, record.gyroAngle)
|
||||
&& Objects.equals(modulePositions, record.modulePositions)
|
||||
&& Arrays.equals(modulePositions, record.modulePositions)
|
||||
&& Objects.equals(poseMeters, record.poseMeters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(gyroAngle, modulePositions, poseMeters);
|
||||
return Objects.hash(gyroAngle, Arrays.hashCode(modulePositions), poseMeters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,9 +128,7 @@ public class LinearFilter {
|
||||
}
|
||||
|
||||
double[] ffGains = new double[taps];
|
||||
for (int i = 0; i < ffGains.length; i++) {
|
||||
ffGains[i] = 1.0 / taps;
|
||||
}
|
||||
Arrays.fill(ffGains, 1.0 / taps);
|
||||
|
||||
double[] fbGains = new double[0];
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public final class SplineHelper {
|
||||
* Returns quintic splines from a set of waypoints.
|
||||
*
|
||||
* @param waypoints The waypoints
|
||||
* @return List of splines.
|
||||
* @return array of splines.
|
||||
*/
|
||||
public static QuinticHermiteSpline[] getQuinticSplinesFromWaypoints(List<Pose2d> waypoints) {
|
||||
QuinticHermiteSpline[] splines = new QuinticHermiteSpline[waypoints.size() - 1];
|
||||
|
||||
@@ -15,14 +15,13 @@ import edu.wpi.first.math.spline.SplineHelper;
|
||||
import edu.wpi.first.math.spline.SplineParameterizer;
|
||||
import edu.wpi.first.math.spline.SplineParameterizer.MalformedSplineException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public final class TrajectoryGenerator {
|
||||
private static final Trajectory kDoNothingTrajectory =
|
||||
new Trajectory(Arrays.asList(new Trajectory.State()));
|
||||
new Trajectory(List.of(new Trajectory.State()));
|
||||
private static BiConsumer<String, StackTraceElement[]> errorFunc;
|
||||
|
||||
/** Private constructor because this is a utility class. */
|
||||
|
||||
Reference in New Issue
Block a user