Class DpadTargetConfig
Set enabled to true and populate the pose fields in the deploy JSON to activate a d-pad direction. When disabled, the
corresponding button binding is skipped entirely.
-
Nested Class Summary
Nested classes/interfaces inherited from class frc.robot.shared.config.AbstractConfig
AbstractConfig.ComponentPoseConfig -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWhether this d-pad target is active.doubleTarget heading in degrees (blue-alliance perspective).doubleX-coordinate of the target position on the field in meters (blue-alliance perspective).doubleY-coordinate of the target position on the field in meters (blue-alliance perspective). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReads whether this d-pad target is enabled.doubleReads the tunable heading in degrees.doubleReads the tunable X-coordinate of the target in meters.doubleReads the tunable Y-coordinate of the target in meters.edu.wpi.first.math.geometry.Pose2dtoPose2d()Converts the configured target to a WPILib Pose2d in blue-alliance coordinates.Methods inherited from class frc.robot.shared.config.AbstractConfig
getDashboardPrefix, initializeNestedDashboardPrefixes, readTunableBoolean, readTunableDegrees, readTunableDegreesAsRadians, readTunableNumber, readTunableString, setDashboardPrefix
-
Field Details
-
xMeters
public double xMetersX-coordinate of the target position on the field in meters (blue-alliance perspective).Positive X points toward the red alliance wall. This value is flipped at runtime when the robot is on the red alliance.
-
yMeters
public double yMetersY-coordinate of the target position on the field in meters (blue-alliance perspective).Positive Y points toward the left wall when facing the red alliance wall.
-
headingDegrees
public double headingDegreesTarget heading in degrees (blue-alliance perspective).0 degrees faces the red alliance wall, 180 degrees faces the blue alliance wall. Flipped at runtime for red alliance.
-
enabled
public boolean enabledWhether this d-pad target is active.When
false, the corresponding d-pad button will not be bound to any command. Set totruein the deploy JSON after configuring the target pose.
-
-
Constructor Details
-
DpadTargetConfig
public DpadTargetConfig()
-
-
Method Details
-
getXMeters
public double getXMeters()Reads the tunable X-coordinate of the target in meters.- Returns:
- X position on the field in meters (blue-alliance perspective)
-
getYMeters
public double getYMeters()Reads the tunable Y-coordinate of the target in meters.- Returns:
- Y position on the field in meters (blue-alliance perspective)
-
getHeadingDegrees
public double getHeadingDegrees()Reads the tunable heading in degrees.- Returns:
- target heading in degrees (blue-alliance perspective)
-
getEnabled
public boolean getEnabled()Reads whether this d-pad target is enabled.- Returns:
trueif the target is active and should be bound to the d-pad button
-
toPose2d
public edu.wpi.first.math.geometry.Pose2d toPose2d()Converts the configured target to a WPILib Pose2d in blue-alliance coordinates.Callers are responsible for flipping the returned pose for the red alliance using
FlippingUtil.flipFieldPose().- Returns:
- field pose with position in meters and heading in degrees converted to a Rotation2d
-