2024 kitbot code for one driver

I noticed in the documentation for kitbot it uses a code designed for 2 operators. Is there code available for one driver?

No, but it should be pretty straightforward to modify it.

In the robot container file

  /*The gamepad provided in the KOP shows up like an XBox controller if the mode switch is set to X mode using the
   * switch on the top.*/
  private final CommandXboxController m_driverController =
      new CommandXboxController(OperatorConstants.kDriverControllerPort);
  private final CommandXboxController m_operatorController =
      new CommandXboxController(OperatorConstants.kOperatorControllerPort);

Switch the constants used for the ports to be the same port number.

Then in configure bindings you can change which controller and buttons are tied to which commands

 /*Create an inline sequence to run when the operator presses and holds the A (green) button. Run the PrepareLaunch
     * command for 1 seconds and then run the LaunchNote command */
    m_operatorController
        .a()
        .whileTrue(
            new PrepareLaunch(m_launcher)
                .withTimeout(LauncherConstants.kLauncherDelay)
                .andThen(new LaunchNote(m_launcher))
                .handleInterrupt(() -> m_launcher.stop()));

    // Set up a binding to run the intake command while the operator is pressing and holding the
    // left Bumper
    m_operatorController.leftBumper().whileTrue(m_launcher.getIntakeCommand());
  }

Technically you don’t have to change the controller port numbers if you change m_operatorController to be called m_driverController in the command bindings and make sure you aren’t using buttons/axis for multiple things

1 Like