[examples] Renovate command-based examples (#4409)

Refactor some examples to use newer features, such as HID factories, library-provided command factories, CommandPtr (C++), as well as new idioms such as static/instance command factories.
This commit is contained in:
Starlight220
2022-11-28 18:55:13 +02:00
committed by GitHub
parent 1a59737f40
commit 20dbae0cee
26 changed files with 401 additions and 417 deletions

View File

@@ -34,10 +34,8 @@ RobotContainer::RobotContainer() {
void RobotContainer::ConfigureButtonBindings() {
// Configure your button bindings here
// NOTE: Using `new` here will leak these commands if they are ever no longer
// needed. This is usually a non-issue as button-bindings tend to be permanent
// - however, if you wish to avoid this, the commands should be
// stack-allocated and declared as members of RobotContainer.
// NOTE: since we're binding a CommandPtr, command ownership here is moved to
// the scheduler thus, no memory leaks!
// Grab the hatch when the 'A' button is pressed.
frc2::JoystickButton(&m_driverController, frc::XboxController::Button::kA)