Class TriggerBindings

java.lang.Object
frc.robot.shared.bindings.TriggerBindings

public class TriggerBindings extends Object
Maps the driver controller to robot commands so RobotContainer stays lean. Wires the drive controller to the default manual drive command and provides subsystem test bindings via a dashboard-selectable chooser.

Uses WPILib's CommandXboxController which is compatible with Logitech F310 controllers when set to XInput mode (back switch on X).

  • Constructor Details

    • TriggerBindings

      public TriggerBindings(DriveBaseSubsystemCommandFactory driveBaseCommandFactory, TriggerBindingsConfig triggerBindingsConfig, TurretSubsystemCommandFactory turretCommandFactory, ShooterSubsystemCommandFactory shooterCommandFactory, IndexerSubsystemCommandFactory indexerCommandFactory, FeederSubsystemCommandFactory feederCommandFactory, IntakeSubsystemCommandFactory intakeCommandFactory, HarvesterSubsystemCommandFactory harvesterCommandFactory, GameplayStateCommandFactory gameplayStateCommandFactory)
      Creates trigger bindings with the default driver controller port.
      Parameters:
      driveBaseCommandFactory - factory for creating drive base commands
      triggerBindingsConfig - configuration for per-axis response curves and speed tiers
      turretCommandFactory - factory for creating turret commands
      shooterCommandFactory - factory for creating shooter commands
      indexerCommandFactory - factory for creating indexer commands
      feederCommandFactory - factory for creating feeder commands
      intakeCommandFactory - factory for creating intake commands
      harvesterCommandFactory - factory for creating harvester commands
      gameplayStateCommandFactory - factory for creating gameplay state transition commands
    • TriggerBindings

      public TriggerBindings(DriveBaseSubsystemCommandFactory driveBaseCommandFactory, TriggerBindingsConfig triggerBindingsConfig, TurretSubsystemCommandFactory turretCommandFactory, ShooterSubsystemCommandFactory shooterCommandFactory, IndexerSubsystemCommandFactory indexerCommandFactory, FeederSubsystemCommandFactory feederCommandFactory, IntakeSubsystemCommandFactory intakeCommandFactory, HarvesterSubsystemCommandFactory harvesterCommandFactory, GameplayStateCommandFactory gameplayStateCommandFactory, int driverControllerPort, int operatorControllerPort)
      Creates trigger bindings using explicit controller ports.
      Parameters:
      driveBaseCommandFactory - factory for creating drive base commands
      triggerBindingsConfig - configuration for per-axis response curves and speed tiers
      turretCommandFactory - factory for creating turret commands
      shooterCommandFactory - factory for creating shooter commands
      indexerCommandFactory - factory for creating indexer commands
      feederCommandFactory - factory for creating feeder commands
      intakeCommandFactory - factory for creating intake commands
      harvesterCommandFactory - factory for creating harvester commands
      gameplayStateCommandFactory - factory for creating gameplay state transition commands
      driverControllerPort - USB port for the driver controller
      operatorControllerPort - USB port for the operator controller
  • Method Details

    • checkControllerHealth

      public void checkControllerHealth()
      Checks controller connectivity and input health, logging warnings and telemetry.

      Call this once per robot cycle (e.g., from a default command supplier or robotPeriodic). It performs two checks per controller:

      1. Connection check via DriverStation.isJoystickConnected(int). A warning fires once when a controller transitions from connected to disconnected. The latch resets when the controller reconnects.

      2. Stale-input detection during teleop. If a controller reports as connected but all axes have been exactly zero for 50 consecutive teleop cycles, a warning fires once. This catches the failure mode where the Windows USB data pipe goes to sleep during autonomous and fails to wake for teleop (the DS shows the device as present because the USB descriptor is cached, but actual input data is stale). The stale warning resets when the robot leaves teleop.