Class DriverControllerConfig

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

public class DriverControllerConfig extends AbstractConfig
Configuration for the driver controller's d-pad pathfinding targets, shared pathfinding constraints, and trench zone definitions.

Each d-pad direction has its own DpadTargetConfig holding the target field pose. All four directions share one set of PathPlanner pathfinding constraints (velocity and acceleration limits). Targets are stored in blue-alliance coordinates and flipped at runtime for red.

Trench zones define rectangular areas on the field where the robot must maintain a specific heading while passing through. When a d-pad pathfinding route crosses a trench zone, intermediate waypoints are inserted at the zone entry and exit so the robot passes through at the correct heading.

  • Field Details

    • dpadUp

      public DpadTargetConfig dpadUp
      Target pose for the d-pad up button.
    • dpadDown

      public DpadTargetConfig dpadDown
      Target pose for the d-pad down button.
    • dpadLeft

      public DpadTargetConfig dpadLeft
      Target pose for the d-pad left button.
    • dpadRight

      public DpadTargetConfig dpadRight
      Target pose for the d-pad right button.
    • trenchZones

      public TrenchZoneConfig[] trenchZones
      Trench zones that require heading alignment when the robot pathfinds through them.

      All zones are defined in field (blue-alliance) coordinates. Trenches are physical field features on both halves of the field, so zones should cover both the blue-side and red-side trenches. When a d-pad pathfinding route crosses any enabled zone, entry and exit waypoints are inserted so the robot arrives at the trench with the correct heading.

    • dpadMaxVelocityMetersPerSecond

      public double dpadMaxVelocityMetersPerSecond
      Maximum linear velocity for d-pad pathfinding in meters per second.

      Applies to all four d-pad directions. A conservative value (e.g., 3.0 m/s) keeps the robot under control during teleop pathfinding.

    • dpadMaxAccelerationMetersPerSecondSquared

      public double dpadMaxAccelerationMetersPerSecondSquared
      Maximum linear acceleration for d-pad pathfinding in meters per second squared.
    • dpadMaxAngularVelocityDegreesPerSecond

      public double dpadMaxAngularVelocityDegreesPerSecond
      Maximum angular velocity for d-pad pathfinding in degrees per second.

      Stored in degrees for consistency with other config values. Converted to radians at the call site.

    • dpadMaxAngularAccelerationDegreesPerSecondSquared

      public double dpadMaxAngularAccelerationDegreesPerSecondSquared
      Maximum angular acceleration for d-pad pathfinding in degrees per second squared.

      Stored in degrees for consistency with other config values. Converted to radians at the call site.

  • Constructor Details

    • DriverControllerConfig

      public DriverControllerConfig()
  • Method Details

    • getDpadMaxVelocityMetersPerSecond

      public double getDpadMaxVelocityMetersPerSecond()
      Reads the tunable maximum linear velocity for d-pad pathfinding.
      Returns:
      maximum velocity in meters per second
    • getDpadMaxAccelerationMetersPerSecondSquared

      public double getDpadMaxAccelerationMetersPerSecondSquared()
      Reads the tunable maximum linear acceleration for d-pad pathfinding.
      Returns:
      maximum acceleration in meters per second squared
    • getDpadMaxAngularVelocityDegreesPerSecond

      public double getDpadMaxAngularVelocityDegreesPerSecond()
      Reads the tunable maximum angular velocity for d-pad pathfinding in degrees per second.
      Returns:
      maximum angular velocity in degrees per second
    • getDpadMaxAngularAccelerationDegreesPerSecondSquared

      public double getDpadMaxAngularAccelerationDegreesPerSecondSquared()
      Reads the tunable maximum angular acceleration for d-pad pathfinding in degrees per second squared.
      Returns:
      maximum angular acceleration in degrees per second squared
    • findIntersectingTrenchZone

      public TrenchZoneConfig findIntersectingTrenchZone(edu.wpi.first.math.geometry.Pose2d currentPose, edu.wpi.first.math.geometry.Pose2d targetPose)
      Finds the first enabled trench zone that a straight-line path from the current pose to the target crosses.

      Both poses must be in field (blue-alliance) coordinates. This method checks all configured trench zones regardless of alliance color, since trenches are physical field features on both halves of the field.

      Parameters:
      currentPose - robot's current odometry pose in field coordinates
      targetPose - target pose in field coordinates (already alliance-flipped)
      Returns:
      the first intersecting TrenchZoneConfig, or null if no zone is crossed