Commit Graph

8224 Commits

Author SHA1 Message Date
Tyler Veness
f1d95ee5f8 [upstream_utils] Upgrade to Sleipnir 0.6.0 (#8923) 2026-05-27 21:26:42 -07:00
Jonah Snider
7ff32d7756 [epilogue,ntcore,wpiunits] Use pattern matching switch expressions where possible (#8925)
Use [pattern matching switch
expressions](https://docs.oracle.com/en/java/javase/17/language/pattern-matching-switch.html)
where possible. This is a JVM 21+ feature which wasn't available until
recently.

If you look at the Java bytecode, this improves performance from an O(n)
runtime check of literally each of the `if (x instanceof y)` checks to
instead be an O(1) tableswitch.

---------

Signed-off-by: Jonah Snider <jonah@jonahsnider.com>
2026-05-27 18:06:15 -07:00
Tyler Veness
aedee56e22 [upstream_utils] Add cbegin()/cend()/crbegin()/crend() to SmallVector (#8918)
std::vector has these.
2026-05-26 21:55:50 -07:00
Peter Johnson
ac7a9524f8 [wpigui] Add stdint.h include to PFD (#8920)
Needed for uint8_t.
2026-05-26 21:55:22 -07:00
Thad House
b100586cab [wpilib] Finish gamepad face button rename (#8921) 2026-05-26 21:55:07 -07:00
Tyler Veness
254ca64106 [upstream_utils] Upgrade to LLVM 22.1.6 (#8919) 2026-05-26 16:25:29 -07:00
Peter Johnson
1392db4529 [romi] Fix Romi motor support (#8915)
Since Servo has been removed from WPILib, add a RomiServo to replace it
(similar to XRPServo).

For Romi, move allocation of PWM channels to OnBoardIO since Motor and
Servo share channels.
2026-05-23 17:38:36 -07:00
Peter Johnson
40f9a87e70 [xrp] Fix motor support (#8916)
The protocol layer got out of sync with the rename to throttle.
2026-05-23 17:37:38 -07:00
Sam Carlberg
94fda36e04 [cmd3] Add trigger multi press and continuous bindings (#8901)
`Trigger.multiPress(N, T)` creates a trigger that fires when there are
at least N rising edges within the last T timespan, eg `multiPress(3,
Seconds.of(1.25))` for 3 rising edges within the last 1.25 seconds.

`Trigger.retryWhileTrue` and `retryWhileFalse` will continuously attempt
to schedule a command while the binding condition is met. This is
similar to `whileTrue` and `whileFalse`, but will reschedule the command
if it ends or is canceled while the binding condition is still met,
rather than requiring a new rising edge to reschedule it.
2026-05-23 16:51:45 -07:00
Sam Carlberg
f217dfe747 [cmd3] Make sideload functions scoped and improve docs (#8900)
Notably, this removes the ability to escape command scoping by using a
sideloaded function to schedule another command
2026-05-23 16:50:46 -07:00
crueter
d86378d353 [wpimath,wpiunits] Add PoundSquareInches MOI unit, and improve KilogramMetersSquaredPerSecond definition (#8838)
As discussed in the discord. lb-in^2 is the common imperial MOI unit,
e.g. Onshape uses it.

Also, improved the Java docstring for `KilogramMetersSquaredPerSecond`
to explain what it represents.

---------

Co-authored-by: Benjamin Hall <bhall@ctr-electronics.com>
2026-05-23 16:41:35 -07:00
Gold856
ac41523eb4 [ci] Run wpilibc through asan (#8868) 2026-05-23 16:40:32 -07:00
David Vo
d48f1cd0e5 [bazel] Add mrclib dependency (#8873)
This pulls in the `mrclib` maven repository as shared libraries, as a
prereq for #8858.

Alternative to #8869, which avoids the unnecessary lockfile entry. This
should be a one-to-one replacement for that PR.

Closes #8869

---------

Co-authored-by: PJ Reiniger <pj.reiniger@gmail.com>
2026-05-23 16:39:47 -07:00
Gold856
e88729c67e [ci] Start avahi-daemon in sentinel builds (#8914)
This fixes the mDNS test failures in the sentinel builds.
2026-05-23 15:39:22 -07:00
Daniel Chen
e35ca772fd [cmd3] Make Mechanism an interface (#8303)
Since there is no longer a requirement for Subsystems/Mechanisms to be
registered to the command scheduler via a register() call, Mechanism can
be changed to an interface instead to allow for more flexible
inheritance structures.

Specifically, this would allow compatibility with CTRE swerve (which
previously required implementing Subsystem so that it could extend
CTRE's base class).
2026-05-18 19:30:12 -05:00
Thad House
fa24446ce3 [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>
2026-05-15 00:08:57 -05:00
Thad House
67b795057b [build] Add arm64 MSVC Runtime (#8840) 2026-05-15 00:06:18 -05:00
sciencewhiz
e4ae671b49 [ci] Add CI spelling check and fix spelling errors (#8882)
reviewdog/action-misspell is used on frc-docs. It has a dictionary of
commonly misspelled words, so it has less false positives then other
tools.
2026-05-14 21:55:02 -07:00
David Vo
f751ca88eb [bazel] Enforce up-to-date lock file in CI (#8860)
The Bazel lock file was missing a few dependencies. This adds a check in
CI that the lock file is up-to-date.
2026-05-14 21:54:04 -07:00
PJ Reiniger
6ba5734a94 [robotpy] Add wrapper for timestamp functions, like SetNowImpl (#8889)
`SetNowImpl` is used somewhat often in unit tests. It is a little bit
goofier to wrap because it takes a C function, so a little bit more work
has to be done to get that wrapped in pybind.

Claude helped.
2026-05-14 21:53:26 -07:00
PJ Reiniger
68d24bb29e [python] Improve robotpy generation (#8867)
The initial build file generation for robotpy projects was relatively
naive and purpose built to get `allwpilib` compiling, without supporting
all the available features.

This modifies the generation scripts to be able to support multiple
embedded libraries, which will be necessary for #8858, since `mrclib.so`
will need to be bundled along with the hal libraries. In addition some
cleanup was done to get the wheels looking more like what is in pypi.
2026-05-14 21:52:39 -07:00
Thad House
3f1cf3cabe [wpilib] ExHub Follower Fixes (#8892)
A chunk of updates to followers on Expansion Hub

Fixes followers not implicitly enabling.
Allows followers to follow other followers
Throws exceptions on construction if a follower cycle is detected.
Allows reversing followers.

The enable thing will fix
https://github.com/wpilibsuite/SystemcoreTesting/discussions/259#discussioncomment-16886195

Closes #8843

Depends on https://github.com/wpilibsuite/scservices/pull/30
2026-05-14 21:50:38 -07:00
Jade
b91001f504 Add nix files to gitignore (#8894)
Based on discord comments I assume we don't want to support a Nix shell
or flake for use with building allwpilib so we should just ignore these
files so users can have their own
2026-05-14 21:49:01 -07:00
Thad House
ffd36eb091 [developerRobot] Add an OpModeRobot instance to DeveloperRobot (#8891)
You can switch to it just by switching Main.java
2026-05-14 21:48:09 -07:00
crueter
97c0b0c40a [upstream_utils] Patch LLVM SmallSetIterator for AppleClang 21 (#8877)
Signed-off-by: crueter <crueter@eden-emu.dev>
2026-05-08 12:49:47 -07:00
sciencewhiz
16fcf016de [examples] Update command template names with v2 to disambiguate (NFC) (#8875)
Partially addresses wpilibsuite/vscode-wpilib#876
2026-05-08 09:34:52 -07:00
Ryan Blue
878da3d54c [cmd3] Fix StateMachineTest (#8876) v2027.0.0-alpha-6 2026-05-07 21:42:16 -07:00
Sam Carlberg
1021ff88a9 [cmd3] Add a declarative state machine API on top of commands v3 (#8297)
This provides an API for writing a finite state machine compatible with
the commands v3 framework. Individual states in the state machine are
wrappers around command objects (which may themselves be state
machines). Transitions between states are defined with a staged builder
DSL similar to command builders, and uses `@NoDiscard` to catch
partially configured transitions.

The FSM API is meant to handle highly complex cases that the fluent
command chaining DSL and coroutine-based imperative commands cannot
easily represent; specifically, where a command sequence may want to go
back to an arbitrary previous state or skip forward to an arbitrary
future state.

Here's an example from the design doc for a command that will drive to a
known scoring location, aim at a scoring target, and repeatedly shoot
balls until a storage hopper is empty. It also has conditions to stop
shooting and move back to the scoring location if it's jostled away, and
then automatically resume firing.

```java
public Command autoWithStateMachine() {
  // Declare the state machine
  StateMachine stateMachine = new StateMachine("Auto With State Machine");

  // Define states
  State getInPosition = stateMachine.addState(drivetrain.driveToScoringLocation());
  State aiming = stateMachine.addState(turret.aimAtGoal());
  State scoring = stateMachine.addState(shooter.fireOnce());
  State celebrating = stateMachine.addState(leds.celebrate());

  // Set the initial state. Neglecting this will cause a runtime exception when the state machine starts.
  // Teams using the WPILib compiler plugin will get a compiler error if they do not set this
  stateMachine.setInitialState(getInPosition);

  // Switch to aiming when we reach the scoring location.
  getInPosition.switchTo(aiming).whenComplete();
  // Set the swerve wheels in an X shape after reaching the scoring location to resist being pushed away.
  getInPosition.onExit(() -> Scheduler.getDefault().fork(drivetrain.setX()));

  // Then start scoring once the turret is aimed at the goal.
  aiming.switchTo(scoring).when(turret::aimedAtGoal);

  // Loop the scoring state as long as the hopper has a ball.
  scoring.switchTo(scoring).whenCompleteAnd(() -> hopper.hasBall());

  // Automatically interrupt any part of the aiming or scoring sequence if
  // the robot is moved away from the scoring location and move back into position.
  stateMachine.switchFromAny(aiming, scoring).to(getInPosition).when(atScoringLocation.negate());

  // Start celebrating once the final ball has been scored.
  scoring.switchTo(celebrating).whenCompleteAnd(() -> !hopper.hasBall());

  return stateMachine;
}
```

A compiler check is added to detect object construction that's not
followed by post-construction initializer methods (as defined by the
class by placing `@PostConstructionInitializer` on such methods).
`StateMachine.setInitialState` uses this to detect team code that
creates a state machine but does not set its initial state.
2026-05-07 20:08:09 -07:00
Thad House
0af65ea787 [sim] Make HalSim DS extension a no-op (#8872)
This way this doesn't crash until we get real support added.
2026-05-07 20:04:37 -07:00
Gold856
8832d6a7c2 [sim] GUI: Fix game message string lifetime (#8874)
Fixes an issue where game data can't be set.
2026-05-07 20:03:28 -07:00
Sam Carlberg
62e0bc515c [cmd3] Add rising and falling edge trigger factories (#8366)
`Trigger.getAsBoolean()` behavior has been changed from passing through
the underlying boolean supplier to returning the latest cached signal as
determined by the most recent call to `poll()`. This allows rising and
falling edge triggers to have a consistent return value over an entire
polling cycle, rather than only being high for the _first_ check in a
cycle.

Closes #8309
2026-05-07 16:32:34 -07:00
Charlotte Wilson
5964443038 [romi,xrp] Print IP and port of XRP/Romi (#8560)
Closes #6352
2026-05-07 11:10:01 -06:00
project516
8c5c535e1b [ci] bump sccache-action to v0.0.10 (#8839)
GitHub will force actions to run on node 24 on September 16th, 2026:
https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

sccache-action v0.0.9 which is present does not support node 24

sccache-action v0.0.10 adds support:
https://github.com/Mozilla-Actions/sccache-action/releases/tag/v0.0.10
2026-05-07 11:03:09 -06:00
PJ Reiniger
4c07aedd91 [wpilib][sim] Add Onboard IMU Sim (#8855)
This provides the ability to simulate parts of the Onboard IMU at the
HAL level. This allows team to use and simulate the IMU in code, and a
follow up PR could be made to the halsim_gui to add a new widget to view
and modify the data graphically.

Since the C++ IMU uses radians for angles that is what I did for the
simulator.

Partially deals with #8845
2026-05-07 11:01:26 -06:00
Peter Johnson
3d4cabfbc9 [ci] Update for merge from 2027 to main (#8857)
Keep -Pbuild2027 for combine for now.
2026-05-07 10:59:25 -06:00
Thad House
63a82dccb2 [wpilib] Don't do wait on init for ExHub in sim (#8865)
Closes #8859
2026-05-07 10:58:14 -06:00
crueter
b10bc0a674 [ci] Don't check matrix.os when runner.os suffices (#8863)
There's no real need to manually check the `runs-on`, as `runner.os`
provides a universally identifiable string for checking this anyways.

Signed-off-by: crueter <crueter@eden-emu.dev>
2026-05-06 17:30:50 -07:00
Gold856
e40ca392c3 [ci] Add missing labels and format labeler config (#8795) 2026-05-05 22:10:42 -07:00
Gold856
f97571fb1f [sim] GUI: fix memory corruption and incorrect POV count (#8853)
Fixes #8800 and fixes #8801.
2026-05-05 22:05:53 -07:00
Peter Johnson
d23c732d79 [upstream_utils] Update imgui to 2026-05-04 (#8849)
This fixes ImGuiInputTextFlags_EnterReturnsTrue.
2026-05-05 22:01:27 -07:00
Dan Katzuv
063ac7002f [ci] Remove 2027 from labeler configuration (#8852) 2026-05-05 16:51:52 -07:00
Peter Johnson
e76074d381 [hal] Initialize alert on Systemcore (#8848) 2026-05-05 13:44:01 -07:00
Tyler Veness
6f88066170 [ci] Update default branch to main (#8846)
This fixes the lint/format CI.
2026-05-03 12:14:27 -07:00
Gold856
3fddf71c47 [build] Remove Javadoc fonts (#8837)
Javadoc now includes 4 MB of fonts for every Javadoc JAR, which we have
18 of, which causes unnecessary bloat to the installer size. This
disables the inclusion of those fonts, using the built-in fallback
included in the Javadoc stylesheet. This also increases the default font
size by 10% after polling the FTC Discord resulted in people asking for
a bigger font.
v2027.0.0-alpha-5
2026-04-29 14:57:31 -07:00
Gold856
668124e0fd [build] Compress shared object debug info (#8835)
This saves a huge amount of space when they're unzipped for robot
projects, while not increasing artifact size.
2026-04-29 12:14:11 -07:00
Thad House
433c7f00ad [wpilib] Fix jar loading in folder with spaces (#8836) 2026-04-29 12:11:19 -07:00
Thad House
94443c8e84 [wpilib] Fix OpModeRobot initialization (#8834)
There were 3 cases failing before.

1. An OpModeRobot with no annotation.
2. An OpModeRobot with an annotation but a parameterless constructor.
3. An OpMode with a UserControls constructor

This PR solves both of these issues. The first one is solved by adding
the null check before setting the user controls instance. That one will
never have an opmode instance.

The second one is solved by falling back to a parameterless constructor
if one with a parameter is not found.

The 3rd one is solved by using the annotation type rather than the
instance for constructor lookup.

Also fixes ExpansionHubSample's missing annotations.
2026-04-28 12:54:10 -07:00
Gold856
3bf67edc34 [build] Refactor zip base name generation for consistency (#8831)
Right now, the `zipBaseName` variable in various publish.gradle files
contains the group ID and artifact ID for use by the combiner, however,
they are also duplicated in `artifactGroupId` and `baseArtifactId`,
leading to potential mistakes if they aren't updated together. This
fixes that by adding a new utility function `makeZipBaseName` to
automatically create the right name given a group ID and artifact ID.
This also fixes publishing for thirdparty subprojects, which didn't
update `zipBaseName`.
2026-04-27 11:46:11 -07:00
sciencewhiz
29beacbefe Fix some Test Mode references to Utility (NFC) (#8827) 2026-04-26 22:32:50 -07:00
Gold856
8d30131fce [build] Update native-utils, OpenCV, libssh (#8818) 2026-04-26 22:31:14 -07:00