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:
@@ -19,7 +19,7 @@ import org.wpilib.units.measure.Time;
|
||||
/**
|
||||
* Triggers allow users to specify conditions for when commands should run. Triggers can be set up
|
||||
* to read from joystick and controller buttons (eg {@link
|
||||
* org.wpilib.command3.button.CommandGamepad#southFace()}) or be customized to read sensor values or
|
||||
* org.wpilib.command3.button.CommandGamepad#faceDown()}) or be customized to read sensor values or
|
||||
* any other arbitrary true/false condition.
|
||||
*
|
||||
* <p>It is very easy to link a button to a command. For instance, you could link the trigger button
|
||||
|
||||
@@ -50,98 +50,98 @@ public class CommandGamepad extends CommandGenericHID {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the South Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the South Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Down button's digital signal attached to the
|
||||
* {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the scheduler
|
||||
* passed to the controller's constructor, or the {@link Scheduler#getDefault default
|
||||
* scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #southFace(EventLoop)
|
||||
* @see #faceDown(EventLoop)
|
||||
*/
|
||||
public Trigger southFace() {
|
||||
return southFace(getScheduler().getDefaultEventLoop());
|
||||
public Trigger faceDown() {
|
||||
return faceDown(getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the South Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the South Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Down button's digital signal attached to the
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger southFace(EventLoop loop) {
|
||||
public Trigger faceDown(EventLoop loop) {
|
||||
return button(Gamepad.Button.SOUTH_FACE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the East Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the East Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Right button's digital signal attached to the
|
||||
* {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the scheduler
|
||||
* passed to the controller's constructor, or the {@link Scheduler#getDefault default
|
||||
* scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #eastFace(EventLoop)
|
||||
* @see #faceRight(EventLoop)
|
||||
*/
|
||||
public Trigger eastFace() {
|
||||
return eastFace(getScheduler().getDefaultEventLoop());
|
||||
public Trigger faceRight() {
|
||||
return faceRight(getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the East Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the East Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Right button's digital signal attached to the
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger eastFace(EventLoop loop) {
|
||||
public Trigger faceRight(EventLoop loop) {
|
||||
return button(Gamepad.Button.EAST_FACE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the West Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the West Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Left button's digital signal attached to the
|
||||
* {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the scheduler
|
||||
* passed to the controller's constructor, or the {@link Scheduler#getDefault default
|
||||
* scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #westFace(EventLoop)
|
||||
* @see #faceLeft(EventLoop)
|
||||
*/
|
||||
public Trigger westFace() {
|
||||
return westFace(getScheduler().getDefaultEventLoop());
|
||||
public Trigger faceLeft() {
|
||||
return faceLeft(getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the West Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the West Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Left button's digital signal attached to the
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger westFace(EventLoop loop) {
|
||||
public Trigger faceLeft(EventLoop loop) {
|
||||
return button(Gamepad.Button.WEST_FACE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the North Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the North Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Up button's digital signal attached to the
|
||||
* {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the scheduler
|
||||
* passed to the controller's constructor, or the {@link Scheduler#getDefault default
|
||||
* scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #northFace(EventLoop)
|
||||
* @see #faceUp(EventLoop)
|
||||
*/
|
||||
public Trigger northFace() {
|
||||
return northFace(getScheduler().getDefaultEventLoop());
|
||||
public Trigger faceUp() {
|
||||
return faceUp(getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the North Face button's digital signal.
|
||||
* Constructs a Trigger instance around the Face Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the North Face button's digital signal attached to the
|
||||
* @return a Trigger instance representing the Face Up button's digital signal attached to the
|
||||
* given loop.
|
||||
*/
|
||||
public Trigger northFace(EventLoop loop) {
|
||||
public Trigger faceUp(EventLoop loop) {
|
||||
return button(Gamepad.Button.NORTH_FACE.value, loop);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user