Commit Graph

8104 Commits

Author SHA1 Message Date
Peter Johnson
bfea2b7e1f [upstream_utils] Remove nlohmann JSON 2026-04-08 08:28:28 -07:00
Peter Johnson
3ac168f9d2 [upstream_utils] Add double-conversion to wpiutil 2026-04-08 08:28:28 -07:00
David Vo
44dcf9a3ca [wpilibc] Fix HSV to RGB conversion off-by-one error (#8722)
`Color::FromHSV` didn't match the Java `Color.fromHSV` in some saturated
edge cases, introducing an off-by-one error when the HSV color should
correspond complete saturation of one or two of the primary colors.

Example:

- Java: `Color.fromHSV(0, 255, 255) -> (255, 0, 0)`
- C++: `Color::FromHSV(0, 255, 255) -> (255, 1, 1)`

This also means the following methods are also transitively affected:

- `AddressableLED::LEDData::SetHSV`
- `LEDPattern::Rainbow`

This off-by-one error is introduced by a rounding error from the chroma
calculation, which was dividing by 256 rather than the appropriate
maximum value of 255 like in Java:


7ca35e5678/wpilibj/src/main/java/edu/wpi/first/wpilibj/util/Color.java (L176-L177)

Also port appropriate tests from Java to C++ to catch this bug.

I found this bug when I tried to port `AddressableLEDBuffer` to RobotPy.
Codex found the root cause :)
2026-04-08 08:18:12 -07:00
Tyler Veness
5b4769ea0a [upstream_utils] Upgrade to Sleipnir 0.5.1 (#8726)
There's changes to the diagnostic output and a performance improvement
for autodiff setup. I also updated Java's Options docs to more closely
match upstream.
2026-04-07 23:52:30 -07:00
Tyler Veness
719e9dddc0 [javac] Fix javadoc warnings (#8718)
```
> Task :javacPlugin:javadoc
/home/tav/frc/wpilib/allwpilib/javacPlugin/src/main/java/org/wpilib/javacplugin/OpModeAnnotationValidator.java:31: warning: invalid input: '<'
 *   <li>Name must be <= 32 characters
                      ^
/home/tav/frc/wpilib/allwpilib/javacPlugin/src/main/java/org/wpilib/javacplugin/OpModeAnnotationValidator.java:32: warning: invalid input: '<'
 *   <li>Group must be <= 12 characters
                       ^
/home/tav/frc/wpilib/allwpilib/javacPlugin/src/main/java/org/wpilib/javacplugin/OpModeAnnotationValidator.java:33: warning: invalid input: '<'
 *   <li>Description must be <= 64 characters
                             ^
3 warnings
```

These weren't caught by the `docs:generateJavaDocs` task because the
javacPlugin docs aren't included there.
2026-04-06 09:51:11 -06:00
Thad House
e4ef8a2515 [wpilib] Wait for expansion hub connected for up to half a second during boot (#8715)
Closes #8714
2026-04-06 09:50:47 -06:00
Tyler Veness
173ecd3d02 [hal] Refactor threads API (#8701)
Since sched_setscheduler() requires non-RT priorities to be 0, we can
use that as a sentinel value for disabling RT and condense the Java API
to just two functions with fewer parameters. The thread priority setter
is deprecated since only experts should use it.

The HAL Notifier thread priority setter was replaced with setting the
priority in the thread itself.

The C++ Notifier non-RT and RT constructors were deduplicated.

The real-time scheduler was changed from SCHED_FIFO to SCHED_RR, which
is SCHED_FIFO with threads allowed to run for a maximum time quantum
before yielding (100 ms by default).
2026-04-06 09:49:43 -06:00
David Vo
cc56c42d4c [ci] Avoid duplicate Windows debug build Bazel actions (#8723)
Each Bazel Windows CI job is currently redundantly evaluating the build
actions for both the `opt` and `dbg` compilation modes.

If we group the debug artifact builds together (instead of grouping by
the shared/static library artifacts), the `dbg` compilation mode actions
no longer need to be executed across multiple CI jobs in the matrix.

(Yes, the CI jobs are sharing the Bazel cache, but there's still
overhead in checking the action cache for each action. It's also
possible that two jobs will race to execute the same action.)

| Total actions per job      | [Before] | After |
|----------------------------|---------:|------:|
| Windows x86-64             |    12277 | 10179 |
| Windows x86-64 Static      |    11947 | n/a   |
| Windows x86-64 Debug       |   n/a    |  9895 |
| Windows ARM64              |     5518 |  3420 |
| Windows ARM64 Static       |     5304 | n/a   |
| Windows ARM64 Debug        |   n/a    |  3272 |
| Windows System Core        |     4836 |  2916 |
| Windows System Core Static |     4576 | n/a   |
| Windows System Core Debug  |   n/a    |  2916 |

[Before]:
https://github.com/wpilibsuite/allwpilib/actions/runs/23781230818

This should hopefully translate to shorter wall-clock time Windows CI
jobs.
2026-04-06 09:47:13 -06:00
Thad House
dfc8098b9c [wpiutil] Switch PackCallback to take a range (#8709)
This way it no longer needs something that is contiguous
2026-03-30 21:58:15 -07:00
Thad House
bf218113db [wpiutil] Rename CreateEvent and CreateSemaphore to Make (#8710)
CreateEvent and CreateSemaphore are macros in Windows.h, which causes a
ton of trouble. Just rename the functions.

Closes #7303

Replaces #7336
2026-03-30 15:54:42 -07:00
Tyler Veness
d248c040bf [wpimath] Add Sleipnir Java bindings (#8236)
The wrapper includes reverse mode autodiff, the Problem DSL, and the
optimal control problem API. I wrote it by directly translating the
upstream
[API](https://github.com/SleipnirGroup/Sleipnir/tree/main/include/sleipnir)
and [tests](https://github.com/SleipnirGroup/Sleipnir/tree/main/test) to
Java (i.e., copy-paste-modify).

I replaced the ArmFeedforward and Ellipse2d JNIs with implementations
using the Sleipnir Java bindings. Switching dev binary JNIs to release
by default sped up wpimath test runs from several minutes to 7 seconds.
2026-03-29 22:34:21 -07:00
Thad House
3e821b9448 [hal] Add low level support for Motioncore CAN buses (#8707)
This way vendors can easily access them.
2026-03-29 20:42:25 -07:00
Matt Morley
db42c6cbba [wpinet] Add mDNS discovery tests and fix mDNS JNI bugs (#8682)
In https://github.com/wpilibsuite/allwpilib/issues/8681 we discovered
that multicast service types need to be valid (end with _tcp or _udp),
or else errors are silently swallowed. Let's make our C++ unit test use
a valid name and also check that it works. I think if we
should/shouldn't do this is up for debate still.

I also discovered two bugs in the JNI code that lead to incorrect
results being returned
- Return array index was always 0
- Use of JLocal for the return value seems to mean that the array will
always be NULL in java
2026-03-29 20:41:32 -07:00
sciencewhiz
ceb712b089 [docs] Change NewCommands to Commands v2 (NFC) (#8702) 2026-03-29 20:40:36 -07:00
Thad House
d74644283b [wpilibc] Fix GetUsbId on ExpansionHub in C++ (#8704) 2026-03-29 20:40:06 -07:00
Tyler Veness
f3757bdeae [upstream_utils] Upgrade to Sleipnir 0.5.0 (#8711) 2026-03-29 20:39:18 -07:00
Thad House
962168acf1 [wpinet] Fix port having incorrect endian on windows resolver
For some reason, ip is in network order, but port is in host order.
2026-03-29 16:26:18 -07:00
Peter Johnson
dc4a8d572d [wpilibc] Fix DriverStation comment (NFC) 2026-03-21 00:37:28 -07:00
Peter Johnson
1925cf0e1f [wpilib] Rename LEDPattern constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
d05d3b1c78 [wpilib] Remove PWM.Period enum
Replace it with just numeric values.
2026-03-21 00:37:28 -07:00
Peter Johnson
f2929af00f [wpilib] Rename ADXL345_I2C constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
ea32c247db [wpilib] Rename PneumaticsModuleType constants 2026-03-21 00:37:28 -07:00
Peter Johnson
f060c98992 [wpilib] Rename drivetrain sim enums to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
a57d658ef1 [wpilib] Rename GenericHID and Gamepad enums to all caps
GenericHID.getSupportedOutputs(): Return EnumSet
Gamepad: Add Button-taking accessors
2026-03-21 00:37:28 -07:00
Peter Johnson
d86a745328 [wpilib] Rename DoubleSolenoid.Value constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
c5738fcbad [wpilib] Rename AddressableLED.ColorOrder constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
87e677d4af [wpilib] Rename MotorSafety constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
3776f8a1ef [wpilib] Rename OnboardIMU constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
e73e2e99f7 [wpilibj] SerialPort: update comments to track rename (NFC) 2026-03-21 00:37:28 -07:00
Peter Johnson
49065aa07f [wpilib] Rename CAN constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
38b9214e38 [wpilib] Rename PeriodicOpMode constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
09be21c319 [wpilib] Rename TimedRobot constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
48868020a9 [wpilib] Rename RobotDriveBase constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
7815248d62 [wpilib] Rename MotorType constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
6559d78658 [wpilib] Rename SysIdRoutineLog constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
8fa6976cb2 [wpilib] Rename EdgeConfiguration constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
5ec92df137 [wpilibj] Rename SensorUtil constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
8a802fd670 [wpilib] Rename private constants to all caps 2026-03-21 00:37:28 -07:00
Peter Johnson
b7122f0fda [hal] Rename HAL_kInvalidHandle to HAL_INVALID_HANDLE (#8698) 2026-03-21 00:34:46 -07:00
Peter Johnson
4e4ad9c498 [wpinet] Rename constants to all caps (#8696) 2026-03-20 23:02:21 -07:00
Gold856
0fc1f45324 [wpical] Remove tag ID limit (#8697)
It's annoying to have to update this, and we forgot for 2026.
2026-03-20 20:31:11 -07:00
Gold856
dba033eaee [hal] Clean up references to removed HAL features (#8695)
#7695, #7696, #7697, #7701, #7724, #7753, #7861 removed various features
from the HAL, but forgot to clean up the handles, the WS API, or both.
Additionally, since AnalogInput is the only remaining analog I/O,
AnalogJNI was renamed to the more specific AnalogInputJNI.
2026-03-20 16:50:02 -07:00
Gold856
f1aa84aecf [hal,wpilib] Remove MXP mentions in API docs (NFC) (#8694) 2026-03-20 16:48:53 -07:00
Thad House
fb4bcefabc [wpilibj] Allow passing DS Instance to Robot and OpModes (#8626)
Some discussion with the tech team showed that there were some real
advantages to being able to pass a 2nd type. It allows separating the DS
and Robot. Additionally, we can make the DriverStationBase class
actually usable instead of the existing DriverStation class which is
impossible to handle in intellisense because it has too much.

This won't fully be doable in C++, but we will need to implement
something similar in python.
2026-03-20 14:05:48 -06:00
Peter Johnson
b86204bf45 [wpiutil] Update Color.RGBChannel enum to all caps 2026-03-20 13:24:22 -06:00
Peter Johnson
410c11994e [wpiutil] Update MappedFileRegion MapMode enum to all caps 2026-03-20 13:24:22 -06:00
Peter Johnson
c5e32652f9 [wpiutil] Rename WPI_kInvalidFile to WPI_INVALID_FILE 2026-03-20 13:24:22 -06:00
Peter Johnson
4059797635 [hal,ntcore,cscore] Update Handle constants to all caps 2026-03-20 13:24:22 -06:00
Peter Johnson
aa88fa0fcf [wpiutil] Rename struct constants to all caps 2026-03-20 13:24:22 -06:00
Peter Johnson
c913b27a27 [wpiutil] Rename TimestampSource constants to all caps 2026-03-20 13:24:22 -06:00