mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib,cmd] Rename gamepad face-button trigger APIs to directional names (faceUp/Down/Left/Right) (#8896)
This updates gamepad trigger naming from cardinal-style face buttons
(`northFace/southFace/eastFace/westFace` and
`NorthFace/SouthFace/EastFace/WestFace`) to directional naming
(`faceUp/faceDown/faceRight/faceLeft` and
`FaceUp/FaceDown/FaceRight/FaceLeft`) to match the requested API shape.
The change is applied across Java and C++ HID/command layers, along with
related examples and binding metadata.
- **API surface updates (Java)**
- Renamed trigger/event methods in:
- `wpilibj` `Gamepad`
- `commandsv2` `CommandGamepad`
- `commandsv3` `CommandGamepad`
- Mapping preserved:
- `southFace` → `faceDown`
- `eastFace` → `faceRight`
- `westFace` → `faceLeft`
- `northFace` → `faceUp`
- **API surface updates (C++)**
- Renamed trigger/event methods in:
- `wpilibc` `Gamepad`
- `commandsv2` `CommandGamepad`
- Mapping preserved:
- `SouthFace` → `FaceDown`
- `EastFace` → `FaceRight`
- `WestFace` → `FaceLeft`
- `NorthFace` → `FaceUp`
- **Python semiwrap updates**
- Updated `wpilibc/src/main/python/semiwrap/Gamepad.yml` method mappings
to the renamed C++ method names (`FaceDown/FaceRight/FaceLeft/FaceUp`).
- **Callsite migration**
- Updated Java examples/template code and C++ examples/template code to
use the new method names so samples remain aligned with the API rename.
- **Docs/comments alignment**
- Updated related Javadoc/reference text and example comments to use
directional terminology.
```java
// Before
driverController.southFace().onTrue(command);
driverController.eastFace().onTrue(command);
// After
driverController.faceDown().onTrue(command);
driverController.faceRight().onTrue(command);
```
```cpp
// Before
driverController.SouthFace().OnTrue(command);
driverController.EastFace().OnTrue(command);
// After
driverController.FaceDown().OnTrue(command);
driverController.FaceRight().OnTrue(command);
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ThadHouse <7727148+ThadHouse@users.noreply.github.com>
This commit is contained in:
@@ -29,14 +29,14 @@ void RobotContainer::ConfigureButtonBindings() {
|
||||
.OnTrue(driveHalfVelocity.get())
|
||||
.OnFalse(driveFullVelocity.get());
|
||||
|
||||
// Drive forward by 3 meters when the 'South Face' button is pressed, with a
|
||||
// Drive forward by 3 meters when the 'Face Down' button is pressed, with a
|
||||
// timeout of 10 seconds
|
||||
driverController.SouthFace().OnTrue(
|
||||
driverController.FaceDown().OnTrue(
|
||||
drive.ProfiledDriveDistance(3_m).WithTimeout(10_s));
|
||||
|
||||
// Do the same thing as above when the 'East Face' button is pressed, but
|
||||
// Do the same thing as above when the 'Face Right' button is pressed, but
|
||||
// without resetting the encoders
|
||||
driverController.EastFace().OnTrue(
|
||||
driverController.FaceRight().OnTrue(
|
||||
drive.DynamicProfiledDriveDistance(3_m).WithTimeout(10_s));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ RobotContainer::RobotContainer() {
|
||||
void RobotContainer::ConfigureButtonBindings() {
|
||||
// Configure your button bindings here
|
||||
|
||||
// Grab the hatch when the 'East Face' button is pressed.
|
||||
driverController.EastFace().OnTrue(hatch.GrabHatchCommand());
|
||||
// Release the hatch when the 'West Face' button is pressed.
|
||||
driverController.WestFace().OnTrue(hatch.ReleaseHatchCommand());
|
||||
// Grab the hatch when the 'Face Right' button is pressed.
|
||||
driverController.FaceRight().OnTrue(hatch.GrabHatchCommand());
|
||||
// Release the hatch when the 'Face Left' button is pressed.
|
||||
driverController.FaceLeft().OnTrue(hatch.ReleaseHatchCommand());
|
||||
// While holding Right Bumper, drive at half velocity
|
||||
driverController.RightBumper()
|
||||
.OnTrue(wpi::cmd::RunOnce([this] { drive.SetMaxOutput(0.5); }, {}))
|
||||
|
||||
@@ -24,13 +24,13 @@ void RapidReactCommandBot::ConfigureBindings() {
|
||||
[this] { return -driverController.GetLeftY(); },
|
||||
[this] { return -driverController.GetRightX(); }));
|
||||
|
||||
// Deploy the intake with the West Face button
|
||||
driverController.WestFace().OnTrue(intake.IntakeCommand());
|
||||
// Retract the intake with the North Face button
|
||||
driverController.NorthFace().OnTrue(intake.RetractCommand());
|
||||
// Deploy the intake with the Face Left button
|
||||
driverController.FaceLeft().OnTrue(intake.IntakeCommand());
|
||||
// Retract the intake with the Face Up button
|
||||
driverController.FaceUp().OnTrue(intake.RetractCommand());
|
||||
|
||||
// Fire the shooter with the South Face button
|
||||
driverController.SouthFace().OnTrue(
|
||||
// Fire the shooter with the Face Down button
|
||||
driverController.FaceDown().OnTrue(
|
||||
wpi::cmd::Parallel(shooter.ShootCommand(ShooterConstants::kShooterTarget),
|
||||
storage.RunCommand())
|
||||
// Since we composed this inline we should give it a name
|
||||
|
||||
@@ -17,27 +17,27 @@ void SysIdRoutineBot::ConfigureBindings() {
|
||||
|
||||
// Using bumpers as a modifier and combining it with the buttons so that we
|
||||
// can have both sets of bindings at once
|
||||
(driverController.SouthFace() && driverController.RightBumper())
|
||||
(driverController.FaceDown() && driverController.RightBumper())
|
||||
.WhileTrue(drive.SysIdQuasistatic(wpi::cmd::sysid::Direction::kForward));
|
||||
(driverController.EastFace() && driverController.RightBumper())
|
||||
(driverController.FaceRight() && driverController.RightBumper())
|
||||
.WhileTrue(drive.SysIdQuasistatic(wpi::cmd::sysid::Direction::kReverse));
|
||||
(driverController.WestFace() && driverController.RightBumper())
|
||||
(driverController.FaceLeft() && driverController.RightBumper())
|
||||
.WhileTrue(drive.SysIdDynamic(wpi::cmd::sysid::Direction::kForward));
|
||||
(driverController.NorthFace() && driverController.RightBumper())
|
||||
(driverController.FaceUp() && driverController.RightBumper())
|
||||
.WhileTrue(drive.SysIdDynamic(wpi::cmd::sysid::Direction::kReverse));
|
||||
|
||||
shooter.SetDefaultCommand(shooter.RunShooterCommand(
|
||||
[this] { return driverController.GetLeftTriggerAxis(); }));
|
||||
|
||||
(driverController.SouthFace() && driverController.LeftBumper())
|
||||
(driverController.FaceDown() && driverController.LeftBumper())
|
||||
.WhileTrue(
|
||||
shooter.SysIdQuasistatic(wpi::cmd::sysid::Direction::kForward));
|
||||
(driverController.EastFace() && driverController.LeftBumper())
|
||||
(driverController.FaceRight() && driverController.LeftBumper())
|
||||
.WhileTrue(
|
||||
shooter.SysIdQuasistatic(wpi::cmd::sysid::Direction::kReverse));
|
||||
(driverController.WestFace() && driverController.LeftBumper())
|
||||
(driverController.FaceLeft() && driverController.LeftBumper())
|
||||
.WhileTrue(shooter.SysIdDynamic(wpi::cmd::sysid::Direction::kForward));
|
||||
(driverController.NorthFace() && driverController.LeftBumper())
|
||||
(driverController.FaceUp() && driverController.LeftBumper())
|
||||
.WhileTrue(shooter.SysIdDynamic(wpi::cmd::sysid::Direction::kReverse));
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ void RobotContainer::ConfigureBindings() {
|
||||
return subsystem.ExampleCondition();
|
||||
}).OnTrue(ExampleCommand(&subsystem).ToPtr());
|
||||
|
||||
// Schedule `ExampleMethodCommand` when the Gamepad's East Face button is
|
||||
// Schedule `ExampleMethodCommand` when the Gamepad's Face Right button is
|
||||
// pressed, cancelling on release.
|
||||
driverController.EastFace().WhileTrue(subsystem.ExampleMethodCommand());
|
||||
driverController.FaceRight().WhileTrue(subsystem.ExampleMethodCommand());
|
||||
}
|
||||
|
||||
wpi::cmd::CommandPtr RobotContainer::GetAutonomousCommand() {
|
||||
|
||||
Reference in New Issue
Block a user