Commit Graph

8293 Commits

Author SHA1 Message Date
Sam Carlberg
ffd371cbf8 [cmd3] Add example and template projects for commands v3 and make hatchbot example idiomatic (#8887)
The `command3` example project contains a program that could plausibly
play in the 2026 rebuilt game. It includes nested mechanisms (`Intake`
has an inner `IntakeWrist` and `IntakeRoller` and is similar to the v2
superstructure concept), swerve drive with localization and path
following (albeit stubbed for sake of example), opmodes and
opmode-scoped commands, and command-scoped triggers.

The template projects are basic skeletons. The larger template includes
a basic command that just increments and prints a counter variable every
time it runs.

The hatchbot v3 example has been refactored to be more idiomatic:
- `RobotContainer` removed
- "Subsystem" names in packages, comments, and classes has been replaced
with "Mechanism"
- Some v2-specific comments and structures have been reworded or deleted
- The Drive mechanism now provides commands for arcade drive and driving
a distance, instead of exposing public methods that write directly to
hardware (which broke encapsulation and made it possible to issue
conflicting hardware requests)
2026-06-21 20:10:53 -07:00
Thad House
8444a58640 [wpilib,cmd] Add expanded game controller list (#8959)
Extension of #8957
2026-06-21 19:37:32 -07:00
PJ Reiniger
4a2cd3e5d0 [robotpy] Run wpiformat on non-python robotpy files (#8362)
This turns the styleguide on for the non-python robotpy files.

The overwhelming amount of changes were
related to whitespace, followed by some IWYU for standard library
headers.
2026-06-21 19:36:03 -07:00
PJ Reiniger
6bc7051e23 [robotpy] Port more wpilibc tests to python (#8903)
I tasked Claude with converting the existing C++ tests to python for
wpilib. I gave it a decent review for comparison to the existing tests,
and it seems to have covered everything. I did do some small cleanup in
a couple of places. One notable test that is missing is the LED
patterns, but that is getting handled in
[mostrobotpy](https://github.com/robotpy/mostrobotpy/pull/254) land.
2026-06-21 19:33:50 -07:00
PJ Reiniger
45d4ed5bca [wpilibc] Change DriverStationSim to use a C++ enum for alliance station (#8991) 2026-06-21 19:29:19 -07:00
Peter Johnson
af91ba39f2 [glass,sim] Add sim GUI support for DS display (#8998) 2026-06-21 19:27:02 -07:00
Peter Johnson
c3fe63b2f7 [hal] Translate unit tests to catch2 (#9003) 2026-06-21 19:26:10 -07:00
Peter Johnson
912938b434 [tools] Translate unit tests to catch2 (#9006) 2026-06-21 19:24:30 -07:00
Peter Johnson
edbf2db5a7 [sim] Translate unit tests to catch2 (#9004) 2026-06-21 19:13:33 -07:00
Satchit Kulkarni
678176cd3c [wpimath] Add drivetrain anti-tipping utility (#8787)
Resolves #8587

This PR implements the requested anti-tipping utility and refactors the
math to correctly adhere to the NWU coordinate system.

**Key Changes:**
* Fixed the axis mapping: Positive pitch now correctly maps to a forward
tip (+X), and positive roll maps to a rightward tip (-Y).
* Inverted the proportional control logic: The correction vector now
applies a positive `kP` to drive *into* the direction of the fall to get
the wheels back under the center of gravity, rather than driving away
from it.
* Added a comprehensive JUnit test suite (`AntiTippingTest.java`) to
verify the calculated `ChassisSpeeds` correctly zero out the orthogonal
axis and provide the correct positive/negative velocity across all four
tipping directions.

Tested locally against `testDesktopJava` and passes all style/formatting
guidelines.

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 19:11:48 -07:00
Tyler Veness
d4f89c11c3 [wpimath] Use triangular solves to compute UKF Kalman gain (#9009) 2026-06-21 15:09:34 -07:00
Peter Johnson
7298d9eafb [wpinet] Unit tests: use UNSCOPED_INFO in several places (#9007) 2026-06-21 13:52:38 -07:00
Peter Johnson
7dcb70cfcd [datalog] Translate unit tests to catch2 (#9002) 2026-06-21 13:51:49 -07:00
Peter Johnson
3d6df4a50e [apriltag] Translate unit tests to catch2 (#9001) 2026-06-21 13:50:11 -07:00
Peter Johnson
50eab65b07 [cscore] Translate unit tests to catch2 (#8999) 2026-06-21 13:49:07 -07:00
Thad House
f1c9d82d50 [hal,wpilib] Add DS Display API (#8975) 2026-06-20 10:28:24 -07:00
Tyler Veness
481a586009 [upstream_utils] Upgrade to Sleipnir 0.6.2 (#8996) 2026-06-19 20:16:03 -07:00
Peter Johnson
396b553069 [wpinet] Translate unit tests to catch2 (#8954) 2026-06-19 19:49:50 -07:00
PJ Reiniger
cfab47e871 [bazel] Improve vendored deps, make libssh vendored (#8948)
TL;DR: kill https://github.com/wpilibsuite/bzlmodRio-libssh, update
versions, and make things easier for a script to update.

The main motivation behind this was that libssh was out of date with the
gradle version. Using these "external" dependencies can cause agita as
we churn through toolchain updates. Unlike the toolchains and opencv,
which can be used by external users (i.e. a all bazel robot, if a vendor
wanted to use bazel) a C++ wrapper around libssh maven deps almost
certainly wouldn't be pulled in, much like ceres and mrclib.

As a result of vendor'ing libssh, and knowing some potential pitfalls
and annoyances, this PR does the following:
- Vendor libssh, akin to how mrclib is pulled in
- Moves the vendor'd ceres to `shared/bazel/thirdparty`, and refactors
it to better match mrclib. To me it doesn't necessarily belong in its
`thirdparty` location because it is bazel only.
- Due to the refactoring, libssh and ceres can now be pulled into
`MODULE.bazel` instead of the `WORKSPACE.bzlmod` helper. This is good
prep for a potential upgrade to killing `--enable_workspace` / bazel 9
- Write a python script that can deal with the integrity / sha256 of the
http_archives. I suggested this be added to davo's mrclib PR, but this
one is a little bit more robust and will actually edit the files in
place. This makes upgrading versions substantially easier.
- Upgrade libssh version to what gradle is using, and mrclib to the
version in #8858. These changes have been tested against that PR.
2026-06-19 15:25:07 -07:00
Dan Katzuv
637f006f9b [ci] Build Javadoc with JDK 26 for dark theme support (#8842) 2026-06-19 15:24:13 -07:00
Peter Johnson
608f024f82 [ntcore] Add PubSubOption to disable handle signaling (#8972)
This helps reduce lock contention on Synchronization Signal objects if
the user does not intend to use this signaling path.

Use this option on the RobotBase MultiSubscriber to all topics.
2026-06-19 15:17:37 -07:00
Thad House
8d2f3212e7 [wpilib,cmd2] Fix up issues with generated gamepads (#8985)
There were a few issues with the generated classes.

Python had a __getattr__ forwarder that we defintely did not want.
C++ was using a struct with constexpr values, and not an enum class for
button types.
In all 3, the forwarders from gamepad didn't exist on the generated
types.

This fixes all 3.

---------

Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2026-06-19 14:53:41 -07:00
Thad House
0b950ea6d9 [wpilibj] Crash robot program if an exception occurs during opmode construction (#8982)
There's essentially nothing the user can do here, other then switch
opmodes. It will make it clearer that something is very wrong.
2026-06-19 14:51:46 -07:00
Tyler Veness
ad797456f5 [ci] Upgrade to wpiformat 2026.64 (#8993) 2026-06-19 08:40:55 -05:00
Tyler Veness
e92478c212 [upstream_utils] Upgrade to Catch2 3.15.1 (#8994) 2026-06-19 08:40:13 -05:00
Thad House
0662a78892 [sim] GUI: Fix buttons starting at 1 instead of 0 (#8987)
Closes #8986
2026-06-17 14:39:14 -06:00
Benjamin Hall
c35df58a81 [wpilibc] Change DriverStationSim to use wpi::hal::RobotMode (#8988)
The `RobotState::GetRobotMode()` API returns this enum class, but
`DriverStationSim` was using the `HAL_RobotMode` enum instead. This
commonizes the two APIs to return the same `RobotMode` enum class.

This difference in the APIs also affected Python, as the `hal.RobotMode`
and `hal._wpiHal._RobotMode` types are not compatible with each other.
2026-06-17 14:38:13 -06:00
Thad House
5a7d7d50ee [wpilib,cmd] Remove Axis from Gamepad Triggers (#8956)
It's a bit confusing, especially since some controllers will have this be
a 0:1 button rather than axis.
2026-06-12 06:42:06 -07:00
Thad House
d6fb871a26 [ci] Build bazel builds in docker (#8978)
Needed for mrclib, as mrclib is built on a trixie image.
2026-06-12 05:59:21 -07:00
Thad House
489b993e60 [hal,wpilib] Switch CANBusMap to Enum, use it for CAN API (#8977)
Will make it easier to solve
https://github.com/wpilibsuite/SystemcoreTesting/issues/286
2026-06-11 16:14:40 -07:00
Thad House
97381549e6 [wpilib,cmd] Add new generation for gamepads (#8957)
SDL makes these schemas much simpler, so its easier to support more
controllers.
2026-06-11 16:06:45 -07:00
Thad House
025732093f [wpilib] Remove UserControls (#8973)
It was too complex, and we can solve it by figuring out how to make
singleton GenericHID objects, implemented in #8970.
2026-06-11 15:33:51 -07:00
Thad House
c647e67de0 [wpilib,cmd] Cache HID wrappers (#8970)
Store DriverStation-owned GenericHID and Gamepad instances in Java and
C++, and expose the cached objects to Python bindings.

Move hand-written command gamepad and joystick wrappers to compose
cached CommandGenericHID instances plus typed HID wrappers, including a
Python CommandGamepad.

This will let us remove UserControls, while helping ensure that we don't
have state smashing between GenericHID objects.

Another bonus is without inheritance, intellisense will no longer show a
bunch of annoying methods, and instead just what actually exists.

---------

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2026-06-11 09:42:39 -07:00
Zach Harel
fe499ede4c [build] Update avaje to 3.14 (#8974)
This fixes inherited and generic fields and getters.

Signed-off-by: Zach Harel <zach@zharel.me>
2026-06-10 23:50:01 -07:00
Gold856
3f966aa7c6 Clean up unused includes (#8950) 2026-06-09 22:16:26 -07:00
Thad House
72d85be0c2 [ntcore] Add API to get and set user data on NT_Topic (#8962)
Theres many uses where we need to attach data to a topic, and doing it
this way can make it really easy and efficient.
2026-06-08 19:24:15 -07:00
PJ Reiniger
111130d8bb [copybara] Sync with robotpy (#8964)
GitOrigin-RevId: 9dff8f977401e78be0bb6f39cea2328320ab2d95
2026-06-08 19:22:48 -07:00
Thad House
0213ecf382 [build] Update native utils, to switch to new compilers (#8966) 2026-06-08 19:21:33 -07:00
Zach Harel
bdd45c7365 [cmd2] Move .cpp files to subproject source root (#8967)
This matches all of the other subprojects.

Signed-off-by: Zach Harel <zach@zharel.me>
2026-06-08 19:20:48 -07:00
David Vo
44501bf5eb [bazel] Update rules_cc with patches (#8969)
@AustinSchuh's `rules_cc` patches have all been merged upstream. This
updates `rules_cc` to include the relevant patches, removing the need to
patch it here.

This also squashes this warning on every build:

> WARNING: For repository 'rules_cc', the root module requires module
version rules_cc@0.2.13, but got rules_cc@0.2.14 in the resolved
dependency graph. Please update the version in your MODULE.bazel or set
--check_direct_dependencies=off
2026-06-08 19:20:03 -07:00
Thad House
1be5da5bde [wpiutil] Fix Handle.hpp not including cstddef (#8965) 2026-06-07 16:08:11 -07:00
Thad House
06fb36ba8e [hal] Switch IMU to mrclib (#8961) 2026-06-06 16:30:08 -07:00
Thad House
71ed28f768 [hal] Switch SmartIO to mrclib (#8960) 2026-06-06 14:54:49 -07:00
Peter Johnson
edf77fa007 [hal,sim] Add notifier generation counter to WaitForProgramStart (#8947)
This fixes simulation WaitForProgramStart(true) potentially advancing
due to a stale or pre-start notifier created before SetProgramStarted()
was called.
2026-06-06 12:17:14 -07:00
Thad House
6e5171cd8f [hal] Use MrcLib to talk to DS (#8858)
Using MrcLib on the robot is going to be the plan for the future, to
make things easier.

MrcLib is how sim is supported going forward. The desktop version of
mrclib can act as a robot server.

This is set up where the mrclib interface is in shared code. On robot,
that is the only backend used. On desktop, a default sim backend is
used. However, the sim plugin can switch that to the real robot backend,
so the robot code will exactly look like a real robot.
2026-06-06 12:15:17 -07:00
Peter Johnson
ddf9306264 [ntcore] Fix a couple of bugs in NetworkOutgoingQueue (#8953)
Fix SetPeriod() valuePos handling when an ID moves between period queues

In SendValue(), don't append older values, and fix the total size
accounting for the underflow case when a smaller value replaces a larger
value.

Add comprehensive unit tests.
2026-06-05 20:35:11 -07:00
Peter Johnson
88d8369751 [upstream_utils] Update catch2 to 3.15.0 (#8955) 2026-06-05 20:34:20 -07:00
Peter Johnson
96fb033deb [build] Remove cmake Java support (#8952)
This is increasingly difficult to maintain, and has very limited
benefit. Modern coprocessors with enough horsepower to run Java
applications can use the Gradle or Bazel build systems instead.
2026-06-05 15:05:09 -07:00
Vasista Vovveti
d941be905e [ntcore] NetworkClient: Add IsLoopClosing() guard in deferred disconnect timer (#8936)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 15:01:44 -07:00
Peter Johnson
e085c3e8b3 [examples,cscore] Don't use assertTimeoutPreemptively in tests (#8951)
Particularly with short timeouts, this results in spurious failures
under high CPU load.
2026-06-05 07:28:51 -07:00