Class DpadTargetConfig

java.lang.Object
frc.robot.shared.config.AbstractConfig
frc.robot.shared.bindings.DpadTargetConfig

public class DpadTargetConfig extends AbstractConfig
Configuration for a single d-pad pathfinding target. Stores a field position and heading in blue-alliance coordinates that the robot will pathfind to when the corresponding d-pad button is held.

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.

  • Field Details

    • xMeters

      public double xMeters
      X-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 yMeters
      Y-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 headingDegrees
      Target 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 enabled
      Whether this d-pad target is active.

      When false, the corresponding d-pad button will not be bound to any command. Set to true in 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:
      true if 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