Commit Graph

91 Commits

Author SHA1 Message Date
Tyler Veness
7af3ac579b [build] Upgrade Gradle wrapper and plugins (#8767)
This fixes builds on JDK 26 for me.
2026-04-12 22:03:50 -07:00
Tyler Veness
9bd9656871 [wpimath] Replace Speeds with Velocities (#8479)
I left "free speed" alone since that's the technical term for it. In
general, velocity is a vector quantity, and speed is a magnitude (i.e.,
a strictly positive value).

This PR also replaces the speed verbiage in MotorController with duty
cycle.

Fixes #8423.
2026-03-06 14:19:15 -08:00
Thad House
880ffe94f2 [wpiutil] Remove CombinedRuntimeLoader (#8623)
It was only ever for Java tools, which we do not support anymore.
2026-02-27 20:15:17 -08:00
sciencewhiz
44ca9e816d [build] Add LineLength suppression for generated version file (#8530)
I managed to get a length of 101 characters when building locally
2026-01-02 08:47:48 -08:00
Peter Johnson
dacded37e5 [hal, wpilib] Add OpMode support (#7744)
User code:
- OpModeRobot used as the robot base class
- LinearOpMode and PeriodicOpMode are provided opmode base classes
- In Java, annotations can be used to automatically register opmode classes

Additional user code functionality:
- OpMode (string) is available in addition to the overall
auto/teleop/test robot mode
- OpMode does not indicate enable (enable/disable is still separate)
- The HAL API uses integer UIDs; these are exposed at the user API level
as well for faster checks
- User code creates opmodes on startup (these have name, category,
description, etc).

DS:
- DS will present opmode selection lists for auto and teleop for
match/practice. During a match, the DS will automatically activate the
selected opmode in the corresponding match period.
- For testing, an overall mode is selected (e.g. teleop/auto/test) and a
single opmode is selected

Future work:
- Command framework support/integration
- Python annotation support
- Unit tests (needs race-free DS sim updates)
- Porting of examples

Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2025-12-12 20:25:57 -08:00
Joseph Eng
ca206c5633 [build] Clean up spotbugs excludes (#8334) 2025-11-08 16:21:58 -08:00
PJ Reiniger
c89910b7c6 HAND FIXES: Fixup gradle / cmake / styleguide 2025-11-07 23:09:21 -08:00
PJ Reiniger
f0a3c64121 SCRIPT Run java package replacements 2025-11-07 23:09:21 -08:00
Peter Johnson
cc043df07f Merge branch 'main' into 2027 2025-11-01 09:39:08 -07:00
Thad House
58ba536351 [wpilib] Remove Jaguar (and other) motor controllers (#8298)
https://community.firstinspires.org/2025-robot-rules-preview-for-2026
2025-10-28 20:18:02 -07:00
Sam Carlberg
b37e2d9343 [commands] Add Commands v3 framework (#6518)
The framework fundamentally relies on the continuation API added in Java 21 (which is currently internal to the JDK). Continuations allow for call stacks to be saved to the heap and resumed later.

The async framework allows command bodies to be written in an imperative style. However, an async command will need to be actively cooperative and periodically call coroutine.yield() in loops to yield control back to the command scheduler to let it process other commands.

There are also some other additions like priority levels (as opposed to a blanket yes/no for ignoring incoming commands), factories requiring names be provided for commands, and the scheduler tracking all running commands and not just the highest-level groups. However, those changes aren't unique to an async framework, and could just as easily be used in a traditional command framework.
2025-10-10 13:47:22 -07:00
Sam Carlberg
909f8a1dc4 [build] Remove PMD.RedundantFieldInitializer rule (#8184)
Code readability is much more important than saving three bytes per redundantly-initialized field.
2025-09-08 21:19:00 -07:00
Peter Johnson
3e4e9c9b01 Merge branch 'main' into 2027 2025-08-09 00:55:26 -07:00
Tyler Veness
9ac7e286f5 [build] Upgrade Gradle plugins (#8166)
I upgraded all plugins I could see except org.ysb33r.doxygen. 2.0 made
breaking changes, and I couldn't figure out how to migrate.

Most of the changes are for suppressing new linter purification rites.
2025-08-08 23:04:02 -07:00
Jade
e93c8cdb29 [build] Upgrade to Java 21 (#7547)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
2025-07-25 15:45:40 -07:00
Peter Johnson
82ce317083 Merge branch 'main' into 2027 2025-06-30 20:21:11 -07:00
sciencewhiz
f2dd81c839 [build] Add checkstyle check for deprecation (#7738)
Ensures java deprecated notation is paired with javadoc and vice versa.
Adds javadoc deprecation for MecanumControllerCommand, ArmFeedForward,
ElevatorFeedforward, and MecanumDriveMotorVoltages
Fixes #7736
Supersedes #7737

Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2025-06-30 00:09:02 -07:00
Thad House
6e704370b3 [hal, wpilib] Remove DigitalSource and AnalogTrigger (#7753) 2025-01-30 19:58:21 -07:00
Thad House
48ce2dcc8d [hal, wpilib] Add initial systemcore counter implementation (#7723) 2025-01-28 09:58:34 -07:00
Sam Carlberg
a9b885070e [wpiunits] Java units API rewrite (#6958)
Java generics are too limited to do what we need. This refactors generic code previously in Unit and Measure into unit-specific classes that can have unit-safe math operations (notably, times and divide) that can return values in known units instead of a wildcarded Measure<?>.

Unit-specific measure implementations are automatically generated by ./wpiunits/generate_units.py, which generates generic interfaces and mutable and immutable implementations of those interfaces. These make up the bulk of the diff of this PR (approximately 9300 LOC).

This also adds units for angular and linear velocities, accelerations, and momenta; moment of inertia; and torque.
2024-09-07 10:59:29 -07:00
Jade
70fa41c69e [epilogue] Allow configuring logging period and logging period offset (#6893) 2024-08-14 09:26:48 -07:00
Gold856
b0cc84a9c7 [build] Upgrade to PMD 7.2.0 (#6718) 2024-06-08 22:08:23 -07:00
Gold856
65c6306047 [wpilib,commands] Use Jinja to generate HID classes (#6274) 2024-06-08 09:59:07 -07:00
Jade
6220c6be4d [wpiutil] Remove RuntimeDetector and simplify RuntimeLoader (#6600) 2024-05-24 10:48:59 -07:00
Thad House
fb947fe998 [cscore] Use Raw for CvSink and CvSource (#6364)
Eventually we want to get to a point where we can remove OpenCV from the internals of cscore. The start to doing that is converting the existing CvSource and CvSink methods to RawFrame.

For CvSource, this is 100% a free operation. We can do everything the existing code could have done (with one small exception we can fairly easily fix).

For CvSink, by defaut this change would incur one extra copy, but no extra allocations. A set of direct methods were added to CvSink to add a method to avoid this extra copy.
2024-02-12 22:33:03 -08:00
Tyler Veness
ad0859a8c9 [docs] Add missing JavaDocs (#6125) 2024-01-01 22:56:23 -08:00
Tyler Veness
d40bdd70ba [build] Upgrade to spotbugs Gradle plugin 6.0.2 (#6027) 2023-12-09 15:34:29 -08:00
Gold856
28deba20f5 [wpimath] Commit generated quickbuf Java files (#5994)
This removes a build dependency on the quickbuf generator being available for the build platform.

It's safe to generate Java because the quickbuf version is defined by the project.

C++ protobufs can't be committed because the protoc version must
match the library version (this is a particular issue for cmake builds).
2023-12-05 17:02:29 -08:00
Jordan McMichael
49920234ac [build] Fix checkstyle rules to allow Windows paths (#5839) 2023-10-27 16:56:58 -07:00
Peter Johnson
cf54d9ccb7 [wpiutil, ntcore] Add structured data support (#5391)
This adds support for two serialization formats for complex data types:

- Protobuf for complex objects with variable length internals that need forward and backward wire compatibility (lower speed, more flexible)
- Raw struct (ByteBuffer-style) for fixed-length objects (higher speed, less flexible)

Deserialization can be done either by creating a new object (for immutable objects) or overwriting the contents of an existing object (for mutable objects).

Implementing classes should provide inner classes that implement the Protobuf or Struct interface (in Java) or specialize the wpi::Protobuf or wpi::Struct struct (in C++). It is possible for classes to implement both. If the class itself does not implement serialization, it's possible for third parties/users to provide an implementation instead.

Uses the Google protobuf implementation for C++ and the QuickBuffers alternative protobuf implementation for Java.
2023-10-19 21:41:47 -07:00
Tyler Veness
19a8850fb1 [examples] Add TimesliceRobot templates (#3683) 2023-09-15 20:42:21 -07:00
Tyler Veness
96f7fa662e Upgrade Maven dependencies (#5553)
The following source code changes were required:

* Whitespace changes from spotless
* PMD warning suppressions for utility class tests
* PMD warning rename from "BeanMembersShouldSerialize" to
  "NonSerializableClass"
* Declared more class members as final
2023-08-18 19:18:33 -07:00
Zhiquan Yeo
86d7bbc4e4 [examples] Add Java Examples and Templates for the XRP (#5529) 2023-08-11 23:31:35 -07:00
sciencewhiz
d20594db0d Fix typos (#4839) 2022-12-21 08:53:00 -06:00
Thad House
69a66ec5ec [wpilib] Fix multiple motor safety issues (#4784)
Java was missing the motor safety thread entirely
C++ accidentally used a manual reset event, causing the motor safety thread to spin.
C++ PWMMotorController would not feed the watch kitty.
Both languages would call feed() from the StopMotor call, causing some ping ponging.
2022-12-08 19:47:47 -08:00
Jordan McMichael
e22d8cc343 [wpimath] Use Odometry for internal state in Pose Estimation (#4668)
This effectively replaces the Unscented Kalman Filter used for Pose Estimation with the Odometry model, and uses a recalculable Kalman gain matrix to update pose estimations whenever a vision measurement is added.

Notably, this change removes the need for the confusing generics used in Java, and the C++ implementation got quite a bit less complex as well.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-12-02 08:36:10 -08:00
Starlight220
8958b2a4da [commands] Add property tests for command compositions (#4715) 2022-11-27 16:23:56 -08:00
Peter Johnson
77301b126c [ntcore] NetworkTables 4 (#3217) 2022-10-08 10:01:31 -07:00
Tyler Veness
a791470de7 Clean up Java warning suppressions (#4433)
Checkstyle naming conventions were changed to allow most of what's in
wpimath. Naming rules were disabled completely in wpimath since almost
all suppressions are for math notation.
2022-09-24 00:13:55 -07:00
Tyler Veness
aebc272449 [build] Upgrade to spotbugs Gradle plugin 5.0.8 (#4310)
This fixes a SecurityManager deprecation warning generated by spotbugs.
2022-06-14 20:26:53 -07:00
Thad House
1f59ff72f9 [wpilib] Add ADIS IMUs (#3777)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Matteo Kimura <mateus.sakata@gmail.com>
2021-12-30 19:43:53 -08:00
Tyler Veness
7269a170fb Upgrade maven deps to latest versions and fix new linter errors (#3772)
This also makes the Gradle build work with JDK 17.

The extra JVM args in gradle.properties works around a bug with spotless
and JDK 17: https://github.com/diffplug/spotless/issues/834

PMD.CloseResource was ignored because it's almost always a false
positive, and there are many of them.
2021-12-09 12:20:08 -08:00
Prateek Machiraju
d81ef2bc5c [wpilib] Fix deadlocks in Mechanism2d et al. (#3770)
UpdateEntries() and Flush() are called from methods that lock the mutex,
so locking it again will cause deadlocks. This also updates the Java
code to make MechanismObject2d::update synchronized like in the C++
version.
2021-12-06 14:42:02 -08:00
Tyler Veness
95dd20a151 [build] Enable spotbugs (#3601)
Benign spotbugs warnings were suppressed, and all others were fixed. Bug
descriptions are documented here:
https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2021-09-24 16:04:02 -07:00
Tyler Veness
c1e128bd5a Disable frivolous PMD warnings and enable PMD in ntcore (#3419)
Some valid warnings like throwing NullPointerException or using a for
loop instead of System.arraycopy() were fixed.

Abstract classes marked with PMD.AbstractClassWithoutAbstractMethod were
made concrete because they already had protected constructors.

Fixes #1697.
2021-06-09 07:01:00 -07:00
Peter Johnson
9c3b51ca0f [wpilib] Document simulation APIs (#3079)
- Remove sim checkstyle suppression
- Add [[nodiscard]] to C++ register callback functions
- Add a couple of missing sim functions

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Starlight220 <yotamshlomi@gmail.com>
2021-01-11 21:55:45 -08:00
Austin Shalit
65b2359b27 [build] Add spotless for other files (#3007)
Adds spotless formatting for Gradle, xml, md, and gitignore files.

yml linting is not performed as it requires a dependency on npm.
2020-12-30 16:17:20 -08:00
Peter Johnson
a751fa22d2 [build] Apply spotless for java formatting (#1768)
Update checkstyle config to be compatible with spotless.

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2020-12-29 22:45:16 -08:00
Austin Shalit
6e1919414e [build] Bring naming checkstyle rules up to date with Google Style guide (#1781)
Also update Checkstyle to 8.38.

Google changed their style guide from the last time we imported it. This PR brings in those naming changes. The change they made is allowing single letter member, parameter, and local variable names. They also added a lambda naming scheme and I thought it would be good to bring that in too.
2020-12-29 09:27:48 -08:00
Austin Shalit
6e7c7374fd [build] Globally Exclude PMD.TooManyMethods (#2793)
This was not a useful check, as every time we hit it, we simply excluded it.
2020-10-22 20:53:48 -07:00