mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
Don't force public variables to use Hungarian notation (#8774)
People generally have expressed a dislike for the Hungarian notation used in member variables, especially in examples/templates, and our styleguide shouldn't be forced on downstream consumers, so this removes all Hungarian notation from the examples/templates. There are _some_ benefits to Hungarian for private member variables (like knowing what's a member vs. local in a PR review) so we'll keep private member variables the same for now, but public variables should no longer use Hungarian notation, since it looks much worse. A new PMD XPath rule has been added to accomplish this goal. Some other non-compliant variables were fixed for the new rule.
This commit is contained in:
@@ -11,11 +11,11 @@ import org.wpilib.util.RawFrame;
|
||||
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
|
||||
|
||||
/** Represents an AprilTag's metadata. */
|
||||
@SuppressWarnings("MemberName")
|
||||
@Json
|
||||
public class AprilTag {
|
||||
/** The tag's ID. */
|
||||
@Json.Property("ID")
|
||||
@SuppressWarnings("PMD.PublicFieldNamingConvention")
|
||||
public int ID;
|
||||
|
||||
/** The tag's pose. */
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.wpilib.vision.apriltag.jni.AprilTagJNI;
|
||||
*/
|
||||
public class AprilTagDetector implements AutoCloseable {
|
||||
/** Detector configuration. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public static class Config {
|
||||
/**
|
||||
* How many threads should be used for computation. Default is single-threaded operation (1
|
||||
@@ -110,7 +109,6 @@ public class AprilTagDetector implements AutoCloseable {
|
||||
}
|
||||
|
||||
/** Quad threshold parameters. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public static class QuadThresholdParameters {
|
||||
/** Threshold used to reject quads containing too few pixels. Default is 300 pixels. */
|
||||
public int minClusterPixels = 300;
|
||||
|
||||
@@ -216,19 +216,19 @@ public class AprilTagFieldLayout {
|
||||
* @throws UncheckedIOException If the layout does not exist.
|
||||
*/
|
||||
public static AprilTagFieldLayout loadField(AprilTagFields field) {
|
||||
if (field.m_fieldLayout == null) {
|
||||
if (field.fieldLayout == null) {
|
||||
try {
|
||||
field.m_fieldLayout = loadFromResource(field.m_resourceFile);
|
||||
field.fieldLayout = loadFromResource(field.resourceFile);
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(
|
||||
"Could not load AprilTagFieldLayout from " + field.m_resourceFile, e);
|
||||
"Could not load AprilTagFieldLayout from " + field.resourceFile, e);
|
||||
}
|
||||
}
|
||||
// Copy layout because the layout's origin is mutable
|
||||
return new AprilTagFieldLayout(
|
||||
field.m_fieldLayout.getTags(),
|
||||
field.m_fieldLayout.getFieldLength(),
|
||||
field.m_fieldLayout.getFieldWidth());
|
||||
field.fieldLayout.getTags(),
|
||||
field.fieldLayout.getFieldLength(),
|
||||
field.fieldLayout.getFieldWidth());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,11 +264,9 @@ public class AprilTagFieldLayout {
|
||||
}
|
||||
|
||||
static class FieldDimensions {
|
||||
@SuppressWarnings("MemberName")
|
||||
@Json.Property(value = "length")
|
||||
public final double fieldLength;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
@Json.Property(value = "width")
|
||||
public final double fieldWidth;
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ public enum AprilTagFields {
|
||||
public static final AprilTagFields kDefaultField = k2026RebuiltWelded;
|
||||
|
||||
/** Resource filename. */
|
||||
public final String m_resourceFile;
|
||||
public final String resourceFile;
|
||||
|
||||
AprilTagFieldLayout m_fieldLayout;
|
||||
AprilTagFieldLayout fieldLayout;
|
||||
|
||||
AprilTagFields(String resourceFile) {
|
||||
m_resourceFile = kBaseResourceDir + resourceFile;
|
||||
this.resourceFile = kBaseResourceDir + resourceFile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ package org.wpilib.vision.apriltag;
|
||||
import org.wpilib.math.geometry.Transform3d;
|
||||
|
||||
/** A pair of AprilTag pose estimates. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class AprilTagPoseEstimate {
|
||||
/**
|
||||
* Constructs a pose estimate.
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.wpilib.vision.apriltag.jni.AprilTagJNI;
|
||||
/** Pose estimators for AprilTag tags. */
|
||||
public class AprilTagPoseEstimator {
|
||||
/** Configuration for the pose estimator. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public static class Config {
|
||||
/**
|
||||
* Creates a pose estimator configuration.
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.wpilib.math.util.Units;
|
||||
import org.wpilib.util.runtime.RuntimeLoader;
|
||||
|
||||
class AprilTagDetectorTest {
|
||||
@SuppressWarnings("MemberName")
|
||||
AprilTagDetector detector;
|
||||
|
||||
@BeforeAll
|
||||
|
||||
Reference in New Issue
Block a user