Bingu

object Bingu : SubsystemBase

Bingu provides a centralized, declarative system for binding XboxController buttons to WPILib Commands.

This object is designed to simplify the process of mapping controller inputs to robot actions, supporting both simple and complex command scheduling. It contains a modern DSL-based binding for clarity, flexibility, and maintainability.

Usage:

  • DSL-based bindings extension:

      controller.bindings {
    press(Button.A, MyCommand())
    release(Button.A, MyReleaseCommand())
    press(Button.B) { println("Pressed B!") }
    hold(Button.B) { println("Holding B!") }
    }

Internally, Bingu tracks all bindings and schedules commands in its periodic loop. Each button can have a press, release, and hold command. If a button is not explicitly bound, it defaults to an InstantCommand (does nothing).

See the documentation for each function for more details and examples.

Properties

Link copied to clipboard
open val currentCommand: Command?
Link copied to clipboard
open var defaultCommand: Command?
Link copied to clipboard
open var name: String?
Link copied to clipboard
open var subsystem: String?

Functions

Link copied to clipboard
open fun addChild(name: String?, child: Sendable?)
Link copied to clipboard
fun XboxController.bindings(builder: ButtonBindingsBuilder.() -> Unit)

Extension function for XboxController to bind multiple button-command pairs using a DSL builder.

Link copied to clipboard
open fun defer(supplier: Supplier<Command?>?): Command?
Link copied to clipboard
open fun initSendable(builder: SendableBuilder?)
Link copied to clipboard
open override fun periodic()

Periodically checks the state of each button and schedules the corresponding command if the button is pressed or released.

Link copied to clipboard
open fun register()
Link copied to clipboard
Link copied to clipboard
open fun run(action: Runnable?): Command?
Link copied to clipboard
open fun runEnd(run: Runnable?, end: Runnable?): Command?
Link copied to clipboard
open fun runOnce(action: Runnable?): Command?
Link copied to clipboard
Link copied to clipboard
open fun startEnd(start: Runnable?, end: Runnable?): Command?
Link copied to clipboard
open fun startRun(start: Runnable?, run: Runnable?): Command?