Commit Graph

8202 Commits

Author SHA1 Message Date
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
Kevin Cooney
657d4d9b58 [ntcore,wpilib] Fix tsan errors in tests that add NT listeners (#8713) 2026-04-26 16:40:46 -07:00
Gold856
97d0b15f7d Add README files for some subprojects and update various other docs (#8640)
Adds a section on design philosophy so we have something to point to
when people suggest features that aren't compatible with the way WPILib
is designed. Fixes some missed reorg changes (although the native-utils
link intentionally points to main as to be up-to-date in the future) and
generally cleans up any outdated information. Also includes wording
about supporting FTC. Per discussion in Slack, the LabVIEW wording has
been removed, and anything to do with LabVIEW is going to have to be
NI's job. And pursuant to #2757 and #5331, additional (light) developer
documentation has been added to some subprojects, mostly being a quick
summary of the what the project does and what it's for (or not for).

---------

Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2026-04-26 16:39:26 -07:00
PJ Reiniger
a695865781 [bazel] Update copybara scripts (#8822)
I've been running my copybara syncs from this branch for a long time.
Finally deciding to PR it.

The biggest update was due to `mostrobotpy` absorbing the commands,
examples, and pyfrc libraries, but I also added in hooks to "enable" the
flakey `xfail` tests on the allwpilib side, and the ability to run
verbose or force push updates.
2026-04-26 15:14:58 -07:00
sciencewhiz
c511fcc160 Update a few misc FRC references (NFC) (#8824) 2026-04-26 15:09:14 -07:00
PJ Reiniger
e5980b46ef [copybara] Sync with mostrobotpy (#8820)
GitOrigin-RevId: f03f29e57af22a74b680873090028b9c9f5c8063
2026-04-26 08:25:15 -07:00
Tyler Veness
af7d68e993 [wpiutil] Use C++23 stacktrace library on Windows (#6839)
This lets us remove the unmaintained StackWalker library and its hacky
upstream_utils script.

@Gold856 reported that StackWalker gives blank stacktraces:
https://discord.com/channels/176186766946992128/368993897495527424/1261940029287301150.
They also reported an earlier version of this PR giving the following
stacktrace instead:
```
D:\allwpilib\developerRobot\src\main\native\cpp\Robot.cpp(18): developerRobotCpp!Robot::RobotInit+0xB6
D:\allwpilib\wpilibc\src\main\native\cpp\TimedRobot.cpp(22): wpilibcd!frc::TimedRobot::StartCompetition+0x4F
D:\allwpilib\wpilibc\src\main\native\include\frc\RobotBase.h(36): developerRobotCpp!frc::impl::RunRobot<Robot>+0xC8
D:\allwpilib\wpilibc\src\main\native\include\frc\RobotBase.h(106): developerRobotCpp!frc::StartRobot<Robot>+0x17E
D:\allwpilib\developerRobot\src\main\native\cpp\Robot.cpp(60): developerRobotCpp!main+0xB
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(79): developerRobotCpp!invoke_main+0x39
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(288): developerRobotCpp!__scrt_common_main_seh+0x132
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(331): developerRobotCpp!__scrt_common_main+0xE
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp(17): developerRobotCpp!mainCRTStartup+0xE
KERNEL32!BaseThreadInitThunk+0x1D
ntdll!RtlUserThreadStart+0x28
```
2026-04-26 00:15:39 -07:00
sciencewhiz
880cfd60c4 Update vendordeps wpilibYear to alpha 5 (#8817) 2026-04-25 21:15:54 -07:00
Thad House
a3968faa57 [examples] Add an ExpansionHubSample example (#8810) 2026-04-25 15:43:24 -07:00
sciencewhiz
6aa1611959 [examples] Add a Hatchbot Commands v3 example (#8809)
This is adapted from the work that @Starlight220 did here:
https://github.com/SamCarlberg/allwpilib/pull/5

---------

Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2026-04-25 15:06:26 -07:00
Gold856
35e8abedeb Don't force public variables to use Hungarian notation (#8774)
People generally have expressed a dislike for the Hungarian notation
used in member variables, especially in examples/templates, and our
styleguide shouldn't be forced on downstream consumers, so this removes
all Hungarian notation from the examples/templates.

There are _some_ benefits to Hungarian for private member variables
(like knowing what's a member vs. local in a PR review) so we'll keep
private member variables the same for now, but public variables should
no longer use Hungarian notation, since it looks much worse. A new PMD
XPath rule has been added to accomplish this goal. Some other
non-compliant variables were fixed for the new rule.
2026-04-25 11:32:08 -07:00
PJ Reiniger
e7e51c9c05 [bazel][ci] Add CI action to generate pregen patch (#8816)
There were complaints about no patch files being created from CI when
the examples pre-gen fails for people who don't build with bazel. This
adds a new action step to run just the non-robotpy pregen.

I also added an argument to the diff tests to make it a unified diff,
which might make it easier to hand fix.
2026-04-25 11:06:02 -07:00
David Vo
2edef821f9 [bazel] Colocate Doxygen version declarations (#8806)
Since we currently have both a Bazel build and Gradle build, we need to
keep the Doxygen versions in sync between the two.


40188d9cc6/docs/build.gradle (L71)

It's awkward that these are in very disjoint parts of the repo. This
puts them in the same directory so it's more obvious it should be kept
in sync.
2026-04-24 20:06:15 -07:00
Zach Harel
3bf3060ff5 [wpilib] Separate ExpansionHubServo into separate Servo and CRServo classes (#8770)
This removes the confusion of the `ExpansionHubServo` class serving both
purposes, and thus having a `set` method that functions as `setPosition`
when in servo mode and `setThrottle` when not in continuous mode. It
also removes the `setContinuousRotationMethod` which could be confused
for a method that switches the actual servo firmware itself from servo
to continuous mode, which is not a thing that is physically possible I
think.

---------

Signed-off-by: Zach Harel <zach@zharel.me>
2026-04-24 20:03:24 -07:00
Alan Everett
ded1937fcf [build] Update QuickBuffers to 1.3.3 for Bazel builds (#8811)
Continuation of #6072, this fixes a cross-project bug in QuickBuffers.
Needed for #8776.
2026-04-24 19:21:19 -07:00
Zach Harel
a6425d3e1e [wpilib] DriverStation: Add usage reporting for opmodes (#8761) 2026-04-24 19:20:45 -07:00
PJ Reiniger
68a8ebfc81 [robotpy] Fixup problems during stubgen (#8781)
Part of the `semiwrap` process that hasn't been ported over yet is
generating pyi stubs. It is possible to not have your semiwrap setup
correctly and "leak" native types into the generated python docstrings,
which causes the process to
[fail](https://github.com/pjreiniger/mostrobotpy/actions/runs/24618640845/job/71985311682#step:12:3652).
semiwrap also has a tool you can run, 'create-imports' that will read
the symbols from a build pybind library and automatically create and
sort the imports in the `__init__.py` file. This step is not enforced by
CI, which is why it hasn't been failing in `mostrobotpy` land.

This PR fixes the stubgen problems and runs reorganizes the imports. I
will have a follow up PR that can bring these automatically into the
build system after this lands. I'd do a fancy new `gh stack` but I can't
figure out if it works on forks.
2026-04-24 14:59:31 -07:00
Peter Johnson
d539e06b4f [wpinet] DsClient: Use new port which provides IP in dotted quad format (#8807) 2026-04-24 13:15:07 -07:00
David Vo
163cfaa027 [ci] Enable Bazel colored output (#8808) 2026-04-24 13:14:34 -07:00
Peter Johnson
40188d9cc6 [glass] Plot: Fix weight and marker settings (#8805)
Line weight needed to default to 1.0.
Marker added an "auto" setting and now starts at -2.

Fixes #8802.
2026-04-24 08:03:16 -07:00
Peter Johnson
a8b827af54 [wpigui] Rename ini setting from userScale to userScaling (#8804)
This avoids very small text resulting from an upgrade.
2026-04-24 08:02:56 -07:00
Peter Johnson
5703f608d7 [wpiutil] Struct: fix is_constexpr check in constexpr functions (#8798)
Capturing the info parameter pack explicitly is required for the
is_constexpr check to work.

Add some basic tests.

Fixes #8789.
2026-04-24 08:02:27 -07:00
Gold856
d893d44e37 [wpimath] Mark all geometry classes as final (#8790)
In Java, these are likely to become value classes in the future.

Make C++ final for consistency.
2026-04-23 22:55:54 -07:00