Compare commits

...

3253 Commits

Author SHA1 Message Date
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
Sam Carlberg
98c03baf54 [javac] Add compiler check for integer division in floating-point contexts (#8885)
Useful for catching bad behavior when doing math or configuring ratios
with integers. Errors can be turned off with
`@SuppressWarnings("IntegerDivision")`

```java
double kV = 12 / 6000; // error: integer division in a floating-point context
double kV = 12. / 6000; // OK
double kV = 12 / 6000.; // OK

int kV = 12 / 6000; // OK, but evaluates to 0

double ratio = 42 / 12; // error: integer division in a floating-point context

@SuppressWarnings("IntegerDivision")
double ratio = 42 / 12; // OK, evaluates to 2
```

```
Execution failed for task ':developerRobot:compileJava'.
> Compilation failed; see the compiler output below.
  /Users/sam/code/wpilib/allwpilib/developerRobot/src/main/java/wpilib/robot/Robot.java:10: error: integer division in a floating-point context
    double kV = 12 / 6000;
                   ^
  1 error
```

Also adds the compiler plugin as a dependency to the developerRobot
project for dev testing
2026-06-04 21:56:22 -07:00
sciencewhiz
8353b95507 Add avahi license to ThirdPartyNotices (#8883) 2026-06-04 21:54:00 -07:00
Benjamin Hall
a41679854b [wpimath] Fix C++ Odometry ResetRotation missing a negation (#8949)
The original implementation was `m_gyroOffset + (rotation -
m_pose.Rotation())`, which means the first `RotateBy` should be using
`-m_pose.Rotation()` (see `ResetPose()`). Java is already correct. This
also adds new tests to catch this particular error.
2026-06-04 17:03:22 -07:00
PJ Reiniger
fdc6fd9cb1 [build][bazel] Combine remote setup CI actions (#8893)
When the bazel remote cache was switched from buildbuddy to a self
hosted server in #8342, I asked that the buildbuddy hooks be remain so
that I could still use their caching service for local builds.

The downside of this was that my forks builds aren't leveraging
buildbuddy, so if I'm fiddling with something heavy like a wpimath
robotpy thing, my CI builds never update a cache and never are warm when
I push fixups.


This PR combines the `setup-bazel-remote` and `setup-build-buddy`
actions which set up the bazel remote cache. Rather than having two
different version, the correct one will be choosen in the following
order:
1. Use wpi's server with write access if the `bazel_remote` information
is set (This basically would only happen on main branch in
`wpilibsuite/allwpilib` since secrets aren't accessible from builds
originating in forks)
2. Use buildbuddy if the key it is present (This would work for my fork
builds)
3. Fall back to the readonly version of wpi's server


As seen
[here](https://github.com/bzlmodRio/allwpilib/actions/runs/25777428163/job/75712863120#step:7:28)
the build in my fork will run with buildbuddy, and my PR's build here
should fall back to readonly mode.
2026-06-03 20:16:42 -07:00
PJ Reiniger
dca59147e1 [robotpy][examples] Split examples and snippets (#8944)
This also updates the bazel scripts to behave more like the C++ and Java
examples, and updates the copybara scripts to be able to sync up
`mostrobotpy`
2026-06-03 19:43:16 -07:00
Benjamin Hall
a734275cc5 [wpimath] Add const qualifier to C++ SwerveModuleVelocity Optimize and CosineScale (#8946)
These two functions were changed to return new objects instead of
modifying in-place, so the `const` qualifier should be added. Otherwise,
users with a const reference to a `SwerveModuleVelocity` need to make a
temporary copy first.
2026-06-03 19:42:05 -07:00
Peter Johnson
3f0d7bc2c4 [wpiutil,hal] Move C++ Handle wrapper to wpiutil (#8935)
Also move WPI_Handle typedef to its own header (util/Handle.h).
2026-06-01 14:57:25 -06:00
Vasista Vovveti
3d982f81dd [ntcore] Update period on added or removed, not XOR (#8941)
`added ^ removed` (XOR) is incorrect for the update guard.
Both `added` and `removed` can be true simultaneously (e.g. subscription
options change), and XOR would incorrectly skip the period update. Fixed
to `added || removed`.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 14:56:23 -06:00
sciencewhiz
a3c18d24a7 [examples] Add mecanum drive snippets (#8931)
shows both polar, and cartesian
2026-05-29 23:10:42 -07:00
Peter Johnson
c597116f02 [hal] HALSIM_StepTiming: Avoid underflow (#8933)
Don't advance time if the only active timer is in the past; just wake up
any notifiers.
2026-05-29 23:10:02 -07:00
Peter Johnson
9adffd356d [hal] Update waitForProgramStart to optionally wait for first notifier (#8932)
This addresses a race condition caused by TimedRobot and other
frameworks not creating their first notifier alarm until after signaling
program start.

Default this to true because it's the most common desired use case when
combined with TimedRobot.
2026-05-29 23:09:25 -07:00
Thad House
635e971a02 [wpilib] Add a default deadband to all gamepads (#8897)
The FTC DS had a deadband. Additionally, the FRC one had an implicit
deadband due to the only 8 bit resolution. We need a deadband by default
now with the high resolution gamepads.
2026-05-29 16:31:48 -07:00
sciencewhiz
40fdb779d8 [examples] Add differential drive snippets (#8927)
Shows tank, arcade, and curvature for wpilib-docs
2026-05-29 15:00:12 -07:00
Tyler Veness
e728ee27f2 [upstream_utils] Upgrade to Sleipnir 0.6.1 (#8930)
This fixes a memory leak on Windows.
2026-05-29 14:59:39 -07:00
Guinea Wheek
50fd29e697 [ntcore] Fix unbounded memory size tracker (#8929)
If a `ClientMessageQueue` is at a
memory limit, `ClientMessageQueueImpl::ClientSetValue` will still
increment `m_valueSize.size` even though no element has actually been
actually been added.

This quickly results in things like topics completely shutting down
under high load, as no new elements can be added as `m_valueSize.size`
explodes to infinity unless `ClearQueue()` is explicitly called. You can
see this pretty easily with the following code, be it in sim or on a
robot:

```cpp
#include "wpi/framework/TimedRobot.hpp"
#include "wpi/smartdashboard/SmartDashboard.hpp"
class Robot : public wpi::TimedRobot {
  public:
  // ...
  uint64_t value{0};
  /**
   * This function is called periodically during all modes
   */
  void RobotPeriodic() override {
    for (int i = 0; i < 1'000'000; i++) {
      value += 1;
      wpi::SmartDashboard::PutNumber("value", value);
    }
  }
}
```

Connecting via your favorite dashboard quickly reveals that no new
values get added after a while. However, with this patch implemented,
values do still continue to increment as updates gradually get serviced.
2026-05-29 11:01:13 -07:00
Sam Carlberg
4fa5dacfc4 [epilogue] Improve support for robot base classes in epilogue (#8886)
Generate an `update` method for any logged Robot class, not just
TimedRobot

Continue to generate a `bind` method for TimedRobot subclasses

Also removes unnecessary import statements for generated loggers, since
they're using fully-qualified names in the generated Epilogue class now.
2026-05-29 00:14:30 -04:00
sciencewhiz
1e12408a7d [examples] add motor safety and invert to motor snip (#8924) 2026-05-28 20:09:07 -07:00
sciencewhiz
14db070c2c [build] Add guard for missing arm64 msvc runtime (#8922) 2026-05-28 20:08:46 -07:00
sciencewhiz
5c3a474a58 Replace references of frc-docs with wpilib-docs (NFC) (#8926) 2026-05-28 09:01:11 -06:00
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) 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.
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
Gold856
1586dcf385 [wpimath] Fix incorrect C++ return docs in Pose3d and Translation3d (#8793) 2026-04-23 22:53:29 -07:00
Gold856
930340e8f0 [build] Always run Checkstyle after spotlessApply (#8794)
This avoids issues where Checkstyle will error on line length by having
Spotless run first and fix up line lengths before Checkstyle sees the
files.
2026-04-23 22:52:19 -07:00
Zach Harel
7fc8845424 [wpilib] separate expansion hub position and velocity constants (#8791)
this is because position and velocity control follow different rules;
see #8773

Signed-off-by: Zach Harel <zach@zharel.me>
2026-04-23 17:40:52 -07:00
Sam Carlberg
44b9545f30 [epilogue] Use full class names in static logger fields (#8786)
This prevents conflicts when multiple classes with the same simple name
exist in separate packages
2026-04-21 22:24:24 -07:00
Peter Johnson
ab00aac960 [hal,wpilib] Rename "Test" robot mode to "Utility" (#8782)
The "Utility" name better matches its intended generic use case and
avoids overloaded terminology with unit testing (e.g. the need to name
the opmode annotation `@TestOpMode`).

The driver station will also be updated to reflect this change.
2026-04-20 20:29:25 -07:00
Peter Johnson
14d14e4ebc [hal] Prefix all error #defines with HAL_ (#8780) 2026-04-19 16:12:18 -07:00
Sam Carlberg
b7df267687 [cmd3] Change Command.noRequirements to accept a command implementation (#8783)
This is more ergonomic than `Command.noRequirements().executing(...)`
2026-04-19 15:40:50 -07:00
Sam Carlberg
3eaeac6150 [developerRobot] Add commands v3 (#8784) 2026-04-19 15:40:08 -07:00
Thad House
ab2aef2c29 [wpilib] Split DriverStation into smaller classes (#8628) 2026-04-18 19:56:45 -07:00
Tyler Veness
58ad633ae2 [build] Fix CMake add_source_jar() OUTPUT_DIR warnings (#8778)
```
CMake Warning (dev) at /usr/share/cmake/Modules/UseJava.cmake:716 (cmake_parse_arguments):
  The OUTPUT_DIR keyword was followed by an empty string or no value at all.
  Policy CMP0174 is not set, so cmake_parse_arguments() will unset the
  _add_jar_OUTPUT_DIR variable rather than setting it to an empty string.
Call Stack (most recent call first):
  cmake/modules/CreateSourceJar.cmake:29:EVAL:1 (add_jar)
  cmake/modules/CreateSourceJar.cmake:29 (cmake_language)
  wpiannotations/CMakeLists.txt:29 (add_source_jar)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake/Modules/UseJava.cmake:716 (cmake_parse_arguments):
  The OUTPUT_DIR keyword was followed by an empty string or no value at all.
  Policy CMP0174 is not set, so cmake_parse_arguments() will unset the
  _add_jar_OUTPUT_DIR variable rather than setting it to an empty string.
Call Stack (most recent call first):
  cmake/modules/CreateSourceJar.cmake:29:EVAL:1 (add_jar)
  cmake/modules/CreateSourceJar.cmake:29 (cmake_language)
  wpiunits/CMakeLists.txt:25 (add_source_jar)
This warning is for project developers.  Use -Wno-dev to suppress it.
```
2026-04-17 21:08:41 -07:00
Peter Johnson
a97214df43 [hal] Resource classes: Use expected, refactor errors (#8768)
Also revamp SetLastError et al; Instead of taking status by pointer,
take by value and return new status instead. Rename from SetLast to Make
to make this new usage obvious.

Also move declarations for the error functions from duplicated in the
per-target HALInternal.hpp to a common ErrorHandling.hpp.
2026-04-17 20:19:38 -07:00
Thad House
6cb6903780 [hal,wpilib] Remove a ton of things related to the FPGA (#7846)
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
2026-04-17 19:38:25 -07:00
crueter
fdb454a6b1 [fields] refactor: FTC/FRC separation, better naming scheme (#8034)
Closes #8018

- Adds the 2024-2025 and 2025-2026 FTC field image data
- Used a better naming scheme of `<year> F{R,T}C <gamename>`
  * Also removed generic `field` verbiage from PNG file names
- JSON and PNG files moved into respective `frc` and `ftc` directories
- Rotated fields for the new red-left scheme

Signed-off-by: crueter <swurl@swurl.xyz>
2026-04-17 19:36:38 -07:00
Gold856
056d7bcbbe [wpimath] Make swerve and differential kinematics functions immutable (#8274)
Originally started with just swerve, but expanded to diff and mecanum
(docs only) for parity across the drivetrains. Return value checks are
applied when possible to make migration easier and to error loudly if
people forget.

---------

Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2026-04-16 21:23:32 -07:00
Thad House
8c80cdcf28 [hal] Add CAN Bus Map (#8765)
We will want a better API for higher level devices that expect to be on
motioncore, but for ones that are not expected to be, it'll be really
nice to have an API that can let us map the motioncore can bus to its
HAL index.
2026-04-16 21:03:39 -07:00
Sam Carlberg
628ba1458f [build] Java 25 support (#8775)
Commands v3 had a few changes due to the upgrade:
- Java 24 removed the Pinned: MONITOR IllegalStateException when
yielding in a synchronized block, so we no longer need to special case
for it
- Lambda method name generation was tweaked, requiring tests to be
updated
- Bazel java_rules needed to be bumped to support Java 25

Closes #8425
2026-04-16 21:02:17 -07:00
Gold856
f96ded6909 Fix various typos (#8769) 2026-04-13 21:51:36 -07:00
sciencewhiz
613c86d1d7 [cmd2] Flatten wpi::cmd::cmd to wpi::cmd (#8764)
Fixes #8763
2026-04-13 21:48:13 -07:00
Tyler Veness
f89cf297e4 [wpical] Fix linker errors (#8766)
```
mold: error: undefined symbol: wpi::fields::GetFields()
>>> referenced by Field2D.cpp
>>>               /home/tav/frc/wpilib/allwpilib/glass/build/libs/glass/static/linuxx86-64/debug/libglassd.a(Field2D.o):((anonymous namespace)::FieldInfo::DisplaySettings())
>>> referenced by Field2D.cpp
>>>               /home/tav/frc/wpilib/allwpilib/glass/build/libs/glass/static/linuxx86-64/debug/libglassd.a(Field2D.o):((anonymous namespace)::FieldInfo::LoadImage())
collect2: error: ld returned 1 exit status
```
The issue seems to stem from libglass linking to the shared version of
fields, whereas wpical requires static linkage.
2026-04-12 22:04:24 -07:00
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
Peter Johnson
476b9641c1 [upstream_utils] Update imgui and implot (#8762)
Not updating GLFW yet due to a likely future move to SDL.
2026-04-12 12:19:32 -07:00
Peter Johnson
d76486d885 [upstream_utils] Update googletest to HEAD (#8755)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2026-04-11 16:53:55 -07:00
Tyler Veness
7e9138f8c1 [upstream_utils] Upgrade to Google Benchmark 1.9.5 (#8760) 2026-04-11 16:52:24 -07:00
Tricks1228
042567d0ba [wpimath] Prevent CoordinateSystem from accepting left-handed systems (#8750) 2026-04-11 13:53:36 -07:00
PJ Reiniger
c6f54e963c [build] Fixup maven publishing (#8753)
This primarily fixes up the bazel publishing to match the gradle
publishing again, as some new libraries were added but not hooked up to
the maven publishing.

During the process, I noticed that the 3rd party libraries (googletest,
catch2, and imgui_suite) were still getting published on the old
`edu.wpi` namespace. I tried to clean up all the other references to
that that I could. Note: opencv and libssh are handled outside
`allwpilib` so they need to be updated separately.
2026-04-11 13:52:43 -07:00
Alan Everett
9ea63c7fd6 [wpilibc] Return empty string instead of null for GetOpMode (#8754)
Clang 21 catches returning `0` from `GetOpMode` as returning `null`.
Since this state is very momentary and all comparisons inside WPILib are
done against `GetOpModeId` instead, I changed it to return an empty
string.
2026-04-11 13:51:58 -07:00
Tyler Veness
8e72d17770 [upstream_utils] Upgrade to Catch2 3.14.0 (#8757) 2026-04-11 13:51:34 -07:00
Gold856
2102a543d1 Change Java JSON to Avaje Jsonb (#8721)
Jackson is a very heavy library; it supports loads of features that we
don't need, and historically has caused issues due to long class loading
times (a little over 2 seconds to load AprilTagFieldLayout). This often
manifests as a help request in the form of "my robot disables when I do
X, but doesn't disable when doing X in subsequent attempts until code
restart." While SC has brought down Jackson loading times significantly,
with AprilTagFieldLayout loads taking only 330 milliseconds, that's
still a rather long delay, and while libraries should handle any JSON
loading ahead of time to prevent delays in auto/teleop, it would still
be good to make the worst case better to reduce user frustration.
Benchmarks indicate using [Avaje
Jsonb](https://github.com/avaje/avaje-jsonb) to load AprilTagFieldLayout
only takes ~70 ms, a fair chunk of which isn't actually in Avaje Jsonb
(~4 ms is spent on using getResourceAsStream to retrieve the JSON file,
~8 ms is spent on just loading the AprilTag class and its dependencies).

Note that all times listed are end-to-end, meaning nothing else was done
except for the operation being benchmarked, and doing arithmetic on them
can be flawed due to some classes being loaded twice, i.e.,
getResourceAsStream and `new AprilTag()` likely load some of the same
JDK classes and so subtracting both from the Avaje Jsonb load time is
likely slightly incorrect because class loading is being double counted.
For our purposes, it's likely accurate enough and is mostly just for
contextualization.

Benchmarks were run on a Raspberry Pi CM5 with 2 GB of RAM. Source code
for the
[results](https://github.com/user-attachments/files/26471452/benchmark.txt)
can be found in the "Fastjson2" commit
(2456d15ca8ebd17635e607cd40bf8816e77869a1).

Avaje Jsonb uses code generation via annotation processors to generate
the classes needed to do JSON serde and uses service providers to find
them, which will require downstream changes in robot projects, as the
different service providers in each library must be merged together for
Avaje Jsonb to function. We will use the Gradle shadow plugin, as its
already used by the installer and therefore adds zero additional
dependencies.
2026-04-10 23:21:00 -07:00
Thad House
346cd9ed9c [build] Update native utils to fix new mac builds (#8752) 2026-04-10 21:12:18 -07:00
Tyler Veness
aedff82286 [ci] Escape upload-artifact path (#8748)
Asterisk prefixes are interpretted as YAML aliases, which resulted in a
parsing failure.
2026-04-10 17:11:48 -07:00
Joseph Eng
d8df358e6a [cmd3] Update Scheduler class doc description of run() (NFC) (#8747)
#8705 updated the `run()` doc comment but missed the class doc comment.
2026-04-10 16:14:54 -07:00
Zach Harel
a8c7f3e3c6 [wpilib] Change opmodes to purely periodic (#8652)
1. Make the OpMode interface itself periodic; this means the only
differences between `OpMode` and `PeriodicOpMode` are the latter's
methods to add sideloaded periodic callbacks
2. Make OpModeRobot process callbacks in a similar fashion to TimedRobot
and
3. Add some lifecycle functions (discussed below)
4. Pull the callback priority queue from TimedRobot to a new class
called `PeriodicPriorityQueue` so that `TimedRobot` and `OpModeRobot`
have less duplication
5. Fix a typo in the DriverStationJNI class that causes a memory leak
when certain driver station sim calls
6. Port the C++ OpModeRobot tests to Java 

`OpModeRobot` now possesses some `IterativeRobotBase`-stye lifecycle
functions; these functions
1. `robotPeriodic` 
2. `simulationInit` and `simulationPeriodic` 
3. `disabledInit`, `disabledPeriodic`, and `disabledExit`
(note that `simulationInit` and `disabledInit` may be renamed to match
wpilibsuite#8719)

`OpModeRobot` also now processes `OpMode` changes (by the Driver
Station) in its `loopFunc` method, similar to
`IterativeRobotBase.loopFunc` processing game mode changes; `loopFunc`
is, similarly to `TimedRobot`, provided as a default `Callback`

---------

Signed-off-by: Zach Harel <zach@zharel.me>
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2026-04-10 13:40:17 -07:00
Peter Johnson
84295180cd [wpinet] WebSocket: Mutex-protect static random device/engine (#8741) 2026-04-10 13:32:55 -07:00
Peter Johnson
bc984234e9 [cmd2] CommandScheduler::Cancel(): Don't mutate in for loop (#8743)
Erasing elements from a container while iterating over the container may
not be well-defined.
2026-04-10 12:30:00 -07:00
Peter Johnson
ea06f0b257 [wpilibj] Watchdog: handle callback throwing an exception (#8742)
Ensure mutex is re-locked.
2026-04-10 12:29:38 -07:00
Peter Johnson
3728bc3b5c [wpilibc] Notifier: Use atomic exchange in move constructor/assignment (#8740) 2026-04-10 12:28:54 -07:00
Peter Johnson
1671150521 [wpiutil] WPI_WaitForObjectTimeout: Add null check (#8739) 2026-04-10 12:28:34 -07:00
Peter Johnson
b7fe3dad46 [ntcore] WireDecodeBinary: Fix some mpack paths (#8738) 2026-04-10 12:28:17 -07:00
Peter Johnson
7e86c10a28 [wpiutil] Fix Semaphore backing vector usage (#8737)
The wrong backing vector was being used (eventIds).
2026-04-10 12:27:52 -07:00
Sam Freund
21f6bdbc1a [hal,wpilib] Remove alert level aliases (#8744) 2026-04-10 12:26:52 -07:00
Sam Freund
ce77e6022f [ci] Remove archival for lint patches (#8745)
When downloading a patch to fix linting errors, it's annoying to have to
unzip it, particularly when it's a single file. This PR updates the
`upload-artifact` action to v7, which allows for uploading an artifact
without zipping it. It also sets archive to false for all patches
generated by linting.
2026-04-10 12:26:13 -07:00
Tyler Veness
b6849a8da3 [wpilib] Rename MotorController setDutyCycle() to setThrottle() (#8720)
Fixes #8716.
2026-04-09 22:28:01 -07:00
Peter Johnson
a4e035ba64 Replace gmtime/localtime with std::chrono (#8735)
Fixes #8734.
2026-04-09 22:25:46 -07:00
Sam Freund
ece8001b1e [wpilib] Add AlertSim function to get only active alerts (#8732) 2026-04-09 22:25:26 -07:00
Sam Carlberg
02c6030251 [cmd3] Enforce command lifetimes across all opmode and command scopes (#8705)
Commands are no longer able to outlive their schedule-site's scope,
regardless of how they were scheduled (set as a default command, bound
to a trigger, or manually scheduled)

As a consequence, default commands need better tracking so the default
command setting can be released when their scope exits and the next-most
appropriate default command can be rescheduled (eg, an opmode sets a
default command, then the globally-scoped default is restored when the
opmode exits). Some complexity is required here to make it work well for
edge cases.

Like `schedule()`, `setDefaultCommand()` will immediately start the new
default command if called inside of another command to avoid 1-loop
delays. However, this does not apply when called by the _current_
default command, as it would result in attempting to cancel the default
command while it's mounted (which is impossible and would throw an
exception)

```java
class Robot extends OpModeRobot {
  final Drive drive = new Drive();
  final CommandXboxController controller = new CommandXboxController(1);

  public Robot() {
    // global default command, active unless overridden in an opmode or command
    drive.setDefaultCommand(drive.stop());

    // global trigger binding, always active
    controller.rightBumper().onTrue(drive.setX());
  }
}

@Teleop
class ExampleOpMode extends PeriodicOpMode {
  public ExampleOpMode(Robot robot) {
    // opmode-specific default command
    robot.drive.setDefaultCommand(robot.drive.operatorControl(robot.controller));

    // opmode-specific binding
    robot.controller.leftBumper().whileTrue(robot.drive.stop());

    // opmode-specific binding that takes precedence over the global binding
    // because it happens last; it "wins out" over the `setX()` binding
    robot.controller.rightBumper().onTrue(robot.drive.selfTest());
  }

  @Override
  public void periodic() {
    Scheduler.getDefault().run();
  }
}
```
2026-04-09 17:05:42 -07:00
Tyler Veness
5a96685c86 [upstream_utils] Upgrade to Sleipnir 0.5.2
This fixes a bug in Sleipnir's Newton solver (the exit status was inaccurate because unconstrained optimization problems can't be infeasible).
2026-04-09 17:03:57 -07:00
Peter Johnson
9ca93fa190 Update for jart/json.cpp change 2026-04-08 08:28:28 -07:00
Peter Johnson
de3e211fdb [upstream_utils] Add jart/json.cpp 2026-04-08 08:28:28 -07:00
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
Peter Johnson
9ce9918763 [wpiutil] Rename PixelFormat constants to all caps 2026-03-20 13:24:22 -06:00
Peter Johnson
e5107e7e00 [wpiutil] Rename Color constants to all caps 2026-03-20 13:24:22 -06:00
Joseph Eng
8af6bd354e [ntcore] Fix up constants renames (#8693)
Takes care of a few renames missed in #8676.
2026-03-19 23:35:59 -07:00
Peter Johnson
0665aed66b [hal] Fix Python CAN API types prefix (#8687) 2026-03-16 21:47:58 -07:00
Gold856
e81d47fb46 [hal,wpilib] Remove unused error/warning codes (#8684) 2026-03-16 20:26:43 -07:00
Peter Johnson
58e112480a [ntcore] Prefix log levels to avoid macro conflicts (#8686) 2026-03-16 20:24:23 -07:00
Peter Johnson
aad08b9ad1 [hal] Rename SimDevice constants to all caps
Also use enum class for SimDevice C++ wrapper.
2026-03-15 22:38:09 -07:00
Peter Johnson
70f77a1f8e [hal,wpilib] Rename SerialPort constants to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
68ca74c129 [hal,wpilib] Rename REVPH compressor constants to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
c18f811ea7 [hal,wpilib] Rename PowerDistribution constants to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
261a0ebbd7 [hal,wpilib] Rename I2C constants to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
b68fbb1adc [hal,wpilib] Rename Encoder constants to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
f6fdae3212 [hal,wpilib] Rename RuntimeType constants to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
227f01f3bd [hal,wpilib] Rename DriverStation constants to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
614eb1db18 [hal,wpilib] Rename CAN device and manufacturer types to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
fc3be46e6c [hal] Rename kAddressableLEDLength to all caps 2026-03-15 22:38:09 -07:00
Peter Johnson
ab7e4766f6 [ntcore] Rename constants to all caps style (#8676) 2026-03-15 20:44:45 -07:00
Tyler Veness
86dd3ca2b7 [hal] Simplify monotonic_clock (#8678)
The epoch() function, zero() function, and min_time member are all not
part of the std::chrono clock interface.

The default constructor of time_point is
[documented](https://en.cppreference.com/w/cpp/chrono/time_point/time_point.html)
to initialize to the clock's epoch.
2026-03-15 20:42:52 -07:00
Tyler Veness
14e2c1c4cf [ci] Fix all warnings from clang-tidy 22 (#8680)
I ran the following locally:
```bash
gradle generateCompileCommands
./.github/workflows/fix_compile_commands.py build/TargetedCompileCommands/linuxx86-64release/compile_commands.json
wpiformat -default-branch 2027 -no-format -tidy-all -compile-commands=build/TargetedCompileCommands/linuxx86-64release
```

The `HeaderFilterRegex` option is used to filter out warnings from
thirdparty headers.
2026-03-15 20:42:35 -07:00
Peter Johnson
e944ae9aca [hal,wpilib] Rename FPGA clock to monotonic clock (#8672)
- Remove status return from HAL level (clock getting should never fail)
- Remove 32-bit timestamp expand function
- Make monotonic_clock.hpp (formerly fpga_clock.hpp) header-only and
move to root hal include directory
2026-03-15 15:08:41 -07:00
Joseph Eng
1a5b023235 [wpiutil] Add WPI_String usage documentation (NFC) (#8675)
The description is adapted from the PR description in #6299.
2026-03-14 22:38:12 -07:00
Gold856
d1fba06851 Remove deprecated code (#8656) 2026-03-14 21:28:31 -07:00
Gold856
f1adce4cf7 [examples] Clean up examples (#8674)
Move various "examples" into snippets. Several examples that were less
than a full mechanism or robot were moved to snippets. `arcadedrive` and
`tankdrive` were removed in favor of their Gamepad variants. `hidrumble`
was removed due to being too simple. `potentiometerpid` was removed
because of low utility. `gyromecanum` replaced `mecanumdrive` for
deduplication and because very few teams run holonomic drivetrains
without gyros.
2026-03-14 14:13:45 -07:00
Gold856
62ce8944aa [bazel] Add Doxygen excludes for Gradle parity and silencing warnings (#8673) 2026-03-14 09:48:27 -07:00
Thad House
b2b111dc11 Rename FRC to WPILib (#8637) 2026-03-13 23:05:55 -07:00
Peter Johnson
6830c65a15 [hal] Rename HALBase.h to HAL.h (#8668) 2026-03-13 17:19:39 -07:00
Peter Johnson
ab4700854c [hal] Remove HAL.h single header include (#8667) 2026-03-13 15:53:24 -07:00
Peter Johnson
80647654c3 [hal] Add HAL_Status typedef (#8671) 2026-03-13 15:51:43 -07:00
Tyler Veness
907bf05607 [ci] Upgrade to wpiformat 2026.56 (#8666) 2026-03-13 13:15:01 -07:00
Joseph Eng
f196418297 [wpilib] Fixup alerts (#8663)
Makes Java `Alert.Level.ERROR`, `Alert.Level.WARNING`, and
`Alert.Level.INFO` proper aliases (instead of separate enum constants
with the same value).
Cleans up Python tests.
Makes the Alert tests more consistent between languages.
2026-03-09 23:03:00 -07:00
PJ Reiniger
c0f8159540 [copybara] Resync with mostrobotpy (#8662) 2026-03-08 21:38:21 -07:00
Tyler Veness
71cd434699 [wpimath] Don't clamp Rotation2d interpolation (#8661)
Extrapolation is also valid.
2026-03-07 15:58:48 -08:00
Peter Johnson
6910ff1362 [ntcore] PubSubOption: Use record approach for Java (#8659) 2026-03-06 22:26:31 -08:00
PJ Reiniger
ccfb3ab1cd [robotpy] Fixup errors missed in #8479 (#8660)
Looks like a race condition happened in the landing of the examples PR
and #8479 which caused some of the python examples to fail.
2026-03-06 21:21:43 -08:00
Tyler Veness
b29bde123f [wpimath] Implement Rotation3d interpolation as slerp instead of lerp (#8529)
Also replace arithmetic operators since they're not commutative, which
is confusing for users.
2026-03-06 15:15:00 -08:00
Sam Carlberg
28176f1062 [javac] Add @MaxLength annotation for limiting lengths of string parameters (#8493)
Useful for eg OpModes, where names have a maximum length

Also includes validations for values in opmode annotations like
`@Autonomous(name = "...")`; name, group, and description all have
maximum allowable lengths
2026-03-06 14:20:20 -08: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
sciencewhiz
1e39f39128 [ci] Build docs with Java 25 (#8655) 2026-03-05 23:19:10 -08:00
PJ Reiniger
51a3876330 [robotpy] Build examples (#8629)
This hooks up the bazel build to the robotpyExamples. It can use the
(formly pyfrc or whatever) automatic unit tests for an example, as well
as exposing the ability to run the example in simulation, with or
without `halsim_gui` with a command such as `bazel run
//robotpyExamples:AddressableLED-sim`

This required building and using wheels instead of just a normal
`py_library`, so that things like `ENTRY_POINTS` can be used. I took a
bare bones approach to building and naming the wheels (for example the
native ones don't have the OS info or python version in them, so they
wouldn't be suitable publish to pypi, but that can always be updated
later.
2026-03-05 23:18:37 -08:00
Tyler Veness
26b2b08c8d [wpimath] Clean up KalmanFilter tests (#8651)
Also synchronize C++ and Java versions of tests.
2026-03-05 23:17:36 -08:00
Gold856
c8780950c0 [wpimath] Simplify LinearSystem#slice in Java (#8658)
Avoids boxing to reduce allocations, combines for loops as an
optimization, and removes massive switch statement because Java's
generics are type erased, so the different type parameters make no
difference.
2026-03-05 23:16:44 -08:00
Peter Johnson
e9d226491c [cscore] Split cscore classes into separate headers
Fixes #3713.
2026-03-04 22:09:40 -07:00
Peter Johnson
f08258f784 [wpiutil] Split C++ header files 2026-03-04 22:09:40 -07:00
Peter Johnson
a7f71c9434 [hal] Consistently use .hpp for C++ header content
Some headers were renamed, but others were split.
2026-03-04 22:09:40 -07:00
Gold856
ab45819f6f [ci] Specify exact OpenCV features in vcpkg manifest (#8653)
This allows us to skip building things we don't need, like the ML
libraries or QR code scanning. This cuts the vcpkg configure time down
by 50%.
2026-03-04 18:52:48 -08:00
Peter Johnson
733cfa4b07 [hal,wpilib] Move Alert to HAL (#8646)
SystemCore implementation is not yet connected to MRCComm.
2026-03-03 20:58:47 -08:00
Thad House
f4935a2ea9 [nanopb] Add function to get rest of buffer (#8650) 2026-03-02 10:46:23 -08:00
Gold856
06598f5436 [wpiunits] Remove deprecated divide and negate functions (#8645) 2026-02-28 10:30:04 -08:00
Peter Johnson
ba81d4b790 [cscore] Remove Axis camera (#8642)
Was a thin wrapper around HttpCamera and haven't been used by teams for
years.
2026-02-27 21:05:52 -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
Gold856
46a911d50c [docs] Fix various @see tags in Javadoc (#8644)
Most of these were leftovers from the reorg, the Commands v2 change is
from the recent merge from main and fixes our builds again.
2026-02-27 20:04:07 -08:00
Peter Johnson
c8c68329fa [build] Fix Robotpy pregeneration post-merge (#8641) 2026-02-27 15:14:47 -08:00
Matt Morley
4d0b67d293 [wpinet] Fix uv_tcp_keepalive to take seconds (#8639)
[Libuv docs](https://docs.libuv.org/en/v1.x/tcp.html) states:

> Enable / disable TCP keep-alive. delay is the initial delay in
seconds, ignored when enable is zero.

But we used std::milli, leading to being off by a factor of 1000.
2026-02-27 14:27:59 -08:00
Peter Johnson
b566814bae [wpilib] Remove LinearOpMode (#8638)
Linear OpModes have several major downsides with no obvious solutions:

- Some things stop working automatically--e.g. in a linear opmode,
simulation will not work out-of-the-box; the user must explicitly call
sim themselves.  there's a few other things we do periodically, but this
is the big one (it also forces some decisions on other parts of the
library—eg if we want Tunable to work in linear without the user
manually calling refresh, we have to run it on a background thread,
which means it must be thread safe throughout).  We can help in some
areas (e.g. have sleep functions call background things), but if the
user is writing a loop that waits to drive a certain distance with no
sleep, it's an easy footgun
- Writing code with no sleeps is easy to do, and can hog an entire
processing core easily--yes, there's more than one core, but it could
still easily impact e.g. vision processing
- Many people I've talked to want robot-level periodic and periodic sim
functions.  Given linear opmodes, we have two options, neither of which
is great: (1) don't provide robot-level periodic functions, and the
users who want those must set those up themselves and remember to call
them explicitly from every periodic opmode, or (2) provide them, but
only call them automatically from periodic opmodes, which could be
confusing for linear opmode users (they'd have to call them manually if
they wanted them).  Currently we do (1) but someone in the community
already opened a change to do (2).
- Restarting the robot program fixes the "stuck in auto for the rest of
the match" problem but still feels like an ugly hack because the startup
time is not unlikely to make the robot not immediately ready for teleop

Removing LinearOpMode resolves these issues by moving to a periodic-only
structure. We can address the few notable use cases of LinearOpMode
(e.g. very basic autonomous sequences) in other ways such as Blocks
generated code, better state machine tutorials/documentation, etc.
2026-02-27 14:26:27 -08:00
Peter Johnson
7513846c72 Merge branch 'main' into 2027 2026-02-27 14:24:41 -08:00
amsam0
7ca35e5678 [wpimath] Add limit setters to SlewRateLimiter (#8581)
This is just #7793 with requested changes applied.
2026-02-27 12:53:18 -08:00
Kevin Cooney
613bd88548 [wpilib] Make Preferences Listener not depend on mutable fields (#8607)
The Listener installed by Preferences was referencing m_typePublisher which could be modified by a future call to setNetworkTableInstance(). Instead, reference a local.

Also made Topic.m_handle final, to guarantee that Topic.equals() is thread-safe, and still work after the publisher has been closed.
2026-02-27 12:42:40 -08:00
Stephen Just
e311722637 [ntcore] Handle interrupted save in NetworkServer (#8630)
In NetworkServer::SavePersistent, if the save is interrupted (by robot
power loss, etc), the networktables.json file may be left in an
unhandled state where the file consumed by
NetworkServer::LoadPersistent is not found, but the backup file exists.
In this case, we should attempt to recover the backup file to avoid
losing all persistent data.
2026-02-27 12:39:05 -08:00
sciencewhiz
ae43b8b6dd [cmd] Fix WaitUntilCommand for match time counting down (#8632)
Fixes #8631
Documents that it will return immediately if FMS isn't attached or DS
isn't in practice mode.
Related to change in DS match time behavior that was documented in #8606
2026-02-23 17:11:59 -08:00
sciencewhiz
5ae8ee06dd [build] use local opencv docs element-list (#8633)
Fixes opencv cloudflare blocking gradle javadoc builds
2026-02-23 16:32:28 -08:00
DeltaDizzy
d9eba4bb22 [wpilib] Document zero angle in SingleJointedArmSim (NFC) (#7756)
Fixes #7752

---------

Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2026-02-21 14:36:36 -08:00
Thad House
44441daad7 [wpilib] Use reflection to load main class, remove main from templates (#8627)
#8626 needs to switch to using reflection to load the robot class. Do
that with this PR so it's separate.

Also, remove the duplicated main files from the template, and instead
fixup vscode to handle this properly.
2026-02-21 14:35:26 -08:00
Sam Carlberg
793b0a3187 [build] Migrate to Gradle version catalogs (#8524)
Also fixes the google compile-testing library to 0.23.0 (the latest
available at time of writing) instead of a wildcard

Jackson versions were inconsistent across projects; most were on 2.19.2,
but the fields subproject was on 2.15.2. All projects are now on 2.19.2
for consistency
2026-02-20 15:31:33 -08:00
PJ Reiniger
8f9fc4d1b6 [copybara] Import robotpy examples (#8608)
GitOrigin-RevId: 9ba4bc3040fa7e772f5a594039e78fc6c43d114e
2026-02-20 15:30:35 -08:00
Jordan Powers
9cd933fa14 [wpiunits] Fix incorrect magnitudes in some MutableMeasure mutations (#8620)
This PR fixes the magnitude units in `MutableMeasure#mut_acc` and
`MutableMeasure#mut_plus`.

Previously, both `mut_acc` and `mut_plus` were setting the base
magnitude using the unit-ed magnitude value. While this would work fine
for base units where `magnitude == baseUnitMagnitude`, this was creating
issues with derived units.

This PR also adds missing tests for the `MutableMeasure` class.
2026-02-20 15:29:53 -08:00
Gold856
1806cd2d78 [hal] Remove useless usage reporting return (#8625)
The value is not used anywhere and it also just returns 0 (was a value
from Netcomm in pre-2027).
2026-02-20 15:28:57 -08:00
Ryan Blue
0c44e63465 [wpilib] Make joystick unplugged warning better in cases of out of range axis/button (#8614)
Closes #8594 
Fixes #7700 
Also fixes DS HAL to zero out joysticks not received from DS.
2026-02-17 20:22:02 -08:00
Thad House
10fa2fced4 [wpinet] Switch macOS mDNSResolver to dispatch_queue (#8621)
The old thread based method had issues and occasionally segfaulted. And
was much more complex. This is much cleaner
2026-02-17 20:20:34 -08:00
Thad House
af01a72725 [wpilib] Enable ExpansionHub motors and servos on any set (#8619)
This more matches the existing FTC SDK. And removes the footgun of
needing to call set.
2026-02-17 20:19:52 -08:00
PJ Reiniger
1dbffb972f [robotpy] Fixup build after merge (#8618) 2026-02-15 10:22:58 -08:00
Peter Johnson
af865f8020 Merge branch 'main' into 2027 2026-02-15 00:51:21 -08:00
Ryan Blue
36c489247c [ntcore] Fix local client sending value updates before publish message (#8613)
Text frames were being queued while binary frames were sent immediately.
Change NetworkOutgoingQueue to send text frames immediately on local
connections. Add asserts since local connections should now not be
queueing at all.
2026-02-14 21:46:38 -08:00
sciencewhiz
77dfad97c6 [ci] Use wpilib docker-run-action fork (#8615) 2026-02-14 11:32:57 -08:00
Tyler Veness
245186cb15 Fix clangd #include warnings (#8565) 2026-02-11 12:15:02 -07:00
sciencewhiz
7ac0612397 [hal,wpilib] Update MatchTime docs for teleop and auto mode (NFC) (#8606)
Update Timer and JNI MatchTime functions to latest docs
2026-02-09 17:14:42 -08:00
Charlotte Wilson
1680e676b6 [wpimath, wpiutil] Use java_multiple_files for Protobuf (#8555)
Closes #8256
2026-02-09 17:11:57 -08:00
PJ Reiniger
227c89ab23 [copybara] Resync robotpy (#8585)
Project import generated by Copybara.
    
GitOrigin-RevId: fd000778e9b78c72cc7ca7b2ebe476129b78c6e0
2026-02-08 07:36:35 -08:00
Thad House
4aa21e947d [wpilib,cmd] Rename gamepad shoulder to bumper (#8573)
Both programs used bumper, so we shouldn't rename it. There's no reason
to change it, and we don't need to match SDL.
2026-02-07 10:39:22 -08:00
sciencewhiz
19c61cc419 [upstream_utils] Update to SDL joystick mappings from 1-19-2026 (#8593)
Fixes #8103
2026-02-07 09:49:30 -08:00
Tyler Veness
2c5529d714 [wpimath] Speed up pose estimator correction computation (#8574)
In C++, we use a diagonal matrix to avoid an expensive matrix
multiplication. EJML doesn't have a diagonal matrix type, so in Java, we
use a double array and implement the multiplication manually.
2026-02-06 21:47:49 -08:00
Gavin P
7cd3790c7c [wpiunits] Make RPM an alias of RotationsPerMinute (#8595)
Currently the only name for this unit is `RPM`. This caused a bit of
confusion for a couple of my team members when we failed to find an RPM
unit, assuming it would be named `RotationsPerMinute` as is the standard
for almost all other units, such as `RotationsPerSecond`.

No corresponding changes have been made to wpilibc as it seems to
already work this way, with `rpm` being the abbreviation for
`revolutions_per_minute`.
2026-02-06 21:47:08 -08:00
PJ Reiniger
2d97cb928f [bazel] Upgrade hermetic python version to 3.13 (#8554)
Robotpy dropped support for 3.10 recently, so this updates to the next
lowest version. This will be helpful when the examples get merged into
`mostrobotpy`

There's not really a specific reason why I just jumped to 3.11 instead
of a newer version. If anybody suggests otherwise I will gladly bump it
higher.
2026-02-06 21:40:10 -08:00
NotTacos
664484306c [glass] Change match times for rebuilt (#8575)
The timer has changed for rebuilt's auto and teleop.
2026-02-06 21:39:12 -08:00
Thad House
85adbf990e [hal,wpilib] Switch to new game data (#8584)
Game data is now limited to 8 bytes, and comes through the UDP packets.
2026-02-06 21:38:15 -08:00
Thad House
ac45c694f3 [wpinet] Fix windows mDNS announcer long startup times (#8604)
The existing code takes 750ms to start per resolver. This is too long,
especially in mrccomm where we start 4 on initialize, and 3 any time the
team number changes.

Solve this by handling the async setup more correctly. Assuming it
returns pending, we're assuming the announcer is good. Then on stop(),
we cancel the register in case its still pending, wait for the callback,
and then deregister.
2026-02-06 21:37:11 -08:00
jpokornyiii
0a37317467 [examples] Adding XRP java and cpp examples for Timed Robot (#8599)
Adding an example (one C++ and one Java) for using TimedRobot with the
XRP.
2026-02-06 21:36:35 -08:00
Thad House
5c5d5222f4 [wpilib] Prefix all NI DS specific controller classes (#8596)
Easier then the last one that put everything in a sub namespace. By
prefixing the name less things break, and intellisense will be less
confusing to new users during the transition.
2026-02-06 21:36:01 -08:00
Ryan Blue
77b2f9802e [ntcore] Fix local client behavior (#8588)
Fixes local clients receiving inconsistent data updates. Data was only
flushed to local clients on incoming websocket data (or when explicitly
flushed), so local clients on a quiet server would stop receiving
updates.

Revert some changes from #7997.
Instead of relying on periodic sends, always immediately send local data
updates to the wire for lower latency. This means that on local clients,
the periodic update rate and sendAll settings will be ignored, as all
data updates will be sent immediately.
2026-02-06 21:35:02 -08:00
FirstFox3
6b225bb1f1 [wpilib] Fix typo in TimedRobot.getLoopStartTime() docs (#8590)
Fixed a typo in the description of the getLoopStartTime function in both
C++ and Java TimedRobot class.

---------

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2026-02-05 18:57:49 -07:00
Vasista Vovveti
3d92547d62 [cscore] Fix format specifier on Mac (#8602) 2026-02-05 18:56:52 -07:00
Thad House
a2a40b56d1 [bazel, gradle] Fix deprecation warnings for gradle 10 and Bazel build (#8597) 2026-01-31 16:36:41 -08:00
crueter
c89401250f [hal, wpilib] Usage Reporting: QFRCDashboard -> QDash (#8571) 2026-01-15 19:55:55 -07:00
Tyler Veness
8be7720a68 [sysid] Fix crash on partially empty raw data (#8572)
Fixes #8570.
2026-01-15 18:57:38 -07:00
Michael Lesirge
21b5389bbe [wpimath,cmd] Add multi tap boolean stream filter and multi tap trigger modifier (double tap detector) (#8307)
Add a simple tap counting filter for boolean streams. 

The filter activates when the input has risen (transitioned from false
to true, like when a button is tapped) the required number of times
within the time window after the first rising edge. Once activated, the
output remains true as long as the input is true. The tap count resets
when the time window expires or when the input goes false after
activation.

Example usage:
```java
    xbox.a()
      .multiPress(2, 0.2) // Detect a double tap within 0.2 seconds
      .onTrue(Commands.print("Double tapped A button"));
      
     xbox.y()
      .multiPress(2, 0.5) // Detect a double tap within 0.5 seconds
      .whileTrue(Commands.print("Y held after tap").repeatedly());
```

This is not a noise reduction and/or input smoothing filter, but it is
similar in usage to debounce, so I believe it could be considered a
filter, but am open to a better location.

I believe this would be a useful addition, as double/triple tapping a
button is a common control option in games, yet is not often utilized by
newer FRC teams. I believe adding it to WPILib in a standard way will
allow more teams to make the most out of their controls.
2026-01-14 20:22:07 -08:00
Joseph Eng
9e1258440b [wpimath] Fix Rotation3d interpolation and document extrinsic vs intrinsic (#8544)
Documents the extrinsic vs intrinsic semantics of `plus()` and
`minus()`. (`rotateBy()` was documented in [a previous
PR](https://github.com/wpilibsuite/allwpilib/pull/5508))
Fixes usage of `plus()` and `minus()` in `Rotation3d.interpolate()`.
(Fixes #8523)
Fixes incorrect usages of `plus()`, `minus()`, and `rotateBy()`
throughout `Odometry3d`.
Adds explanatory comments for some `plus()`, `minus()`, and `rotateBy()`
operations.
Fixes `TimeInterpolatableBuffer` not using twists for `Pose3d` (this was
just because I happened to notice it, it isn't really related to the PR)

To check all of our usages of `plus()`, `minus()`, and `rotateBy()`, I
marked them as deprecated, checked compile errors from `./gradlew
compileJava`, and then undeprecated them. You can see all of the spots
that showed up (at least on the Java side) by viewing the diff for
241109c.

I wanted to present this alternative to #8526 because the change has its
own quirks, there's little time before kickoff, and there would be no
code-side warning to teams (and mentors) already used to the current
behavior.
2026-01-14 20:16:24 -08:00
Austin Schuh
0001ddc7ec [bazel] Switch over to /DEBUG:FULL unconditionally (#8563)
This is faster everywhere.

Fixes #8517
2026-01-14 20:15:42 -08:00
PJ Reiniger
1cbc25bc36 [copybara] Resync commandsv2 (#8535)
This will be the last sync from the commandsv2
[repo](https://github.com/robotpy/robotpy-commands-v2), as it has now
been merged into
[mostrobotpy](https://github.com/robotpy/mostrobotpy/pull/226).

Doing this on its own to make the diffs smaller when doing a full
`mostrobotpy` sync, which will now have a lot of other new goodies
coming along for the ride.

---------

Co-authored-by: Default email <default@default.com>
2026-01-14 20:15:00 -08:00
Dave Oleksy
812a1b8e1a [hal] Add 2026 REV products for usage reporting (#8567)
Adding REV Easy Swerve and MAXSpline Encoder to usage reporting.

Co-authored-by: Dave Oleksy <dave.oleksy@revrobotics.com>
2026-01-14 20:14:20 -08:00
Tyler Veness
996af272e8 [wpilib] Fix C++ DCMotorSim constructor docs (#8568)
See
https://github.com/wpilibsuite/allwpilib/pull/8468#discussion_r2692411059.
2026-01-14 20:13:19 -08:00
PJ Reiniger
eccc2301ac [py] Add wpimath/kinematics tests (#8461)
Used Gemini to convert the C++ tests in wpimath/.../kinematics to
pytest. For ease of use required a better constructor for
`MecanumDriveWheelPositions`

I did this conversion months ago (before robotpy landed and before the
reorg), so new tests might be missing. At least its better than nothing
🤷

Broke the huge pr that does almost everything into parts so its easier
to review.

---------

Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2026-01-12 19:14:14 -08:00
Peter Johnson
c2b339cfc9 [wpilib] OpModeRobot: set up notifier before calling observe starting (#8547)
This avoids a simulation race.
2026-01-12 19:11:58 -08:00
Ryan Blue
05225a29a7 [cmake] Fix datalog config file (#8546) 2026-01-12 19:11:35 -08:00
PJ Reiniger
762d1e8b93 [copybara] mostrobotpy to allwpilib (#8545)
Project import generated by Copybara.
GitOrigin-RevId: f10284b37498bb6a088891ca41f160793ec7fd90
2026-01-12 19:11:02 -08:00
Tyler Veness
7e1260b003 [wpilib] Replace unit .to<double>() with .value() (#8548)
This is consistent with the rest of the library. I left instances alone
which intended a specific typecast.
2026-01-12 19:10:10 -08:00
Tyler Veness
00fa8361dd [wpimath] Reorganize LinearSystem factories (#8468) 2026-01-12 19:09:35 -08:00
Tyler Veness
89d0759ef2 [wpimath] Remove unused #includes (#8549)
This is based on a filtered list of #includes clangd reported were
unused.
2026-01-12 19:08:21 -08:00
Kevin-OConnor
18249badc0 Add 2026 game specifics (#8558)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
2026-01-12 19:07:51 -08:00
Austin Schuh
1724e59f8d [bazel] Move the easy pieces of the build over to bzlmod (#8542)
bzlmod is the future, and makes it easier to depend on AOS.

---------

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2026-01-12 15:30:31 -07:00
Dustin Spicuzza
0fd8210b5a [ntcore] Release ListenerStorage mutex before stopping thread (#8562)
If the thread is still running then it will deadlock.
Fixes #8561
2026-01-11 02:29:49 -08:00
Tyler Veness
67ae589c11 [wpimath] Replace convolution operator with multiplication in derivations (NFC) (#8557) 2026-01-10 11:44:50 -08:00
sciencewhiz
b82d204525 Update vendordep frcYear to 2026 (#8552) 2026-01-06 16:29:45 -08:00
PJ Reiniger
6654627016 [bazel] Improve path resolution during pybind build file generation (#8522)
This anecdotally fixes a problem that occurs when building with bzlmod.
At least for me this fixes the problem, and now that there is a function
for it it can be easier to deal with any other special casing that needs
to happen (windows, remote execution, etc). It is still a bit naive, but
should fix the major problem at the moment.
2026-01-04 00:59:54 -08:00
PJ Reiniger
32cd2ddf8e [upstream_utils] Remove patch that results in building with NDEBUG causing ODR issues (#8539)
Semiwrap / meson / robotpy define `NDEBUG` when building their software
in all modes, while `allwplib` only does it when building debug. This
causes the size of `DenseMap` to differ between the shared libraries
built here, and the extension modules built in `mostrobotpy`, causing
segfaults when you try to execute code that uses `DenseMap`. This is not
a problem with the robotpy code in `allwpilib`, because bazel uses the
exact same compiler flags when building the shared libraries and
pybind11 extensions.
2026-01-03 13:32:16 -08:00
PJ Reiniger
ccb3266753 [upstream_utils] Remove patch that results in building with NDEBUG causing ODR issues (#8540) 2026-01-03 13:31:26 -08:00
PJ Reiniger
5a3f2ce13a [gradle] More gradle 9 codesign updates (#8536)
This replicates the fix in #8531 for other binaries that are still tripping up CI.
2026-01-02 13:33:00 -07:00
PJ Reiniger
8518b7014c [py] Add wpimath/geometry tests (#8460) 2026-01-02 09:10:02 -08:00
Charlotte
32fa124166 [upstream_utils] Upgrade JSON library to v3.12.0 (#8509)
Closes #7903.
2026-01-02 08:51:16 -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
sciencewhiz
d6b243fb46 [build] Update exec for Gradle 9 (#8531) 2026-01-02 08:47:25 -08:00
sciencewhiz
8efdab81fe [build] Preserve file permisions and timestamps in archives (#8532)
Fixes tools not being executable.
2026-01-02 08:47:10 -08:00
sciencewhiz
71a788e20b [docs] Update references to 2026 (#8534) 2026-01-02 08:46:22 -08:00
Ryan Blue
d3159c2554 [glass] Fix server mode (#8508) 2025-12-31 09:41:26 -08:00
sciencewhiz
699a0583fa [ci] Fix docs publishing after reorg (#8510) 2025-12-31 09:40:56 -08:00
Gold856
ae84f6d2c5 [wpical] Refactor to use WPILib libraries and modern C++ conventions and improve UX (#7796)
wpical was unable to use wpimath and its dependent libraries because
Ceres was compiled with a different version of Eigen. Now that the Ceres
build has been redone and shipped in #8151, we can now use wpimath and
our C++ apriltag wrapper in wpical, allowing for major refactors. This
includes:
* Using `to_json` and `from_json` specializations to concisely serialize
and deserialize all JSON files instead of manually handling JSON.
* Removal of the `Fieldmap` and `Pose` classes, which were duplicates of
the `AprilTagFieldLayout` and `Pose3d` classes respectively.
* Using `AprilTagDetector` instead of the raw libapriltag library.
* Using `Pose3d` instead of raw Eigen matrices.

In addition, several other refactors were made to make the code more
readable and to fix several UX issues and crashes. This includes:
* Eagerly parsing every JSON file when selected by the user. This means
JSON files are only parsed once on selection, instead of every time a
downstream function wants to use the data. This also means invalid JSON
can be detected upfront and a specific error shown immediately instead
of a catch all error when trying to calibrate.
* Using `std::optional` to indicate a calibration failed instead of
status codes.
* Processing videos on separate threads to not block the UI thread and
take advantage of parallelization for camera calibration. (2x speedup on
my laptop)
* Removing the OpenCV calibration option, since mrcal should be better
in every scenario.
* Showing a progress bar for camera calibration.
* Breaking up the massive `DisplayGui` function into separate functions
which contain code for different popups. This also allowed for better
organization and scoping of static variables.
* Renaming variables to make their purpose more clear.
* Displaying the tags present in a field layout when trying to combine
multiple field layouts.

Fixes #7722.
2025-12-31 09:28:51 -08:00
sciencewhiz
8fbaf4c2f5 [ci] Update github actions to use Node 24 versions (#8521)
https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

Done on the 2027 branch since the force change to Node 24 should (tm)
happen after the last 2026 release. And in case it breaks something and
we do need to backport to 2026, the release timeline on 2027 is not as
strict
2025-12-31 09:13:01 -08:00
sciencewhiz
32fcf5bc27 [build] Add datalog project to docs build (#8511) 2025-12-31 09:11:56 -08:00
Charlotte Wilson
f395954d3c [ci] Update Android NDK version to R27D in CMake workflow (#8525)
https://github.com/android/ndk/wiki#release-schedule
2025-12-31 09:08:33 -08:00
PJ Reiniger
40fb9ff562 [copybara] mostrobotpy to allwpilib (#8503)
Resync with `mostrobotpy`

This mostly involves the big "ignore almost everything in the HAL
project" and some fixups for the Addressable LED classes.

Required two small hand fixes to get it building over here with bazel,
and with more compiler warnings on.

I also manually zeroed out the `repo_url` field in the toml files to
avoid unnecessary churn whenever it goes from a release build to a
development build. I already did this with `version` field in there, and
will do a follow up PR that updates the copybara script to do it
automatically.

---------

Co-authored-by: Default email <default@default.com>
2025-12-31 09:06:01 -08:00
PJ Reiniger
bdc9391738 [py] Fix opmodes (#8498)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-12-31 09:05:00 -08:00
PJ Reiniger
1bbb284ad1 [py][wpiutil] Add type caster for WPI_String (#8500)
This adds a type caster for `WPI_String` so that pybind11 can more
easily auto-convert between that and strings. This helps remove the need
to do things like
[this](f1d77244c3)
in the opmodes fixup
2025-12-31 09:03:24 -08:00
Thad House
632eb0922d [build] Bump versioning plugin to ignore non-annotated tags (#8505) 2025-12-24 07:40:47 -06:00
PJ Reiniger
419ef31e30 [copybara] Zero out high churn 'repo_url' in .toml files (#8504)
This is a high churn change whenever `mostrobotpy` switches from
pointing to `release-2027` to `development-2027`. The value isn't used
by the bazel build scripts, so there is no reason to have a zero impact
change on ~11 files muddying up the synchronization diffs.

In the `allwpilib -> mostrobotpy` direction, we update [this
](https://github.com/robotpy/mostrobotpy/blob/main/rdev.toml) config
file and run
[this](https://github.com/robotpy/mostrobotpy/blob/main/rdev.sh) script
which updates it in that repo during.

I manually did this change in #8503, but this will do it automatically
in the future
2025-12-24 07:39:24 -06:00
Bryce Roethel
ab3af00d07 [wpimath] TrapezoidProfile.State implement StructSerializable (#8499)
Seems like this was missed in #8163
2025-12-21 10:08:32 -06:00
Tyler Veness
0349524f80 [wpilib] Remove MotorController::StopMotor() (#8483)
It does the same thing as Disable() in practice, and MotorSafety has its
own StopMotor() function.
2025-12-17 21:18:47 -08:00
PJ Reiniger
a38499dcd7 [py] Fixup new acceleration classes (#8459)
I tried to sync `mostrobotpy` with `allwpilib` and was getting a
compilation error I had not seen before when it tried to do the stub
generation (which `allwpilib` does not do).

Luckily, I was able to debug it here by writing some unit tests (i.e.,
having Gemini convert the C++ tests into python) that failed in a
similar way. The main problem was needing to write a custom constructor
for the class and adding a `force_type_casters`. I used `ChassisSpeed`
as my main example, but I did not copy all of the other custom code like
overriding the index operator, `__repr__` operator, feet helpers, etc. I
can gladly add those in.

In the future, we should start enforce a policy that if you add a C++ or
Java unit test, you also have to add a python test. That developer might
have gotten more stuck on the minutia of how to fix it, but this problem
would have at least been caught earlier before it landed.
2025-12-17 19:19:12 -08:00
Thad House
d6b54bbae2 [ntcore] SetServerTeam: Use Systemcore name/addresses (#8314) 2025-12-16 22:28:45 -08:00
Thad House
e2d492ac3f [ntcore] Add ability to announce mDNS for server (#8373)
We can use this as a new way of resolving addresses.
2025-12-16 22:26:56 -08:00
Sam Carlberg
7cb58962c5 [cmd3] Scope scheduled commands to the running opmode, if one exists (#8492)
This prevents commands from outliving the opmodes in which they were
scheduled
2025-12-16 22:24:58 -08:00
Thad House
5a22abb85b [hal] Explicitly wait for mrccomm server to be ready (#8490)
Avoids a race if robot ready happens before mrccomm is fully booted
2025-12-16 22:24:13 -08:00
Sam Carlberg
5bebaebcc0 [cmd3] Report incorrect coroutine usage on the variable use site (#8481)
This makes error messages point directly at the variable use, instead of
on the enclosing AST node:

```
error: `outerCoroutine` may not be in scope
    outerCoroutine.yield()
    ^

error: `outerCoroutine` may not be in scope
    consume(x, outerCoroutine);
               ^
```

instead of 

```
error: `outerCoroutine` may not be in scope
    outerCoroutine.yield()
                        ^

error: `outerCoroutine` may not be in scope
    consume(x, outerCoroutine);
           ^
```
2025-12-16 22:23:30 -08:00
Sam Carlberg
6ef55654f6 [cmd3] Fix commandv3 builders and add tests (#8482)
Sequential group builder had an inverted if condition causing NPEs

Parallel group builder was building parallel groups using an old ctor
signature and creating groups that didn't match what was specified in
the builder

Test coverage has been added for both builder types
2025-12-16 22:23:04 -08:00
Thad House
8b10a0546d [hal] Fix typo in NumOccurrences (#8487)
Closes #8439
2025-12-16 22:20:48 -08:00
Tyler Veness
718f2f7ccd [ci] Upgrade to wpiformat 2025.79 (#8491)
wpiformat now skips binary files matching a list of extensions.

https://github.com/wpilibsuite/styleguide/blob/main/wpiformat/wpiformat/__init__.py#L483-L504
2025-12-16 22:20:21 -08:00
sciencewhiz
f668e10197 [docs] Update Doxygen Awesome to 2.4.1 (#8494)
Supports Doxygen 1.14, and should be better with Doxygen 1.15 that we
use, compared to the current version.
Improves, but does not fix #8486. The sidebar now covers the search
results, rather then both bleeding through

<img width="1206" height="1969" alt="image"
src="https://github.com/user-attachments/assets/e8c0cefd-a72a-4c41-a5bf-c191752250f4"
/>
2025-12-16 22:19:47 -08:00
Tyler Veness
f9ee67e85f [wpilib] Move motor controller .cpp files to mirror headers (#8484) 2025-12-15 10:54:11 -07:00
Tyler Veness
1b2f051b4b [docs] Replace instance of PWMSpeedController (#8478) 2025-12-14 08:06:02 -08:00
Peter Johnson
f6ef155166 [wpilib] LinearOpMode: wait for mode change to return from OpModeRun (#8477)
We need to wait, or otherwise OpModeRobot will immediately reinstantiate
and re-run the opmode, which is generally undesirable (e.g. for
autonomous).

Fixes #8475.
2025-12-13 21:45:22 -08:00
PJ Reiniger
e2c9af862e [py] Fix maven coordinates for native downloads (#8474)
This got missed in the reorg, and these values aren't actually used for
anything when building in `allwpilb`, but we might as well fix them here
to make the copybara process easier.
2025-12-13 21:44:31 -08:00
Thad House
af0a3e9c2f [build] Update to gradle 9.2.0, use new reorged plugins (#8471) 2025-12-13 21:44:00 -08:00
Thad House
bcb5c5c16c [hal] Fix controldataproto SupportsOpModes (#8476)
It wasn't updated, so DS was always assumed to be NI DS
2025-12-13 16:07:23 -08:00
Benjamin Hall
3dc334c1ee [wpimath] Fix ResetTranslation and ResetRotation in PoseEstimator and PoseEstimator3d causing the robot to teleport (#8285)
Fixes https://github.com/wpilibsuite/allwpilib/issues/8284.

If we have vision updates at the time of the `Reset*` call, we can
correct the translation/rotation of the new odometry pose by adding a
new vision update where:
- `ResetTranslation`: the translation is hard-coded to the new
translation, and the rotation components are set to those of the latest
vision update (prior to clearing the map).
- `ResetRotation`: the rotation is hard-coded to the new rotation, and
the translation components are set to those of the latest vision update
(prior to clearing the map).
2025-12-13 15:53:53 -08:00
PJ Reiniger
ea71bdfba6 [py][cmd2] Fix opmodes merge (#8473)
Looks like a build failure got lost in the landing order of python
commands and the big opmode change. This makes it compile again, based
on the java / C++ changes from the opmode PR.
2025-12-13 12:11:29 -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
Peter Johnson
2a41b80e00 [wpilib] Fix Watchdog to always ack notifier (#8472) 2025-12-12 20:19:54 -08:00
PJ Reiniger
0049c6f23f [py] Add copybara scripts (#8368)
These are the scripts I've been using to sync between mostrobotpy and
here. I debated putting it in the "source of truth" that is
`mostrobotpy` , but I think it makes more sense here since it already
has bazel set up, and I've also recently added the ability to sync the
`commands-v2` repository, so having it all in one copybara script makes
sense.

This includes a helper python script to make it a little bit easier to
run.
2025-12-12 20:06:19 -08:00
PJ Reiniger
13abb3d332 [py][cmdv2] Add python commands-v2 to build system (#8380)
This hooks up the recently landed robotpy commands v2 to the build
system.

The swerve controller command was deleted to match #8119
2025-12-12 20:05:31 -08:00
Tyler Veness
cca035787c [upstream_utils] Upgrade to Sleipnir 0.3.3 (#8463) 2025-12-12 19:40:43 -08:00
Thad House
d830c41063 [wpinet] Add option to use directly linked Avahi from cmake (#8469) 2025-12-12 19:39:26 -08:00
Peter Johnson
cbe447aad7 [hal] Notifier: Reset signal object on ack (#8466)
This is needed to avoid spurious wakeups in WaitForObject due to a
previous alarm having set the signal object.
2025-12-11 22:31:49 -08:00
Peter Johnson
5aaf2d7138 [hal] Handle: free on operator= (#8462) 2025-12-11 22:31:30 -08:00
Peter Johnson
06a9a055b3 [hal] Notifier: simplify ack API (#8457)
Adding an ack parameter to both set and cancel is cleaner than adding
all the set alarm parameters to the ack function. It also provides an
ack-and-cancel method.
2025-12-09 19:28:15 -08:00
Zach Harel
936be71a7d [wpimath] Add ChassisAccelerations and drivetrain accelerations classes and add forward and inverse kinematics for accelerations to the interface (#8185)
ChassisAccelerations and the drivetrain acceleration types are added in
both Java and C++. `ChassisAccelerations` is basically just
`ChassisSpeeds` but for accelerations!
`DifferentialDriveWheelAccelerations`, `MecanumDriveWheelAccelerations`,
and `SwerveModuleAccelerations` are the acceleration equivalent of the
drivetrain speeds types.

In Java, the `Kinematics` interface now has an additional generic
parameter `A` which represents the accelerations, and
`toChassisAccelerations` and `toWheelAccelerations` methods, which are
implemented the same way as `toChassisSpeeds` and `toWheelSpeeds`.

Protobuf and struct classes were also added for all four classes in Java
and C++.

---------

Signed-off-by: Zach Harel <zach@zharel.me>
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2025-12-08 17:25:07 -07:00
Sam Carlberg
44cf645632 [epilogue] Fix v3 scheduler incompatibility with epilogue (#8458)
Was caused by checking assignability like`Protobuf<Scheduler,
ProtoMessage>` instead of `Protobuf<Scheduler, ? extends
ProtoMessage<?>>`

This epilogue bug would have also applied to other protobuf-serializable
types
2025-12-06 22:38:10 -08:00
Joseph Eng
59edbdd3cc [halsim_gui, wpilibc/j] Fixups for joystick outputs (#8443)
#8385 changed gamepad types to follow SDL_GamepadType, so 20 and 21
(previously `kHIDJoystick` and `kHIDGamepad`, respectively) are no
longer valid constants. This meant that after leaving the disconnected
state of the sim GUI, `GamepadType.getGamepadType()` would return null
(since it didn't match any constants). Since there aren't analogous
generic joystick and gamepad constants anymore, this PR changes
GlfwSystemJoystick and KeyboardJoystick to both unconditionally report
as kStandard.

This also updates the GenericHID.SetRumble doc comment to reflect the
two new types of rumble and changes some switch labeled statement groups
to use switch rules instead. If we want to keep on using switch labeled
statement groups (e.g. for consistency with C++, though
GenericHID::SetRumble currently uses if-else), then I could drop the
last change- I just made it since GenericHID.setRumble() previously used
switch rules and general switch rules are nice since there's no risk of
fall-through.
2025-12-06 09:17:48 -08:00
Peter Johnson
baa6379267 [wpimath] Add usage reporting for state-space classes (#8453)
- LinearQuadraticRegulator
- Kalman filters
- Pose estimators
- LinearSystemLoop

Fixes #2925.
2025-12-06 09:17:02 -08:00
Peter Johnson
0d1dd84e86 [wpilib] LEDPattern: Add usage reporting (#8452) 2025-12-06 09:16:45 -08:00
sciencewhiz
8411314850 [build] Build examples with v3 commands & javacPlugin (#8456) 2025-12-05 22:53:14 -08:00
Levi
a61866912b [hal] Rename Lumen to Lumyn in usage reporting (#8455) 2025-12-05 19:13:39 -08:00
Thad House
0b44b8de4e [wpiutil] Fix cmake build on windows when only MulticastServiceAnnouncer is used (#8454)
The pragma lib was only in the resolver. But if you had a statically
linked library that only used the announcer, the import wouldn't get
resolved.
2025-12-05 17:30:21 -08:00
Peter Johnson
57c40a3dfc [hal] Add more usage reporting constants (#8451)
Fixes #7234 
Fixes #6919
Supports #2925
Supersedes #8212 
Supersedes #7708
2025-12-05 15:20:49 -08:00
Peter Johnson
6f86f533e5 [wpiutil] MemoryBuffer: Fix zero extending size_t warning on Win32 (#8450) 2025-12-05 10:55:28 -08:00
Peter Johnson
934f8d9c15 [hal,wpilib] Fix TimedRobot notifier race (#8445)
It was possible for the alarm to fire between the set alarm and ack,
resulting in a hang on next wait. It's not possible to ack before set
alarm due to a race in sim step timing, so the fix is to provide an
atomic ack and set alarm; the easiest way to implement this in the API
was to change ack to optionally also set the alarm again.
2025-12-04 09:59:59 -07:00
Austin Schuh
d1b1703c86 [bazel] Use lowercase repo name (#8441) 2025-12-03 18:14:34 -08:00
Tyler Veness
08784dc2d1 [upstream_utils] Upgrade to Sleipnir 0.3.2 (#8323)
Also includes a C++ benchmark, which has a Java counterpart in #8236.
2025-12-01 13:51:28 -07:00
Peter Johnson
feea24251f [wpilib] Move ExpansionHub to hardware/expansionhub (#8440)
These need to be moved out of the org.wpilib root for Java
modularization, and in general it's cleaner.
2025-12-01 13:47:01 -07:00
sciencewhiz
ccfbf5f5b3 [commands] Add conflicts for Commands v2 & v3 vendordeps (#8438) 2025-11-30 11:12:12 -08:00
Peter Johnson
42992953ed [wpiutil] Move Color and Color8Bit from wpilib to wpiutil (#8437)
Removes one of the org.wpilib.util package conflicts for modularization.

Only a few minor tweaks were required to remove the wpimath dependency.
2025-11-30 11:11:48 -08:00
sciencewhiz
e902a98601 [examples] Reorganize templates to use CommandsV2 (#8432)
Change Commandbased to Commandv2
Run example check on templates
2025-11-29 20:46:32 -08:00
sciencewhiz
5aa0b7afea Update DevelopmentBuilds for Alpha 3 (#8435)
wpimathVersion was removed in wpilibsuite/gradlerio#804
2025-11-29 20:45:05 -08:00
David Vo
5514a1285d [bazel] Remove unused rules_bzlmodrio_jdk (#8436)
This previously provided a Java 17 toolchain. We now use (and require)
Java 21.
2025-11-29 20:44:33 -08:00
Ryan Blue
ded6790bcd [cmake] Only add wpilibj to generated config if Java is enabled (#8434)
Fixes #8422
2025-11-29 20:44:02 -08:00
Tyler Veness
d87e109a4e [ci] Free disk space in Gradle and Bazel builds (#8405) 2025-11-29 17:13:29 -08:00
Tyler Veness
473f2a0aff [wpilibc] Fix compilation failure (#8431) 2025-11-29 13:59:29 -08:00
Peter Johnson
02c8d5c9db [hal] Revamp notifiers (#8424)
This changes the HAL notifier interface to:
- Use wpiutil signal objects. This means waiting is done through the
`WPI_WaitObject` API instead of a dedicated function and allows for
higher level code to simultaneously wait on notifiers and other events.
- Interval timers are supported at the HAL layer
- Handlers are now required to acknowledge notifications. This is
invisible to users unless they're directly using the HAL API.
- For interval timers, an overrun count is maintained to detect if the
handler didn't acknowledge

The underlying implementation still uses condition variables for the
actual waiting. In basic testing using this approach seemed to be lower
jitter than timerfd.

Currently, the simulation and systemcore implementations are nearly
identical except for a few additional sim hook bits. This could be
refactored, but keeping them separate may make sense to keep the
systemcore implementation easy to read and reason about, or if we ever
choose to use a different underlying timer implementation on systemcore.

The simulation side API is unchanged in form but does change in
function--waiting for notifiers now only waits for currently running (or
newly signaled) notifiers to acknowledge. To avoid a race condition in
sim stepTiming, users of the low level API must make any alarm updates
(especially for one-shot alarms) prior to acknowledging the previous
alarm.

The only current use of the interval timer feature is the `Notifier`
class. The `TimedRobot` implementation still uses a single notifier and
its own interval timing logic to ensure consistent callback order. Using
separate notifiers for each user-level interval would substantially
increase complexity. `Watchdog` also doesn't use the interval timer, as
it's looking for an amount of time since the last `set` call rather than
a recurring interval time.

To reduce flicker, the sim GUI uses a fade out when a timeout goes from
set to unset.

This fixes tsan for wpilib and commands, and also fixes some spurious
test failures.
2025-11-29 11:00:18 -08:00
Peter Johnson
704b6ccaee Merge branch 'main' into 2027 2025-11-29 10:41:16 -08:00
Tyler Veness
a79f86ade3 [wpimath] Refactor StateSpaceUtil into separate files (#8421)
* Moved makeWhiteNoiseVector() to random.Normal.normal()
* Moved isControllable() and isDetectable() to system.LinearSystemUtil
* Renamed makeCostMatrix() to costMatrix() (Java)
* Renamed makeCovarianceMatrix() to covarianceMatrix() (Java)
* Renamed MakeCostMatrix() to CostMatrix() (C++)
* Renamed MakeCovMatrix() to CovarianceMatrix() (C++)
* Removed deprecated poseTo3dVector(), poseTo4dVector(), poseToVector()
* Removed clampInputMaxMagnitude()
* We don't use it, and Eigen has this functionality built in via `u =
u.array().min(u_max.array()).max(u_min.array());`
* Simplified implementation of desaturateInputVector()
2025-11-29 10:28:38 -08:00
Tyler Veness
c8e6ce1ca4 [wpimath] Rename variables in Twist tests (#8420)
Exp() now returns a transform instead of a pose.
2025-11-29 10:26:32 -08:00
Peter Johnson
a4aad63dd4 [hal,tests] Use waitForProgramStart in tests (#8429)
Change setProgramStarted to accept a boolean so it can be set back to
false by tests. This allows properly waiting for program start in tests.
2025-11-29 10:10:01 -08:00
David Vo
32d3ec0218 [bazel] Remove unused bzlmodrio-ni dependencies (#8430) 2025-11-29 10:09:29 -08:00
Tyler Veness
b482fa02df Shorten wpiformat config (#8427) 2025-11-27 17:30:06 -08:00
Tyler Veness
a802855e0c [upstream_utils] Upgrade to Eigen 5.0.1 (#8428) 2025-11-27 17:29:44 -08:00
Tyler Veness
c9b989ac6a [ci] Upgrade to wpiformat 2025.77 (#8426)
This release associates .cpp and .hpp files as C++ files by default.
2025-11-27 11:45:18 -08:00
Keagan Kautzer
769ce5e9fa [wpiunits] Rename AngularMomentumUnit.mult to per (#8409)
Fixes #8408
2025-11-23 14:40:30 -08:00
Tyler Veness
cba939cf43 [wpimath] Remove redundant parentheses in TransformBy() (#8419) 2025-11-22 20:20:44 -08:00
DeltaDizzy
7fdb42b9d9 [bazel] Add datalog dev targets (#8418) 2025-11-22 13:41:20 -08:00
David Vo
6059cc8b79 [ci] Build only publish artifacts in Bazel cross-compile jobs (#8416)
#8363 split all the cross-compilation into separate jobs, however these
jobs are still also building the world (including the tests) targeting
the host.

Since `//:publish` and its dependencies are transitioned to target the
desired platforms for each artifact, `bazel build //:publish` in the CI
jobs that aren't running tests to only build what we actually care about
in these jobs.

This saves around 1 to 1.5 minutes for each cross-compile job with 100%
cache hit rates.
2025-11-22 08:36:17 -08:00
Ryan Blue
f6b4ad575b [ci] Pin docker-run-action and remove rm command (#8415)
The fix was made but has not been tagged.
2025-11-22 07:55:44 -08:00
Peter Johnson
e47b4a5c3b [wpilib] Color: Improve string support (#8403)
Now rgb() and color constants are supported.

Changed from constructor to fromString() factory function to enable
directly returning color constant values.
2025-11-21 16:41:05 -08:00
Thad House
32fc543dc8 [hal,wpilib] Add Touchpad support (#8401) 2025-11-21 13:57:11 -08:00
Peter Johnson
8546d301e3 [wpiutil] Constexprify parse_integer and kin (#8411)
Also use requires instead of enable_if.
2025-11-21 12:57:41 -08:00
David Vo
e2cbde2061 [ci] Use Java headers for macOS Bazel build (#8413)
I'm not entirely sure why Java header compilation is disabled for the
macOS build. But this option will be causing rebuilds to happen more
often than strictly necessary.

[Turbine](https://github.com/google/turbine) takes Java class sources
and spits out .class files with all method bodies, and private fields
and methods stripped. This provides a .jar with sufficient information
on the classpath to build dependent Java libraries without depending on
the implementation in the build graph.
2025-11-21 12:53:17 -08:00
David Vo
84aec2b8c1 [ci] Remove Java and deprecated Bazelisk setup from Bazel workflow (#8412)
We download the JDK in the workspace and tell Bazel to use it for all
Java actions in our config, so we don't need to download another one.


99af9d775c/.bazelrc (L12-L15)

The
[bazelbuild/setup-bazelisk](https://github.com/bazelbuild/setup-bazelisk)
action is deprecated, and is redundant with the
[bazel-contrib/setup-bazel](https://github.com/bazel-contrib/setup-bazel)
action we use after it.
2025-11-21 12:52:34 -08:00
DeltaDizzy
51190bcf64 [readme] Update Bazel resource-limiting commands (#8407)
`--local_ram_resources=value` and `--local_cpu_resources=value` have
been replaced by `--local_resources=[memory|cpu]=value`, so the Bazel
README is updated to recommend the new form.
2025-11-21 12:48:41 -08:00
Tyler Veness
99af9d775c Update wpiformat config filename in .gitattributes (#8406) 2025-11-20 20:33:04 -08:00
PJ Reiniger
fbabcc2022 [ci] Run robotpy gen steps in series instead of simultaneously (#8404)
The update yaml step _might_ cause changes that would affect the build
file generation. Since `bazel run //:write_robotpy_update_yaml_files`
runs them all at once, user that was using the github action to fix
their python stuff would end up having to run it twice.

By running the steps individually in series, this should be able to get
it in one swoop.
2025-11-18 21:30:26 -08:00
Thad House
148ed63499 [wpinet] Directly link to mDNS APIs on Windows (#8374)
These were added in Windows 10 1703. Technically Windows 10 in general
is out of support, but versions of Windows 10 older than that are _well_
out of support. And we do directly link to other APIs that are newer. So
no need to do the dynamic linking.
2025-11-18 17:15:15 -08:00
Ryan Blue
a5ccd1795e [wpilibc] Fix PWM Sendable accepting pulse time in ms (#8400) 2025-11-18 17:14:21 -08:00
Gold856
7cd0ef5bd9 [docs] Revert "Update readme to say Xcode is required" (#8397)
This reverts commit 49b4b064cf  (#7892).
2025-11-18 17:14:01 -08:00
Warren Reynolds
bd7a88a6d0 [examples] Fix order of Swerve Modules in Odometry Update (#8396)
The order of the Swerve Modules in the m_odometry.Update call needs to
match the order they are defined in the creation of the kDriveKinematics
object.
2025-11-18 17:13:27 -08:00
Gold856
8e8c657e12 Remove gfortran mention in README (#8398)
Accidentally dropped in merge commit
ed7982563b due to
3b7d0e7bf5 also modifying adjacent lines.
2025-11-18 17:12:55 -08:00
PJ Reiniger
9bfb030b46 [robotpy] Improve debug information failures that require running scan-header, update-yaml, and update-build-info (#8388)
Fixes #8386 

Was already working on this when more people started hitting issues so I
prioritized getting this PR up. This updates the wrapper script to look
for the 3 biggest categories of "everything should be fine if you run
this step first" tool failures.

Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-11-17 15:37:41 -07:00
Tyler Veness
aba592bec0 [ci] Upgrade to wpiformat 2025.69 (#8394) 2025-11-17 15:36:32 -07:00
Thad House
ce6fd225a6 [hal,wpilib] Add support for joystick outputs (#8385)
Support joystick outputs, including Rumble and LEDs.

Also requires an update to Joystick descriptors, as that has also
changed in mrccomm to support showing what outputs are supported.
2025-11-17 15:36:14 -07:00
Keagan Kautzer
5db6d2f500 [cmd2] Revert wait back to waitSeconds (#8391)
Fixes #8272
2025-11-16 16:57:47 -08:00
Peter Johnson
0e621e8ec1 [ci] Remove command robotpy PR responder (#8392)
This is no longer required with the merge of Python commands.
2025-11-16 16:57:10 -08:00
David Vo
2cc46dd68c [bazel] Update rules_jvm_external to version 6.8 (#8389)
The commit we were pinned to
(3089931487)
ended up in a release.

https://github.com/bazel-contrib/rules_jvm_external/releases/tag/6.8
2025-11-16 14:22:18 -08:00
sciencewhiz
7b455e663c Update ThirdPartyNotices for 2027 reorg (NFC) (#8384) 2025-11-16 14:17:17 -08:00
Tyler Veness
b63743645f [wpimath] Only print Sleipnir diagnostics on test failure (#8382)
Bazel and CMake's CTest already do this by default since they run tests
in parallel, but Gradle doesn't.
2025-11-15 17:04:09 -08:00
sciencewhiz
34a72b71e1 [build] Fix 2027 java examples publishing (#8383) 2025-11-15 17:03:55 -08:00
David Vo
87c3c1fbc8 [bazel] Remove duplicate gson maven library (#8381)
Squashes the following warning:

```
DEBUG: /home/buildbuddy/workspace/output-base/external/rules_jvm_external/private/rules/coursier.bzl:775:18: 
Found duplicate artifact versions
    com.google.code.gson:gson has multiple versions 2.13.1, 2.10.1
Please remove duplicate artifacts from the artifact list so you do not get unexpected artifact versions
```
2025-11-15 08:32:39 -08:00
PJ Reiniger
1a99a348cb [robotpy] Mirror robotpy's commands-v2 (#8369)
Project import generated by Copybara.

GitOrigin-RevId: 715c8e8372d936f447f2937aab6b1a22dc619126
2025-11-13 21:55:54 -08:00
Tyler Veness
6e6f8dd7cc [cmd2] Fix include style of generated controller classes (#8372) 2025-11-13 21:32:45 -08:00
Benjamin Hall
95cb38e6df [wpimath] Fix ElevatorSim::GetCurrentDraw() in C++ (#8370)
The Kv calculation in C++ was missing a negative sign compared to the Java implementation.
2025-11-13 11:48:43 -07:00
Tyler Veness
7a04d6a6a2 Merge wpiformat configs (#8365)
After replacing the remaining include guards with `#pragma once`, I was
able to merge all the wpiformat configs into one file in the repo root.
This should make the config easier to reason about and maintain in the
future.
2025-11-11 22:00:42 -08:00
Tyler Veness
23906ee2f7 [wpiutil] Add JNI array factories for more types (#8355)
The Sleipnir Java bindings needed these.
2025-11-11 18:06:55 -08:00
Tyler Veness
1705b2d61c Upgrade wpiformat and use clang-format's include sorting (#8350)
This PR also uses the newly added -default-branch flag to generate the list of changed files with respect to the correct branch (2027).
2025-11-11 18:05:12 -08:00
Austin Schuh
a0f4727179 [ci] Run each of the various bazel builds in a separate worker (#8363)
We are running out of disk space.  If we split the
build up more in parallel, that'll use less space in each build.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-11-11 18:03:47 -08:00
Ryan Blue
418b3814bc Change SystemCore to Systemcore (#8359) 2025-11-10 18:18:58 -08:00
Ryan Blue
e5f8aa2cf4 [cmd2] Rename vendordep (#8357) 2025-11-10 18:18:14 -08:00
PJ Reiniger
71eab3524e [ci] Add hal mrc comm to pregen (#8360) 2025-11-10 18:17:33 -08:00
PJ Reiniger
dc9e70ef05 [ci] Decrease CI verbosity (#8361)
Offline conversations have pointed out that the bazel output is very noisy upon a failure. The -k that was there for a while was recently deleted in another PR, and this one removes --verbose_failures. --verbose_failures prints all of the command line arguments, which can be quite lengthy and make it harder to find the actual compiler error.

This also removes the -vv from the clang-tidy step. I have found it very hard to find the actual errors when its printing out all of the debug information.
2025-11-10 18:16:56 -08:00
Ryan Blue
a9fd0c3845 [hal] Save NT listener handle (#8356) 2025-11-10 16:49:36 -08:00
Tyler Veness
83465c291a [wpimath] Port Sleipnir nonlinear problem tests (#8358)
This is a copy of Sleipnir's nonlinear problem tests ported to Google Test.
2025-11-10 13:53:15 -08:00
Tyler Veness
694a79579e [benchmark] Split benchmarks into separate files (#8351)
Also add Sleipnir cart-pole benchmark from #8323.
2025-11-10 11:36:21 -07:00
Tyler Veness
37d81d490b [build] Sort Doxygen suppressions (#8353) 2025-11-10 10:11:17 -07:00
Austin Schuh
00ff8b941d [bazel] Publish almost all artifacts (#8141)
This uses all the infrastructure we put together earlier to actually build and publish all the artifacts.

We might still want to adjust what is built by default to control CI times.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Co-authored-by: PJ Reiniger <pj.reiniger@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-11-10 10:10:49 -07:00
Austin Schuh
0167409858 [bazel] Upgrade build_bazel_apple_support (#8352)
This is finally a released version with some of my patches in it.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-11-10 10:08:57 -07:00
Austin Schuh
4529ef0ea6 [bazel] Use script based python bootstrapping (#8180)
This fixes issues found building AOS with import paths.
2025-11-10 10:03:11 -07:00
Austin Schuh
c2e0f381ce [bazel] Add integrity to pybind11 (#8354)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-11-10 07:57:58 -08:00
Tyler Veness
603a59fbfe [wpimath] Add typedefs for LQR and Kalman filters (#8340)
These are industry-standard initialisms. The original class names were
left as is so they're more googleable, but I could be convinced
otherwise.
2025-11-09 10:34:04 -08:00
PJ Reiniger
892666fbbe [robotpy] Add build scripts for wpilib and dependencies (#8348)
This gets the majority of projects from mostrobotpy building in this mirror. Projects missing still are cscore and the halsim wrappers.
2025-11-09 10:32:58 -08:00
Charlotte
5636b8cd77 [wpilib] Remove deprecated MotorControllerGroup (#8349) 2025-11-09 10:31:26 -08:00
Peter Johnson
4ea584b64f [wpilibc] Move framework sources to framework directory (#8347) 2025-11-08 22:52:01 -08:00
Austin Schuh
04fb95a897 [bazel] Use the new gitlib-bazel.wpi.edu cache server (#8342)
This is owned by WPI, so we can make it as big or small as we want.
This lets us check in more of the bazel build.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-11-08 16:59:26 -08:00
Peter Johnson
5c9c45fadb [cscore, wpilibcExamples] Use double-quote includes for wpi/ (#8346)
Use ERR and WARN in cscore to avoid conflict with Windows headers.
2025-11-08 16:58:51 -08:00
Peter Johnson
fc4e922206 Use wpilib.robot instead of frc.robot (#8345) 2025-11-08 16:22:34 -08:00
Joseph Eng
ca206c5633 [build] Clean up spotbugs excludes (#8334) 2025-11-08 16:21:58 -08:00
Peter Johnson
18efd1e534 Move robot base classes from opmode to framework (#8344)
Having these in opmode will be confusing to users when opmodes are added.
2025-11-08 15:08:38 -08:00
Tyler Veness
aeedfa588c [build] Fix clang-tidy warnings (#8343) 2025-11-08 14:07:00 -08:00
Peter Johnson
161f8d107b Merge branch 'main' into 2027 2025-11-08 00:03:50 -08:00
PJ Reiniger
2109161534 SCRIPT: wpiformat 2025-11-07 23:09:21 -08:00
PJ Reiniger
ae6bdc9d25 SCRIPT: Spotless Apply 2025-11-07 23:09:21 -08:00
PJ Reiniger
09d46229c7 HAND FIX: Fixup robotpy yaml files 2025-11-07 23:09:21 -08:00
PJ Reiniger
844c7c38dd HAND FIXES: Fix ntcoreffi 2025-11-07 23:09:21 -08:00
PJ Reiniger
106bc774d4 HAND FIX: final java package changes 2025-11-07 23:09:21 -08:00
PJ Reiniger
67f2502b08 HAND FIX final frc:: replacements 2025-11-07 23:09:21 -08:00
PJ Reiniger
928ff20695 SCRIPT: FRC_ replacements 2025-11-07 23:09:21 -08:00
PJ Reiniger
824f36f63a SCRIPT: 'edu.wpi.first' replacements 2025-11-07 23:09:21 -08:00
PJ Reiniger
013a238994 HAND FIXES: Update maven info 2025-11-07 23:09:21 -08:00
PJ Reiniger
3f740894c9 HAND FIXES: Manual cleanup of namespaces 2025-11-07 23:09:21 -08:00
PJ Reiniger
ad138270a8 HAND FIXES: Update build scripts for namespaces 2025-11-07 23:09:21 -08:00
PJ Reiniger
07b60384d0 SCRIPT run upstream utils 2025-11-07 23:09:21 -08:00
PJ Reiniger
9aca8e0fd6 SCRIPT namespace replacements 2025-11-07 23:09:21 -08:00
PJ Reiniger
ae6c043632 HAND FIXES: Update upstream for namespace changes 2025-11-07 23:09:21 -08:00
PJ Reiniger
cf711a125e HAND FIX: Fix robotpy yaml files 2025-11-07 23:09:21 -08:00
PJ Reiniger
d3da30d53a HAND FIXES: Fixup remaining rename issues 2025-11-07 23:09:21 -08:00
PJ Reiniger
bf9da2cdea SCRIPT run upstream utils 2025-11-07 23:09:21 -08:00
PJ Reiniger
198771dde4 HAND FIXES: Fix upstream util scripts 2025-11-07 23:09:21 -08:00
PJ Reiniger
1e7604f81c SCRIPT: wpiformat 2025-11-07 23:09:21 -08:00
PJ Reiniger
c48b722dac SCRIPT: Spotless Apply 2025-11-07 23:09:21 -08:00
PJ Reiniger
c89910b7c6 HAND FIXES: Fixup gradle / cmake / styleguide 2025-11-07 23:09:21 -08:00
PJ Reiniger
105deaddb0 HAND FIXES: Fixup java and python compilation 2025-11-07 23:09:21 -08:00
PJ Reiniger
108a8c0f9b SCRIPT: Pregenerate files 2025-11-07 23:09:21 -08:00
PJ Reiniger
e0320a942a HAND FIX - Fixup pregen files 2025-11-07 23:09:21 -08:00
PJ Reiniger
6b69aab44e HAND FIX - Fixup bazel files 2025-11-07 23:09:21 -08:00
PJ Reiniger
7c6efa41ae SCRIPT Run cc include replacements 2025-11-07 23:09:21 -08:00
PJ Reiniger
f0a3c64121 SCRIPT Run java package replacements 2025-11-07 23:09:21 -08:00
PJ Reiniger
12823a003d SCRIPT Generic Renames 2025-11-07 23:09:21 -08:00
PJ Reiniger
c350c5f112 SCRIPT Move java files 2025-11-07 23:09:21 -08:00
PJ Reiniger
7ca1be9bae SCRIPT Move cc files 2025-11-07 23:09:21 -08:00
PJ Reiniger
10b4a0c971 SCRIPT fixup project rename 2025-11-07 23:09:21 -08:00
PJ Reiniger
a5492d30da SCRIPT Move subprojects 2025-11-07 23:09:21 -08:00
Joseph Eng
b8d6bc2eb1 [wpimath] Scale transforms instead of twists in PoseEstimator (#8333)
The spiraling issue occurs when the vision rotation standard deviation is very high relative to the odometry rotation standard deviation and the vision measurements have a large rotation error. (Scaling the rotation component of a twist without scaling the translation component causes the direction of overall translation to change, leading to spiraling around (either towards or away) the vision measurement instead of moving towards it.) Using a transform instead of a twist avoids this issue.

In general, scaling twist components is more mathematically correct than scaling transform components. However, although twists are correct for modeling uncertainty in an odometry-only pose estimate, they are not correct for the difference between the odometry-only pose estimate and a vision measurement. Since neither twists nor transforms are completely correct (and the pose estimator as a whole is not mathematically correct), but using transforms can guarantee that the pose estimate approaches the vision measurement (instead of potentially spiraling away), they are the least bad option.
2025-11-07 18:07:43 -08:00
Peter Johnson
688535298b [cscore] Add braces to match styleguide (NFC) (#8339) 2025-11-07 18:07:05 -08:00
Thad House
02252b58d7 [build] Update to 2026 Beta 1 (#8337) 2025-11-07 18:06:39 -08:00
PJ Reiniger
8cfc158790 [wpilibc] Remove declaration of removed function (#8336) 2025-11-07 10:09:26 -08:00
Joseph Eng
e207ca4880 [build] Clean up spotbugs excludes (#8332) 2025-11-07 10:07:56 -08:00
Tyler Veness
3bdaeac3e1 [build] Upgrade to Doxygen 1.15.0 (#8328) 2025-11-02 05:18:58 -08:00
Peter Johnson
5eb3140f69 [wpinet] Remove old resources (#8329)
These are out of date, and nothing uses them in allwpilib; wpilibpi used
them but a more major upgrade is needed there.

While we may in the future add integrated support for e.g. an integrated
NT viewer, it's unlikely we would use these versions.
2025-11-01 21:09:38 -07:00
Sam Carlberg
8992cf7081 [javac plugin] Add compile-time checks for unsafe or incorrect coroutine usage (#8289)
CoroutineYieldInLoopDetector

This checks for while loops where coroutines are in scope but without calling a blocking method on at least one of those coroutines:

```
drivetrain.run(theCoroutine -> {
  while (drivetrain.getDistance() < 10) { // ERROR: "Missing call to `theCoroutine.yield()` inside loop"
    drivetrain.setSpeed(1);
  }
});
```

Note that, because we assume most looping constructs in commands will use while loops, we don't check for-loops, for-each loops, or do-while loops.

This check can be disabled with `@SuppressWarnings("CoroutineYieldInLoop")`

CodeAfterCoroutineParkDetector

Essentially acts like the Java compiler's check for code after a while (true) loop, but for coroutine.park():

```
drivetrain.run(theCoroutine -> {
  drivetrain.setSpeed(1.0);
  theCoroutine.park();
  drivetrain.setSpeed(0.0); // ERROR: "Unreachable statement: `theCoroutine.park()` will never exit"
});
```

This check can be disabled with `@SuppressWarnings("CodeAfterCoroutinePark")`

IncorrectCoroutineUseDetector

Checks for usage of captured (outer) coroutine parameters and assignments to fields.

```
drivetrain.run(outer -> {
  outer.await(arm.run(inner -> {
    outer.yield(); // ERROR: "Coroutine `outer` may not be in scope. Consider using `inner`"
  }))
});
```

This check can be disabled with `@SuppressWarnings("CoroutineMayNotBeInScope")`

```
private Coroutine coroutineField;
drivetrain.run(co -> coroutineField = co); // ERROR: "Captured coroutines may not be stored in fields"
```

This check can be disabled with `@SuppressWarnings("CoroutineCapture")`
2025-11-01 17:27:08 -07:00
Tyler Veness
bc44ced506 [upstream_utils] Upgrade to fmt 12.1.0 (#8312) 2025-11-01 16:19:37 -07:00
Tyler Veness
f4db88da9a [build] Document how to mirror new Doxygen versions (#8327) 2025-11-01 14:45:53 -07:00
Thad House
cb720048b8 [wpilib] Remove Jaguar (and other) motor controllers (#8299) 2025-11-01 14:45:19 -07:00
Peter Johnson
577dd48af7 [build] Fix bazel examples lists after merge (#8326) 2025-11-01 13:58:28 -07:00
PJ Reiniger
49e84c6b52 [robotpy] Sync robotpy (#8318)
Project import generated by Copybara.

GitOrigin-RevId: f6818c55dda55da1226e47a05a22d30f7cc477f1
2025-11-01 10:28:05 -07:00
Peter Johnson
3f88c287d6 [examples] Fix ProfiledPIDFeedForward after merge 2025-11-01 10:01:42 -07:00
Peter Johnson
cc043df07f Merge branch 'main' into 2027 2025-11-01 09:39:08 -07:00
Thad House
def7849909 [wpilib] Integrate support for ExpansionHub over USB (#8292) 2025-11-01 09:24:58 -07:00
Thad House
4da2511638 [cmd3,wpilib] Add CommandGamepad for V3 commands (#8311)
Also fix typo.

Co-authored-by: Dan Katzuv <31829093+katzuv@users.noreply.github.com>
2025-11-01 09:24:22 -07:00
Jade
e45aadc851 [sysid] Remove Phoenix5 CANcoder preset (#8316)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-11-01 09:19:52 -07:00
Dalton Smith
fea6883d98 [wpimath] DCMotor: Add X44 and Minion (#8319) 2025-11-01 09:19:36 -07:00
Tyler Veness
b7fe5ef833 [build] Fix up grammar in docs/build.gradle (#8317) 2025-11-01 09:18:50 -07:00
Tyler Veness
cd237e57d4 [ci] Upgrade to macOS 15 runner image (#8321)
This fixes a compiler bug (rejecting out-of-line definitions of constrained members) newer versions of Sleipnir were encountering.
2025-11-01 09:17:09 -07:00
Murat65536
8b99ad82c3 [wpilib] Add a few unit overloads (#8231)
Co-authored-by: Sam Carlberg <sam@slfc.dev>
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2025-10-28 20:18:55 -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
Tyler Veness
4aef52a117 [ci] Upgrade to wpiformat 2025.36 (#8308)
clang-format 21 made some formatting changes. Since wpiformat's stdlib
task was removed, I removed NOLINT comments for it and removed some
std:: prefixes it added to comments.
2025-10-28 20:17:04 -07:00
Jason Daming
a6a4912a80 [snippets] Add ProfiledPIDController with feedforward snippets (#8280)
Adds snippets demonstrating ProfiledPIDController usage with
SimpleMotorFeedforward using the two-parameter calculate() method
(currentVelocity, nextVelocity).

These snippets will be used in frc-docs to document the recommended
feedforward pattern with ProfiledPIDController.

Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
2025-10-27 20:49:16 -06:00
Thad House
bd2cecbb1a [cmd3] Correct the groupId for commands v3 in the JSON (#8306) 2025-10-26 00:08:42 -07:00
Thad House
2e10f91e07 [hal,wpilib] Use new DS available API from mrccomm (#8302)
Instead of just having a max count for joystick values, there's an available mask of values. This is because in the future we're expecting there to be holes in the list of available buttons and axes. This updates everything to support that scenario.

Also, Joystick buttons, axes, and POVs all now start at 0 instead of 1.
2025-10-25 23:03:50 -07:00
Thad House
429698f508 [build] Fix deprecated gradle warning in catch2 publish.gradle (#8305) 2025-10-25 23:02:09 -07:00
Austin Schuh
51fbde777b [bazel] Package headers in ntcoreffi correctly (#8170)
* [bazel] Package headers in ntcoreffi correctly

The original package includes headers from ntcore and wpiutil, so
include those too.

* Merge in new 2027
2025-10-25 21:17:43 -07:00
Ryan Blue
873e960e93 [ci] Update tools workflow for 2026 (#8301) 2025-10-25 17:23:12 -07:00
Gold856
4f133c6aa1 [build][ci] Update vcpkg baseline (#8300) 2025-10-25 10:28:39 -07:00
Peter Johnson
b9bd3e5754 Merge branch 'main' into 2027 2025-10-23 22:33:14 -07:00
Edan Thomton
35dd61cde5 [build] Fix Eclipse annotation generation in wpilibjExamples (#8295) 2025-10-23 22:29:32 -07:00
PJ Reiniger
44b9cc1398 [robotpy] Mirror most other subprojects (#8208)
GitOrigin-RevId: ac60fd3cf4a24023184376687da28373d14b781a

This mirrors the robotpy files for the following projects:
- apriltag
- datalog
- hal
- ntcore
- romiVendordep
- wpilibc
- wpimath
- xrpVendordep

This excludes cscore and the halsim wrappers for at this time.

NOTE: This does not hook these projects up to the build system, just simply mirrors the files. The building will take place in a follow up PR to make it easier to review the changes necessary to build.
2025-10-23 22:28:04 -07:00
Jade
8992dcdc99 [wpilib] Remove Driverstation.waitForDsConnection (#8288)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-10-22 18:43:29 -07:00
Peter Johnson
7a2a982e66 Merge branch 'main' into 2027 2025-10-11 23:54:41 -07:00
Michael Lesirge
9e85f3cf55 [wpimath] Rename 1D copySignPow to match 2D copyDirectionPow (#8286) 2025-10-11 09:24:10 -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
Michael Lesirge
2b43541b94 [wpimath] MathUtil: Add 2D variants of applyDeadband and copySignPow (#8057) 2025-10-10 13:44:12 -07:00
Ryan Blue
33f91589b4 [wpilib, examples] Remove AnalogGyro (#8205) 2025-10-10 12:44:39 -07:00
arbessette
4c4996e638 [docs] Remove Private Message language (#8202)
Removing private written message for safety of all users and contributors.
2025-10-10 12:43:02 -07:00
Sam Carlberg
cfbd7a5af2 [build] Fix doxygen builds on apple CPUs (#8282)
Caused by the doxygen gradle plugin attempting to download 1.10.0 (presumably its default version) from artifactory because the 1.12.0 config is only applied on x86_64 platforms. Just fixing that isn't enough, however; on mac, the plugin would fail to extract the dmg. We need to fall back to a global installation on the PATH for the plugin to find, preferentially using that instead of a failed attempt to download and extract the dmg.
2025-10-10 12:42:02 -07:00
Tyler Veness
f5990e8b40 [upstream_utils] Fix Eigen tag (#8283)
Upstream no longer seems to have the commit we were pointing to. We'll
just use the tag since that hasn't changed since the official release
announcement.
2025-10-09 21:50:55 -07:00
sciencewhiz
b56b843c8a Update frcYear in vendordeps (#8276) 2025-10-07 22:00:04 -07:00
Sam Carlberg
35e4a18e86 [cmd, build] Fix wpiannotation dependencies on commandsv2 (#8279) 2025-10-07 21:50:38 -07:00
Peter Johnson
7ff312bb69 Merge branch 'main' into 2027 2025-10-06 19:43:02 -07:00
sciencewhiz
2fb5271cc9 [build] Update native-utils to 2026 (#8277) 2025-10-05 14:22:53 -07:00
Gold856
b1aaabc1c6 [hal] Remove FPGA functions that won't exist on SC (#8273) 2025-10-04 15:58:12 -07:00
Peter Lilley
f1b9be551b [wpiutil] Add reverse/bidirectional iterators to wpi::circular_buffer (#8275)
Use std::reverse_iterator<> to create reverse iterators, make other
iterators bidirectional to allow for this. Added unit tests.
2025-10-03 23:13:55 -07:00
Sam Carlberg
3972b01c51 Add javac plugin for detecting common error cases at compile time (#8196)
Adds a `@NoDiscard` annotation that can be placed on methods to guarantee their return values are used and on types to guarantee that any method returning that type uses the return value.

Methods that call `@NoDiscard`-annotated functions can add a `@SuppressWarnings("NoDiscard")` or `@SuppressWarnings("all")` annotation (or annotation on the class declaring that method) to silence the compiler error warnings.
2025-10-03 17:42:47 -07:00
Austin Schuh
5c719ced5f [bazel] Put eigen in an external repo like bzlmod (#8169)
This sets us up to use AOS, which wants @eigen to resolve, without
introducing a second version or copy of eigen.
2025-10-03 12:32:40 -07:00
Thad House
7d34f43e44 [wpilib] Replace internal usages of Analog getAverageVoltage (#8271) 2025-10-02 22:40:45 -07:00
Thad House
e369c721ca [wpilib] Remove Servo Classes (#8270)
SystemCore doesn't directly support Servos. It would be possible to still use a Servo Power Module, but those are fairly rare, and we should probably use a different class for that case, so users don't attempt to hook a servo directly up to systemcore. That will depend on what happens with the rules in 2027.

Rev Servo Hubs are a current working replacement for systemcore users.
2025-10-02 22:39:55 -07:00
Joseph Eng
871769c815 [wpimath] Fix units overload resolution (#8267) 2025-10-02 17:36:30 -07:00
Peter Johnson
ca7718cb08 [glass] FMS: Fix reading past end of GSM buffer (#8268) 2025-10-02 17:35:50 -07:00
Joseph Eng
5e7e5306df [wpiutil] Update StructSerializable contract (NFC) (#7441)
Matches ProtobufSerializable.  This is necessary for generic types.
2025-09-30 14:57:42 -06:00
Gold856
6447011bc3 [ci] Consolidate docs jobs (#7910)
We build docs in three different places, which is annoying to deal with, and it means we build docs two more times than necessary. Now, docs are built just once in the main Gradle workflow, with warnings promoted to errors, eliminating the need for the separate job in lint-format.yml. The uploaded docs artifact is then unpacked and commited to the GitHub Pages repo like normal.
2025-09-29 18:02:42 -07:00
Tyler Veness
bb5ee73e46 [build] Build JNI and benchmarks as release by default (#8257)
It doesn't make sense to benchmark debug binaries. Also, wpimath JNI
performance in unit tests is drastically impacted by debug vs release.
2025-09-29 17:47:17 -07:00
PJ Reiniger
c46b54a523 [wpilibj] Use non-global NetworkTableInstance in alert test (#8265) 2025-09-29 17:45:37 -07:00
PJ Reiniger
7290766482 [epilogue-processor] Fix naive tests in prep for huge refactor (#8255) 2025-09-29 11:47:51 -07:00
Tyler Veness
bd5141e254 [upstream_utils] Upgrade to fmt 12.0.0 (#8263) 2025-09-29 11:45:15 -07:00
Jonah Bonner
e364087e99 [glass] Fix color order for sim GUI LEDs (#8264) 2025-09-29 11:44:27 -07:00
Gold856
0277759d44 [wpiunits] Remove redundant if statement and inaccurate comment (#8262) 2025-09-28 16:00:35 -07:00
Gold856
7aabc19977 [bazel] Update Bazel to 8.4.1 to fix Windows builds (#8258)
- Fix missing epilogue deps
- Compress debug info to save space in CI
2025-09-27 22:50:21 -07:00
Gold856
f9899eb73f [wpimath] Fix odd header path in BangBangController (#8261) 2025-09-27 22:48:00 -07:00
Peter Johnson
ef676aca70 Merge branch 'main' into 2027 2025-09-25 22:17:00 -07:00
Tyler Veness
6b8be313c7 [build] Fix Java 25 builds (#8245)
I'm able to use a local install of Gradle 9.1 that has Java 25 support,
but some plugin upgrades are needed as well.
2025-09-25 21:28:37 -07:00
Tyler Veness
ab53d51c6f Fix or suppress clang-tidy warnings (#8254) 2025-09-25 21:28:04 -07:00
Tyler Veness
5003939b64 [upstream_utils] Recopy Eigen source (#8251)
Upstream slid the tag (again).  Change to the SHA commit ID until things stabilize.
2025-09-24 09:03:16 -06:00
Tyler Veness
ab259c2e89 [build] Fix Gradle 9 archives deprecation warning (#8247)
The deprecation message was:
```
The `archives` configuration added by the `base` plugin has been
deprecated and will be removed in Gradle 10.0.0. Adding artifacts to the
`archives` configuration will now result in a deprecation warning. If
you want the artifact built when running the `assemble` task, you should
add the artifact (or the task that produces it) as a dependency of the
`assemble` task directly.

val specialJar = tasks.register<Jar>("specialJar") {
    archiveBaseName.set("special")
    from("build/special")
}
tasks.named("assemble") {
    dependsOn(specialJar)
}
```
2025-09-22 11:58:14 -06:00
Tyler Veness
8fb5a1985a [upstream_utils] Recopy Eigen source (#8249)
Upstream slid the tag.
2025-09-21 21:58:43 -07:00
Sam Carlberg
cf4f6ce4b6 Update maven_install.json to match maven artifacts list in WORKSPACE (#8248)
Use `REPIN=1 bazel run @maven//:pin` to regenerate. `REPIN=1` is necessary for the conflicting gson versions to be resolved.
2025-09-21 20:44:43 -04:00
sciencewhiz
1e50471d2c [build] Update gradle-jni to 1.2.0 for Gradle 9 support (#8246) 2025-09-21 08:14:37 -07:00
sciencewhiz
c575a23e8e [build] Fix wpical and sysid icons on macOS (#8243)
Fixes #8239
2025-09-20 20:30:44 -07:00
sciencewhiz
4522cca70f [build] Update to develocity plugin (#8242)
Gradle enterprise plugin has been replaced by develocity.
2025-09-20 20:30:05 -07:00
sciencewhiz
850a148aad [build] Fix gradle 9 deprecations in msvc runtime (#8244) 2025-09-20 17:59:29 -07:00
Tyler Veness
0a4e44ea06 [wpimath] Synchronize C++ and Java RK4 docs (NFC) (#8238) 2025-09-20 15:49:41 -07:00
Tyler Veness
a7e7f6912a [upstream_utils] Upgrade to Eigen 5.0.0 (#8240) 2025-09-20 15:49:23 -07:00
Caitlin Cai
76ee08e0b4 [readme] Add instructions for installing SystemCore toolchain (#8182) 2025-09-20 11:24:05 -07:00
Sam Carlberg
ee0a8a1e56 [epilogue] Support logging of protobuf-serializable types (#8229)
For parity with struct-serializable types.

Change struct serialization to only apply to types with a public static final <type> struct field, instead of relying only on the marker interface (which is not always followed). Doing this allows fallthrough to the protobuf handler for types with dynamic structs but static protobuf serializers.
2025-09-20 11:23:22 -07:00
Tyler Veness
f701132392 [wpimath] Refactor MathUtil.interpolate() and MathUtil.inverseInterpolate() to handle extrapolation (#8232) 2025-09-20 11:22:05 -07:00
Tyler Veness
3dbdfa1839 [upstream_utils] Upgrade Sleipnir (#8235) 2025-09-20 11:21:06 -07:00
Peter Johnson
1ce2854a1e Merge branch 'main' into 2027 2025-09-20 11:19:40 -07:00
Tyler Veness
ee3d55e848 [upstream_utils] Upgrade Eigen to latest (#8228) 2025-09-19 17:52:48 -06:00
Gold856
d59f1732bb [glass] Fix handling for optionals and empty arrays (#8227) 2025-09-14 07:46:51 -07:00
Peter Johnson
d5d67d874b [glass] NetworkTables: Show struct enum values (#8224)
Also change the format for both proto and struct enums to show other values as <N>, and not put quotes around the value.
2025-09-12 13:01:50 -07:00
Peter Johnson
8c20da44c8 [hal] Remove old netcomm types (#8225) 2025-09-12 07:29:05 -07:00
Peter Johnson
855ef10d58 [wpiutil] DynamicStruct: Make GetEnumValues() const (#8223)
Also remove unnecessary include.
2025-09-12 07:27:43 -07:00
Peter Johnson
90d90f334d [wpiutil] Add alloc_wpi_string() and copy_wpi_string() (#8222)
These are useful to allocate a WPI_String, rather than referencing existing data.
2025-09-12 07:27:09 -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
Tyler Veness
be72d543ad [wpilib] Remove robotInit() (#8199)
Fixes #6622.
2025-09-08 21:17:37 -07:00
Peter Johnson
f8ed2a4d92 [wpiutil] Synchronization: fix shutdown use-after-free (#8213)
Also in ntcore, join the notifier thread on shutdown.
This prevents tsan from reporting it as a leaked thread.
2025-09-08 21:15:00 -07:00
Tyler Veness
dbffe6e8ac [wpimath] Add readme (#8209) 2025-09-08 17:26:22 -07:00
Gold856
5cd97c6353 [upstream_utils] Add Catch2 (#8203) 2025-09-08 15:14:23 -06:00
Peter Johnson
e8490eb242 [ntcore] Disable assertions unit test (ValueDeathTest) (#8221)
This likes to hang on Windows.
2025-09-08 14:58:09 -06:00
Peter Johnson
e5b7613b78 [ntcore] Change ntcore_test to just exit on tsan error (#8220)
In shutdown situations, calling FAIL() can deadlock in tsan.
2025-09-08 14:57:32 -06:00
Ryan Blue
2639e0365b [ci] Update sentinel build with Windows FFI changes (#8218) 2025-09-07 21:33:19 -07:00
Ryan Blue
08f11488b0 [ci] Add 2027 development repo to cleanup task (#8217) 2025-09-07 06:16:26 -07:00
Tyler Veness
632749e6f3 [build] Upgrade Maven dependencies (#8173) 2025-09-01 08:13:46 -07:00
Jade
b0829356fa [wpimath] Fix sysid links (NFC) (#8204)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-09-01 08:11:39 -07:00
Ryan Blue
ed904851eb [ci] Fix CMake Android build caching (#8206)
sccache was enabled but didn't have write credentials
2025-08-31 21:55:13 -07:00
Wispy
2cfd58f119 [commands] Add Subsystem.idle() (#7815) 2025-08-30 22:54:53 -07:00
Sam Carlberg
129cbbe11d [epilogue] Optimize time and memory usage of epilogue backends (#8190) 2025-08-30 20:15:22 -07:00
Ryan Shavell
45db0fd45e [epilogue] Use reflection to access non-public superclass fields (#7996)
Co-authored-by: Sam Carlberg <sam@slfc.dev>
2025-08-30 20:14:41 -07:00
PJ Reiniger
bd1dcc4358 [bazel][robotpy] Add mirror for robotpy's wpiuil and wpinet libraries (#8062)
Project import generated by Copybara.

GitOrigin-RevId: 92ea93d1b47a82667044bd0af05f7fdb34d2c2c2
2025-08-30 11:55:11 -07:00
ninjadrknss
96004f9bb5 [wpimath] Replace Pose2/3d.exp(Twist2/3d) with Pose2/3d.plus(Twist2/3d.exp()) (#8188)
This better matches math notation.
2025-08-30 11:37:09 -07:00
Kevin-OConnor
9fd4ccf95b [hal] Add CAN Mfgrs and Adjust Device Types (#8201) 2025-08-30 11:36:26 -07:00
sciencewhiz
4e6b9706ff [build] Explicitly set Documentation archiveVersion (#8192)
In the recent gradle or gradle dependencies update, the documentation
zips were being published as documentation-version-unspecified, where
the unspecified was coming from archiveVersion. It looks like we use a
different method of setting the version, so make sure that
archiveVersion is empty
2025-08-26 08:09:18 -06:00
Ryan Blue
55e52bc2b7 ThirdPartyNotices: Update location of Simd library (NFC) (#8193) 2025-08-25 16:38:37 -06:00
ninjadrknss
c280fce147 [wpimath] Replace MathUtil.clamp() with Java 21 Math.clamp() (#8186) 2025-08-23 09:01:51 -07:00
Gold856
183328384b [upstream_utils] Remove extra protobuf patch (#8181)
Missed in the rebase for #7988
2025-08-17 18:41:51 -07:00
Gold856
d4311d5a29 [wpiutil,glass,dlt] Replace libprotobuf with upb for dynamic decode (#7988)
libprotobuf is a very annoying dependency to deal with, and with the switch to nanopb for generated C++ code, libprotobuf is only used for dynamic decode in the GUI apps. libprotobuf has been swapped out with upb, a much smaller C-based library that supports reflection and can therefore do dynamic decode. This means we can remove the libprotobuf dependency and stop dealing with build issues because of it.
2025-08-16 22:56:32 -07:00
Ryan Blue
7f35104012 [hal] AddressableLED: Restore alternative color order support (#8130)
Unlike armv7, aarch64 doesn't have alignment assertions for SIMD instructions. The compiler output between the aligned and unaligned variants is the same.
2025-08-16 22:53:04 -07:00
Thad House
73c26dcf89 [hal] Enable CAN FD on bus when bus is configured for FD (#8175)
Without this, FD reads would not be supported, however FD writes would still work.
2025-08-16 22:51:45 -07:00
Tyler Veness
0d9e850e22 [wpimath] Fix dt type in C++ tests (#8179)
The UKF test was calling `.value()` on an implicit
`units::millisecond_t` type assuming it was `units::second_t`.

I normalized the rest of the dt declarations while I was at it.
2025-08-16 22:51:13 -07:00
sciencewhiz
46a3318324 [build] Fix processstarter publishing (#8171)
Artifacts weren't in OS and architecture subfolders in the zip like all the other
C++ tools
2025-08-11 20:52:10 -07:00
Daniel Chen
f209ecb0cb [wpimath] Add structs for TrapezoidProfile.State and ExponentialProfile.State (#8163) 2025-08-10 11:45:36 -07:00
Peter Johnson
f89cf2e441 Merge branch 'main' into 2027 2025-08-09 00:55:56 -07:00
Peter Johnson
3e4e9c9b01 Merge branch 'main' into 2027 2025-08-09 00:55:26 -07:00
Iris
78fa67099e [build] Small fixes to build on GCC 15 (#8148)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2025-08-09 00:07:41 -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
Tyler Veness
5fd9e1e72a [build] Fix Gradle Task.project deprecation warning (#8167)
```
> Task :wpilibcExamples:checkCommands
Script '/home/tav/frc/wpilib/allwpilib/shared/examplecheck.gradle': line 135
Invocation of Task.project at execution time has been deprecated. This will fail with an error in Gradle 10.0. This API is incompatible with the configuration cache, which will become the only mode supported by Gradle in a future release. Consult the upgrading guide for further information: https://docs.gradle.org/8.14.3/userguide/upgrading_version_7.html#task_project
        at examplecheck_4wsg1s37eigy9vs5arzst20ga$_run_closure5$_closure16$_closure17.doCall$original(/home/tav/frc/wpilib/allwpilib/shared/examplecheck.gradle:135)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
```

Moving the project access outside the doLast block makes it occur at
confguration time instead.
2025-08-08 22:48:11 -07:00
DeltaDizzy
94399dd7e0 [datalog] Overload DataLogReaderThread::GetEntry to accept an entry id (#8152)
It is useful when programmatically interacting with DataLogs to be able to retrieve an record's associated metadata (entry name, type, and metadata string), but the only reference to an entry that a record contains is the id. DataLogReaderThread already builds a map of id->DataLogReaderEntry, but it was unexposed until now.
2025-08-08 09:09:54 -06:00
Tyler Veness
0a0adebd89 [build] Upgrade to Gradle 8.14.3 (#8164)
This fixes local builds with JDK 24.

I fixed deprecation warnings from `./gradlew wrapper --warning-mode all`
as well.
2025-08-08 09:08:34 -06:00
Austin Schuh
6eba91bc04 [bazel] Build and test wpical with bazel (#8155)
This pulls down the prebuilt ceres libraries and uses them with Bazel to
build and test wpical.

Do note that bazel looks up artifacts used for testing differently than
the other build systems.  It wants you to use its runfiles API to find
the dependencies reliably.  Add a function to look up the paths for
files, and use runfiles only when building with Bazel to maintain
compatibility with other languages.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-06 22:56:42 -06:00
Austin Schuh
c01f0c3d46 [bazel] Use rules_jvm_external for opencv (#8158)
This makes it so rules_jvm_external also doesn't package up all the
opencv class files into the final published packages.  And is simpler to
maintain.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-06 22:16:44 -06:00
Austin Schuh
d203541b7b [bazel] Build wpilibj docs too (#8159)
We've got javadocs for each module, but wpilib has 1 for everything.
Build that too using rules_jvm_external.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-05 20:54:59 -06:00
Austin Schuh
13852760f6 [bazel] Build wpilibc docs with doxygen (#8157)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-04 23:49:47 -06:00
Austin Schuh
dffa2542c9 [build] Fix wpiformat errors in 2027 (#8156)
Must have gotten introduced in a merge, let's fix them.
2025-08-03 21:36:05 -06:00
Peter Johnson
ed7982563b Merge branch 'main' into 2027 2025-08-03 11:51:25 -07:00
Gold856
2d11946d98 [wpical] Use updated thirdparty-ceres and move resource files (#8151) 2025-08-03 11:41:25 -07:00
Gold856
c42fde5d07 [ci] Make upstream_utils check error with a more clear message (#8153)
Now it links to the README in upstream_utils.
2025-08-03 11:37:40 -07:00
Austin Schuh
23f5725853 [bazel] Reduce number of windows builds in CI (#8145)
Windows is proving to be a *lot* slower than everything else.  I supect
this is because we are building both arm64 and x86 every time, which
ends up being twice the work.  Leave those builds in place, but skip
doing them in CI.  This should be a 2x speedup when building Windows
code.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-02 23:09:29 -07:00
James Kuszmaul
3b7d0e7bf5 [readme] Mention X11-dev dependency in developer README (#8150)
Tested a bazel build of //... on a (relatively) clean Debian system.

It feels like there is a more pricnipled list we could provide (e.g.,
libglfw3-dev), although I think most of those would also end up
installing more than necessarily required.
2025-08-02 23:08:58 -07:00
Austin Schuh
0dd77e55cb [bazel] Build and publish ntcoreffi too (#8147) 2025-08-02 21:59:50 -07:00
Austin Schuh
1ab705b354 [bazel] Publish ntcore + wpimath for real (#8144)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-01 22:12:38 -07:00
Austin Schuh
dbf22c98b4 [bazel] Build processstarter with bazel too (#8143) 2025-08-01 22:12:16 -07:00
Austin Schuh
9c523f98f5 [bazel] Build and deploy binary tools (#8142)
This is a subset of the full publish review.
2025-08-01 17:20:43 -07:00
Austin Schuh
0089e518cb [bazel] Update configuration for which platforms to split debug symbols for (#8140)
I could have sworn that we were only splitting debug symbols on x86.
The most recent tests I have done suggest that is backwards.  This is
easy to reconfigure later if needed.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-01 13:00:13 -07:00
Austin Schuh
2f918900ff [bazel] Publish wpilib{c,j}examples (#8136)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-01 12:59:52 -07:00
Austin Schuh
48077cdb91 [bazel] Add publishing rules for other package types (#8139)
This adds shortcuts for static only, shared only, and binary projects.
The end result is that it is pretty easy from here to publish all the
arifacts needed.
2025-08-01 12:59:25 -07:00
Austin Schuh
6e9ed8b7f1 [bazel] Rename imgui so it deploys correctly (#8137)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-08-01 12:58:58 -07:00
Gold856
e0e774abde [commands, wpimath] Remove Mecanum/SwerveControllerCommand and HolonomicDriveController (#8119) 2025-07-31 23:05:42 -07:00
Austin Schuh
b251d16ef7 [bazel] Build simulation/halsim_ws_client shared+static libraries (#8138)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-07-31 23:04:16 -07:00
Austin Schuh
76881e2940 [bazel] Rename liblibglass -> libglass (#8135)
The lib gets automatically added, don't add it by hand.
2025-07-31 23:03:19 -07:00
Austin Schuh
2245dccff6 [bazel] Link cscorestatic correctly (#8134)
Statically link opencv, and make it work on all the architectures.
2025-07-31 23:02:56 -07:00
Rain Heuer
b3aeee18c8 [wpimath] Add vector product and squared length operations to Translation2d/3d (#8133)
Adds methods to compute the dot and cross products between Translation2ds and Translation3ds, as well as methods to compute the square of Distance and Norm, which allows avoiding some calls to sqrt in many cases.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2025-07-31 21:05:39 -07:00
Tyler Veness
feee88f40d [wpimath] Remove redundant transposes on symmetric matrices (#8131)
This likely won't have a performance impact since it only affects matrix traversal order, but it does simplify the code.
2025-07-31 21:04:55 -07:00
Austin Schuh
12223ff188 [bazel] Implement cscore shared libraries (#8089)
Use all our fancy new linking code to link cscore properly. nm reports that the symbols look quite good.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Co-authored-by: PJ Reiniger <pj.reiniger@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-07-31 21:04:22 -07:00
Austin Schuh
79f6351073 [bazel] Link all third party apriltag symbols (#8132)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-07-31 19:27:35 -07:00
Austin Schuh
ef95333a89 [bazel] Shorten the platform suffix for windows arm (#8129)
This needs to be short enough to fit in the windows path restriction.
The full name was too long for some targets.
2025-07-31 19:27:21 -07:00
Austin Schuh
343e748643 [bazel] Upgrade opencv and toolchains dependencies (#8128)
This sets us up to properly depend on opencv, by introducing the new
helpers, @rules_bzlmodrio_toolchains//cc:cc_shared_import.bzl to import
the shared libraries correctly from opencv.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-07-30 21:30:00 -07:00
Peter Johnson
0478176e47 [simgui] Add GUI context getter hooks (#8127)
This enables GUI libraries to be linked statically with shared context.
2025-07-30 21:29:24 -07:00
Austin Schuh
db95f55394 [bazel] Handle debug symbols and debug builds like gradle (#8118)
This follows the gradle build accurately.  Gradle copies debug symbols
into a second file (libfoo.so.debug) and links it back into the .so
file.  Disable this behavior when gradle doesn't do it today.

Also, name everything correctly.  When building debug builds, most
libraries get a 'd' at the end of them.  Do that here too.
2025-07-30 20:07:06 -07:00
Tyler Veness
e678a338b4 [ci] Upgrade wpiformat (#8124)
See https://github.com/wpilibsuite/styleguide/pull/312
2025-07-30 11:10:12 -06:00
Austin Schuh
3871cab6e8 [bazel] Use WPILIB_VERSION automatically for version template generation (#8117) 2025-07-26 15:10:15 -07:00
Gold856
22ed224035 [build] Clean up DataLog CMake build (#8116) 2025-07-26 14:48:58 -07:00
Sam Carlberg
8d36df671b [wpiunits] Make Java units immutable only (#8115)
Remove mutable implementations, as systemcore doesn't need mutability to keep performance under control.
2025-07-26 14:48:35 -07:00
Austin Schuh
373eedc77b [bazel] Generate a filtered .def file for windows for wpimath (#8113)
wpimath otherwise quickly gets too many symbols.  Instead, gradle
exports only some of the symbols from protobuf files automatically, and
then manually exports the math operations.  Do that here too.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-07-26 14:47:12 -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
PJ Reiniger
c78bd942bb [bazel] Make publishers for c++ hdr / srcs, and java (#8114) 2025-07-24 09:11:09 -04:00
Austin Schuh
e2f901822c [bazel] Upgrade bazel to 8.3.1 and rules_cc to 0.1.4 (#8112) 2025-07-24 09:10:10 -04:00
Thad House
cd0e7fb7d7 [hal, wpilib] Fix LED key and byte order (#8110) 2025-07-22 17:45:10 -07:00
Austin Schuh
60098b0685 [bazel] Build a single maven artifact bundle (#8049)
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Co-authored-by: PJ Reiniger <pj.reiniger@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-07-22 14:26:20 -06:00
Peter Johnson
f3af50fc8e [hal, wpilib] Update Addressable LED support (#8100) 2025-07-21 21:52:10 -07:00
Peter Johnson
8aa312fb6f Merge branch 'main' into 2027 2025-07-21 18:38:43 -07:00
Thad House
b66a66b693 [commands] Add systemcore to command vendor dep (#8108) 2025-07-21 18:38:14 -07:00
sciencewhiz
09680072ac [examples] Add Snippets for Accelerometers using OnboardIMU (#8087) 2025-07-20 22:19:14 -07:00
Tyler Veness
946ab9e98f [wpimath] Fix S3UKF tests (#8097)
They weren't actually instantiating S3UKF.
2025-07-20 22:18:31 -07:00
sciencewhiz
5905a3ba27 [hal] Clean up HAL ports (#8101)
Remove references to PWM/Digital/relay Headers.
Fix analog cnd digital hannels
Set SPI and relay channels to 0.
Fix typos and roboRIO references.
2025-07-20 22:17:19 -07:00
Austin Shalit
484cbabc06 [wpinet] Disable Uv FailedLookup test (#8105)
See https://github.com/wpilibsuite/allwpilib/discussions/8104. This test consistently fails when ISPs 'helpfully' resolve an invalid name.
2025-07-20 22:16:28 -07:00
sciencewhiz
b445d48033 [ci] Remove tools build (#8098) 2025-07-18 20:44:46 -07:00
Jonah Bonner
a6892b6cd5 [hal, wpilib] Add support for onboard IMU mount orientations with Euler angles (#8061) 2025-07-17 21:20:10 -07:00
Michael Lesirge
f308e9873a [wpimath] Add miles per hour conversation methods (#8026) 2025-07-17 21:19:32 -07:00
sciencewhiz
8799733838 [processstarter] Handle Elastic and AdvantageScope (#8068)
Since they are in different directories, they need to be special cased
This is needed to support wpilibsuite/WPILibInstaller-Avalonia#492,
since those are currently handled by special scripts.
2025-07-17 21:18:27 -07:00
Ryan Blue
fa65657746 [hal] Set publish options for SmartIO mode publisher (#8096) 2025-07-17 21:17:18 -07:00
PJ Reiniger
412d189507 [bazel] Set readonly api when building pull requests (#8094) 2025-07-16 20:45:14 -07:00
PJ Reiniger
b85a0d5cf3 [build] Add missing sources to published zip files (#8055)
Gradle publishing does not capture all of the source files that are used during a build. This should get most of them, and get it equivalent to what bazel pushes out.
2025-07-15 21:20:28 -07:00
sciencewhiz
2875fd7d7c [wpilib] Disambiguate HID Sendable names (#8081)
Fixes #7933
Add Axis to triggers sendable name
2025-07-15 21:19:03 -07:00
Thad House
24e2d2d676 [hal] Remove DS Data timeout (#8083) 2025-07-15 21:18:17 -07:00
Joseph Eng
1530fccbd0 [wpimath] Implement Scaled Spherical Simplex Filter (S3F) (#8091)
Adds S3SigmaPoints based on MerweScaledSigmaPoints. In addition, restructures UnscentedKalmanFilter to support different sigma point generators and provides MerweUKF and S3UKF for convenience when working with either kind of filter.

S3UKFTest is copied from MerweUKFTest (which is a rename of UnscentedKalmanFilterTest). Curiously, however, in Java the original tolerance used in MerweUKFTest.testDriveConvergence() for the final rotation was too low for S3UKFTest, so the tolerance is increased from 0.000005 (5e-6) radians to 0.00015 (1.5e-4) radians. However, the C++ version still uses the original tolerance. (This difference is probably because Java uses a final rotation of 5.846 degrees while C++ uses a final rotation of 5.846 radians)

Closes #8072.

Breaking changes:

- (C++) UnscentedKalmanFilter has a new template parameter for the sigma point generator type.
- (Java) UnscentedKalmanFilter has an additional parameter to every constructor providing an instance of a sigma point generator.
- (C++) int MerweScaledSigmaPoints.NumSigmas() has been replaced with constexpr int MerweScaledSigmaPoints::NumSigmas.
- (C++) The second parameter of SquareRootUnscentedTransform has been changed from States to NumSigmas.
2025-07-15 21:17:25 -07:00
Joseph Eng
2fc86a155d [benchmark] Add benchmark subproject (#8042) 2025-07-15 21:16:06 -07:00
sciencewhiz
f03df5388e [doc] Clarify mount orientation for SystemCore IMU (NFC) (#8088) 2025-07-14 23:47:59 -07:00
sciencewhiz
efedc5d69a [doc] Update Analog Input voltage to 3.3v (NFC) (#8085) 2025-07-14 23:47:30 -07:00
Thad House
8d248f61fd [hal] Various CAN fixes (#8043) 2025-07-14 23:46:57 -07:00
Thad House
3497a7d09f [hal] Add frequency support to DutyCycle (#8076) 2025-07-14 23:46:17 -07:00
Thad House
ef24c1df97 [hal] Implement HAL_GetSystemTimeValid on SystemCore (#8051) 2025-07-14 23:45:28 -07:00
PJ Reiniger
abeaa40e38 [ci] Install bazel on docker image builds (#8079)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-07-13 22:12:45 -05:00
Peter Johnson
7c1a22376b Merge branch 'main' into 2027 2025-07-13 20:11:31 -07:00
sciencewhiz
8d7bed791c [ci] Revert Bazel artifactory caching (#8080)
* Revert "[bazel] Set remote cache header to prevent redirects (#8065)"

This reverts commit 082de35ad7.

* Revert "[ci] Add Bazel caching (#8006)"

This reverts commit c3b327d57b.
2025-07-13 21:56:00 -05:00
Ryan Blue
fa08679762 [wpiutil] Enable priority_mutex for systemcore (#8071) 2025-07-11 08:29:44 -05:00
Tyler Veness
69ecd02aec [upstream_utils] Add timestamps to commit hashes (#8078) 2025-07-10 17:01:15 -05:00
Kevin-OConnor
72d7a07635 [upstream_utils] Update fmt to recent commit (#8077)
Fixes crash seen in SystemCore Java debugging.
2025-07-10 17:00:25 -05:00
PJ Reiniger
d36b1d0dd9 [bazel] Update bazel toolchain, libssh, opencv (#8075) 2025-07-08 20:20:08 -07:00
Peter Johnson
7142fb1f5f Merge branch 'main' into 2027 2025-07-08 19:54:03 -07:00
Joseph Eng
6bac1cbc1a [docs] Add information about the development process (NFC) (#8012) 2025-07-08 00:21:23 -05:00
Austin Schuh
89c1fc156d [bazel] Switch build tag filters from no-roborio to target_compatible_with (#8067)
This uses platforms a lot better.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-07-07 23:44:08 -05:00
Jason Daming
708bf7d815 [wpilib] Add unit docs for return type of DCMotorSim getters (#8070)
We took away the units as part of the function name but didn't comment them back
2025-07-06 19:45:47 -07:00
Ryan Blue
082de35ad7 [bazel] Set remote cache header to prevent redirects (#8065)
Doesn’t fully fix the issue but improves things.
2025-07-06 08:28:56 -05:00
Austin Schuh
4b39853483 [build] Check results of subprocess.run in wpimath/generate_quickbuf.py (#8069)
The generator was calling a binary of the wrong architecture and failing
internally, but passing the build (incorrectly).  Explode right away.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-07-06 07:24:09 -05:00
Austin Schuh
d7550a02f7 [bazel] Upgrade and reorganize dependencies (#8063)
Pull in some of the fixes merged into the various dependencies.  While
we are here, move all the downloads up to the top of the file so they
download in parallel.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-07-05 18:59:22 -05:00
Thad House
f6558c4815 [hal] Update analog scaling for updated image (#8052) 2025-07-04 11:51:28 -07:00
Thad House
0304f50141 [wpiutil] Use steady_clock directly on SystemCore (#8053)
Don’t offset it from program start time.

This will make it much easier to coordinate timestamps across the system.

Closes #8041
2025-07-04 08:18:03 -05:00
Austin Schuh
44d42759a4 Work around gcc 12 overlap memory region warning (#8058)
Thad says this is a compiler bug, rather than fight it, let's use a new
code path through the compiler.

ERROR: /home/austin/local/allwpilib3/wpilibcExamples/BUILD.bazel:50:12: Compiling wpilibcExamples/src/main/cpp/examples/I2CCommunication/cpp/Robot.cpp failed: (Exit 1): gcc failed: error executing CppCompile command (from target //wpilibcExamples:I2CCommunication-test) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 234 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from /usr/include/c++/12/ios:40,
                 from /usr/include/c++/12/istream:38,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/chrono:41,
                 from bazel-out/k8-opt/bin/wpilibc/_virtual_includes/wpilibc.static/frc/TimedRobot.h:7,
                 from bazel-out/k8-opt/bin/wpilibcExamples/_virtual_includes/I2CCommunication-examples-headers/Robot.h:10,
                 from wpilibcExamples/src/main/cpp/examples/I2CCommunication/cpp/Robot.cpp:5:
In static member function 'static constexpr std::char_traits<char>::char_type* std::char_traits<char>::copy(char_type*, const char_type*, std::size_t)',
    inlined from 'static constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/12/bits/basic_string.h:423:21,
    inlined from 'static constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/12/bits/basic_string.h:418:7,
    inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_replace(size_type, size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/12/bits/basic_string.tcc:532:22,
    inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/12/bits/basic_string.h:1647:19,
    inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /usr/include/c++/12/bits/basic_string.h:815:28,
    inlined from 'virtual void Robot::RobotPeriodic()' at wpilibcExamples/src/main/cpp/examples/I2CCommunication/cpp/Robot.cpp:27:77:
/usr/include/c++/12/bits/char_traits.h:431:56: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' accessing 9223372036854775810 or more bytes at offsets -4611686018427387902 and [-4611686018427387903, 4611686018427387904] may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=restrict]
  431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
      |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
2025-07-03 22:58:47 -07:00
Gold856
c3b327d57b [ci] Add Bazel caching (#8006) 2025-07-03 23:15:18 -05:00
Gold856
26771e38fb [commands] Deprecate Command.schedule() (#7072)
It's only syntactic sugar over the CommandScheduler's schedule method and creates a footgun because it’s too obvious to try to use in incorrect places.

Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2025-07-02 13:46:59 -07:00
PJ Reiniger
1ccafdc13f [bazel] Simple shared library implementation (#8044) 2025-07-01 22:53:34 -07:00
crueter
6d92e2501d [wpimath] Remove unnecessary deprecation in ArmFeedForward (#8050)
Signed-off-by: crueter <swurl@swurl.xyz>
2025-06-30 21:13:54 -07:00
Peter Johnson
82ce317083 Merge branch 'main' into 2027 2025-06-30 20:21:11 -07:00
Gold856
a3ce880334 [ci] Update Homebrew protobuf version for CMake (#8045)
protobuf@3 will be deactivated July 1st, so it's been replaced with protobuf@29.
2025-06-30 00:10:37 -07:00
Nathan Karwel
e6bb29e2f1 [wpilib] Fix typos in notifier comments (NFC) (#8047) 2025-06-30 00:10:08 -07:00
Tyler Veness
633603dc3d [build] Fix Clang 20 warnings (#8048)
* `-Wfixed-enum-extension` was replaced with `-Wc23-extensions`
* Removed unused private variables in SysId
* Suppressed `-Wnontrivial-memcall` in imgui.h and imgui_internal.h
2025-06-30 00:09:41 -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
Joseph Eng
f55564729b [hal,wpilib,cmd] Update POVs to use enums (#7978) 2025-06-29 18:32:26 -07:00
PJ Reiniger
e13d237390 [bazel] Create better static libraries and add basic publishing (#8029) 2025-06-27 16:36:12 -07:00
Peter Johnson
ccc9740d56 [glass] Fix NT int64 value display (#8038) 2025-06-27 06:33:31 -07:00
ThePixelatedCat
ffe296892c [wpimath] Fix TrapezoidProfile limiting velocity incorrectly (#8030) 2025-06-24 22:36:53 -07:00
Gold856
22b58c1853 [upstream_utils] Upgrade to LLVM 20.1.7 (#8033)
Also removes xxhash, Hashing, and MapVector to reduce the size of the patches and to speed up compile times by a smidge.
2025-06-24 22:36:22 -07:00
Tyler Veness
ddc5220ed4 [upstream_utils] Remove memory library (#8035)
We added this in 2022. If we haven't used it by now, we probably never
will and it's just wasting space.
2025-06-24 22:35:30 -07:00
Jonah Bonner
a77441b78a [hal] Fix portrait yaw from onboard IMU (#8037) 2025-06-24 22:34:50 -07:00
Peter Johnson
676f2f84d7 [ntcore] Check id ranges in control messages (#7726) 2025-06-18 21:03:24 -07:00
Dustin Spicuzza
edde38a41a Restore original language from original contributor covenant (#7836)
- https://www.contributor-covenant.org/version/2/0/code_of_conduct/
2025-06-18 20:56:38 -07:00
Kevin Cooney
c655b7a893 [wpilibj] Add Preferences.getNetworkTable() (#7962) 2025-06-16 20:22:11 -07:00
Tyler Veness
057f5ddf81 [glass] Fix compilation errors from C++23 clang (#8008) 2025-06-16 19:01:00 -07:00
Thad House
2361959ff1 [hal] Fix I2C order on systemcore (#8024) 2025-06-16 18:41:02 -07:00
Austin Schuh
6cfa21364e [bazel] Upgrade bazel to 8.2.1 (#8023)
This necesitated some rules updates too, and a couple of flag changes.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-06-15 14:09:21 -07:00
Michael Lesirge
fb399eef3d [wpimath] Add copySignPow to MathUtil for joystick input shaping (#8013) 2025-06-15 14:08:41 -07:00
Michael Lesirge
e2517b7a21 [wpimath] Update parameter type from list to general collection (#8020) 2025-06-15 14:08:06 -07:00
Peter Johnson
3355383fe9 Merge branch 'main' into 2027 2025-06-13 22:26:09 -07:00
Thad House
fbee476fd2 [hal] Use new canbus names for systemcore (#8022)
The canbus names are changing to ensure stable ordering.
2025-06-13 21:30:42 -07:00
PJ Reiniger
fbbc4bc53c [bazel] Clean up bazel scripts (#7984) 2025-06-13 20:53:09 -07:00
Michael Lesirge
05c080328b [wpimath] Pass Translation2d by const reference instead of by value (#8021) 2025-06-13 18:50:05 -07:00
Michael Lesirge
c01e318370 [wpimath] Add Translation3d.nearest() (#8015) 2025-06-12 22:14:00 -07:00
Ryan Blue
5dfc664b93 [hal, wpilib] Add systemcore IMU (#8016) 2025-06-10 21:57:42 -07:00
Ryan Blue
89b97a21d8 [ntcore] Change 'null' to 'empty string' in NT StartServer docs (NFC) (#8017) 2025-06-10 21:55:51 -07:00
Michael Lesirge
075cc4a20f [wpimath] Add nearest() method to Pose3d (mirroring Pose2d) (#8010) 2025-06-05 22:11:49 -07:00
Peter Johnson
f99692f287 [ntcore] Minimize latency on localhost connections (#7997) 2025-06-02 16:43:18 -07:00
Thad House
2af8c59858 Replace /home/lvuser with /home/systemcore (#8002) 2025-06-02 16:42:56 -07:00
Thad House
4d74ea6278 [wpilib] Remove version writes (#8003)
This will use a much different mechanism in the future.
2025-06-02 16:41:47 -07:00
Thad House
a4cf2ea6ec [hal] Fix dutyCycle high time units (#8000)
The units are nanoseconds, not microseconds
2025-06-01 22:24:48 -07:00
Thad House
b205f3e1b4 [hal] Add temp value for HAL_GetUserVoltage3V3 (#8001)
Lots of higher level code in allwpilib depends on this, so we should return at least a valid and sane value, rather then erroring.
2025-06-01 22:23:51 -07:00
Thad House
be67432a5e [hal] Remove unnecessary print in CAN initialization (#8004) 2025-06-01 22:21:11 -07:00
DeltaDizzy
1955dcddb3 [wpimath] Fix SimpleMotorFeedforward no-accel overload returning negative voltage outputs (#7999)
SimpleMotorFeedforward::calculate(velocity) was not updated to account for the removal of calculate(velocity, acceleration), so it would pass currentVelocity = velocity and nextVelocity = 0, resulting in negative outputs in many scenarios.
2025-06-01 16:46:54 -07:00
Ryan Blue
e12d78a70a [ci] Deploy 2027 docs on tag (#7998) 2025-06-01 10:00:59 -07:00
Thad House
d3fbebc0a9 [hal] Add systemcore battery reading (#7995) 2025-05-31 10:53:11 -07:00
Thad House
1991af34a5 [hal] Update to new joystick protobuf definitions (#7991) 2025-05-31 10:52:27 -07:00
Ryan Shavell
7a3df6175e [epilogue] Add superclass field & method logging (#7993) 2025-05-31 06:38:51 -07:00
Peter Johnson
a6f601453a [examples] Fix up merge from main (#7994) 2025-05-30 17:36:53 -07:00
Peter Johnson
6c16e846fa Merge branch 'main' into 2027 2025-05-29 21:41:50 -07:00
Gold856
ca05ffa1b9 [upstream_utils] Use pathlib instead of os.path (#7983)
A noteworthy change is the replacement of the `dp.startswith(os.path.join(".", "subdir"))` pattern. pathlib doesn't offer something with similar semantics besides `match` and `full_match`, so there's now a helper function that replicates the behavior.

Other notable changes include the addition of type annotations to ensure code correctness, using == to check file names instead of `endswith` for clarity (`endswith` is still used to check extensions), manual walking and copying being refactored in googletest, json, memory, nanopb, protobuf, and sleipnir to use `walk_cwd_and_copy_if`, and matching functions being shortened to the point where they can just be inlined into the lambda.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-29 16:05:22 -06:00
Tyler Veness
de718f7ae5 [upstream_utils] Upgrade Sleipnir (#7973) 2025-05-27 08:24:15 -06:00
sciencewhiz
5368e8c6ed [ci] Disable RobotPy build (#7990)
Needs update for meson build
2025-05-27 08:19:39 -06:00
sciencewhiz
25eacfa226 Update frcYear to 2027_alpha1 for vendordeps (#7989) 2025-05-27 08:19:03 -06:00
Thad House
22d12d2345 [wpinet] Add callback for mDNS service resolver (#7986) 2025-05-23 15:22:59 -05:00
Phuc-Thanh Nguyen
abd312f3d0 [wpinet] http_parser: unset F_CHUNKED on new Transfer-Encoding (#7985) 2025-05-22 15:43:20 -06:00
Tyler Veness
b4823569a4 [upstream_utils] Upgrade Eigen to latest (#7982) 2025-05-19 14:26:53 -06:00
Thad House
0cb4df7e05 [hal] Fix joystick buttons not working on SC (#7980) 2025-05-18 07:03:52 -07:00
Thad House
231ec348fe [hal] Update DS API to new format (#7977) 2025-05-16 22:15:14 -07:00
Lucien Morey
d32e60233f [wpimath] Add dynamic size support for angle statistics (#7964) 2025-05-15 18:43:46 -07:00
sciencewhiz
1596e2fd7a [ci] Remove dispatch for tools not supported in 2027 (#7975) 2025-05-15 18:25:34 -07:00
sciencewhiz
79a9d7f987 [examples] Add Accelerometer filtering snippets 2025-05-13 22:03:22 -07:00
sciencewhiz
0877d130be [examples] Add Accelerometer collision detection snippets 2025-05-13 22:03:22 -07:00
sciencewhiz
89555383cc [examples] Add BuiltInAccelerometer Snippet 2025-05-13 22:03:22 -07:00
sciencewhiz
de315947e9 [examples] Add ADXL 345 and 362 snippets 2025-05-13 22:03:22 -07:00
sciencewhiz
b7cd03adc4 [examples] Add AnalogAccelerometer snippets
Delete AnalogAccelerometer comments about sensitivity and zero constants that don't exist
2025-05-13 22:03:22 -07:00
PJ Reiniger
6e3f48daeb [bazel] Add scripts to validate pregeneration tools (#7690) 2025-05-13 22:01:47 -07:00
PJ Reiniger
0e5a6f38d8 [bazel] MVP for building GUI related things with bazel (#7934)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2025-05-12 08:24:41 -06:00
Tyler Veness
cc8eaf3ed7 [wpilib] Remove unhelpful comments from BooleanEvent (#7970)
These were apparently a meme about state being hard to manage rather
than a statement about the code itself. I spent a while trying to find
some complex logic this comment was alluding to that would indicate why
it's "a nightmare to manage".
2025-05-12 08:19:54 -06:00
Peter Johnson
dd6c830768 Revert "Added parity with C++ units. (#7965)" (#7968)
This reverts commit 3dee19a435.

This was merged without sufficient review or discussion as to whether these units are value-add for the Java units library.
2025-05-11 15:08:31 -07:00
T Grinch
3dee19a435 Added parity with C++ units. (#7965)
* Added parity with C++ units.

* Update Units.java

* Update Units.java

* Formatting

* Fixed formatting

---------

Co-authored-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
2025-05-10 21:04:17 -04:00
sciencewhiz
55a97f0c11 [examples] Add Analog Potentiometer Snippets (#7957) 2025-05-10 07:18:19 -07:00
Yuhao
b1f7e6d6f2 [cscore] Resolve macOS camera freeze with specific devices (#7960)
Addresses an issue where certain USB cameras, specifically the ArduCam OV9281, would freeze when attempting to stream on macOS.

The previous logic started the AVCaptureSession (startRunning) before locking the device for configuration (lockForConfiguration). While this works for many cameras, it causes the OV9281 to become unresponsive.

Further investigation revealed:
- Moving startRunning to after unlockForConfiguration resulted in macOS overriding the custom format and frame rate settings applied within the lock.
- The reliable solution, inspired by findings shared in the community (e.g., Stack Overflow), is to lock the device, apply the configuration, start the session, and then unlock the device.

This commit reorders the operations within deviceStreamOn in UsbCameraImplObjc.mm to follow the sequence: lockForConfiguration -> apply settings -> startRunning -> unlockForConfiguration. This ensures the desired camera configuration is applied correctly without causing device freezes on problematic hardware like the OV9281.
2025-05-07 19:57:03 -07:00
Gold856
ca3137b291 [build] Remove statically linked JNI artifacts (#7553) 2025-05-05 22:10:07 -07:00
Lucien Morey
e1da917270 [wpimath] Add dynamic size support for numerical jacobian computation (#7959) 2025-05-05 21:55:51 -07:00
Peter Johnson
0a38400734 [datalog] Finish up a few missed moves from wpiutil split (#7956) 2025-05-04 11:21:29 -07:00
sciencewhiz
b96264f042 [examples] Misc fixes for snippets (#7952) 2025-05-04 00:13:46 -07:00
sciencewhiz
a15152712f [examples] Add AnalogInput snippets (#7951) 2025-05-04 00:13:20 -07:00
Eric
17cae787e7 [commands] Mark CommandPtr class as [[nodiscard]] (#7803)
This has the same effect but makes it so any user code returning CommandPtr can't discard a returned command.

Signed-off-by: Eric Ward <ezeward4@gmail.com>
2025-05-03 20:44:55 -07:00
Jade
02de5f710e [cscore] Fix memory leak in usbviewer example (#7922)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-05-01 22:07:45 -07:00
sciencewhiz
e63899e63a [examples] Add snippets for Digital Input article (#7949) 2025-05-01 11:40:38 -06:00
Tyler Veness
ba37e7eb3c [wpimath] Fix warning false positive from GCC 15 (#7948)
```
In file included from /usr/include/c++/15.1.1/functional:61,
                 from /home/tav/frc/wpilib/allwpilib/thirdparty/googletest/include/gtest/gtest-matchers.h:43,
                 from /home/tav/frc/wpilib/allwpilib/thirdparty/googletest/include/gtest/internal/gtest-death-test-internal.h:47,
                 from /home/tav/frc/wpilib/allwpilib/thirdparty/googletest/include/gtest/gtest-death-test.h:43,
                 from /home/tav/frc/wpilib/allwpilib/thirdparty/googletest/include/gtest/gtest.h:65,
                 from /home/tav/frc/wpilib/allwpilib/wpimath/src/test/native/cpp/controller/ControlAffinePlantInversionFeedforwardTest.cpp:7:
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = Eigen::Matrix<double, 2, 1>; _ArgTypes = {const Eigen::Matrix<double, 2, 1, 0, 2, 1>&, const Eigen::Matrix<double, 1, 1, 0, 1, 1>&}]’,
    inlined from ‘frc::ControlAffinePlantInversionFeedforward<States, Inputs>::ControlAffinePlantInversionFeedforward(std::function<Eigen::Matrix<double, Size, 1, (Eigen::AutoAlign | (((Size == 1) && (1 != 1)) ? Eigen::RowMajor : (((1 == 1) && (Size != 1)) ? Eigen::ColMajor :  Eigen::ColMajor))), Size, 1>(const Eigen::Matrix<double, Size, 1, (Eigen::AutoAlign | (((Size == 1) && (1 != 1)) ? Eigen::RowMajor : (((1 == 1) && (Size != 1)) ? Eigen::ColMajor :  Eigen::ColMajor))), Size, 1>&, const Eigen::Matrix<double, Cols, 1, (Eigen::AutoAlign | (((Cols == 1) && (1 != 1)) ? Eigen::RowMajor : (((1 == 1) && (Cols != 1)) ? Eigen::ColMajor :  Eigen::ColMajor))), Cols, 1>&)>, units::time::second_t) [with int States = 2; int Inputs = 1]’ at /home/tav/frc/wpilib/allwpilib/wpimath/src/main/native/include/frc/controller/ControlAffinePlantInversionFeedforward.h:59:19,
    inlined from ‘virtual void frc::ControlAffinePlantInversionFeedforwardTest_Calculate_Test::TestBody()’ at /home/tav/frc/wpilib/allwpilib/wpimath/src/test/native/cpp/controller/ControlAffinePlantInversionFeedforwardTest.cpp:29:70:
/usr/include/c++/15.1.1/bits/std_function.h:393:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  393 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/15.1.1/bits/std_function.h: In member function ‘virtual void frc::ControlAffinePlantInversionFeedforwardTest_Calculate_Test::TestBody()’:
/usr/include/c++/15.1.1/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = Eigen::Matrix<double, 2, 1>; _Functor = frc::ControlAffinePlantInversionFeedforwardTest_Calculate_Test::TestBody()::<lambda(auto:45&, auto:46&)>; _ArgTypes = {const Eigen::Matrix<double, 2, 1, 0, 2, 1>&, const Eigen::Matrix<double, 1, 1, 0, 1, 1>&}]’ declared here
  269 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
/home/tav/frc/wpilib/allwpilib/wpimath/src/test/native/cpp/controller/ControlAffinePlantInversionFeedforwardTest.cpp:29:70: note: ‘<anonymous>’ declared here
   29 |                                                                 20_ms};
      |                                                                      ^
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = Eigen::Matrix<double, 2, 1>; _ArgTypes = {const Eigen::Matrix<double, 2, 1, 0, 2, 1>&}]’,
    inlined from ‘frc::ControlAffinePlantInversionFeedforward<States, Inputs>::ControlAffinePlantInversionFeedforward(std::function<Eigen::Matrix<double, Size, 1, (Eigen::AutoAlign | (((Size == 1) && (1 != 1)) ? Eigen::RowMajor : (((1 == 1) && (Size != 1)) ? Eigen::ColMajor :  Eigen::ColMajor))), Size, 1>(const Eigen::Matrix<double, Size, 1, (Eigen::AutoAlign | (((Size == 1) && (1 != 1)) ? Eigen::RowMajor : (((1 == 1) && (Size != 1)) ? Eigen::ColMajor :  Eigen::ColMajor))), Size, 1>&)>, frc::Matrixd<Rows, Cols>&, units::time::second_t) [with int States = 2; int Inputs = 1]’ at /home/tav/frc/wpilib/allwpilib/wpimath/src/main/native/include/frc/controller/ControlAffinePlantInversionFeedforward.h:79:11,
    inlined from ‘virtual void frc::ControlAffinePlantInversionFeedforwardTest_CalculateState_Test::TestBody()’ at /home/tav/frc/wpilib/allwpilib/wpimath/src/test/native/cpp/controller/ControlAffinePlantInversionFeedforwardTest.cpp:45:73:
/usr/include/c++/15.1.1/bits/std_function.h:393:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  393 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/15.1.1/bits/std_function.h: In member function ‘virtual void frc::ControlAffinePlantInversionFeedforwardTest_CalculateState_Test::TestBody()’:
/usr/include/c++/15.1.1/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = Eigen::Matrix<double, 2, 1>; _Functor = frc::ControlAffinePlantInversionFeedforwardTest_CalculateState_Test::TestBody()::<lambda(auto:47&)>; _ArgTypes = {const Eigen::Matrix<double, 2, 1, 0, 2, 1>&}]’ declared here
  269 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
/home/tav/frc/wpilib/allwpilib/wpimath/src/test/native/cpp/controller/ControlAffinePlantInversionFeedforwardTest.cpp:45:73: note: ‘<anonymous>’ declared here
   45 |                                                                 B, 20_ms};
      |                                                                         ^
```
2025-05-01 11:40:13 -06:00
Cory
7036bd509e [wpimath] Correct mil unit (#7950) 2025-05-01 11:28:02 -06:00
Yuhao
8fe3cfb325 [cscore] Add UVC Protocol Support for USB Camera Controls on macOS (#7926) 2025-04-30 08:02:59 -06:00
Jonah Snider
a4572a01b7 [wpiutil] Add nested struct schemas before parent schema (#7935)
When adding struct schemas, the current logic is to add the parent/outer schema, and then add the schemas for any nested inner schemas.  This reverses that order to make it easier for tools to process.

Matches C++ logic.
2025-04-29 20:52:27 -07:00
Lucien Morey
f14af97dc7 [wpimath] Support dynamic matrix sizes in StateSpaceUtil (#7942) 2025-04-29 11:58:28 -06:00
Jade
631521a980 [thirdparty] Set IMGUI_DEFINE_MATH_OPERATORS (#7899)
This avoids the need to define it early in the include order everywhere else.

Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-04-29 08:44:17 -06:00
sciencewhiz
c49fc29046 [examples] Add Limit Switch snippets (#7946) 2025-04-29 08:42:32 -06:00
Nolan Barker
40ce42712f [wpimath] Fix coordinate frame docs in HolonomicDriveController (#7938) 2025-04-28 16:27:38 -07:00
sciencewhiz
659710a79a [examples] Add remaining Encoder snippets (#7936) 2025-04-28 16:25:49 -07:00
David Vo
d059cbc157 [bazel] Hide wpinet implementation headers (#7941)
The headers in wpinet/src/main/native/cpp/*.h aren't intended to be used by dependents, so they shouldn't get propagated.
2025-04-28 16:46:22 -06:00
Thad House
08297430b5 [hal,wpilib] Add support for second I2C port (#7878) 2025-04-28 09:29:01 -06:00
Thad House
85a8fc9943 [hal] Add SystemCore to Java runtime type (#7932) 2025-04-28 09:10:32 -06:00
Peter Johnson
36811211be Merge branch 'main' into 2027 2025-04-25 23:45:43 -07:00
Gold856
2f0990e9d2 [commands] Remove control commands and subsystems (#7921) 2025-04-25 22:06:26 -07:00
crueter
0695a4db89 [wpimath] Fix Debouncer type-changing behavior (#7870)
Closes #7867

Properly resets the baseline upon switching the debounce type, and adds
a test for such.

Signed-off-by: swurl <swurl@swurl.xyz>
2025-04-25 22:05:31 -07:00
me-it-is
3960045663 [wpimath] TrapezoidProfile: Fix null pointer when calling timeLeftUntil (#7894) 2025-04-25 21:58:05 -07:00
Tyler Veness
92010c175f Fix more emscripten compiler errors (#7895)
I ran the CMake configure with:
```bash
emcmake cmake -B build-wasm -S . \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_SHARED_LIBS=OFF \
  -DWITH_SIMULATION_MODULES=OFF \
  -DWITH_PROTOBUF=OFF \
  -DWITH_GUI=OFF \
  -DWITH_CSCORE=OFF
```

* Turned off simulation modules because they require shared libraries
* Turned off GUI because glfw requires libssh
* Turned off cscore because it requires OpenCV

I still get the following compiler errors:

```
/home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/linux.cpp:43:10: fatal error: 'sys/epoll.h' file not found
   43 | #include <sys/epoll.h>
      |          ^~~~~~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/stream.cpp:991:56: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
  991 |   for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/tav/.cache/emscripten/sysroot/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/wpinet/src/main/native/thirdparty/libuv/src/unix/core.cpp:748:56: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
  748 |   for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg))
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/tav/.cache/emscripten/sysroot/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2025-04-25 21:56:26 -07:00
sciencewhiz
90ee11a9e0 [examples] Add DutyCycleEncoder Snippets (#7930) 2025-04-25 21:47:53 -07:00
David Vo
828199befb [ci] Use Bazel fastbuild compilation mode on Windows (#7925) 2025-04-25 21:46:40 -07:00
David Vo
d04e15b957 [bazel] Avoid globally linking macOS SDK frameworks (#7927) 2025-04-25 10:37:42 -07:00
Joseph Eng
d98ad815b1 [wpimath] Adjust applyDeadband logic (#7816)
Reduces nesting by returning when the value is within the deadband.

Adjusts the algorithm to handle large values of maxMagnitude naturally (instead of needing a separate check).

Reformats the math comments.
2025-04-23 08:41:03 -06:00
Austin Schuh
1c35a3a5ff [bazel] Make bazel work outside // (#7918)
The .bazelrc was doing a relative import, not an absolute one.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-04-23 08:31:43 -06:00
Gold856
b248663386 [ci] Upgrade sccache action (#7914) 2025-04-22 15:27:55 -06:00
Gold856
9c60da1319 [ci] Use sccache for RobotPy build (#7915)
Also uses Artifactory to store the caches.
2025-04-22 15:27:20 -06:00
sciencewhiz
21d921184a [examples] Add compilable code snippets (#7909)
This enables frc-docs to use RLIs for things that are currently in-line
code blocks, and ensures they compile, which is important with the 2027
breaking changes coming. They are kept separate from the examples to
ensure they don't polute the VSCode examples finder.

Adds the Encoder snippets used in the frc-docs Encoder article as the
first instance of this.
2025-04-22 15:26:26 -06:00
Yuhao
26e299115f [cscore] Fix USB video mode handling on macOS (#7904)
* fix: UsbCameraImpl on macOS

* fix: add back logs
2025-04-21 09:27:42 -07:00
Wispy
07192285f6 [wpiunits] Add InchesPerSecondPerSecond (#7905) 2025-04-17 19:00:14 -07:00
Tyler Veness
ed94e3af3e [ci] Upgrade sccache action (#7911) 2025-04-17 18:59:10 -07:00
Tyler Veness
3cd282d9b0 [ci] Upgrade to wpiformat 2025.33 (#7902) 2025-04-12 20:29:09 -07:00
Tyler Veness
49b4b064cf [docs] Update readme to say Xcode is required (#7892)
The command line tools are insufficient.
2025-04-08 08:11:15 -06:00
Tyler Veness
bd78215b43 [glass] Fix compilation error with protobuf 30.1 (#7890)
```
/home/tav/frc/wpilib/allwpilib/glass/src/libnt/native/cpp/NetworkTables.cpp: In function ‘void UpdateProtobufValueSource(glass::NetworkTablesModel&, glass::NetworkTablesModel::ValueSource*, const google::protobuf::Message&, std::string_view, int64_t)’:
/home/tav/frc/wpilib/allwpilib/glass/src/libnt/native/cpp/NetworkTables.cpp:363:27: error: no match for ‘operator+’ (operand types are ‘const char [7]’ and ‘google::protobuf::internal::DescriptorStringView’ {aka ‘std::basic_string_view<char>’})
  363 |   out->typeStr = "proto:" + desc->full_name();
      |                  ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
      |                  |                         |
      |                  const char [7]            google::protobuf::internal::DescriptorStringView {aka std::basic_string_view<char>}
```
2025-04-07 07:31:31 -06:00
Tyler Veness
c13b2f45c1 [wpimath] Update link to Ramsete controller derivation (#7887)
The derivation was moved from the Controls Engineering in FRC book to a
separate paper.
2025-03-30 16:25:08 -07:00
Jonah Snider
ea986427aa [wpiutil] Add Kaitai Struct definition for data log format (#7882)
Adds a Kaitai Struct definition for the WPILOG format. This can be used to generate code to read/write data log files without needing to build out a parser/serializer by hand. Or just an additional resource for readers to help understand the WPILOG format.
2025-03-27 16:51:13 -06:00
jpokornyiii
dcd397e007 [xrp] Update XRP for new SparkFun RP2350 Board (#7880)
Enables servos 3 and 4 usage on the new XRP board.
2025-03-26 08:50:09 -06:00
Thad House
e2cc9e0059 [hal, wpilib] PWM Rewrite (#7845)
The HAL will only contain the output period and the raw microseconds. Higher level things such as SimDevice can handle everything else.
2025-03-20 19:23:22 -07:00
Thad House
2e21a41f87 [hal] Set number of SmartIO and CAN buses (#7871) 2025-03-19 19:49:54 -07:00
Thad House
52b353fe57 [hal, wpilib] Remove power rails that don't exist on systemcore (#7861) 2025-03-14 10:16:08 -07:00
Jack Cammarata
1efaaefd78 [wpimath] Fix UnscentedKalmanFilter and improve math docs (#7850)
Throughout the code the state sqrt covariance S and innovation covariance Sy are maintained as upper triangular cholesky factors of those covariance matrices. The original paper defines P=S*S', so S should be lower triangular. The functions in the paper reflect this. In the code implementation, the sqrt covariance matrices are upper triangular, but the algorithm expects them to be lower triangular.

This bug was likely missed because the incorrect version of the filter is able to converge for some systems where all the states are observed, and the test case is set up such that all states are observed.

To fix the bug, a couple things needed to be changed:
all instances of rankUpdate() needed to be changed to use the lower triangular cholesky factor,
In the unscented transform, when S is found via QR decomposition, we need to take the transpose because R is upper triangular,
P() and SetP() functions need to be modified to be P=S*S' instead of P=S'*S, and P.llt().matrixL() instead of P.llt().matrixU() respectively.

Each part of the algorithm has also had the comments changed to clarify exactly which equation from the paper it implements.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2025-03-14 10:05:15 -07:00
Tyler Veness
71b6e8ec58 [wpiutil] Avoid including execinfo.h for Emscripten target (#7854) 2025-03-06 23:15:22 -08:00
Tyler Veness
1a835fec01 [wpimath] Fix singularities in Ellipse2d::Nearest() (#7851)
The problem was ill-conditioned if either semiaxis had zero length.
2025-03-04 18:52:17 -08:00
Tyler Veness
d3cc185382 [upstream_utils] Upgrade to fmt 11.1.4 (#7852) 2025-03-04 18:50:56 -08:00
crueter
0ad595c33c [wpimath] Add Debouncer type and time setters (#7839)
Signed-off-by: swurl <swurl@swurl.xyz>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2025-03-03 17:21:38 -07:00
Tyler Veness
7cb29ce70b [datalog] Fix sorting of related header (#7832) 2025-03-02 10:47:48 -08:00
Thad House
93bf6c70ba [build] Remove sources from ceres-cpp (#7844) 2025-03-02 10:46:50 -08:00
arbessette
a7ae22d764 [docs] Update code of conduct (#7833) 2025-02-27 11:02:13 -08:00
Tyler Veness
822457d45b [wpimath] Fix feedforward returning NaN when kᵥ = 0 (#7790) 2025-02-25 19:07:51 -08:00
Thad House
baa20fa239 [hal, wpilib] Rewrite CAN APIs (#7798) 2025-02-25 19:07:01 -08:00
Adrien Bourdeaux
75321f1d84 [wpimath] Add Translation2d/Translation3d slew rate limiter (#7806)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2025-02-25 19:06:00 -08:00
Tyler Veness
cd6fee7fea [sysid] Refactor feedback analysis (#7827) 2025-02-25 19:05:05 -08:00
Tyler Veness
517344fe80 [wpimath] Fix another infinite loop in ArmFeedforward (#7823) 2025-02-25 19:04:31 -08:00
Rain Heuer
b0e588fd49 [glass] Update Field2D default field to 2025 (#7820) 2025-02-25 19:04:16 -08:00
Tyler Veness
0f0e93722e [ci] Upgrade to Clang 17 sanitizers (#7819) 2025-02-25 19:01:41 -08:00
Gold856
b39744b562 [wpimath] Remove PathWeaver support (#7813)
Also rename file load type in glass to "Field Image JSON".
2025-02-21 07:43:45 -07:00
Thad House
72bba2491a [wpilib] Remove Nidec Brushless support (#7811) 2025-02-20 20:14:01 -08:00
sciencewhiz
f9307de04c [docs] Document that /format is disabled (#7810)
Add instructions for manual workarounds
2025-02-20 20:13:09 -08:00
sciencewhiz
15dcdebe21 [docs] Update contributing so breaking changes go to 2027 (#7809) 2025-02-20 20:12:48 -08:00
Peter Johnson
98f933eca5 Merge branch 'main' into 2027 2025-02-20 00:26:23 -08:00
Tyler Veness
0c3c2c1fda [sysid] Remove extra period from exception messages (#7805) 2025-02-19 21:08:39 -08:00
DeltaDizzy
da47f06d70 [datalog] Move all DataLog functionality to new datalog library (#7641)
Currently the major DataLog backend API (reading and writing) is split between wpiutil and glass. In the interest of allowing code that wants to use these APIs to not need to link to glass and declutter wpiutil, all of those APIs are moved to a new library named "datalog".

Signed-off-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
2025-02-19 21:08:17 -08:00
HarryXChen
c898853b4d [wpilib] LinearSystemSim.setState: calculate new output state (#7799)
Establishes the invariant that the state and measurement always match up, even immediately after construction.
2025-02-18 22:49:28 -08:00
Sam Carlberg
bd2211119f [epilogue] Make nonloggable type warnings configurable (#7792)
Now a flag at the class level controls whether warning messages are printed.

Defaults to false (no warning messages).
2025-02-18 21:48:51 -08:00
Tyler Veness
13626063dc [wpimath] Fix units typo (#7789) 2025-02-13 23:22:44 -08:00
Peter Johnson
7e6077c546 [wpimath] Fix up order and docs for Feedforward gain setters (#7788) 2025-02-13 23:20:08 -08:00
Jade
4d126b158c [wpimath] Add setters to Feedforward gains (#7784)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-02-13 21:09:28 -08:00
Peter Johnson
e22f76ce73 [build] Bump native-utils to 2025.9.1 (#7783) 2025-02-13 20:23:07 -08:00
Jonah Bonner
e648b9c86d [wpinet] Serve index HTML file from WebServer if available (#7780) 2025-02-13 18:10:02 -08:00
Kevin-OConnor
23658a8c62 [apriltag] Split 2025 AprilTag Maps (#7781)
Splits maps for welded vs AndyMark field perimeters. More info about why and what fields are at what events will be in TU12.
2025-02-13 17:53:11 -08:00
Tyler Veness
155b3d45e7 [wpiutil] Remove broken StackWalker library (#7777)
A Discord user reported that StackWalker gives blank stacktraces.

MSVC's C++23 support is unstable, so we can't use std::stacktrace yet.
In the meantime, we can just return an empty string and remove the
unmaintained StackWalker library and its hacky upstream_utils script.
2025-02-12 22:54:41 -08:00
Austin Schuh
d62ab12855 [bazel] Add missing -ldl when building libuv in bazel (#7775)
I was getting:
external/arm_frc_linux_gnueabi_repo/bin/../arm-nilrt-linux-gnueabi/sysroot/usr/lib/gcc/arm-nilrt-linux-gnueabi/12/../../../../../../../arm-nilrt-linux-gnueabi/bin/ld: bazel-out/k8-opt--roborio/bin/external/com_github_wpilibsuite_allwpilib/wpinet/libwpinet.static.a(fs.o): undefined reference to symbol 'dlsym@@GLIBC_2.4'
external/arm_frc_linux_gnueabi_repo/bin/../arm-nilrt-linux-gnueabi/sysroot/usr/lib/gcc/arm-nilrt-linux-gnueabi/12/../../../../../../../arm-nilrt-linux-gnueabi/bin/ld: external/arm_frc_linux_gnueabi_repo/bin/../arm-nilrt-linux-gnueabi/sysroot/lib/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

This fixes that error for me.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-02-12 16:17:11 -07:00
Dustin Spicuzza
1921d7b79a [wpilibc] Remove Alert magic static with map lookup (#7712)
The magic static adds yet another thing that needs to be reset if you
want to run a unit test with a completely reset wpilib state. Use the
existing Sendable static map to store the data instead.

This leaks memory if ResetSmartDashboardInstance is called.
2025-02-11 22:05:22 -08:00
Tyler Veness
ac1705ae2b [wpimath] Remove unit suffixes from variable names (#7529)
* Move units into API docs instead because suffixes make user code verbose and hard to read
* Rename trackWidth to trackwidth
* Make ultrasonic classes use meters instead of a mix of m, cm, mm, ft,
  and inches
2025-02-10 08:23:04 -07:00
Gold856
9dbb0c8c3d [ci] Turn on sync labels for the labeler (#7770)
This means PRs that had labels for certain changes will have those labels removed if those changes are removed.
2025-02-09 23:04:36 -08:00
Michael Fisher
b2584c6bdf [cmake] Use binary output dir for generated field images code (#7772) 2025-02-09 23:03:15 -08:00
Peter Johnson
53df127535 [cmake] Suppress enum warning on all clang, not just Apple (#7771) 2025-02-09 23:01:51 -08:00
Peter Johnson
d2611d4ad5 [hal] SPI: Remove byte limit on size in Java API (#7774)
The underlying Linux spidev supports up to page size length.
2025-02-09 23:01:01 -08:00
Peter Johnson
764ada9b66 [hal] Change usage reporting to string-based (#7763) 2025-02-07 13:37:23 -07:00
Ryan Blue
b60b2b64bd [hal, wpilib] AddressableLED: add support for other color orders (#7102)
Many LED strips use different color order (GRB in particular is common).

This makes the change at the HAL level. This solves 2 problems; first, no code needs to change in the high level drivers, which was challenging for C++, and second, simulation will behave properly as no conversion is needed. The HAL will accept an array of data objects in the same order no matter what the selected output order is, and will convert before sending it to the FPGA for output.

To accomplish this, NEON bulk load/interleave instructions are utilized. The low level implementation (load, store, and alignment functions) come from the Simd Library. The high level implementations are inspired by the image conversion functions in the simd library, but have diverged significantly.

Much of the implementation uses templates and inlined functions rather than runtime parameters; This is a trade off between the size of the generated code and the amount of function calls done at runtime. Currently, the entire conversion operation is inlined.
2025-02-07 13:36:41 -07:00
Ryan Blue
a0976a1fd9 [build] Update developerRobot JRE (#7764) 2025-02-07 11:24:30 -07:00
Peter Johnson
bfff891b5c [cameraserver] Remove Axis camera functions (#7767) 2025-02-05 20:33:32 -08:00
Peter Johnson
35aee1d78d [hal] Add ntcore to other libs in styleguide (NFC) (#7766) 2025-02-05 20:32:51 -08:00
DeltaDizzy
b3b515e1dd [sysid] Error on missing tests in loaded DataLog (#7747)
* add exception

* detect missing tests

* throw in analyzer

* define tests setter

* change to std::map

* alignas fail

* make missingTests parameter const&

* const& impl

* use set and naive comparison

* use default comparison

* add <utility>

* Revert "alignas fail"

This reverts commit 5e97940f34.

* indent validtests

* format
2025-02-04 18:12:00 -05:00
Joseph Eng
296986397b [wpimath] Document drift from desaturating discretized chassis speeds (NFC) (#7741) 2025-02-03 11:46:18 -07:00
DeltaDizzy
297f0d1b03 [wpiutil] Change kInvalidFile to macro (#7750)
This is needed on Windows because accessing global variables across shared library boundaries doesn’t work.
2025-01-30 20:01:35 -07:00
Thad House
ad29d45dfb [hal] Remove HAL_GetPort (#7754) 2025-01-30 19:59:34 -07:00
Thad House
6e704370b3 [hal, wpilib] Remove DigitalSource and AnalogTrigger (#7753) 2025-01-30 19:58:21 -07:00
Tyler Veness
7533b323d1 [upstream_utils] Upgrade to fmt 11.1.3 (#7629) 2025-01-30 13:35:33 -07:00
Sam Carlberg
18321e5551 [epilogue] Fix epilogue with package-info files (#7749) 2025-01-30 13:34:51 -07:00
Tyler Veness
b31fd17d05 [wpimath] Fix infinite loop in ArmFeedforward::Calculate(xₖ, vₖ, vₖ₊₁) (#7745)
Small values of kₐ make the iterative solver ill-conditioned. This
change reverts to the constant-acceleration feedforward in that case. It
gives _very_ bad results (hence why we added the iterative solver in the
first place), but it's better than hanging.

```
TEST(ArmFeedforwardTest, CalculateIllConditioned) {
  constexpr auto Ks = 0.5_V;
  constexpr auto Kv = 20_V / 1_rad_per_s;
  constexpr auto Ka = 1e-2_V / 1_rad_per_s_sq;
  constexpr auto Kg = 0_V;
  frc::ArmFeedforward armFF{Ks, Kg, Kv, Ka};

  // Calculate(currentAngle, currentVelocity, nextAngle, dt)
  CalculateAndSimulate(armFF, 0_rad, 0_rad_per_s, 2_rad_per_s, 20_ms);
}
```
This produces 1 V and doesn't accelerate the system at all. Using
nextVelocity instead of currentVelocity in the feedforward outputs 41 V
and still only accelerates to 0.4 rad/s of the requested 2 rad/s.

I picked the kₐ cutoff by increasing kₐ until the iterative solver
started converging.

Fixes #7743.
2025-01-30 13:33:39 -07:00
Thad House
48ce2dcc8d [hal, wpilib] Add initial systemcore counter implementation (#7723) 2025-01-28 09:58:34 -07:00
Thad House
b799b285b3 [hal, wpilib] Remove digital source from encoder (#7740) 2025-01-28 06:43:09 -07:00
PJ Reiniger
3b345fe218 [bazel] Add macros to build jni code and java tests (#7693) 2025-01-26 16:52:33 -08:00
Peter Johnson
eee30c49e2 [wpilib] Remove LiveWindow (#7733)
This will be replaced by a different mechanism, but removing it eases
the initial implementation burden of a new Telemetry/Sendable framework.
2025-01-25 10:52:19 -08:00
Peter Johnson
adbe95e610 [wpilib] Remove Shuffleboard API (#7730) 2025-01-24 23:47:42 -08:00
Peter Johnson
01e71e73ce [build] developerRobot: Fix link order (#7732)
ntcore now needs to be after hal.
2025-01-24 23:47:09 -08:00
Gold856
b44a80c07a [build] cmake: Install wpimath nanopb headers (#7731) 2025-01-24 23:26:09 -08:00
Gold856
25d11524e8 [ci] Re-enable Artifactory cleaner cron job (#7721)
The query now targets the local repo for extra safety.
2025-01-23 21:46:13 -08:00
Thad House
5898cdd5c3 [hal, wpilib] Remove interrupt (#7724) 2025-01-23 21:45:18 -08:00
Thad House
e2b6beb28a [hal, wpilib] Remove DigitalGlitchFilter (#7725) 2025-01-23 21:44:18 -08:00
Peter Johnson
d86a2ec83b [ci] Fix labeler indentation (#7716) 2025-01-21 12:51:48 -07:00
sciencewhiz
0690d3d832 [ci] Update labeler for wpical and usage reporting (#7710) 2025-01-20 09:14:27 -07:00
Ryan Blue
304b98c0c9 [wpilibc] Alert: Fix first alert in group not publishing data (#7711) 2025-01-20 09:10:03 -07:00
Joseph Eng
72541c10e6 [wpilib, commands] Improve HID direction documentation (NFC) (#7672) 2025-01-19 20:34:07 -08:00
sciencewhiz
00445f4f27 [hal] Add Kitbot framework usage reporting (#7709)
Used in FIRST's kitbot code
2025-01-18 15:02:41 -08:00
Matthew Wozniak
8fc3767b30 [wpimath] Fix macro name typo (#7707) 2025-01-17 22:19:21 -08:00
Peter Johnson
5ab0409c15 [wpilib] ADIS164xx: report product ID on mismatch (#7706) 2025-01-17 18:14:20 -08:00
Thad House
5a6c895b87 [hal, wpilib] Remove built in accelerometer (#7702) 2025-01-17 14:06:09 -08:00
Thad House
1600e773f4 [hal, wpilib] Remove DMA (#7701) 2025-01-17 14:05:34 -08:00
Peter Johnson
4caa16e254 [wpilibj] ADIS16470: Allow product ID of 16470 (#7704)
C++ allows either 16982 or 16470, do the same for Java.
2025-01-17 13:53:20 -08:00
Thad House
f80874dd4b [hal, wpilib] Remove analog accumulator and analog gyro (#7697)
The 2 high level classes were temporarily kept to keep the examples compiling. We will remove those when we have the interface into the built in IMU.
2025-01-17 12:58:31 -08:00
Thad House
92f0a3c961 [hal, wpilib] Remove SPI support (#7678) 2025-01-17 00:22:29 -08:00
Sam Carlberg
e52f400687 [wpiunits] Add Measure.per overloads for all known unit types (#7699)
Instead of only providing per(TimeUnit)

Useful for making conversion factors easier, eg `Inches.of(10).per(Rotation)` vs `Inches.of(10).per(Rotation.one())`

Update VelocityUnit.one() and VelocityUnit.zero() to return Velocity objects instead of generic Measure<? extends VelocityUnit<D>>; VelocityUnit is final, so the wildcard generic is unnecessary, and this makes the generated `per` functions possible for this type
2025-01-16 23:24:11 -08:00
Thad House
dc335ddedb [hal] Remove everything that references chipobject or VISA (#7698) 2025-01-16 23:21:40 -08:00
Thad House
ff1b2a205e [hal, wpilib] Remove analog output (#7696) 2025-01-16 23:20:44 -08:00
Thad House
5017393b3a [hal, wpilib] Remove relay (#7695) 2025-01-16 23:20:07 -08:00
Peter Johnson
d9f8fded09 Merge branch 'main' into 2027 2025-01-16 23:17:59 -08:00
PJ Reiniger
a9f3fc6b2c [bazel] Update toolchain to support systemcore (#7689) 2025-01-16 10:52:43 -07:00
Thad House
1cad4f64a4 [hal] Add high level way of getting systemserver NT instance (#7683) 2025-01-16 10:49:40 -07:00
Thad House
58cb395d76 [hal] Add systemcore duty cycle (#7682) 2025-01-15 12:57:31 -07:00
Thad House
24d6e87447 Remove CrossConn and Integration Tests (#7692) 2025-01-15 12:53:17 -07:00
Thad House
f81c42e700 [hal] Fix systemcore analog input scaling (#7691) 2025-01-15 12:52:57 -07:00
Thad House
fa71fb55a2 [wpilib] Remove I2C Warnings (#7677)
SystemCore won't have the I2C issues.
2025-01-14 12:31:47 -07:00
Thad House
45d7549ca9 [hal] Add systemcore analog input (#7681) 2025-01-14 12:30:44 -07:00
Thad House
afbaa43539 [wpiutil] Remove roboRIO-specific timestamp code (#7669) 2025-01-13 15:59:11 -07:00
David Racovan
a14545102f [wpimath] DifferentialDriveWheelPositions: tag as Proto/StructSerializable (#7622) 2025-01-13 14:52:40 -07:00
Tyler Veness
25e6549398 [wpimath] Fix various constexpr support bugs (#7676) 2025-01-13 14:44:55 -07:00
ハイドラント
cd92b07321 [wpimath] Add Pose2d and Pose3d rotateAround() (#7659) 2025-01-13 12:55:26 -07:00
Jason Daming
fc9e413ce1 [hal, wpilib] Add note about support for WS2815 (#7664) 2025-01-13 12:26:54 -07:00
Thad House
e41b33960a [rtns] Remove roboRIO team number setter (#7667)
It won't be needed in 2027.
2025-01-13 12:26:03 -07:00
Thad House
df77580a15 [hal] Remove athena hal folder (#7668)
Also remove roborio bazel target.
2025-01-13 12:25:28 -07:00
Thad House
09a6bc9a25 [build] Remove RoboRIO specializations from build system (#7670) 2025-01-13 12:23:54 -07:00
Tyler Veness
007526089e [wpimath] Fix LinearSystemId return type and docs (#7675)
Fixes #7674.
2025-01-13 12:22:53 -07:00
Thad House
666d1638ce [hal] Digital IO SystemCore implementation (#7621) 2025-01-12 16:58:46 -08:00
Sam Carlberg
c5f7a2b4ac [epilogue] Fix lazy logging of mutable arrays (#7665) 2025-01-11 10:25:47 -08:00
Jade
638d265b33 [commands] Add a warning to schedule docs (NFC) (#7073)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-01-09 23:31:40 -08:00
Elliot Scher
6125227836 [wpical] Add JSON Combiner (#7640)
This new feature allows users to combine multiple Apriltag layouts. This can be useful for fields where the apriltags are split into two or more sections: (red/blue side, grouped together by task, etc.)
2025-01-09 23:30:17 -08:00
HarryXChen
e37c35746a [wpimath] Implement Translation3d.RotateAround (#7661) 2025-01-09 20:31:34 -08:00
oh-yes-0-fps
995bc98ccf [epilogue] Revert "Add a measure's symbol to its name when logged by Epilogue (#7535)" (#7652)
This reverts commit 469bb3290d.

The approach used has issues due to the fact unit symbols often have a literal / in them,
which causes issues with NT topic visualization.

A better approach would be to use topic metadata.
2025-01-07 12:35:10 -07:00
Matt
2de03c9601 [cscore] Use frame time in Linux UsbCameraImpl (#7609) 2025-01-07 09:33:20 -07:00
Ryan Heuer
8e459a4f2a [glass] Field2d: Fix custom image padding to maintain aspect ratio (#7648) 2025-01-06 21:16:14 -08:00
Peter Johnson
58d7c07343 [fieldImages] Use rendered image (#7650)
Source: https://www.chiefdelphi.com/t/4k-field-image-2025-reefscape/478797
2025-01-06 21:15:39 -08:00
Peter Johnson
9b08f0244c [wpiutil] SignalObject: Fix move operator= (#7649) 2025-01-06 20:11:34 -08:00
sciencewhiz
7032de3d5d [glass] Field2D: Change field picker to show JSONs first (#7643)
Too many people don't realize that glass/simgui field2d can load
pathweaver JSON field files since it's hidden.
2025-01-05 22:36:14 -08:00
Peter Johnson
03d9e96877 [wpiutil] Change StringExtras split() to template (#7636)
It now calls back a function for each part rather than creating a SmallVector.
2025-01-05 20:53:43 -08:00
Kevin-OConnor
159e18ce05 [fieldImages] Flip 2025 Field Image (#7638)
Original image was flipped when it should have been rotated.
2025-01-04 11:37:44 -08:00
Peter Johnson
257d0e0824 [fieldImages] Add 2025 Reefscape to Fields, make default (#7635) 2025-01-04 11:14:27 -08:00
Kevin-OConnor
b65f159c3f Add 2025 field and apriltags (#7634)
Column in Field Drawings is labeled X-Rotation, but I believe it should be Y-Rotation so have reflected that here. We'll fix in a TU if this is correct.
2025-01-04 10:14:34 -08:00
Tyler Veness
11a0c36737 [wpimath] Make Rotation2d member initialization order match declaration order (#7632) 2025-01-03 22:44:17 -08:00
Peter Johnson
0f6693594c [glass] Split DataSource into type-specific variants (#7588) 2025-01-03 13:36:40 -08:00
Peter Johnson
148fcdca85 [wpiutil] DataLog: Move schema info to a separate map (#7626) 2025-01-03 13:28:50 -08:00
Peter Johnson
93521420c8 [wpinet] uv::AddrToName: Add StringAssignable constraint (#7627) 2025-01-03 13:28:29 -08:00
Peter Johnson
12a1475ee4 [wpiutil] Remove LEB128 (#7628)
This was only used for NT3.
2025-01-03 07:13:49 -08:00
Peter Johnson
1240ee1bf4 [ntcore] Remove NT3 support (#7625)
- Remove StartClient3
- Rename StartClient4 to StartClient
- Remove port3 parameter from StartServer
- Remove 3-suffix constants
- Remove 4 suffix from constants

Also remove Shuffleboard build from CI.
2025-01-02 23:05:13 -08:00
Peter Johnson
da90ffd24a [wpical] Disable systemcore target (#7620) 2025-01-01 16:30:23 -08:00
Wispy
17a03514ba [glass, simgui] Fix minimum widths of windows (#7604) 2025-01-01 15:20:35 -08:00
Jade
9ebc4b32ae [commands] Undeprecate deferredProxy (#7417)
This changes the way deferred proxy is implemented to not use the
deprecated ProxyCommand constructor.

This function serves a good purpose that should be kept IMO. The
constructor was confusing but this is just good syntactic sugar over
`defer(() -> supplier.get().asProxy())`.

Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-01-01 15:11:39 -08:00
Elliot Scher
ce60bd5035 [wpical] Add support for new Apriltags (ID 16-22) (#7619) 2025-01-01 14:53:58 -08:00
Jade
468a3c6d95 [apriltag] Add kDefaultField to C++ (#7618)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2025-01-01 14:34:51 -08:00
Peter Johnson
4350ea769c [build] Bump ni-libraries to 2025.2.0 (#7617) 2024-12-31 20:50:50 -08:00
sciencewhiz
83397392f4 [hal] Update Usage Reporting to match 2025v2 image numbers (#7616) 2024-12-31 20:24:26 -08:00
Tyler Veness
786d22049b [wpilibc] Rename DCMotorSim getters (#7614) 2024-12-31 16:48:45 -08:00
Dustin Spicuzza
86137c49f5 [wpilibc] DCMotorSim: Add setAngle/setAngularVelocity (parity with Java) (#7613) 2024-12-31 14:30:16 -08:00
Tyler Veness
4edf52d3b6 [wpilibc] Clean up Joystick::GetDirection() (#7612) 2024-12-31 13:31:05 -08:00
Gold856
a41fb460a9 Update ThirdPartyNotices.txt (#7608) 2024-12-30 20:16:10 -06:00
sciencewhiz
d4985b8ba0 [ci] Build RobotPy in tools workflow (#6800) 2024-12-29 23:47:45 -06:00
sciencewhiz
1538370034 Update license year to 2025 (#7607) 2024-12-29 23:46:38 -06:00
Peter Johnson
a931a6554f Merge branch 'main' into 2027 2024-12-29 18:22:39 -08:00
Carl Hauser
eef1bf33de [wpilib] Fix SmartDashboard.setDefault* docs (NFC) (#6490)
Fix incorrect comments related to NT SetDefault* methods across multiple components
2024-12-29 18:41:29 -06:00
ハイドラント
78b6d61e88 [commands] Use factories and decorators in Command tests (#7006) 2024-12-29 10:45:17 -06:00
David Vo
e7dd5dca82 [wpilibj] TimedRobot: Squash ErrorProne warnings (#7605) 2024-12-28 21:01:43 -08:00
Matt
a27df8ec24 [cscore] Sink: add ability to get most recent frame instead of waiting (#7572)
This allows more control over frame dropping.
2024-12-28 20:44:48 -08:00
Elliot Scher
85507a6c65 [wpical] Add WPIcal: Field Calibration Tool (#6915)
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
Co-authored-by: Jade <spacey-sooty@proton.me>
Co-authored-by: Matthew Morley <matthew.morley.ca@gmail.com>
2024-12-28 20:24:32 -08:00
Peter Johnson
b74f84f876 [upstream_utils] Add imgui_demo.cpp (#7602)
This has useful debugging functions; it was left out of the change
from the separate thirdparty repo.
2024-12-28 19:33:55 -08:00
Joseph Eng
54e9c76e03 [wpilibc] Fully qualify names in error macros (#7601) 2024-12-28 16:59:19 -06:00
sciencewhiz
203487a6aa [wpimath] improve LTVUnicycleController docs (NFC) (#7599)
Document the states and inputs so it isn't necessary to look at the code
Fix max velocity throws doc
2024-12-28 16:03:47 -06:00
Tyler Veness
57344ef3b2 [wpimath] Use ct_matrix instead of Eigen/LU for determinant in headers (#7600)
This caught a bug in ct_matrix's 3x3 determinant.
2024-12-28 16:03:29 -06:00
Peter Johnson
3232630a38 Merge branch 'main' into 2027 2024-12-27 19:40:43 -08:00
sciencewhiz
46d401553e [wpilib] Add Koors40 motor controller (#7469) 2024-12-27 15:04:43 -06:00
Tyler Veness
df244cd198 [wpimath] Clean up arm and elevator feedforward APIs (#7595) 2024-12-27 08:12:14 -06:00
Tyler Veness
9e63dcfb16 [ci] Install wpiformat into venv (#7596) 2024-12-26 21:59:48 -06:00
Gold856
934bf7bf05 [build] CMake: Make NO_WERROR also work on MSVC (#7594) 2024-12-26 21:33:20 -06:00
Peter Johnson
2a757eaeb5 Merge branch 'main' into 2027 2024-12-26 18:55:43 -08:00
Nicholas Armstrong
fe49cbe429 [wpimath] Remove Units class from Elevator and Arm Feedforwards (#7570) 2024-12-26 20:21:19 -06:00
Tyler Veness
0470e51569 [upstream_utils] Upgrade to fmt 11.1.0 (#7593)
Usage of FMT_STRING() was removed since it caused compilation failures,
and https://fmt.dev/11.1/api/#compile-time-checks says it's no longer
necessary for compile-time format strings.

Fixes #7592.
2024-12-26 19:14:02 -06:00
Tyler Veness
72fdca3507 [examples] Fix C-style cast warning from cpplint (#7591) 2024-12-25 23:33:41 -06:00
sciencewhiz
dee50bf500 [ci] Validate gradle wrapper inline (#7582)
Updates to v4 of the gradle wrapper validation action
2024-12-24 17:42:07 -08:00
Tyler Veness
939a9ceee1 [upstream_utils] Upgrade to LLVM 19.1.6 (#7101) 2024-12-24 17:40:31 -08:00
Gold856
b670a59b5b [build] Fix imgui libraries not being published (#7575) 2024-12-23 19:05:06 -08:00
Brendan Raykoff
9b12ddb595 [upstream_utils] Patch protobuf to remove deprecated ATOMIC_VAR_INIT (#7585) 2024-12-23 16:14:15 -06:00
Peter Johnson
76625fa0f9 [build] cmake: Build wpiutil dev executable (#7578) 2024-12-22 15:03:33 -08:00
Peter Johnson
bb130b67b8 [wpiutil] DataLogWriter: Don't crash on file open error (#7579) 2024-12-22 15:03:12 -08:00
Wispy
469bb3290d [epilogue] Add a measure's symbol to its name when logged by Epilogue (#7535) 2024-12-22 13:35:31 -08:00
Tyler Veness
02a0adc653 [wpimath] Add Rotation3d rotation vector getter (#7564)
The code churn in Java is just making the function order consistent
between languages.
2024-12-22 13:34:51 -08:00
Ryan Blue
0c99073b94 Use std::bit_cast (#7567)
Backport #7492

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-12-22 13:34:16 -08:00
Tyler Veness
d631fa8e4b [wpimath] Fix algorithm link (NFC) (#7569)
Fixes #7568.
2024-12-22 13:33:07 -08:00
hjelstromboli
78b14c5204 [hal] Update SmartIO PWM implementation (#7571)
* Integer microsecond setters and getters
* Per-port subtables
2024-12-22 13:45:44 -06:00
Tyler Veness
19d385d149 [ci] Upgrade to wpiformat 2024.51 (#7573) 2024-12-22 13:44:40 -06:00
Ryan Blue
d0cc7e4eca [ci] Disable cleaner cron job (#7574) 2024-12-21 19:08:48 -08:00
Kaya
807dffed35 [commands] Fix C++ iterator invalidation bug (#7554)
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
Co-authored-by: Ryan Blue <13878527+rzblue@users.noreply.github.com>
2024-12-20 00:32:24 -06:00
Peter Johnson
529bab6ca1 Merge branch 'main' into 2027 2024-12-19 20:40:37 -08:00
Ryan Blue
f46c81cfe3 [ci] Delete comment command (#7566) 2024-12-19 20:53:17 -06:00
PJ Reiniger
9ccd73108b [bazel] MVP for building wpilibc + commands framework (#7231) 2024-12-18 22:00:40 -08:00
Gold856
38d8929f48 [ci] Move pregen steps into a composite action (#7474)
This ensures that complete uniformity in how the generation scripts are run. All dependencies and scripts are set up in the exact same way, each time. The old pregen_all script has been removed and moved into the composite action to ensure failed scripts will always fail the job.
2024-12-18 21:59:47 -08:00
Jan-Felix Abellera
cc73236a06 [hal] Add CAN device type for servo controllers (#7556) 2024-12-18 21:57:34 -08:00
Jade
f8720a628c [commands] Fix proxy command deprecation docs (#7396)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
2024-12-18 21:57:11 -08:00
Jade
156bd71fef [developerRobot] Workaround Eclipse annotation processor issues (#7537)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2024-12-18 09:46:31 -07:00
Ryan Blue
6e44187ff6 [build] cmake: Add wpilibNewCommands and apriltag to developerRobot (#7557) 2024-12-18 09:35:23 -07:00
Jan-Felix Abellera
e2cbdf9718 [hal] Add usage reporting for REV Servo Hub (#7555) 2024-12-18 09:34:45 -07:00
Jade
66cce1835c [ci] Add Buildifier to /format comment command (#7480)
Signed-off-by: Jade Turner <spacey-sooty@proton.me>
2024-12-18 09:31:02 -07:00
sciencewhiz
6fe5da7289 [examples] Fix example json for SimpleDifferentialDriveSimulation (NFC) (#7561)
Uses LTVUnicycleController now instead of RAMSETE.
2024-12-18 09:20:31 -07:00
Tyler Veness
03f0fc4dea [wpimath] Use immutable member functions in ChassisSpeeds (#7545) 2024-12-15 16:09:34 -08:00
Peter Johnson
80c391e182 [wpinet] WebServer: Unescape URI (#7552)
Also provide Content-Disposition filename header in response.

This fixes e.g. filenames with spaces in them.
2024-12-15 12:28:08 -08:00
Joseph Eng
70f36cce7e [commands] Extract common trigger binding logic (#7550)
This makes the logic clearer in the actual binding methods and will hopefully make it less annoying to make changes such as allowing control over initial edges.

Also changes Java to use previous and current to match C++.
2024-12-14 23:13:41 -08:00
Peter Johnson
564c1f2de2 [wpinet] WebServer: Fix Windows (#7551)
The order of evaluation of parameters is not defined; on Windows,
the std::move was executed before the GetBuffer().
2024-12-14 23:07:48 -08:00
Peter Johnson
a1b642a402 [wpinet] Add simple web server (#7527)
Also add EscapeHTML to HttpUtil.
2024-12-14 11:51:21 -08:00
Falon
f9b3efb712 [wpiunits] Refactor MomentOfInertiaUnit constructor to use MomentOfInertiaUnit instead of a Per<> (#7546) 2024-12-14 11:26:26 -08:00
Thad House
782459dff4 [wpiutil] Make runtime loader exception message slightly better (#7536) 2024-12-14 11:25:27 -08:00
Peter Johnson
945d416d07 Merge branch 'main' into 2027 2024-12-14 10:45:32 -08:00
Peter Johnson
4bca79b9af [wpimath] Revert "ChassisSpeeds fromRelative and discretize methods made instance methods (#7115)" (#7549)
This reverts commit a3b12b3bd9.
2024-12-14 10:42:49 -08:00
Daniel Chen
68285dae77 [commands] Add withDeadline modifier (#7299)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2024-12-13 18:30:02 -07:00
Daniel Chen
5e3dba672a [wpiutil] Record/Enum struct generation fix (#7538)
ProceduralStructGenerator's genRecord and genEnum were package-private, and only extractClassStruct was made public.
However, this package private visibility rendered them unable to be used by the rest of wpilib(and advanced users).

Here, ProceduralStructGenerator is split into 2 classes: StructGenerator(which generates structs) and StructFetcher(the new namespace for extractClassStruct). In addition, genRecord and genEnum have been made public methods.
2024-12-13 12:25:38 -07:00
Ryan Blue
e943424609 [build] Update shadow plugin (#7540) 2024-12-12 19:19:14 -08:00
Joseph Eng
4225b732fd Remove unnecessary boxing (#7539)
* Remove unnecessary boxing
Also remove unnecessary warning suppression

* Use more idiomatic functional interfaces in NumericalIntegration
2024-12-12 19:18:40 -08:00
Carl Hauser
39d05ebe7c [rtns] Capture exitCode from ssh_channel_get_exit_status (#7541) 2024-12-12 19:18:02 -08:00
Thad House
6ba7189373 [hal] Enable periodic CAN sends (#7530)
* Implement periodic can support

* Fix build
2024-12-08 22:29:01 -08:00
Thad House
31d1aa62c1 [hal] Fixes for making PWM drive (#7528)
* Increase connection timeout, fix ld path, properly initialize smart io.

* Also fix HAL_GetSystemTimeValid, so DataLogManager doesn't throw errors.
2024-12-08 22:08:05 -08:00
Wispy
cc41a0ed24 [wpilib] Replace MecanumDriveMotorVoltages with a functional interface (#6760) 2024-12-08 17:05:06 -08:00
Thad House
b6ae9e9cc9 Merge branch 'main' into 2027 2024-12-08 12:04:23 -08:00
Thad House
f1e4eafaa0 [hal] Add initial PWM support for systemcore (#7525) 2024-12-08 12:02:22 -08:00
Thad House
41d4826694 [hal] Initial CAN implementation for SystemCore (#7514) 2024-12-08 12:01:28 -08:00
Tyler Veness
220f4e1ba4 [wpimath] Remove RamseteController and RamseteCommand (#7522) 2024-12-07 23:38:35 -08:00
Tyler Veness
d5edb4060d [upstream_utils] Upgrade Sleipnir (#7512)
It now uses SQP for problems without inequality constraints, which is
faster.

main:
```
[ RUN      ] Ellipse2dTest.DistanceToPoint
0.203 ms
[       OK ] Ellipse2dTest.DistanceToPoint (0 ms)
[ RUN      ] Ellipse2dTest.FindNearestPoint
0.019 ms
[       OK ] Ellipse2dTest.FindNearestPoint (0 ms)
```

upgrade:
```
[ RUN      ] Ellipse2dTest.DistanceToPoint
0.197 ms
[       OK ] Ellipse2dTest.DistanceToPoint (0 ms)
[ RUN      ] Ellipse2dTest.FindNearestPoint
0.015 ms
[       OK ] Ellipse2dTest.FindNearestPoint (0 ms)
```
2024-12-07 23:02:39 -08:00
Tyler Veness
ae44295024 Use std::bit_cast (#7492) 2024-12-07 23:02:09 -08:00
Tyler Veness
e08fdeba21 [wpimath] Rename FindNearestPoint() to Nearest() (#7513)
This is easier to type and follows the naming of Pose2d::Nearest().

Since Ellipse2d and Rectangle2d were added for the 2025 season, we don't
need to add deprecation notices.
2024-12-07 23:01:18 -08:00
Wispy
544553a58f [developerRobot] Add Epilogue and wpiunits to developerRobot (#7510) 2024-12-07 23:00:49 -08:00
Tyler Veness
4910436b10 [wpimath] Remove LUTs from LTV controllers (#7521)
The Raspberry Pi 5 is fast enough that we no longer need it.
```
Running ./build/DAREBench
Run on (4 X 2400 MHz CPU s)
CPU Caches:
  L1 Data 64 KiB (x4)
  L1 Instruction 64 KiB (x4)
  L2 Unified 512 KiB (x4)
  L3 Unified 2048 KiB (x1)
Load Average: 0.47, 0.72, 0.45
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-------------------------------------------------------------------------------
Benchmark                                     Time             CPU   Iterations
-------------------------------------------------------------------------------
DARE_WPIMath_Dynamic                       34.4 us         34.4 us        20315
DARE_WPIMath_NoPrecondChecks_Dynamic       21.7 us         21.7 us        32266
DARE_WPIMath_Static                        15.2 us         15.2 us        45878
DARE_WPIMath_NoPrecondChecks_Static        7.84 us         7.84 us        89316
DARE_SLICOT                                79.4 us         79.4 us         8789
DARE_Drake                                 34.9 us         34.9 us        20074
```
2024-12-07 23:00:15 -08:00
Tyler Veness
a7349f00ef [wpimath] Fix duplicate Rotation2d constructor (#7524) 2024-12-07 22:31:09 -08:00
Peter Johnson
e493da3486 Merge branch 'main' into 2027 2024-12-07 21:38:18 -08:00
Peter Johnson
838c5fbcd7 [ci] Fix labeler yaml (#7523) 2024-12-07 21:37:49 -08:00
Peter Johnson
32ba751e58 Merge branch 'main' into 2027 2024-12-07 21:30:28 -08:00
Tyler Veness
62a6a77bbf [wpimath] Add affine transformation constructors and getters to geometry API (#7509)
Fixes #7429.
2024-12-07 21:29:02 -08:00
Tyler Veness
c81bd0c909 [ci] Upgrade to Ubuntu 24.04 (#7496) 2024-12-07 21:20:48 -08:00
Peter Johnson
38a239b531 [ci] Add labeler action to auto-label PRs (#7520) 2024-12-07 21:15:49 -08:00
Tyler Veness
c497e4ec22 [wpimath] Fix SimpleFeedforward overload set (#7516) 2024-12-07 20:32:16 -08:00
Thad House
6dbff902fa [build] Remove athena completely from build (#7517) 2024-12-07 20:31:10 -08:00
Thad House
9a1b4245fa [build] Restore Windows constexpr mutex define on wpiutil (#7515) 2024-12-07 18:55:06 -08:00
Thad House
be72e0ecd8 Skip linux arm64 build on tools build (#7511) 2024-12-07 16:37:11 -08:00
Tyler Veness
e222efaa01 [wpimath] Add affine transformation constructors and getters to geometry API (#7430)
Fixes #7429.
2024-12-07 15:49:17 -08:00
Thad House
e69c5710b3 [hal] Add ErrorInfo support to systemcore DS (#7488) 2024-12-07 14:14:21 -08:00
Peter Johnson
52b33edcbd Merge branch 'main' into 2027 2024-12-07 14:11:47 -08:00
shueja
f772bb141d [epilogue] Add extra parentheses around cast when using varhandle (#7428)
* [epilogue] Add extra parentheses around cast when using varhandle

* Fixed tests and added one for private suppliers

* Fix tests

* Formatting fixes

* Update epilogue-processor/src/test/java/edu/wpi/first/epilogue/processor/AnnotationProcessorTest.java

Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
Co-authored-by: Sam Carlberg <sam@slfc.dev>
2024-12-07 16:09:35 -05:00
Tyler Veness
278efa6384 [upstream_utils] Remove Sleipnir patches no longer needed with GCC 11 (#7491) 2024-12-07 12:36:25 -08:00
Tyler Veness
e876452967 [ci] Upgrade to wpiformat 2024.50 (#7506) 2024-12-07 11:40:24 -08:00
Sam Carlberg
5c95966d44 Fix epilogue loading optional types from the newcommands vendordep (#7505) 2024-12-07 13:56:05 -05:00
Thad House
c8900cadc3 Add SPARKmini to PWM support (#7504) 2024-12-07 00:48:20 -08:00
Thad House
5058b48dea [developerRobot] Switch to initial password and host for systemcore (#7503) 2024-12-06 23:19:48 -08:00
Tyler Veness
882233bede [wpimath] Improve SimpleMotorFeedforward argument names and deprecation message (#7489)
Also roll back SimpleMotorFeedforward unit API until 2027.
2024-12-06 22:32:40 -08:00
Peter Johnson
1921d019b7 [build] Update arm builds to bookworm (#7501)
Also bumps native-utils to 2025.9.0.
And upgrades OpenCV to -3; fixes some enum conversion deprecation warnings.
2024-12-06 22:19:00 -08:00
Tyler Veness
144e79a614 [wpimath] Remove Rotation2d value field (#7490)
It's not part of SO(2).
2024-12-06 21:00:09 -08:00
Peter Johnson
c3fc7c829d [build] Upgrade OpenCV to 4.10.0 (#7500) 2024-12-06 15:41:40 -08:00
Ryan Blue
4ce8930342 [developerRobot] Add instructions for developerRobot java sim (NFC) (#7498) 2024-12-06 00:24:26 -08:00
Thad House
38b09a6dfd [hal] Clean up systemcore notifier impl (#7487)
* Clean up systemcore notifier impl

* Formatting fixes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-05 09:17:45 -08:00
Thad House
d7cd71589a [hal] Enable an I2C bus on systemcore (#7485) 2024-12-04 20:19:51 -08:00
Daniel Chen
60198c0bec [epilogue] Improved opt-in logging support (#7437) 2024-12-03 20:30:55 -08:00
Gold856
54f0e11fc0 [build] Update OpenCV to 2025-4.8.0-2 (#7476) 2024-12-03 20:30:03 -08:00
Thad House
a954091ea2 [ci] Remove 32-bit Windows builds (#7475) 2024-12-01 17:45:04 -08:00
Thad House
bf653d9895 [hal] Add SystemServer DS support (#7466) 2024-12-01 17:05:07 -08:00
Thad House
5a9e0abe44 [ci] Build tools with systemcore image (#7472) 2024-12-01 17:03:51 -08:00
Peter Johnson
5cab27fdd5 Merge branch 'main' into 2027 2024-12-01 17:03:03 -08:00
sciencewhiz
de82ed434d [hal] Add usage reporting for TOF sensors (#7470) 2024-12-01 17:02:20 -08:00
Thad House
4dd3a36d2e [ci] Switch lint task to use base ubuntu image (#7471) 2024-12-01 17:01:19 -08:00
Thad House
ce63770970 Merge branch 'main' into 2027 2024-12-01 12:40:50 -08:00
sciencewhiz
92f8c89267 [hal] Add usage reporting for 2025 legal motor controllers (#7467) 2024-11-30 22:25:04 -08:00
Thad House
1eecaaf337 [build] Update OpenCV to 2025 (#7468) 2024-11-30 22:21:41 -08:00
sciencewhiz
892e062316 [hal,wpilib,wpimath] Add Usage Reporting for Choreo and PathWeaver (#7464) 2024-11-30 20:33:09 -08:00
sciencewhiz
9807d60566 [hal,wpilib] Change Power Distribution usage reporting to Instances (#7465)
LabVIEW doesn't appear to report PDP. This should reduce the number of
Unknowns in the parsed UsageReporting.
2024-11-30 20:32:21 -08:00
Thad House
c51f65bd4f [hal] Add initial SystemServer support (#7463) 2024-11-30 20:31:26 -08:00
Thad House
c387a7ecae [build] Update to 2025 compilers (#7462) 2024-11-30 10:07:53 -08:00
Thad House
82132c3272 [hal] Initial SystemCore empty HAL (#7454) 2024-11-30 10:04:00 -08:00
Peter Johnson
715cbb6b76 [sim] GUI: Update FMS widget when real DS is connected (#7456) 2024-11-30 09:49:09 -08:00
Ryan Blue
9d40b993f8 [wpiutil] Fix HasNestedStruct docs (NFC) (#7459) 2024-11-30 07:44:19 -08:00
Sam Carlberg
92ee5bc523 [epilogue] Add usage reporting (#7461) 2024-11-30 09:50:34 -05:00
Peter Johnson
847c3120d3 Merge branch 'main' into 2027 2024-11-30 00:35:00 -08:00
Peter Johnson
5012ad7499 [epilogue] Fix missed EpilogueBackend renames (#7458) 2024-11-30 00:34:41 -08:00
Peter Johnson
7ae4333c81 [ci] Publish on 2027 repositories 2024-11-29 23:52:22 -08:00
Peter Johnson
145450b73d [ci] Disable processing of 2027 tags (#7457) 2024-11-29 23:51:27 -08:00
Nicholas Armstrong
b91864a5ec [wpilib] Fix acceleration getter for DCMotorSim (#7449) 2024-11-29 22:15:00 -08:00
sciencewhiz
0941251375 [wpilib] Add usage reporting for loggers (#7450) 2024-11-29 22:13:31 -08:00
Sam Carlberg
7d178615fa [epilogue] Allow custom loggers for generic types (#7452)
Support custom loggers for generic types
Improve error messaging for custom loggers with generic type arguments
Consistently start all epilogue processor prints with "[EPILOGUE]"
2024-11-29 22:11:46 -08:00
Sam Carlberg
806d56e564 [epilogue] Rename DataLogger to EpilogueBackend for clarity (#7453)
Update documentation and internal names correspondingly
2024-11-29 22:10:51 -08:00
Tyler Veness
65f3345407 [upstream_utils] Suppress protobuf warnings on GCC 12 too (#7451) 2024-11-29 18:19:59 -08:00
Sam Carlberg
5e1c6a84ce [wpilibj, wpilibc] Fix LED patterns not offsetting reads (#6948)
Was causing bugs when combined with patterns that need to read back from the buffer (eg masks and overlays)

Co-authored-by: Joseph Eng <s-engjo@bsd405.org>
2024-11-28 21:25:54 -08:00
Tyler Veness
a0af0fd572 [wpimath] Remove redundant internal DARE function (#7442) 2024-11-28 21:24:13 -08:00
Kavin Muralikrishnan
f377a9c573 [examples] Fix SysId example references to shooter subsystem (#7392) 2024-11-27 23:04:53 -08:00
Peter Johnson
62338c7287 [sim] Fix DS GUI System Joysticks window auto-hiding (#7431) 2024-11-27 23:03:55 -08:00
sciencewhiz
49e3e4a0be [wpiunits] Fix deprecation javadoc for units negate (#7436)
deprecated javadoc tags aren't inherited
2024-11-27 23:03:23 -08:00
Joseph Eng
59dbfc9c2d [wpimath] Improve C++ SimpleMotorFeedforward unit type support (#7440)
Allow using non-base types
Allow using angles for serde
2024-11-27 23:02:31 -08:00
Sam Carlberg
9607c6c10d [epilogue] Fix epilogue generating incorrect packages for inner classes (#7439) 2024-11-27 23:02:00 -08:00
sciencewhiz
6ef5b85758 [wpiunits] Restore and deprecate divide (#7438)
It was changed to div in #7387, but 2024 used divide.
2024-11-27 23:01:26 -08:00
Peter Johnson
b6de7acbdb [sim] GUI: Don't show Window menu if it has no contents (#7432) 2024-11-25 17:25:55 -08:00
Thad House
fe28fa1ded [wpilibj] Fix ADIS16470 Gyro (#7434) 2024-11-25 17:23:32 -08:00
Tyler Veness
b7eb9fb8f9 [upstream_utils] Add std::is_debugger_present() shim (#7423) 2024-11-22 09:17:23 -08:00
oh-yes-0-fps
1d58c5025e [wpilibj] Add procedural struct generator for enums and records (#7149) 2024-11-21 20:48:11 -08:00
Thad House
b4a8d33486 [ntcoreffi] Use static runtime for ntcoreffi (#7422)
This avoids requiring users of this library to keep up to date with the latest MSVC runtimes.
2024-11-21 16:14:12 -07:00
sciencewhiz
0a3ccf93c6 [wpimath] Add BangBangController Usage Reporting (#7411) 2024-11-20 17:00:54 -08:00
Matt
d92f17b014 [apriltag] Fix AprilTagDetector cols/stride mixup (#7415) 2024-11-20 17:00:08 -08:00
Gold856
4c225ef2c1 [wpimath] Add proto files back to JAR (#7414)
PhotonVision depends on these being in the JAR to generate quickbuf classes.
2024-11-20 07:59:37 -08:00
Thad House
561078ce29 [hal] Cache sim TCP data to update during HAL_RefreshDSData (#7360) 2024-11-18 20:56:32 -08:00
sciencewhiz
d312bccfeb [hal] Add Swerve Instances for RobotDrive usage reporting (#7410) 2024-11-18 20:51:50 -08:00
David Vo
9826539198 [hal] Add MagicBot framework to usage reporting (#7330)
Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
2024-11-18 20:51:16 -08:00
sciencewhiz
33f7067216 [hal] Add usage reporting for Rust (#7409)
Co-authored-by: itsmeft24 <57544858+itsmeft24@users.noreply.github.com>
2024-11-18 20:25:33 -08:00
Vignesh Balasubramaniam
ac1836ec44 [wpiunits] Add absolute value and copy sign functionality (#7358) 2024-11-18 17:46:15 -08:00
sciencewhiz
57e10755fd [wpilib] Add usage reporting for dashboards as instances (#7294)
Detects dashboards based on network tables client identity.
2024-11-18 10:16:29 -07:00
Tyler Veness
8ec22b7d5c [wpiutil] Remove unfinished ct_map class (#7406) 2024-11-17 21:31:25 -08:00
Tyler Veness
a04c40f589 Replace std::make_pair with std::pair CTAD (#7405) 2024-11-17 20:29:23 -08:00
Jade
b4bec566f0 [github] Fix templates not labelling (#7400) 2024-11-17 20:28:39 -08:00
sciencewhiz
d76827db48 [build] Update to Gradle 8.11 (#7402) 2024-11-17 20:28:12 -08:00
Tyler Veness
602c4caa02 [upstream_utils] Check patch files are up to date (#7401) 2024-11-17 20:27:53 -08:00
Peter Johnson
661c321fe2 [upstream_utils] Restore Eigen intellisense fix (#7404)
This reverts commit d1de7663d3.

Intellisense is still broken on Windows Athena target with the error
`incomplete type "Eigen::Matrix<double, 3, 3, 0, 3, 3>" is not allowed`.
2024-11-17 19:11:25 -08:00
Tyler Veness
d1de7663d3 [upstream_utils] Remove Eigen intellisense fix (#7397)
FRC Code intellisense continued to work in developerRobot with a QR
decomposition.
2024-11-16 22:16:11 -08:00
Peter Johnson
b040059108 [ntcore] Properly clean up time sync listeners (#7398) 2024-11-16 22:15:40 -08:00
sciencewhiz
0798ac53d0 [build] Generate NI Style UsageReporting header (#7331)
based on wplibsuite/ni-libraries src/include/FRC_NetworkCommunication/UsageReporting.h
2024-11-16 07:58:25 -08:00
Sam Carlberg
ded7c87d63 [wpimath] Remove units from trapezoid profile classes (#7276) 2024-11-16 07:57:38 -08:00
Joseph Eng
2acf111f56 [wpimath] Add 3D odometry and pose estimation (#7119) 2024-11-16 07:56:14 -08:00
Tyler Veness
aa7dd258c4 [wpimath] Replace constexpr coeff() and coeffRef() with operator() (#7391) 2024-11-16 07:44:20 -08:00
Jonah Bonner
ca51197486 [wpilib] Add timestamp getters with configurable time base (#7378) 2024-11-16 07:43:38 -08:00
Gold856
91142ba5fe [build] Remove Windows constexpr mutex define (#7375)
Since we ship a newer runtime, and we also have checks to ensure a valid runtime, we can remove this again.
2024-11-16 07:27:46 -08:00
Thad House
969664ceaa [wpiutil] Faster nanopb submessage encode (#7374)
Due to how submessages are encoded (with a length prefix), nanopb currently does the encoding twice. It encodes once to get the length to write, then writes the length, then reencodes the entire message a 2nd time.

This results in a requirement that each encode always encodes the same. Generally, this is fine, but it'd be nice to not make this a requirement.

The double encode also requires going through the entire set of fields again, which has the possibility to be slow.

Instead of doing this, write to a temporary SmallVector. Then we can just encode the length of that buffer, and do a memcpy into primary stream. Theoretically in most cases, this should be much faster.
2024-11-16 07:26:10 -08:00
Kavin Muralikrishnan
1e545c38a8 [romi] Update Romi for parity with XRP (#7389) 2024-11-16 07:24:58 -08:00
Kavin Muralikrishnan
6eb652e10e [xrp] Copy XRPReference docs from Java to C++ (NFC) (#7388) 2024-11-16 07:24:21 -08:00
Thad House
fff73ee6e1 [ci] Add basic Android build to CI (#7390) 2024-11-16 07:23:32 -08:00
Tim Winters
bade0a8716 [wpiunits] Use div instead of divide for kotlin compatibility (#7387) 2024-11-15 11:49:40 -07:00
Thad House
453335e354 [build] Remove java requirement from cmake (#7395)
It was leftover from the failed protoc stuff
2024-11-15 07:45:20 -07:00
Thad House
c289562a06 Allow compilation on android (#7386) 2024-11-12 16:39:41 -08:00
Kavin Muralikrishnan
07345712dc [wpimath] Document default tolerances of PIDController (#7377) 2024-11-12 18:19:55 -05:00
Joseph Eng
425bf83036 [wpimath] Add 2D to 3D geometry constructors (#7380) 2024-11-12 18:18:37 -05:00
David Vo
6adad7bad7 [wpiutil] Replace StringBuffer usage with StringBuilder (#7376)
This is a local variable that doesn't escape the method, so there's certainly no reason to have synchronization here.
2024-11-10 07:43:43 -08:00
Kavin Muralikrishnan
280d2c7e32 [examples] Update C++ XRP Code to use SI Units (#7366) 2024-11-08 20:24:13 -08:00
Thad House
edc3963955 [wpinet] Fix resolver thread on newer versions of macOS (#7372)
Implicit capture of this is deprecated.
2024-11-08 20:23:17 -08:00
Tyler Veness
c58be2580d [ntcore] Suppress warning false positive (#7370)
```
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = void; _ArgTypes = {unsigned int}]’,
    inlined from ‘nt::server::ServerClient4Base::ServerClient4Base(std::string_view, std::string_view, bool, nt::server::SetPeriodicFunc, nt::server::ServerStorage&, int, wpi::Logger&)’ at /home/tav/frc/wpilib/allwpilib/ntcore/src/main/native/cpp/server/ServerClient4Base.h:24:77,
    inlined from ‘nt::server::ServerClientLocal::ServerClientLocal(nt::server::ServerStorage&, int, wpi::Logger&)’ at /home/tav/frc/wpilib/allwpilib/ntcore/src/main/native/cpp/server/ServerClientLocal.cpp:18:75:
/usr/include/c++/14.2.1/bits/std_function.h:391:17: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  391 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
      |             ~~~~^~~~~~~~~~
/usr/include/c++/14.2.1/bits/std_function.h: In constructor ‘nt::server::ServerClientLocal::ServerClientLocal(nt::server::ServerStorage&, int, wpi::Logger&)’:
/usr/include/c++/14.2.1/bits/std_function.h:267:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = void; _Functor = nt::server::ServerClientLocal::ServerClientLocal(nt::server::ServerStorage&, int, wpi::Logger&)::<lambda(uint32_t)>; _ArgTypes = {unsigned int}]’ declared here
  267 |       _M_manager(_Any_data& __dest, const _Any_data& __source,
      |       ^~~~~~~~~~
/home/tav/frc/wpilib/allwpilib/ntcore/src/main/native/cpp/server/ServerClientLocal.cpp:18:75: note: ‘<anonymous>’ declared here
   18 |     : ServerClient4Base{"", "", true, [](uint32_t) {}, storage, id, logger} {
      |                                                                           ^
```
2024-11-08 20:22:47 -08:00
Peter Johnson
f40bd3593d [wpilib,wpimath] Don't use mutable units for return values (#7369)
It only saves a single allocation and can cause confusing behavior on the
caller (user) side.
2024-11-08 18:29:51 -08:00
Thad House
3cc541f261 Remove generated google protobuf support (#7371)
It's not used anymore, and cleans up the build.
2024-11-08 18:29:30 -08:00
Tyler Veness
811b130968 [docs] Link to Bazel build docs from main readme (#7367)
I had a really hard to finding them because the main readme didn't call
it out.
2024-11-08 14:05:50 -08:00
Thad House
d39dfd64ea [build] Fix cmake build with WITH_PROTOBUF off (#7368)
Protobuf.cpp only uses nanopb, which is fine to have even with WITH_PROTOBUF off.
2024-11-08 14:05:29 -08:00
Tyler Veness
661bae568f [wpimath] Add time-varying RKDP (#7362)
This makes the ground truth for the Taylor series AQ discretization more
accurate.
2024-11-07 23:46:52 -08:00
Peter Johnson
01f85abcfe [ntcore] Use Endian.h in WireEncoder3 2024-11-08 00:46:27 -07:00
Peter Johnson
396f8203ac [ntcore] HandleMap: Use concepts for T 2024-11-08 00:46:27 -07:00
Peter Johnson
4a43ddbacf [ntcore] Split LocalStorage implementation into separate files 2024-11-08 00:46:27 -07:00
Peter Johnson
0921054a28 [ntcore] Split ServerImpl implementation into separate files 2024-11-08 00:46:27 -07:00
Peter Johnson
f738fc92f0 [ntcore] Move ServerImpl to nt::server namespace 2024-11-08 00:46:27 -07:00
Peter Johnson
a0f38f83f9 [ntcore] NetworkOutgoingQueue: Move function defs inside class 2024-11-08 00:46:27 -07:00
Peter Johnson
876be30724 [ntcore] Value: Inline constructors 2024-11-08 00:46:27 -07:00
Peter Johnson
de318fab91 [ntcore] LocalStorage: Move template functions inside class definition 2024-11-08 00:46:27 -07:00
Thad House
8b8b634f65 [wpiutil] Change C++ protobuf to nanopb (#7309)
The Google C++ protobuf implementation has issues with dynamic linkage across DLL boundaries because it uses global variables.  It also has a compile-time dependency because the protoc version must exactly match the libprotobuf version.  Using nanopb with a customized generator fixes both of these issues.

Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
2024-11-07 22:42:50 -08:00
Thad House
fd2e0c0427 [ntcoreffi] Switch ntcoreffi DLM to WPI_String (#7359)
We forgot to do this originally.
2024-11-07 15:19:37 -07:00
Tyler Veness
a66fa339dc [wpimath] Make controllers and some trajectory classes constexpr (#7343) 2024-11-07 14:02:11 -07:00
Kavin Muralikrishnan
44a45d44e2 [xrp] Update XRP C++ Method/Class Descriptions for Java Parity (#7351)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2024-11-06 16:12:16 -07:00
Ryan Blue
af652817d9 [commands] Revert "WrappedCommand: Call wrapped command initSendable (#6471)" (#7353)
This reverts commit 7bc0380694.

Calling initSendable on the wrapped command is fundamentally flawed as the wrapper is the command being sent.
2024-11-06 16:10:37 -07:00
Ryan Blue
5a16b0e108 [wpilib] Refactor Alert (#7279)
This refactors Alert in both c++ and java to fix the issues with the current c++ implementation and improve performance.

Currently, constructing an Alert adds it to a list of Alerts with the same group and type. Activating an alert sets a flag on the alert. When the SendableAlerts is polled (GetStrings), the entire list is iterated over, filtered, and the filtered list is sorted by timestamp. This leads to a worst case O(m + nlog(n)) time complexity for GetStrings, where m and n are the count of total constructed alerts active alerts respectively. It also allocates intermediate data structures to hold the active alert strings for sorting.

This changes the implementation to improve the performance of GetStrings, by shifting the sorting overhead to Alert.Set
Constructing the Alert only initializes the alert's initial state, and initializes the SendableAlerts for the group if it is not already initialized.
Activating or deactivating an alert sets an internal flag for state tracking, and inserts or removes a structure containing the timestamp and text into a self-sorting data structure (std::set, TreeSet) containing other active alerts with the same group and type. (worst case O(log(n))
Now, SendableAlerts.GetStrings only has to iterate over the structure and copy the strings to the returned array. (amortized O(n))

This also fixes the c++ implementation by removing the need for SendableAlerts to directly access the Alert.

This also adds a helper method to SendableRegistry to force initialization of the instance to prevent static initialization ordering issues.
2024-11-06 16:09:06 -07:00
sciencewhiz
71c050389a [wpiunits] Restore and deprecate measure negate (#7345)
Delegate to unaryMinus.

This ensures there's a deprecation message to help users with migration, vs just a compile error.
2024-11-06 16:07:31 -07:00
Ryan Blue
83fa422338 [wpiutil] DynamicStruct: Fix decoding of signed integers (#7350)
Add tests for both C++ and Java.
2024-11-05 17:45:49 -07:00
Tyler Veness
3113627be6 [wpimath] Fix PIDController error tolerance getters (#7341) 2024-11-05 09:52:22 -07:00
Thad House
f2d2500d1d [wpiutil] Check MSVC Runtime (#7301) 2024-11-05 09:51:48 -07:00
Tyler Veness
63e623d70b [wpimath] Fix case and order of HolonomicDriveController PID getters (#7342) 2024-11-05 09:50:17 -07:00
Tyler Veness
9e8d37c03b [wpimath] Remove unhelpful test fixtures (#7344)
These test fixtures were adding complexity while only saving one line of
object initialization per test. Our other tests like this just make the
object at the top of each test.
2024-11-05 09:49:38 -07:00
truher
ad09d73dd6 [ntcore] Replace "ValueListenerPoller" with "NetworkTableListenerPoller" in docs (#7328) 2024-11-05 09:49:03 -07:00
Ryan Blue
3fd33b1f72 [wpiutil] DynamicStruct: Clear nested fields when updating/adding a schema (#7334) 2024-11-05 09:48:24 -07:00
Jade
043c155087 Fix a few clangd warnings (#7335) 2024-11-05 09:47:54 -07:00
Ryan Blue
7a6c7af412 [wpiutil] Fix dynamic struct decoding for nested structs (#7346)
After a struct-type field descriptor had offsets calculated more than once, IsBitField would return true, causing the second call to CalculateOffsets to calculate incorrect offsets.
2024-11-05 06:43:04 -07:00
Ryan Blue
8588b5e520 [glass] Revert "Storage: Store Value by value" (#7333)
This reverts commit 309b370223.

Storage::GetChildArray never initializes the child array when the entry is new, so it returns invalid references.
2024-11-04 23:34:18 -07:00
Jade
debb52156c [wpilib] Clamp sim battery voltage to 0 (#7325) 2024-11-03 10:37:44 -08:00
Kavin Muralikrishnan
23e71e10e4 [xrp] Add getter for XRP LED (#7327) 2024-11-03 10:32:03 -08:00
Sam Carlberg
44c0bbc4a9 [epilogue] Generate unique names for variables used in instanceof chains (#7323)
Fixes an issue where the variable names would clash with the field names of the associated VarHandles.
2024-11-02 19:11:22 -07:00
Tyler Veness
a48f3c35f4 Remove argv usage from Python scripts (#7311)
argparse will automatically read sys.argv, so we don't need to pass it
in manually. Furthermore, none of our scripts customize argv.
2024-11-02 19:09:32 -07:00
Tyler Veness
7c91b81906 [ci] Upgrade to wpiformat 2024.45 (#7326) 2024-11-02 17:56:55 -07:00
Jade
eb8583596c [ci] Remove parts of Bazel CI (#7324)
We were building huge amounts with bazel we were already building
otherwise. We've been getting heavily backlogged in CI because of the amount
of CI jobs we are running versus our maximum runners quota (particularly on Mac), so this really isn't worth it right now.
2024-11-02 07:05:24 -07:00
Tyler Veness
dfd1084526 [wpimath] Replace pi with symbol in docs (#7322) 2024-11-01 17:16:18 -07:00
Peter Johnson
2cfe114c78 [wpiutil] DynamicStruct: Store StructDescriptor by value 2024-10-31 22:04:13 -07:00
Peter Johnson
caae5357b7 [wpilibc] Mechanism2d: Store roots by value 2024-10-31 22:04:13 -07:00
Peter Johnson
22e91bfacd [wpilibc] ShuffleboardInstance: Store ShuffleboardTab by value 2024-10-31 22:04:13 -07:00
Peter Johnson
67e1b5fe95 [sim] halsim_ws_core: Store SimDeviceValueData by value 2024-10-31 22:04:13 -07:00
Peter Johnson
27e07d6787 [ntcore] ClientImpl3: Store Entry by value 2024-10-31 22:04:13 -07:00
Peter Johnson
e49d452e46 [glass] Context: Store storageRoots by value 2024-10-31 22:04:13 -07:00
Peter Johnson
5c0edc2410 [glass] Field2D: Store field objects by value 2024-10-31 22:04:13 -07:00
Peter Johnson
309b370223 [glass] Storage: Store Value by value
This is possible because std::map has stable value pointers.
2024-10-31 22:04:13 -07:00
Peter Johnson
f620141e0d [wpiutil] Replace LLVM StringMap impl with std::map
As string_view operations on std::map<std::string> won't be integrated
until C++26, placeholder implementations are used which are less efficient
in a couple of situations (e.g. insert with hint).
2024-10-31 22:04:13 -07:00
Ryan Blue
5f3cf517d3 [commands] C++: Allow CommandPtrs to be owned by the scheduler (#7310)
Previously users would have to keep track of dynamically created CommandPtrs. This adds an ownership-taking version of schedule which places the command in a temporary store in the scheduler. The command will be freed when the command's lifecycle ends.
2024-10-31 22:03:12 -07:00
Tyler Veness
328a781040 [wpimath] Port Rotation2d Java tests to C++ (#7318) 2024-10-31 20:40:14 -07:00
Thad House
ebf83e4340 [ntcoreffi] Add ntcoreffi headers zip (#7229) 2024-10-31 20:39:56 -07:00
Tyler Veness
9f6f267f5c [wpimath] DARE: Use wpi::expected instead of exceptions (#7312) 2024-10-31 20:37:57 -07:00
Tyler Veness
21980c7447 [sysid] Clamp feedback measurement delay to zero or higher (#7319)
LQR latency compensation applies exponential decay to the feedback
gains, so a negative latency causes them to exponentially grow.
2024-10-31 20:37:15 -07:00
David Vo
75fc4d18ef [bazel] Fix test attempting to upload to readonly cache (#7302) 2024-10-31 20:36:58 -07:00
Ryan Blue
8f81b7723d [ci] Disable caching for setup-go (#7320)
setup-go is warning because it can't find go.sum, which we don't have.
2024-10-31 20:36:35 -07:00
Sam Carlberg
fe45265a3a [epilogue] Log elements based on the most specific available logger (#7317)
Instead of only logging based on the declared type, loggers will be smarter and do instanceof checks to determine what logger should be used.

Note that diamond inheritance may cause unexpected behavior for non-logged classes that implement multiple logged interfaces.
2024-10-31 20:34:41 -07:00
Sam Carlberg
0f313c672f [epilogue] Autogenerate nicer data names by default, not just raw element names (#7167)
eg "getFoo()" will now be logged as "Foo", or "m_leftMotor" as "Left Motor"

It is now a compilation error to reuse the same logged name for multiple elements (since whatever is declared last would overwrite anything logged before it)

Do not log record fields (just use the accessors). This also fixes an issue where records could never be logged due to identical member and accessor names

Also skips toString, hashCode, and clone methods when generating loggers
2024-10-31 20:34:00 -07:00
Thad House
aaf139320e [upstream_utils] Fix protobuf GNUC_MINOR macro (#7316) 2024-10-30 22:42:24 -07:00
Ryan Blue
89c5d98fe9 [build] Use pathlib in wpiunits generation script (#7306)
Makes wpiunits more consistent with the other generation scripts.

Also sort imports, remove args from main.
2024-10-29 23:05:48 -07:00
Tyler Veness
defcc02806 [wpimath] Clean up LTV controller includes (#7313) 2024-10-29 23:03:17 -07:00
Ryan Blue
e6e928d670 [ci] Increase keychain timeout to 6 hours (#7314) 2024-10-29 23:02:47 -07:00
Ryan Blue
f03e0cdf6a [wpilib] Add explanation for HID GetBumper/Touchpad deprecations (#7304) 2024-10-28 19:29:42 -07:00
Ryan Blue
412c042c6c Use LF in generated files (#7305) 2024-10-28 19:28:58 -07:00
Ryan Blue
f44c3eda43 [ci] Update actions to python 3.12 (#7308) 2024-10-28 18:09:35 -07:00
Ryan Blue
018dcaea4f [ci] Check return code of subprocesses in pregen_all (#7307)
Previously errors were ignored.

Also makes the script more cross-platform by using the current python executable to run the subprocesses.
2024-10-28 18:07:30 -07:00
Jade
85ffb7814b [build] Update Gradle to 8.10.2 (#7164) 2024-10-28 00:44:30 -07:00
Brendan Raykoff
6207992709 [wpilibj] RobotController: Add Java unit support (#7278) 2024-10-27 23:41:15 -07:00
Tyler Veness
42a433b6fa [sysid] Remove unused includes and inline short functions (#7296) 2024-10-27 23:40:26 -07:00
sciencewhiz
2c857cd82a [ntcore] Use NT3 client identity in front of unique id (#7293)
This way all NT3 clients are not identified as just NT3.
2024-10-26 18:56:04 -07:00
Gold856
1c220ebc60 [build] CMake: add Doxygen doc generation (#7286) 2024-10-25 10:45:53 -07:00
Jade
1cfed736ce [build] CMake: Make Protobuf dependency actually optional (#7291) 2024-10-25 08:52:38 -07:00
Ryan Blue
46b5631ba7 [docs] Fix wpiutil thirdparty include roots in docs (#7288) 2024-10-25 06:52:14 -07:00
Jade
d2b19d8928 [docs] Add WITH_PROTOBUF to README-CMAKE (#7289) 2024-10-25 06:51:35 -07:00
Joseph Eng
9a5f73d787 [cscore] Add back VideoProperty handle member initializer (#7283) 2024-10-23 21:46:20 -07:00
Tyler Veness
db552317e7 [dlt, rtns] Fix libssh deprecation warnings (#7284)
```
/home/tav/frc/wpilib/allwpilib/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp: In member function ‘void rtns::SshSession::Execute(std::string_view)’:
/home/tav/frc/wpilib/allwpilib/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp:89:44: warning: ‘int ssh_channel_get_exit_status(ssh_channel)’ is deprecated [-Wdeprecated-declarations]
   89 |   INFO("{} {}", ssh_channel_get_exit_status(channel), cmd);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp:139:44: warning: ‘int ssh_channel_get_exit_status(ssh_channel)’ is deprecated [-Wdeprecated-declarations]
  139 |   INFO("{} {}", ssh_channel_get_exit_status(channel), cmd);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/roborioteamnumbersetter/src/main/native/cpp/SshSession.cpp:143:46: warning: ‘int ssh_channel_get_exit_status(ssh_channel)’ is deprecated [-Wdeprecated-declarations]
  143 |     *exitStatus = ssh_channel_get_exit_status(channel);
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/datalogtool/src/main/native/cpp/Sftp.cpp:79:33: warning: ‘int sftp_async_read_begin(sftp_file, uint32_t)’ is deprecated [-Wdeprecated-declarations]
   79 |   int rv = sftp_async_read_begin(m_handle, len);
      |            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
```
```
/home/tav/frc/wpilib/allwpilib/datalogtool/src/main/native/cpp/Sftp.cpp: In member function ‘size_t sftp::File::AsyncRead(void*, uint32_t, AsyncId)’:
/home/tav/frc/wpilib/allwpilib/datalogtool/src/main/native/cpp/Sftp.cpp:87:28: warning: ‘int sftp_async_read(sftp_file, void*, uint32_t, uint32_t)’ is deprecated [-Wdeprecated-declarations]
   87 |   auto rv = sftp_async_read(m_handle, data, len, id);
      |             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
```
2024-10-23 20:34:54 -06:00
Ryan Blue
03cb3c70b4 [epilogue] Set source and target java versions for epilogue-processor tests (#7282) 2024-10-23 17:17:19 -06:00
Nicholas Armstrong
ac907f755a [wpiunits] Add resistance units (#7168) 2024-10-23 08:20:17 -06:00
Nicholas Armstrong
a3b12b3bd9 [wpimath] ChassisSpeeds fromRelative and discretize methods made instance methods (#7115) 2024-10-22 17:23:17 -06:00
Tyler Veness
cbc9264468 [ci] Upgrade to wpiformat 2024.44 (#7256)
This makes the C identifier list scanner correctly handle single quotes
in numeric literals.
2024-10-22 17:19:12 -06:00
Jade
28ac2e3554 Update version in DevelopmentBuilds (#7077) 2024-10-22 09:18:37 -06:00
Jade
58c0cd46b1 [build] Remove cmake toolchains (#7254)
They aren't used and should instead be taken from https://github.com/wpilibsuite/opensdk
2024-10-22 08:36:42 -06:00
Peter Johnson
115a02211c [cscore] HttpCamera: Auto-detect mode from stream if not set (#7248) 2024-10-22 08:35:05 -06:00
Peter Johnson
f553dee6cb [cscore] HttpCamera: Send width/height/fps stream settings (#7247) 2024-10-22 08:33:23 -06:00
Peter Johnson
e8d2d1c39a [wpinet] HttpRequest: Keep params ordered (#7246) 2024-10-22 08:32:41 -06:00
Peter Johnson
7cc7fa1845 [cscore] Fix wakeup on sink destruction (#7245) 2024-10-22 08:02:20 -06:00
Peter Johnson
cbdb4e81f6 [cscore] GetNextFrame: Wake up even if no frames received (#7244) 2024-10-22 08:01:41 -06:00
Tyler Veness
05c7fd929b [wpimath] Make various classes constexpr (#7237) 2024-10-22 07:58:06 -06:00
Tyler Veness
0c824bd447 [wpimath] Take finite difference stencil points by const ref (#7238) 2024-10-21 22:33:56 -07:00
Tyler Veness
ed18b41198 [upstream_utils] Add Eigen geometry module (#7242)
WPICal needs it.
2024-10-21 22:29:35 -07:00
Joseph Eng
6745fc7c2f [wpimath] Fix C++ pose estimator poseEstimate initialization (#7249) 2024-10-21 22:29:04 -07:00
Gold856
40af8db28a [wpilibc] DataLogManager: Rename console log entry to "console" (#7240)
This matches Java.
2024-10-21 06:34:29 -06:00
Tyler Veness
5ac132f6a2 [wpiutil] Make circular buffer classes constexpr (#7232)
The circular buffer class that uses std::vector internally can be used
in a constant expression as long as it doesn't survive to runtime.
2024-10-20 15:33:40 -07:00
Tyler Veness
dd72a78aa4 [upstream_utils] Upgrade to libuv 1.49.2 (#7226) 2024-10-19 09:55:45 -07:00
PJ Reiniger
36e0c9d6db [build] MVP for building with bazel (#6994) 2024-10-19 09:54:49 -07:00
Tyler Veness
95b9bd880b [wpimath] Make geometry classes constexpr (#7222) 2024-10-18 16:08:41 -07:00
Joseph Eng
2054d0f57e [wpimath] Fix pose estimator reset methods (#7225) 2024-10-18 16:06:32 -07:00
Thad House
ee22482f4a [build] ntcoreffi: Don't link to chipobject (#7228) 2024-10-18 16:06:10 -07:00
Étienne Beaulac
796dbd3b86 [wpilib] Add Timer.isRunning() method (#7220) 2024-10-17 17:03:40 -07:00
Gold856
0424e5ba36 [build] Remove unnecessary symbol exclusions (#7221)
The symbol exporter in native-utils was updated and stopped exporting the excluded symbols.
2024-10-17 16:19:19 -07:00
Ryan Heuer
f7dddb8014 [glass] Add Alerts widget (#7219) 2024-10-16 13:45:56 -06:00
Ryan Blue
68715aa484 [wpilibc] SPI & I2C: Use handle wrapper to close port (#7217) 2024-10-16 11:08:44 -06:00
Tyler Veness
fad06ae1e7 Merge .inc files into headers (#7215) 2024-10-15 23:42:57 -07:00
Ryan Heuer
40caabea23 [glass] Align Field2d border and image padding (#7214) 2024-10-15 22:02:08 -07:00
Ryan Blue
59dc9ad8f4 [examples] Rename SysId example to SysIdRoutine (#7213)
CMake target output conflicts with sysid (the application) on windows
2024-10-15 22:01:05 -07:00
Ryan Blue
2b1c5aa4fc [wpilibc] Check for invalid handle in destructors (#7212)
Moved-from objects have invalid handles.
2024-10-15 19:56:13 -07:00
Peter Johnson
0bada2e102 [ntcore] Merge .inc files into headers (#7210) 2024-10-14 22:42:58 -07:00
Tyler Veness
ee281ea448 [wpimath] Merge .inc files into headers (#7209)
Splitting the files didn't help readability or save compilation time and
it confused contributors. Merging them is also in line with how C++
modules will be written.
2024-10-14 16:08:10 -07:00
Peter Johnson
bedfc09268 [ntcore] Add missing multi-subscribe C API functions (#7203)
Also export recently added C API functions.
2024-10-14 09:55:36 -06:00
Peter Johnson
4023cdc80a [ntcore] Fix EALREADY errors by tracking read state (#7202) 2024-10-13 00:14:16 -07:00
Gold856
12885015ed [cscore,hal] Remove VS 2019 16.4.0 workaround (#7201) 2024-10-11 22:18:12 -07:00
Gold856
f23bece791 [sysid] Remove unused dependency on libglassnt (#7200)
Also remove stale libuv references.
2024-10-11 22:05:32 -07:00
Gold856
7ebd45ef4d [sysid] Fix crash when all data is filtered out during analysis (#7199) 2024-10-11 21:51:56 -07:00
Peter Johnson
25c2e26ef8 [ntcore] Fix UID collisions between subscribers and multi-sub (#7198)
The changes in #7189 caused an ambiguity between multi-subscribers and
normal subscribers, because the handle type no longer is sent to the network.

Multi-subscribers now go to the network with negative UIDs, normal
subscribers are positive UIDs.  UID 0 is never used.
2024-10-11 21:39:55 -07:00
PJ Reiniger
f1e032f5e6 [examples] Fix cross project import (#7197) 2024-10-11 21:17:57 -07:00
Gold856
22a04bf470 [commands] Deprecate control commands and subsystems (#7143) 2024-10-11 19:48:47 -07:00
Peter Johnson
77ee9bdd30 [ntcore] Client: only connect to IPv4 addresses (#7195)
The server only binds to IPv6, so connection attempts to that are useless.
2024-10-11 17:05:09 -07:00
Peter Johnson
c6d801d2d6 [wpinet] ParallelTcpConnector: Add option to resolve only IPv4 addresses (#7194) 2024-10-11 16:42:59 -07:00
Peter Johnson
768fa5f973 [wpinet] libuv: Change GetAddrInfo hints parameter to optional (#7196)
This is clearer than passing a pointer.
2024-10-11 16:42:42 -07:00
Peter Johnson
a621cebbd6 [ntcore] Server round robin message processing (#7191)
Each client has an incoming queue of ClientMessage.

In the read callback:
- Parse and process only ping messages and a limited number of messages;
  anything else will get put into the queue and not processed
- If we queued some messages, we tell the network we stopped reading; this will
  result in back-pressure if we are reading too slowly.  We also start an idle
  handle to process the queued messages.

In the idle handle callback:
- For each client, process just a few pending messages.  This is performed in
  round-robin fashion across all clients with pending messages
- When a client's queue becomes empty, we re-enable the network read
- When all client queues are empty, we stop the idle handle (so we don't spin)

For local client processing, we use round-robin processing for most cases (including FlushLocal),
but still do batch processing of all local changes for explicit network Flush() calls.
2024-10-11 16:26:56 -07:00
Peter Johnson
8870d98f80 [upstream_utils] Revert upgrade to libuv 1.49.0
This reverts commit eab93f4fdc (#7129).

There's broken behavior in getaddrinfo.
2024-10-11 16:13:15 -07:00
Peter Johnson
2d6f02d15b [glass] Check for struct descriptor size 0 (#7192)
This avoids a potential divide by 0.
2024-10-11 16:09:32 -07:00
Peter Johnson
96f0b2482c [ntcore] Unify NetworkInterface and MessageHandler (#7190) 2024-10-11 14:38:02 -07:00
Peter Johnson
8ca99c7cb7 [ntcore] Change internal interfaces and messages to use UIDs (#7189)
Also make Handle functions constexpr.
2024-10-11 10:57:36 -07:00
Peter Johnson
59bc53b9b8 [ntcore] Add StopRead/StartRead to WireConnection (#7188) 2024-10-11 10:51:12 -07:00
Peter Johnson
94c62ed3ec [wpiutil] Add FastQueue (#7075)
This is a heavily modified version of https://github.com/cameron314/readerwriterqueue that removes
all atomics and barriers.
2024-10-11 10:49:29 -07:00
Gold856
28cb7cf757 [examples] Add ProfiledPID command to RapidReactCommandBot (#7030) 2024-10-11 08:43:24 -07:00
Peter Johnson
dcf5f55a30 [upstream_utils] Remove ConcurrentQueue (#7183)
It appears to be broken under stress testing (dropped/duplicate values).

This reverts commit 97c6c86f3b (#7066).
2024-10-10 23:41:41 -07:00
Peter Johnson
f65f9ed693 [wpiutil] Add rotated_span (#7111) 2024-10-10 23:36:26 -07:00
Jade
8f57e4c566 [documentation] Remove more outdated commands examples (#7054)
There are still some examples we'd like to remove here (eg Hatchbot
traditional) but this is a good start with not too many changes required
in frc-docs.
2024-10-10 23:09:11 -07:00
Gold856
37e7bfe4f9 [build] Add docs for generated files (#6878) 2024-10-10 22:20:45 -07:00
Jade
679892e8e1 [commands, documentation] Remove controller replaceme commands (#7053) 2024-10-10 22:12:02 -07:00
Nicholas Armstrong
4adfa8bf64 [wpimath] Fully discretized ElevatorFF and ArmFF (#7024)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-10-10 22:10:45 -07:00
Nicholas Armstrong
5d9a553104 [wpilib] DCMotorSim cleanup/enhancement (#7021)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-10-10 22:09:22 -07:00
Nicholas Armstrong
5acb4109ff [examples] Fix flaky ArmSimulationTest (#7170)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2024-10-10 22:07:52 -07:00
Ryan Blue
fc83d4868c [hal] Fix CAN ID validation and reporting for CTRE and REV devices (#7178)
REV: 1-63, 63 devices
CTRE: 0-62, 63 devices
2024-10-10 22:06:53 -07:00
Ryan Blue
a65f6b94ee [hal] Radio LED: Properly close files and improve error messages (#7181) 2024-10-10 22:06:19 -07:00
Bryce Roethel
d97a749d84 [wpimath] SwerveDrivePoseEstimator: Fix stationary module emitting error when calculating angle in ToSwerveModuleStates (#7175) 2024-10-10 22:05:49 -07:00
Sam Carlberg
2085ab3d47 [wpilib] Allow LED pattern gradients to be discontinuous (#7174) 2024-10-10 22:05:33 -07:00
Peter Johnson
0cfff31439 [ntcore] Fix use-after-free on connection termination (#7177)
The stream can close (e.g. due to an error) while in the middle of writing. The close callback would immediately destroy the connection object, resulting in the writing code having a use-after-free. Fix this by deferring the deletion to the loop main using a single-shot timer.
2024-10-10 22:03:55 -07:00
Thad House
a71cee1112 [build] Update to 2025 beta NI Libraries (#7182) 2024-10-10 22:03:29 -07:00
Nicholas Armstrong
968bdf0d06 [commands] Add deadband trigger methods to CommandGenericHID (#7085)
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2024-10-10 22:03:01 -07:00
Gold856
f150b36108 [wpiutil] Fix FileLogger behavior and performance (#7150)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2024-10-08 12:55:16 -06:00
Ryan Blue
f856c05a08 [ci] Add no-cache build workflow to detect potential false-positive cache hits (#7027)
Duplicate of gradle.yml without docs, caching, and release configurations.
It's set up to run off-peak weekly.
2024-10-04 18:24:23 -07:00
Ryan Blue
09a93b86dc [wpilibc] Add RadioLEDState docs to C++ (NFC) (#7158)
Add RadioLEDState docs for consistency with Java.
2024-10-04 18:22:31 -07:00
Tyler Veness
8102516300 [ci] Upgrade to wpiformat 2024.42 (#7165) 2024-10-04 13:55:10 -06:00
Ryan Blue
b541174255 [wpilib] Alert: fix incorrect set docs (NFC) (#7163)
Console printing was removed when Alerts were added to wpilib.
2024-10-03 23:20:53 -06:00
Sam Carlberg
9a7710ebd3 [wpiunits] Make Velocity.mult(Time) return Measure<D> (#7162)
Update code generator to allow arbitrary implementations of multiplication methods.
2024-10-03 23:19:36 -06:00
Ryan Blue
bc6553cd2b [ci] Fix cmake CI (#7159) 2024-10-03 18:22:39 -06:00
Jade
dced751a72 [ci] Merge Windows into CMake matrix (#7153) 2024-10-03 14:26:49 -06:00
Ryan Blue
83615c6024 [wpiutil] DataLogBackgroundWriter: Normalize empty path name (#7151)
An empty path isn't valid on it's own, so fs::space always returns an error. This results in UINT_MAX bytes being used instead of the actual free space, which means a default constructed DataLogBackgroundWriter won't stop for low space.

Using "." instead makes the directory path the current working directory, which is the desired behavior
2024-10-03 13:32:09 -06:00
Jade
a8a5d1609b [build] Name CMake presets more consistently (#7154) 2024-10-03 13:29:27 -06:00
Gold856
f82e1c9d48 [build] CMake: fix Windows build when WITH_PROTOBUF is false (#7147) 2024-10-02 10:20:43 -06:00
Jade
466a4a52fa [wpilibc] Fix missing symbols on Windows (#7140)
Windows doesn't support direct static variable access across library boundaries in a mixed static/shared environment, so change to accessor functions.
2024-10-01 08:46:06 -06:00
Nicholas Armstrong
fe80d72fba [wpimath] Add cosineScale method to SwerveModuleState and instance optimize (#7114) 2024-09-30 13:23:30 -06:00
Peter Johnson
fde264b041 [thirdparty] Add Roboto fonts (#7138) 2024-09-28 10:58:47 -07:00
Peter Johnson
95da92db04 [wpigui] Add "deep dark" style (#7133) 2024-09-28 10:58:29 -07:00
Peter Johnson
d389317c3a [thirdparty] Upgrade imgui fonts to latest versions (#7137) 2024-09-28 10:35:16 -07:00
Peter Johnson
50db16c0c0 [wpigui] Add font selector (#7134) 2024-09-28 10:34:59 -07:00
Benjamin Hall
6b1e656659 [wpimath] Add DCMotor.getCurrent() overload accepting torque (#7132) 2024-09-28 09:33:15 -07:00
Tyler Veness
eab93f4fdc [upstream_utils] Upgrade to libuv 1.49.0 (#7129) 2024-09-27 12:00:54 -07:00
Gold856
f0a1955fd7 Move generated files to more consistent locations (#6906)
Java templates always go under src/generate/main/java. JSON files go to src/generate.
2024-09-24 22:13:49 -07:00
Ryan Blue
b8ff3fcee2 [upstream_utils] StringMap: fix structured bindings with move-only types (#7127) 2024-09-24 22:11:41 -07:00
Gold856
69af7785f6 [gitignore] Add .clangd file to gitignore (#7122) 2024-09-24 09:20:21 -07:00
Nicholas Armstrong
6281ec0810 [wpimath] PIDController: Update field and method names for error and errorDerivative (#7088) 2024-09-23 11:57:20 -06:00
Gold856
64e5e6db59 [ci] Use one script to pregenerate everything (#7121)
A pregen_all Python script was added that calls all the other pregen scripts. This prevents the generated file checks and pregen command from falling out of sync. This is meant to only run in CI, since the script is not portable across platforms.
2024-09-23 11:54:59 -06:00
oh-yes-0-fps
180349bd06 [commands] Improve isScheduled to be more performant when checking a single command (#7096) 2024-09-23 11:54:37 -06:00
Gold856
22f086aba8 Fix app icons on Windows (#7116)
The SysId icon has a bunch of weird artifacting and it's not transparent on Windows. Some of the other icons have issues as well and all of them are inconsistent. GIMP was used to regenerate all the icons from the PNGs, using PNG compression on all the layers.
2024-09-22 23:54:23 -07:00
Gold856
84075997c6 [cscore] Fix Java VideoSink class doc (NFC) (#7120) 2024-09-22 22:12:36 -07:00
Gold856
ba1b97cd78 [wpilib] ADIS IMUs: Add back null checks (#7117)
* Revert "Move creation of objects to ctor"

This reverts commit b1d8001652.

* [wpilib] ADIS IMUs: Add back null checks
2024-09-22 18:05:09 -07:00
Tyler Veness
f93bacc5c5 [upstream_utils] Remove unused clone_repo() function (#7091) 2024-09-20 20:12:48 -07:00
Tyler Veness
38e246c34f [ci] Upgrade to wpiformat 2024.41 (#7112) 2024-09-20 18:41:33 -07:00
sciencewhiz
a884863f19 [ci] Fix RobotBuilder tools build (#7107)
Build more dependencies added by GradleRIO 2025 Alpha 2
2024-09-20 17:44:22 -07:00
Tyler Veness
554024767e Fix errors from new cpplint.py (#7105) 2024-09-20 17:43:39 -07:00
Sam Carlberg
f1dde8895e [build] Use project configured groupId in generated output artifact names (#7095)
Instead of hardcoding to use the project name after edu_wpi_first, which broke epilogue publishing

This did not affect local maven publishing, since it does not use those specially named and configured artifacts
2024-09-18 20:44:01 -07:00
sciencewhiz
0df82da7e6 [build] Update vendordeps frcyear to 2025 (#7087) 2024-09-18 19:07:02 -07:00
Jade
cea8684895 [build] Update native utils (#7029) 2024-09-16 18:59:00 -07:00
Ryan Blue
777f07edfd [wpilibc] Solenoid classes: Make methods non-virtual (#7080) 2024-09-16 18:36:04 -07:00
Ryan Blue
b93160d7ba [wpiutil] Fix MSVC warning in parse_integer (#7082)
```
warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
```
2024-09-14 14:49:08 -07:00
Ryan Blue
64df5e21c0 [build] cmake: Fix libssh search on windows (#7081)
This uses the package config files provided by libssh rather than the module file.
2024-09-14 14:47:12 -07:00
Peter Johnson
994af25fcf [wpiutil] StringLogEntry::Update(): Take string_view (#7074) 2024-09-12 23:45:57 -07:00
Joseph Eng
1f3ef019ce [wpiutil] Return wpi::expected from MemoryBuffer::GetFile (#7069) 2024-09-12 23:45:35 -07:00
Tyler Veness
d44b651558 [build] Make Protobuf optional in CMake build (#7061) 2024-09-12 23:44:19 -07:00
Jade
b9409a4bcf [xrp] Add GetRotation2d to Gyro (#7034) 2024-09-12 22:16:00 -07:00
Gold856
3bbbf86632 [wpiutil, wpilib] Add FileLogger and log console output (#6977) 2024-09-12 22:13:06 -07:00
Ryan Blue
32252f7d6a [upstream_utils] Import argparse to wpiutil (#7071) 2024-09-12 20:10:43 -07:00
Ryan Blue
97c6c86f3b [upstream_utils] Import ConcurrentQueue to wpiutil (#7066) 2024-09-10 23:12:22 -07:00
Peter Johnson
21cbb68465 [ci] Run expected.py as part of upstream-utils (#7068) 2024-09-10 19:56:15 -07:00
Jade
874d8a8dd4 [wpiutil] Remove ConcurrentQueue (#7063)
Its unused and mutexed which makes it less useful to future usecases
2024-09-10 07:08:25 -07:00
Thad House
dcce108b75 [hal] Correct maximum length of DS console send (#7057) 2024-09-08 22:00:04 -07:00
Ryan Blue
43c2409366 [ci] Add cmake cache repo to nightly cleanup (#7059) 2024-09-08 21:45:45 -07:00
Ryan Blue
5d68f0c11a [ci] Fix CMake caching to Artifactory (#7058) 2024-09-08 20:51:25 -07:00
Ryan Blue
34e4587121 [ci] Move nightly cleanup task to monorepo (#7050) 2024-09-08 17:31:55 -07:00
Peter Johnson
7c85c33666 [ntcore] Avoid duplicate addition of publishers in server (#7052)
We emitted a warning but went on to do unsafe things. This could cause a delayed crash.
2024-09-08 10:36:00 -07:00
Peter Johnson
306e190f78 [ntcore] Fix client unpublish outgoing queue (#7051)
The unpublish message must be sent on the outgoing queue before the handle
indicating which queue to use is erased.
2024-09-08 10:35:41 -07:00
Peter Johnson
7bdecab729 [ntcore] Fix unpublishing on client disconnect (#7042) 2024-09-08 10:35:05 -07:00
Jade
cd9922af49 [wpilib] Add getVoltage to PWMMotorController (#6044) 2024-09-07 22:24:51 -07:00
Wispy
6e8feb154c [wpimath] Add more support for wpiunits in the geometry classes (#6587) 2024-09-07 22:23:19 -07:00
Ryan Blue
7f6f19eef4 [ci] Use artifactory for sccache backend (#7049) 2024-09-07 22:21:56 -07:00
Ryan Blue
161dfefb4d [docs] Add romi and xrp to docs build (#7045) 2024-09-07 22:21:16 -07:00
Ryan Blue
0cab7b5204 [wpilibj] AnalogEncoder: fix documentation (#7043)
configureRolloverCounting was added and removed as part of the absolute encoder overhaul, this reference was left dangling
2024-09-07 20:43:15 -07:00
Ryan Blue
dc68576834 [docs] Exclude eigen/unsupported from docs build (#7046) 2024-09-07 20:42:41 -07:00
Bryce Roethel
115ffa3396 [epilogue] Add Epilogue.update() (#7047)
Currently, users can only invoke Epilogue via Epilogue.bind(TimedRobot). This PR adds a new method Epilogue.update(TimedRobot) so that Epilogue can manually called, in case a user is seeking more deterministic timing of their logs in reference to their control loops.
2024-09-07 19:59:49 -07:00
Joseph Eng
c8dab95ea7 [upstream_utils] Rename expected's detail namespace to detail_expected (#7048)
Previously, both wpi/expected and JSON's cpp_future.h would define enable_if_t and conjunction in wpi::detail, leading to conflicts if both were included in the same cpp source file. By renaming the namespace wpi/expected uses, there is no longer a conflict.
2024-09-07 19:59:20 -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
Ryan Blue
496e7c1bba [hal] Refactor C++ handle closing; check for invalid handle before closing (#7016)
Adds a close function pointer template parameter to hal::Handle.  This allows default destructors in many places.
The status parameter has been removed from close functions; in most places it was not used. Where it was, an error is printed instead.
2024-09-07 10:58:15 -07:00
Jade
80f3813908 [xrp] Cleanup gyro docs (#7033) 2024-09-07 10:53:49 -07:00
Ryan Blue
2aef60d49c [ci] Check for full repository name in actions (#7038)
This allows forks of allwpilib owned by wpilibsuite to exist without patching the workflows.
2024-09-07 10:53:23 -07:00
Ryan Blue
46e64e2dcb [ci] Bump MACOSX_DEPLOYMENT_TARGET to 13.3 (#7035) 2024-09-07 10:52:41 -07:00
Brandon Shen
3ad35a5753 [epilogue] Log internal debug data to the configured logger instead of NT (#7040) 2024-09-07 10:52:21 -07:00
Ryan Blue
b38e06c7cb [upstream_utils] Upgrade apriltag to latest master (take 2) (#7018) 2024-09-04 09:12:51 -05:00
Ryan Blue
86f1bfd710 [wpilibc] Make SPI methods non-virtual (#7019) 2024-09-04 09:12:06 -05:00
Thad House
0b0c7c88ee [build] cmake: Add 4324 to ignored MSVC warnings (#7028)
4324 is issued at /W4 if alignas forces padding. Makes it impossible to use SmallVector from something compiled in /W4. Add it to the warning exclusion list.
2024-09-03 14:31:38 -05:00
Jade
495c371ce7 [glass] NetworkTables provider: Add immediate flag to listener (#7013) 2024-08-31 09:44:52 -07:00
Ryan Blue
9d6bee1d1e [build] cmake: Add meta target for examples and example tests (#7015)
Also prefix example test targets with Example_ to make running tests easier
2024-08-29 14:03:41 -07:00
Ryan Blue
5f7b2aefb1 [ci] Check and free disk space on macos (#7014) 2024-08-29 06:30:17 -07:00
Ryan Blue
dc18f71004 [wpilibc] Refactor AnalogTrigger to use shared_ptr (#7010) 2024-08-28 21:34:28 -07:00
Ryan Blue
c9ad26b723 [hal] Remove incorrect parameter directions on a few functions (NFC) (#7011) 2024-08-28 06:30:39 -07:00
Ryan Blue
9f3da8de1b [hal] Correct warning suppression and note in SimDataValue.h (#7009) 2024-08-27 17:07:46 -07:00
Ryan Blue
9aef00340a [build] cmake: Put protobuf symbol export files in per-config directories (#6997) 2024-08-27 17:06:16 -07:00
Gold856
9c35aa6bbf [build] Remove redundant _M_ prefix from artifact file name (#6983) 2024-08-27 17:05:29 -07:00
David Vo
0352a60f38 Override getMessage in Exceptions instead of toString (#7002)
Fixes https://errorprone.info/bugpattern/OverrideThrowableToString
2024-08-26 17:32:32 -07:00
Gold856
1daff9193c [wpilibc] Add missing deprecated HID sim methods (#7005) 2024-08-26 17:32:09 -07:00
David Vo
dbeab8bdd7 Read text input streams as UTF-8 in Java (#6999)
Fixes https://errorprone.info/bugpattern/DefaultCharset for InputStreamReader instances.
2024-08-24 09:05:00 -07:00
Ryan Blue
1fd1dc31b7 [upstream_utils] Clean up and enable foonathan memory docs (#6990)
Group memory doxygen into one module.

Remove concept alias and add doxygen definitions for foonathan memory.

\concept was added as a doxygen command in 1.9.2 and is meant to be applied to concepts. Inserting them into standard comment paragraphs causes doxygen to interpret the following text as a concept name and add it to the documentation, as well as remove the text from the paragraph.
In the upstream repo, this alias links to markdown documentation, so it's not usable for us anyways.

That, plus adding the doxygen definitions/aliases from upstream cleans up most of the errors/weird output from doxygen for foonathan memory.
2024-08-24 06:54:32 -07:00
Ryan Blue
370e63ede6 [upstream_utils] Use os path separator when matching path (#6993) 2024-08-24 06:52:52 -07:00
Tyler Veness
96bd1e489f [wpilibj] Suppress JDK 21 this-escape warning (#6996) 2024-08-24 06:52:04 -07:00
Ryan Blue
ed86f0b6fe [build] Set CMAKE_BUILD_TYPE correctly (#6998)
It has to be set before project otherwise cmake defines it for you.
2024-08-24 06:51:22 -07:00
Ryan Blue
9eb8400f6c [upstream_utils] Revert “Upgrade apriltag to latest master (#6995)" (#7000)
This reverts commit ba200df8be.
2024-08-24 06:50:32 -07:00
David Vo
88fc46da22 Call reachabilityFence inside finally blocks (#7001) 2024-08-24 06:49:46 -07:00
David Vo
36ff22a439 [cscore, wpilibj] Use pattern matching in equals overrides (#7003)
Fixes https://errorprone.info/bugpattern/EqualsGetClass
2024-08-24 06:48:20 -07:00
Jonah
173ffca14a [wpilib] Add persistent alerts API (#6735) 2024-08-23 07:05:53 -07:00
Ryan Blue
ba200df8be [upstream_utils] Upgrade apriltag to latest master (#6995) 2024-08-23 07:04:29 -07:00
Ryan Blue
cf691f744f [glass] Use type string constant in NTStringChooser (#6992) 2024-08-22 23:36:07 -07:00
sciencewhiz
7a2604b299 [wpiutil] Update WPILib Logo (#6987) 2024-08-22 08:51:06 -07:00
Thad House
b76ccc3ab5 [build] cmake: Include our own copy of protobuf_generate to use with plugin (#6989)
The hacks we needed to do to get the existing commands required cmake 3.28. We didn't want that, so just make a local slimmed down copy of the function just for our use. Even better, its much simpler in what it does, no weird hacks.
2024-08-22 08:50:29 -07:00
Ryan Blue
88ea473c94 [wpilibc] AddressableLED: add move constructor/assignment operator (#6985) 2024-08-22 08:48:19 -07:00
Ryan Blue
c640fdc9a4 [docs] Update doxygen and add back sidebar-only theme (#6986)
Update doxygen gradle plugin, use template Doxyfile.
2024-08-22 08:43:10 -07:00
Jade
147e03ddd8 [build] CMake: Add CMakePresets.json for some common WPILib build settings (#6974) 2024-08-21 07:56:28 -07:00
Jade
a9ce3290b5 Fix Doxygen warnings for C++ code (#6608) 2024-08-21 07:55:03 -07:00
Thad House
a9ac5b8e24 Don't read protobuf static data across shared library lines directly (#6979)
Reading exported data from shared objects on windows is broken. It requires __declspec(dllimport). However, this is problematic, as we use the same static libraries both from a shared and static context. So we can't just blindly apply dllimport.

The linker should have caught this, as data members are exported in a different way. However, due to a bug in native-utils, data member symbols were exposed directly. However, interacting with those data member was completely broken.

The only way we can really solve this is to just not use static data members. We're pretty good about this in WPILib itself. However, protobuf is absolutely terrible at this. There are a ton of inline functions that access global data. For the protobuf library itself, we can solve this easily enough.

However, for the generated protobuf code, this is much more problematic. The member needed to bypass the global data is private. This means using just the stock protobuf code, this problem is not solvable. But, protobuf generated code has insertion points. Those insertion points let us add our own code into the generated code via a protoc plugin. And it just so happens that an insertion point exists to add extra public methodsto the generated protobuf header. There is also an insertion point to let us add to the cpp file.

The methods we need are the getters, for unpacking protobufs. For any protobuf that has a message as a member, we generate a new wpi_x() getter (the existing one is just x(), where x is the field name). We then implement this in the cpp file. A trick we can use is in the cpp file, we can safely call the x() function, as the cpp file is in the same library as the global. Thus we can call that inline method, and not actually need to directly access any internal private state of the protobuf object.

TL;DR, all protobuf classes that have messages as fields now have a wpi_x() accessor that must be used instead of x() if you want the code to work on windows. After wpilibsuite/native-utils#212, the bad code will fail to link, rather then just fail at runtime.
2024-08-21 07:53:20 -07:00
Jade
eef516fcc9 [wpimath] Fix pose estimator ResetRotation() in C++ (#6984) 2024-08-21 07:51:21 -07:00
sciencewhiz
f0c3610465 Fix various typos (#6980)
Found with misspell
2024-08-19 16:26:36 -07:00
sciencewhiz
8e52da330e [dlt] Update DataLogTool doc link (#6981) 2024-08-19 09:24:00 -07:00
sciencewhiz
32c4e56897 [docs] Downgrade Doxygen to 1.10.0 and update theme (#6978)
Fixes mobile
Requires re-excluding memory for search
Set new doxygen options required by doxygen-awesome theme
2024-08-19 08:14:04 -07:00
Jade
a325898311 [build] CMake: set CMAKE_EXPORT_COMPILE_COMMANDS to ON (#6973) 2024-08-17 20:58:14 -07:00
Gold856
b12b83aa89 Fix typos with cspell (#6972) 2024-08-17 07:44:34 -07:00
Gold856
780b1e0391 [build] CMake: disable Java components by default (#6975) 2024-08-16 06:46:14 -07:00
Gold856
dc25c13051 [build] CMake: remove redundant logic (#6971) 2024-08-15 21:36:45 -07:00
Gold856
0c58426f4c [sim] Add SendableChooserSim (#6763)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2024-08-15 15:00:10 -07:00
sciencewhiz
477907e4cc [docs] Update to Doxygen 1.12.0 (#6970)
Fixes search when building with foonathan/memory
2024-08-15 14:58:53 -07:00
Tyler Veness
4d7c9edab3 [ci] Upgrade to wpiformat 2024.40 (#6969) 2024-08-15 09:09:13 -07:00
sciencewhiz
063409518e [docs] Delete param doc for func that lacks param (NFC) (#6964) 2024-08-15 07:46:01 -07:00
Jade
14af894711 [gitignore] Add testing files from ctest (#6966) 2024-08-15 07:45:39 -07:00
Tyler Veness
050eafd802 [upstream_utils] Shorten file copy command (#6965)
The new upstream_utils command-line API has been nice, but the
copy-upstream-to-thirdparty command has been annoying to type. Since it
already has documentation, we can shorten it to make it easier to
remember and type.
2024-08-15 07:44:50 -07:00
Tyler Veness
44311671f8 [upstream_utils] Use git to get repo root (#6967) 2024-08-15 07:44:22 -07:00
sciencewhiz
d3421a7c89 [build] Publish source and headers of all generated files (#6963)
Fixes #6962
Don't specially include ntcore generated files from build directory in doxygen, as they are now pregenerated in source
2024-08-14 14:26:38 -07:00
Gold856
112f536716 [epilogue] Remove dependency on Google AutoService (#6955)
This makes potential future compilation with CMake easier and reduces the amount of external code we depend on.
2024-08-14 10:44:50 -07:00
Tyler Veness
8e0d9ac805 Clean up unit UDL usage (#6961) 2024-08-14 10:44:00 -07:00
Jade
70fa41c69e [epilogue] Allow configuring logging period and logging period offset (#6893) 2024-08-14 09:26:48 -07:00
Jade
dece2391f5 [readme] Add note about building with Ninja in README-CMAKE (#6960) 2024-08-14 09:24:50 -07:00
Gold856
a2060feadc [commands] Fix and deprecate TrapezoidProfileCommand (#6722) 2024-08-13 21:01:17 -07:00
Ryan Blue
55c1c5396d [wpimath] Remove deprecated MatBuilder constructor (#6956) 2024-08-13 20:59:59 -07:00
Ryan Blue
e21e129f12 [wpimath, commands] Fix RamseteController deprecation year (#6953) 2024-08-13 16:55:26 -07:00
Gold856
05e955f87e [wpilib] Deprecate Resource (#6952) 2024-08-12 15:26:11 -07:00
Jade
b057044876 Remove ni-libraries from 3rd party licenses (#6902)
Its not in source anymore.
2024-08-11 15:59:03 -07:00
Gold856
2892733e33 [apriltag] Try loading debug OpenCV if release version fails (#6949) 2024-08-11 13:19:31 -07:00
Gold856
8e2cc51f95 [cscore] Try loading debug OpenCV if release version fails (#6928)
On some Linux systems, installing the OpenCV package will actually install a debug version with a d postfix. Try loading that version if the first load attempt failed.
2024-08-11 08:55:36 -07:00
Tyler Veness
e2143c4b5a [rtns] Fix namespace of DeploySession and SshSession (#6925) 2024-08-10 23:39:35 -07:00
Gold856
6b0aeb8e90 [build] CMake: consolidate and clean up include dirs (#6927)
Also remove the thirdparty AprilTag source directory from both CMake and Gradle header setup.
2024-08-10 23:39:17 -07:00
sciencewhiz
dc2112ba43 [wpiutil] Restore and deprecate RuntimeDetector (#6930) 2024-08-10 23:35:04 -07:00
Ryan Blue
008ebbfb77 [docs] Exclude clang-format and clang-tidy from doxygen (#6932) 2024-08-10 23:32:39 -07:00
Tyler Veness
830049b083 [upstream_utils] Upgrade to fmtlib 11.0.2 (#6933) 2024-08-10 23:31:49 -07:00
Ryan Blue
ceaac96ac8 [rtns] Fix crash when ssh error occurs during refresh (#6936) 2024-08-10 23:31:01 -07:00
Ryan Blue
dd99ff420c [wpilib, hal] DigitalGlitchFilter: Fix sim crash and clean up construction (#6937)
Fixes error when >3 are constructed- in java, m_filterAllocated[index] would be evaluated before the bounds check and throw IndexOutOfBounds, in c++ a vague assertion error would be thrown.

Makes DoAdd static in c++

Makes the error message when HAL_SetFilterSelect fails consistent with java
2024-08-10 23:30:02 -07:00
Ryan Blue
c13c512221 [build] Spotless: ignore test json files (#6938) 2024-08-10 23:27:47 -07:00
Ryan Blue
0a15049faa [wpilib] Deprecate setNetworkTablesFlushEnabled (#6940)
The function no longer flushes to network like it did originally, and users generally would not want to disable flushing locally.
2024-08-10 23:27:09 -07:00
Ryan Blue
d4dd2f8028 [hal] Counter/Encoder: use std::numeric_limits::infinity (#6941) 2024-08-10 23:26:07 -07:00
Ryan Blue
19b478a33b [hal] Expose more FPGA functionality (#6942)
- function to reset user rail fault counters
- function to get comms disable count
- correct docs for user rail count functions
2024-08-10 23:25:02 -07:00
Ryan Blue
59dc29e701 [units] Add default case for UNIT_ADD_IO (#6944) 2024-08-10 23:23:25 -07:00
Tyler Veness
79dfdb9dc5 [upstream_utils] Upgrade Sleipnir to support Eigen type specializations (#6924) 2024-08-04 06:26:05 -07:00
Tyler Veness
712db6711a [upstream_utils] Upgrade Eigen to fix warning suppression upstream (#6923) 2024-08-03 22:17:17 -07:00
David Vo
ed37bd5ab1 [wpiutil] Fix mismatching param names in DataLogJNI (NFC) (#6922) 2024-08-03 11:59:09 -07:00
Ryan Blue
5a6dd02ce9 [examples] Replace usages of SIMULATION macro with constexpr if (#6899) 2024-08-03 08:14:17 -07:00
Thad House
1a0efcf948 [wpiutil] Remove SetDllDirectory support in CombinedRuntimeLoader (#6914)
With the changes to all the windows DLLs for library load path, this functionality is no longer necessary.
2024-08-03 08:13:36 -07:00
Ryan Blue
7938d79648 [hal, wpilib] Expose sticky hardware and firmware faults in PDH and PH (#6900) 2024-08-02 19:13:43 -07:00
Ryan Blue
01c47e5bcc [wpilibc] Fix default properties for DS NT publisher (#6909) 2024-08-02 19:07:31 -07:00
Ryan Blue
ecfd3861e8 [hal] Fix Java sim timing on Windows (#6910)
Also set power throttling options correctly.
2024-08-02 18:56:58 -07:00
Tyler Veness
5ff68079e2 [wpimath] Make SplineParameterizer constants inline (#6920) 2024-08-02 18:47:27 -07:00
Thad House
9234590703 [build] Fix deprecation warning in wpilibjExamples (#6912) 2024-08-02 18:39:25 -07:00
Thad House
3e10f23cf3 [gitignore] Ignore .bck files it git (#6913) 2024-08-02 18:38:46 -07:00
Peter Johnson
caf424e09c [hal] Windows sim: enable High QOS and honor timer resolution requests (#6908)
By default on Windows 11, power throttling will increase timer resolution
if a window is occluded.  Disable that behavior.  Also enable high QOS to
achieve maximum performance and turn off power saving.

Also use internal APIs to set timer precision to 500 us if available.
2024-08-01 19:51:02 -07:00
Tyler Veness
685c732568 [wpimath] Make trajectory constraints use Rectangle2d and Ellipse2d (#6901) 2024-08-01 16:46:23 -07:00
Ryan Blue
ddd64aa70c [docs] Add documentation for various HAL/wpilib items (NFC) (#6898) 2024-08-01 16:45:20 -07:00
Ryan Blue
244be83d5d [ci] Disable check run and comments for robotbuilder CI (#6890)
It won't add them to PRs anyway because it doesn't have permissions, but the check run gets added to a random workflow in non-PR builds.
2024-08-01 16:44:16 -07:00
Gold856
1ccc4354b0 [build] Remove invalid MSVC warning suppression (#6907)
2220 is not a valid warning
2024-08-01 16:43:35 -07:00
Gold856
7adf048e83 [wpilib] Remove outdated note about axis conventions (#6905) 2024-08-01 16:42:10 -07:00
Gold856
2fc55b86a2 [wpimath] Fix API docs for DCMotorSim and LinearSystemId (#6904) 2024-08-01 16:41:57 -07:00
sciencewhiz
ad45dc89ef [ci] Uniquely name Robot Builder test results (#6895) 2024-07-30 07:39:07 -07:00
Ryan Blue
8c06ef64cb [hal] Fix potential race in CANAPI (#6819) 2024-07-29 08:00:39 -07:00
Ryan Blue
0e9c514ebf [hal, wpilib] Fix REV PH disabled solenoid list (#6887) 2024-07-29 07:59:49 -07:00
Gold856
3c2bdafd57 [wpilib, commands] Cache controller BooleanEvents/Triggers and directly construct Triggers (#6738)
This has been a common footgun for teams, due to calling the factory functions in periodic loops.
2024-07-29 07:58:23 -07:00
Joseph Eng
073192d513 [wpimath] Add remaining struct and protobuf implementations (#5953) 2024-07-29 07:55:44 -07:00
Gold856
3e1e3fb4ca [ci] Fix comment commands (#6889) 2024-07-29 07:54:17 -07:00
sciencewhiz
7093facced [examples] Correct comment about renaming Robot class (NFC) (#6892) 2024-07-29 07:52:40 -07:00
Gold856
24dd544825 [wpilib] Wait 0.5s after enabling interrupt in tests (#6891)
If the interrupt edge tests are running while under heavy CPU load (like building wpilib) they are prone to failure since the interrupt thread doesn't have enough time to set up callbacks. The interrupt edge tests now copy the original AsynchronousInterrupt test, which has a 0.5s delay after the interrupt is enabled. Running the new interrupt tests while building allwpilib causes far less failures than the old tests.
2024-07-29 07:51:25 -07:00
Gold856
6f6e8ee931 [ci] Bump wpiformat to 2024.39 (#6894) 2024-07-29 07:50:46 -07:00
Ryan Blue
4226d113f1 [hal] Update PCM/PH HAL bitmap function docs (NFC) (#6885) 2024-07-28 17:10:46 -07:00
Ryan Blue
96de39ac6a [gitignore] Add ntcore test persistent files to gitignore (#6886) 2024-07-28 17:09:46 -07:00
Dean Brettle
7aa100589d [wpilib] Fix sim javadocs to not say GC will cancel callbacks (#6665)
That behavior has not been present since PR #4158 was merged more than 2 years ago and imo should not be added back because it was surprising and not consistent with the most common use case of registering a callback permanently.
2024-07-28 14:30:19 -07:00
Ryan Blue
ea7c935bcb [wpilib] Improve bitmap function documentation in PneumaticsBase (NFC) (#6884) 2024-07-28 14:28:42 -07:00
Ryan Blue
143876dfa3 [hal] Add missing HAL CAN javadocs (NFC) (#6882) 2024-07-28 14:27:55 -07:00
Gold856
f142cec97b [ci] Fix /pregen (#6875)
It checked out the main branch instead of the PR branch. Now it checks out the PR branch.
2024-07-28 10:50:24 -07:00
Joseph Eng
158fb23072 [wpiutil] Struct: Change from GetTypeString() to GetTypeName() (#6872)
This makes it easier to define schemas when the type name is non-trivial (e.g., templated structs).

This is breaking for a) custom struct implementations and b) anything calling `wpi::Struct<T>::GetTypeString(info...)` in C++ directly. In both cases, it's a simple translation: For A, rename `GetTypeString()` to `GetTypeName()` and remove the struct: at the beginning, and for B, use `wpi::GetStructTypeString<T>(info...)` instead.
2024-07-27 20:23:45 -07:00
Jade
5dcaa6d671 [wpilibc] Add FRC_ReportWarning (#6681) 2024-07-27 20:20:08 -07:00
Gold856
aba82e6a6c [build] CMake: export fieldImages and install headers (#6876) 2024-07-27 20:16:34 -07:00
Wispy
02bf9a164e [docs] Document the /pregen command (#6874) 2024-07-27 16:30:57 -07:00
Ryan Blue
81ec66f05b [hal] Remove dangling periodic packet function from sim CANAPI (NFC) (#6879)
Removed from API in #1868, sim definition was left dangling.

Also adds extern "C" to the sim file.
2024-07-27 16:30:18 -07:00
Wispy
5a1417aeb9 [commands] Add Trigger.onChange() test (#6849) 2024-07-27 16:29:22 -07:00
Joseph Eng
e83a432731 [wpimath] Fix C++ feedforward constructors and add tests (#6873) 2024-07-27 16:28:59 -07:00
Gold856
03b332d3cf [gitignore] Add CMakeUserPresets.json to gitignore (#6877) 2024-07-27 16:28:40 -07:00
Ryan Blue
ed23b2889d [hal] Remove CANDeviceInterface (#6880) 2024-07-27 16:28:08 -07:00
Ryan Blue
784f0a033a [docs] Cleanup HAL CAN docs (NFC) (#6881) 2024-07-27 16:26:01 -07:00
Joseph Eng
cd39c5e2a1 [upstream_utils] Determine patch list from patch files (#6869) 2024-07-23 15:58:15 -07:00
Gold856
aa44b2fd1e [build] Don't build imgui for Athena (#6871) 2024-07-23 07:29:18 -07:00
Gold856
e3a5299552 [build] Always statically build Glass libraries (#6867)
Also don’t rename libglass on Windows to avoid PDB name collision.
2024-07-22 08:03:19 -07:00
Peter Johnson
4c7fe73f69 [wpiutil] DataLog: Add last value and change detection (#6674)
Update() checks/updates the last value and appends only if changed.
GetLastValue() gets the last value.

Also add OutputStream support to Java DataLogWriter.
2024-07-21 13:08:15 -07:00
Tyler Veness
57205c8d15 [upstream_utils] Disable glfw docs build by default (#6863)
Fixes #6862.
2024-07-21 07:15:22 -07:00
Brendan Raykoff
45f3e3a069 [wpimath] Add getAccumulatedError() to PIDController (#6813) 2024-07-20 23:17:13 -07:00
Jade
eda63dc162 [upstream_utils] Add AprilTag library (#6816)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-07-20 22:12:49 -07:00
PJ Reiniger
6922b9dd5e [upstream_utils] Add imgui and friends (#6822) 2024-07-20 22:11:54 -07:00
Peter Johnson
8548d83b03 [hal] SimDevice: Don't hold lock during callbacks (#6855)
This can cause lock inversions with other code (in particular with
the simulation WebSockets interface).
2024-07-20 22:09:09 -07:00
Joseph Eng
b4d42d8980 [wpimath] Make public final values in feedforwards private and add getters (#6851) 2024-07-20 07:01:56 -07:00
Tyler Veness
d827c84c5e [upstream_utils] Clean up package imports (#6857) 2024-07-20 07:01:06 -07:00
Tyler Veness
6ec8763eac [upstream_utils] Make .c file rename toggleable (#6858) 2024-07-20 07:00:13 -07:00
Tyler Veness
e9efb05cd3 [wpilibj] Fix this-escape warnings from JDK 21 (#6856) 2024-07-18 22:43:55 -07:00
PJ Reiniger
f561a77e75 [upstream_utils] Add googletest (#6820) 2024-07-18 21:10:26 -07:00
Gold856
289d45b081 [wpilib] Refactor and clean up ADIS IMU classes (#6719) 2024-07-18 21:09:11 -07:00
Christopher Mahoney
45823abe86 [wpilib] Synchronize C++ and Java versions of BooleanEvent (#6776) 2024-07-18 21:08:28 -07:00
Gold856
8d857cdb78 [apriltag] Improve AprilTagDetector default config (#6847) 2024-07-18 21:06:37 -07:00
Joseph Eng
602325d608 [wpilibc] Add missing includes to LEDPattern.cpp (#6852) 2024-07-18 21:05:45 -07:00
Gold856
e30440e2af .gitattributes: Mark more files as text with LF line endings (#6853) 2024-07-18 21:05:18 -07:00
Jade
19a5e0c49a Add factory path to .gitignore (#6850) 2024-07-18 11:55:17 -07:00
Jade
7663211819 [wpilib] Implement Sendable for HID classes (#6782) 2024-07-18 07:10:07 -07:00
Gold856
34b8b7a409 [wpilib] Increase time between interrupt operations (#6848) 2024-07-17 18:15:37 -07:00
Tyler Veness
15001afb31 [wpilib] Fix repeat TimedRobot callbacks on loop overrun (#4101)
If one of the *Init() functions takes several multiples of the nominal
loop time, the callbacks after that will run, then increment their
expiration time by the nominal loop time. Since the new expiration time
is still in the past, this will cause the callback to get repeatedly run
in quick succession until its expiration time catches up with the
current time.

This change keeps incrementing the expiration time until it's in the
future, which will avoid repeated runs. This doesn't delay other
callbacks, so they'll get a chance to run once before their expiration
times are corrected.

The other option is correcting all the expiration times at once, which
would starve the other callbacks even longer so that the callback
scheduling returns to a regular cadence sooner. The problem with this
approach is if a previous callback overruns the start of the next
callback, the next callback could potentially never get a chance to run.
2024-07-16 22:56:36 -07:00
Jade
57fa388724 [examples] Prepare for RobotInit deprecation by updating examples (#6623)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-07-16 20:22:39 -07:00
Tyler Veness
f62a055608 [epilogue] Add missing docs (#6844) 2024-07-16 20:20:22 -07:00
Gold856
e5b7cf4c76 [hal] Fix interrupt edges being flipped in sim (#6720) 2024-07-16 17:26:35 -07:00
Sam Carlberg
59256f0e00 [epilogue] Add an annotation-based logging framework for Java programs (#6584) 2024-07-16 17:25:43 -07:00
Nicholas Armstrong
30c7632ab8 [wpimath] Make SimpleMotorFeedforward only support discrete feedforward (#6647)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-07-16 17:23:11 -07:00
Joseph Eng
5f261a88af [upstream_utils] Rework upstream_utils scripts (#6829) 2024-07-16 17:20:07 -07:00
Matt
f9d32ad706 [wpiutil] Struct: Remove explicit span length from int8 (#6840) 2024-07-16 13:40:36 -07:00
Tyler Veness
8f60dc736d [wpimath] Fix build by removing a bad #include (#6843)
WheelPositions.h was removed in #6771.
2024-07-16 13:40:06 -07:00
Christopher Mahoney
6c0429c263 [wpimath] Remove WheelPositions interface/concept (#6771) 2024-07-16 12:39:24 -07:00
Wispy
7d64d4e24c [sim] Add GUI support for the REV PH (#6704) 2024-07-15 17:28:05 -07:00
Gold856
cd6b70af0e [docs] Add documentation for simulation extensions (#6729) 2024-07-15 17:26:25 -07:00
Joseph Eng
7b7d17ccd7 [wpimath] Add and use kinematics.copyInto() (#6789) 2024-07-15 17:19:31 -07:00
Ryan Blue
636450ab7b [build] Disable std::mutex constexpr constructor on Windows (#6791)
We will plan to re-enable this after we release an installer with an updated runtime.
2024-07-15 17:19:07 -07:00
Gold856
9703142ebe [build] CMake: simplify source JAR creation and install (#6831)
Bump required minimum CMake version to 3.21.
2024-07-15 15:12:41 -07:00
sciencewhiz
fc57f6a560 [ci] Filter python commands comment only for Java sources (#6832)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2024-07-15 14:51:10 -07:00
Tyler Veness
912d9b2201 [upstream_utils] Fix LLVM's AlignedCharArrayUnion for C++23 (#6830)
C++23 deprecated std::aligned_union_t.
2024-07-15 14:50:19 -07:00
Tyler Veness
5825bf46d8 [upstream_utils] Suppress has_denorm deprecation in Eigen (#6833)
MSVC doesn't yet claim C++23 compliance for c++latest, so we have to be
less specific in the preprocessor check.
2024-07-15 14:41:40 -07:00
Jade
6b9d41182f [sim] Fix WS sending 1 and 0 instead of booleans (#6836) 2024-07-15 10:17:35 -07:00
Tyler Veness
fc44737a49 [commands] Suppress this-escape warnings (#6828) 2024-07-13 06:52:30 -07:00
Tyler Veness
deb5f3d7af [wpimath] Exit early when parameterizing malformed spline (#6827)
Currently, a max iteration heuristic is used to determine when a spline
is malformed. Instead, we can report a failure immediately if dx and dy
are too small, because the heading won't be accurate either.

Fixes #6826.
2024-07-12 21:52:28 -07:00
Gold856
e00bb2f07b [build] CMake: add some compiler flags from native-utils (#6825) 2024-07-12 21:51:55 -07:00
Jade
19c28c2a76 [commands] Make requirements private (#6769) 2024-07-12 07:51:21 -06:00
Jade
967105568c [commands] Update requirements consistently (#6304) 2024-07-11 16:01:54 -06:00
Gold856
bf75c03218 [build] Clean up CMake files (#6802)
Explicitly list required components when using FindJava and FindJNI
Consolidate find_package calls for Java, JNI, and OpenCV into the root CMakeLists.txt file
Remove references to main_lib_dest
Install missing generated headers
Flatten some if statements
Use LinkMacOSGUI macro instead of hand rolling it
Stop installing OpenCV libraries and an extra ntcorejni library; OpenCV JAR will still be installed to make it easy to use
Only print platform version on Windows
Prevent GUI modules from being built when wpimath is off, which would otherwise cause a build failure
Simplify build configuration checks
Clean up fieldImages JAR creation
Place built JARs in the same subdir as installed JARs
Remove unnecessary JAR includes
Remove extra directories in target_include_directories
Improve CMake docs
2024-07-11 16:01:05 -06:00
Tyler Veness
27a2e02b52 [upstream_utils] Upgrade Sleipnir to avoid pool allocator crash on Windows (#6821) 2024-07-10 07:39:30 -06:00
Jade
c62863cf74 [build] Fix CMake build for wpilibNewCommands (#6815) 2024-07-09 10:25:31 -06:00
Jade
cc02a948a0 [wpimath] Add Reset methods to PoseEstimator (#6751) 2024-07-08 18:26:08 -07:00
Jade
dc276b651b [wpimath] Add reset methods to Odometry (#6702) 2024-07-08 18:25:42 -07:00
Tyler Veness
7f6ba54b68 [wpimath] Report error when x and y components of Rotation2d are both zero (#6767)
Fixes #6766.
2024-07-08 12:23:36 -06:00
Joseph Eng
3d22eeca9d [wpiutil] Remove Protobuf.getNested() (#6812)
It was superseded by using FileDescriptor.getDependencies().
2024-07-08 07:59:05 -06:00
Tyler Veness
6478ba6e3f [upstream_utils] Upgrade Sleipnir to fix unused parameter warnings (#6803) 2024-07-07 06:43:44 -07:00
Tyler Veness
32ed9c5f0b [upstream_utils] Upgrade to fmt 11.0.1 (#6804) 2024-07-07 06:40:15 -07:00
Tyler Veness
0954ded60a [upstream_utils] Upgrade to libuv 1.48.0 (#6806) 2024-07-07 06:39:56 -07:00
Tyler Veness
1f92c59e20 [upstream_utils] Upgrade to GCEM 1.18.0 (#6805) 2024-07-07 06:39:11 -07:00
Tyler Veness
450fae3909 [upstream_utils] Upgrade to json 3.11.3 (#6807) 2024-07-07 06:38:56 -07:00
Thad House
1c42c1c920 [wpimath] Add a base JNI class for WPIMath (#6793)
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2024-07-07 06:38:05 -07:00
Gold856
537976c426 [build] CMake: remove external HAL option (#6797) 2024-07-05 17:49:31 -07:00
Jade
f0f4bac680 [commands] Add setRumble and isConnected to CommandGenericHID (#6768) 2024-07-05 17:47:31 -07:00
Jade
b4645a30f6 [ci] Add /pregen to pregenerate files (#6786) 2024-07-05 17:43:50 -07:00
sciencewhiz
ba210fb560 [ci] Add dispatch to tag RobotBuilder (#6794) 2024-07-05 17:43:06 -07:00
Gold856
3b6f38d7de [build] Drop jinjava as a Gradle dependency (#6801) 2024-07-03 10:18:06 -07:00
Tyler Veness
19ea73ef69 [upstream_utils] Upgrade to fmtlib 11.0.0 (#6796) 2024-07-02 13:34:59 -07:00
Ryan Blue
6a5448322b [wpilib] Add metadata to all dashboard ".type" entries (#6799) 2024-07-02 13:31:50 -07:00
beardedone55
7366a03fc9 [xrp] Add Support for Encoder Period on XRP (#6795)
The XRP firmware has been updated to provide the
encoder period along with the encoder count.

This change allows WPILIB to use the encoder period
data from the XRP so that the GetRate function can
be used to determine the motor speed.
2024-07-02 13:29:52 -07:00
Chris Padwick
1ccd8d14f0 [build] cmake: Add check for protobuf compiler (#6792) 2024-06-30 20:25:10 -07:00
sciencewhiz
a2beb7510b [ci] Add dispatch to tag PathWeaver and Shuffleboard (#6788) 2024-06-29 13:58:09 -07:00
sciencewhiz
88658fb30b [ci] Patch tools builds to only use local artifacts (#6787) 2024-06-29 12:30:21 -07:00
Gold856
c3c1671cf7 [build] CMake: Fix find_package(wpilib) calls when some libraries are missing (#6784) 2024-06-29 06:55:04 -07:00
Jade
8ba9a55759 [commands] Remove deprecated C++ method TransferOwnership (#6780) 2024-06-29 05:37:29 -07:00
sciencewhiz
8e97587765 [ci] Update tools build year to 2025 (#6783)
Fixes robotbuilder build that failed after 2025 alpha tag
2024-06-28 20:16:48 -07:00
Jade
047eaac11e [wpinet] Remove non GP language (#6774) 2024-06-28 20:14:26 -07:00
Joseph Eng
512a4bfc12 [wpimath] Simplify pose estimator (#6705) 2024-06-28 20:12:12 -07:00
Ryan Blue
5e745bc5ef [ci] Add spotless diff to summary and artifacts (#6779) 2024-06-28 06:29:21 -07:00
Gold856
5ce72d43e4 [build] Fix CMake protobuf dependency handling (#6772)
Reverts #6609 since that fix didn't Just Work(tm) on Windows. (edit: or Ubuntu. Seems to have broken everything except macOS.) This PR configures CMake to try and find protobuf-config.cmake first, which allows protobuf to pull in abseil for us. If protobuf-config.cmake is not available (coprocessors which don't have a new enough protobuf installed are a common case), it will fallback to CMake's built-in FindProtobuf module, which is what we were using before.

Add wpi::CreateMessage, a wrapper with an ifdef to switch between Arena::CreateMessage and Arena::Create, since the former is deprecated in newer versions of protobuf. This allows forward compatibility with newer versions of protobuf.
2024-06-28 06:28:39 -07:00
Tyler Veness
a7173dbd3c [apriltag] Fix GCC 14 calloc() warning (#6773) 2024-06-23 20:24:45 -07:00
Tyler Veness
2ff7033edf [upstream_utils] Update to LLVM 18.1.8 (#6764) 2024-06-21 23:21:39 -07:00
Wispy
ca92ef89d3 [sim] Don't send joystick data during auto (#6732)
Testing on a Rio showed that the joystick inputs are not zeroed, they just don't update.
2024-06-21 20:56:23 -07:00
Tyler Veness
b8c2571638 [wpimath] Fix precondition violation messages in LQR and Kalman filters (#6731) 2024-06-21 20:55:01 -07:00
Tyler Veness
d2b1aa1869 [sysid] Remove CTRE v5 CANCoder preset (#6753)
Fixes #6466.
2024-06-21 20:54:29 -07:00
Gold856
76a3a60712 [ci] Bump actions versions to Node 20 (#6758)
Bump webfactory/ssh-agent to 0.9.0 (Node 20)
Switch to gradle/actions/wrapper-validation (Node 20)
Bump mozilla-actions/sccache-action to 0.0.5 (Node 20 for sanitizers only)
Bump actions/github-script to 7 (Node 20 for documentation only)
Bump wpilibsuite/import-signing-certificate to 2 (Node 20)
Bump JamesIves/github-pages-deploy-action to 4.6.1 (Node 20)
2024-06-21 20:53:51 -07:00
sciencewhiz
f5df6f88c8 [ci] Add dispatch actions task to ping tools on tag (#6755)
Allows automation of tagging of tools on allwpilib tag
Adapted from robotpy
2024-06-21 17:15:42 -07:00
Gold856
7f5970b27a [ci] Remove unused steps/package installs (#6756)
Removed steps/packages were used for protobuf/generated files
2024-06-21 11:15:42 -07:00
Tyler Veness
25865759f4 [upstream_utils] Upgrade Sleipnir and use wpi::SmallVector (#6748) 2024-06-21 11:14:19 -07:00
Tyler Veness
e2893fc1a3 [upstream_utils] Add wpi::SmallVector erase_if() (#6752) 2024-06-18 14:03:43 -06:00
PJ Reiniger
b6bd798f9e [wpilib] Pregenerate PWM motor controllers (#6742)
Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
2024-06-18 08:43:08 -06:00
PJ Reiniger
66c0abb732 [build] Use pathlib in pre-generation scripts (#6745) 2024-06-18 08:40:37 -06:00
Brendan Raykoff
e884221a8d [wpilib] Propagate PWMMotorController stopMotor() and disable() to followers (#6750) 2024-06-18 07:40:32 -06:00
Gold856
3a0ee5c9a7 [build] cmake: Improve OpenCV file search (#6747) 2024-06-16 17:08:48 -07:00
Ryan Blue
bb8480c690 [wpilib] Include sendable type information in topic metadata (#6741) 2024-06-14 08:12:18 -06:00
Ryan Blue
d3aa7f85dd [ci] Revert disable std::mutex constexpr constructor on Windows (#6736) 2024-06-12 14:45:59 -06:00
Gold856
3d6b710293 [wpiutil] DataLog: Don't constantly retry log creation when low on space (#6730) 2024-06-10 20:22:50 -06:00
Gold856
ae6954c78f [wpiunits] Clarify return conditions for isEquivalent (NFC) (#6727) 2024-06-09 17:54:31 -06:00
Tyler Veness
a087544933 [upstream_utils] Disable spurious maybe-uninitialized warning from GCC 14 (#6728) 2024-06-09 17:53:38 -06:00
Gold856
b9935c9885 [ci] Fix robotpy PR commenting (#6723) 2024-06-09 06:37:30 -07:00
Ryan Blue
3617a95260 [ci] Disable std::mutex constexpr constructor on Windows (#6725)
Fixes cmake builds, works around issue with windows runners.

Revert when GitHub runner images are fixed.
2024-06-09 06:36:29 -07:00
Gold856
b0cc84a9c7 [build] Upgrade to PMD 7.2.0 (#6718) 2024-06-08 22:08:23 -07:00
Gold856
e2dcbd016d [wpimath] Remove deprecated TrapezoidProfile method in C++ header (#6721) 2024-06-08 22:05:17 -07:00
Tyler Veness
72ae751b9a [ci] Fix PathWeaver name typo (#6717) 2024-06-08 11:58:45 -07:00
Tyler Veness
27cbbfe2ab [upstream_utils] Update to LLVM 18.1.7 (#6715) 2024-06-08 11:24:42 -07:00
Gold856
65c6306047 [wpilib,commands] Use Jinja to generate HID classes (#6274) 2024-06-08 09:59:07 -07:00
sciencewhiz
a0efc9ca31 [ci] Add workflow to build java tools for PRs (#6698)
This can catch breaking changes earlier.
- Builds linux only for speed
- Builds and publishes artifacts in this file as it was actually faster
then reusing the artifacts from the gradle file as those need the
combiner run on them. It uploads the artifacts to Actions with a 1 day
retention, because that allows the tools to be built in parallel, which
overall sped things up. This also only allows relevant tasks in wpilib
to be run
- The tool builds are uploaded with a shorter retention time in case
someone wants to do more extensive tests.
2024-06-08 09:55:07 -07:00
Thad House
917b5dde66 [build] Update Native Utils, remove all rpath tricks (#6671)
With fixes to Windows and macOS library path handling, all the tricks we used in the past to make library loading work are no longer required.
2024-06-08 09:52:29 -07:00
Tyler Veness
300595da9e [upstream_utils] Update Sleipnir (#6709)
Upstream now uses std::format/std::print, so we have to backport it to
fmtlib.
2024-06-08 09:50:59 -07:00
Brendan Raykoff
0606da64c9 [wpimath] LinearFilter lastValue(): Fix runtime exception (#6713) 2024-06-07 17:24:34 -07:00
Gold856
1c884b2260 [ci] Use the comment command token for robotpy comment action (#6711) 2024-06-07 16:15:30 -07:00
Gold856
5b94421b5a [ci] Fix permissions for commenting on commands PRs (#6708) 2024-06-06 10:39:58 -07:00
Sam Carlberg
ad18fa62ee [wpilib] Add LED pattern API for easily animating addressable LEDs (#6344)
Add LEDReader and LEDWriter helper interfaces to facilitate composing simple patterns into more complex ones, e.g. LEDPattern.solid(Color.kBlue).breathe(Seconds.of(0.75)). Pattern composition relies on changing out the write behavior; for example, offsetBy increments the indexes to write to; while blink will switch between playing a base pattern and turning off all the LEDs.

Add a view class for splitting a single large buffer into smaller distinct sections, which is useful for dealing with long chained LED strips mounted on different parts of a robot. Views cannot be written directly to an LED strip (in fact, trying to do so won't even compile).

Adds some utility methods to the Color class for interpolating between two colors, and support color representations with 32-bit integers to avoid object allocations.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-06-05 19:41:10 -07:00
Tyler Veness
5221069bcc [wpimath] Disambiguate wpimath JNI functions (#6695)
Each collection of JNI functions now has its own class.
2024-06-05 12:26:58 -07:00
Wispy
df4694c9df [wpinet] Add indication of success/failure to PortForwarder (#6697) 2024-06-04 21:09:45 -07:00
Gold856
b99d9c1710 Use Java 17 features (#6691)
Uses enhanced instanceof (and simplify equals methods)
Uses switch expressions and arrow labels
Seal and finalize some Shuffleboard classes

Co-authored-by: Sam Carlberg <sam@slfc.dev>
2024-06-04 21:09:10 -07:00
Joseph Eng
d6b66bfa55 [wpiutil] Add remove_prefix() and remove_suffix() (#6118) 2024-06-04 21:01:52 -07:00
Brendan Raykoff
8def7b2222 [wpimath] Add geometry classes for Rectangle2d and Ellipse2d (#6555)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-06-04 18:27:32 -07:00
Tyler Veness
afaf7e2c3f [upstream_utils] Format Eigen patches with Eigen's clang-format config (#6699) 2024-06-04 18:26:20 -07:00
Wispy
5f8c842223 [wpilib] Compressor: Add more Sendable data (#6687) 2024-06-03 07:47:17 -07:00
Tyler Veness
bdc42532ed [wpimath] Make unit max and min constexpr (#6690) 2024-06-02 21:45:02 -07:00
sciencewhiz
21e970f2cd [fieldImages] Move Java fields to edu.wpi.first.fields (#6694)
Doesn't make sense in edu.wpi.fields, and resources are already in
edu.wpi.first.fields
This will require changes in Shuffleboard and Pathweaver
2024-06-02 21:44:39 -07:00
sciencewhiz
38ee6476f2 [ci] Update cmake actions to node 20 versions (#6692) 2024-06-02 21:00:43 -07:00
Tyler Veness
a97904ed1f [upstream_utils] Fix gcem min and max compilation (#6689) 2024-06-02 15:52:12 -07:00
Joseph Eng
1828fdaaa4 [commands] Define order of parallel groups (#6602) 2024-06-01 12:01:15 -07:00
Joseph Eng
7751f6d1d2 [wpimath] Remove swerve wrappers for odometry and pose estimation, move wheel positions operations to kinematics (#6673) 2024-06-01 11:59:54 -07:00
Peter Johnson
7c8a36f3eb [wpiutil] Add Struct and Protobuf clone and immutable checks (#6686) 2024-06-01 11:58:53 -07:00
Wispy
ae8e4289b9 [dlt] Fix build.gradle description (#6682) 2024-05-31 13:43:51 -07:00
CoolSpy3
c1fc86033a [sim] Clarify Sim CAN Device Documentation (#6679) 2024-05-30 05:32:45 -07:00
Dean Brettle
9782abbcb1 [wpilib] Add protected default constructor for CallbackStore (#6667)
This  is to allow 3rd party sim providers (eg vendors) to subclass this class so that the register methods of their sim classes can return CallbackStores like the builtin sims.

Although it was already possible to create such a subclass but passing dummy parameters to one of the other constructors, this eliminates the need to pass such dummy parameters and makes it clearer that subclassing is allowed.
2024-05-27 21:19:12 -07:00
Gold856
0ad4cd69d0 [hal] Initialize DIO to true in sim (#6670) 2024-05-27 21:18:19 -07:00
Avi
76685fe7e8 [wpilibj] Fix docs typo (NFC) (#6672) 2024-05-27 21:17:41 -07:00
Dean Brettle
3b8d8a367b [wpilibj] Make CallbackStore.close() idempotent (#6666)
This is "strongly recommended" in the javadocs for the AutoCloseable.close().
2024-05-27 07:58:03 -07:00
CoolSpy3
a6ac4228c3 [sim] WebSockets Documentation Fixes (#6668) 2024-05-27 06:52:25 -07:00
CoolSpy3
98fcbdb44e [sim] Update WebSockets API Specification (#6664)
Also update AddressableLED data to be output instead of input.
2024-05-26 14:58:32 -07:00
Thad House
958387ddd3 [wpiutil] Add method to skip SetDllDirectory for windows loading (#6662)
With DependentLoadFlags, we shouldn't need this function anymore. Add a way to test this easily without needing to modify allwpilib.
2024-05-26 14:22:29 -07:00
Thad House
a2f2502f70 [build] Bump Native Utils to 2025.0.0 (#6663)
Adds DependentLoadFlags
2024-05-26 11:55:55 -07:00
Thad House
fbfef85f45 [wpiutil] Fix CombinedRuntimeLoader default path (#6661) 2024-05-26 11:12:44 -07:00
Vasista Vovveti
cdbd64c3df [ci] Give comment action PR write permission (#6594) 2024-05-25 19:42:28 -07:00
Joseph Eng
eb3635e622 [commands] Make CommandGenericHID a public base class of CommandXboxController (#6658) 2024-05-25 11:44:41 -07:00
Joseph Eng
9ef6d13b27 [wpilibj] Suppress this-escape warning on SharpIR (#6659) 2024-05-25 11:43:27 -07:00
Wispy
e2545231b8 [glass] Save input after clicking away (#6657) 2024-05-25 09:19:52 -07:00
sciencewhiz
4252a36668 DevelopmentBuilds.md: Fix missing apostrophe (#6655) 2024-05-24 19:46:11 -07:00
Jade
f1e072fc98 [commands] GenericHIDController: use composition in C++ (#6296) 2024-05-24 16:36:05 -07:00
Theinatorinator
221d568bd9 [wpilibj] Add tests for ADIS16448 simulation (#6152) 2024-05-24 16:33:25 -07:00
scarmain
c62396ce4e [wpilib] Fix PowerDistribution.GetAllCurrents() (#6025) 2024-05-24 16:31:19 -07:00
Nicholas Armstrong
f42bc45ee8 [wpilib] FlywheelSim cleanup (#6629)
This is a cleanup of the FlywheelSim class with a few added features.

- One FlywheelSim constructor that takes a plant, DCMotor, and a optional number of measurementStdDevs. The documentation now states how to construct the plant either through LinearSystemId.createFlywheelSystem or identifyVelocitySystem.

- The gearbox, gearing and moment of Inertia (J) are now private final fields. The gearing is determined from the plant in the constructor as well as the moment of inertia. There are getter methods that allow the flywheelSim to return the gearbox, gearing, and moment of inertia.

- The getCurrentDrawAmps function now uses m_x instead of getAngularVelocityRadPerSec in accordance with more accuracy and matches the patter in other sims.

- Added getter methods for the InputVoltage, angularAcceleration and torque

- (Java only) A third getter method for returning the AngularVelocity of the flywheel using a MutableMeasure as a backing field that is set when getAngularVelocity is called. This summarily returns the angularVelocity as just a Measure object. This allows the user of this class to handle unit conversions with less numerical manipulation. Alterations in C++ for this feature were not needed.
2024-05-24 16:05:14 -07:00
Wispy
8c107e4b75 [wpilibj] Add TimedRobot.addPeriodic() measure overloads (#6654) 2024-05-24 16:02:36 -07:00
Peter Johnson
652c721895 [ci] Remove build-dir from Windows Gradle build (#6269)
This is no longer required due to increased disk space in Actions.
2024-05-24 14:03:00 -07:00
Peter Johnson
7e00f2d3eb [wpilib] Fix docs for Sharp IR simulation (NFC) (#6653) 2024-05-24 14:02:22 -07:00
Joseph Eng
5c5e5af0c6 [commands] Add missing C++ decorators (#6599) 2024-05-24 13:14:15 -07:00
Dean Brettle
237ebfd0f2 [sim] Add CAN message schema to wpilib-ws.yaml and add 2 CANMotor props (#6651)
Co-authored-by: CoolSpy3 <coolspythree@gmail.com>
2024-05-24 12:56:34 -07:00
Dustin Spicuzza
dc0e9712e6 [wpilib] Add support for Sharp IR sensors (#6023) 2024-05-24 12:55:30 -07:00
Thad House
d05c7c125b [wpilib] Rewrite DutyCycleEncoder and AnalogEncoder (#6398) 2024-05-24 11:53:56 -07:00
Carl Hauser
294c9946ae [wpimath] PIDController.setIntegratorRange documentation fix (#6489) 2024-05-24 11:49:00 -07:00
Jade
6220c6be4d [wpiutil] Remove RuntimeDetector and simplify RuntimeLoader (#6600) 2024-05-24 10:48:59 -07:00
Gold856
72a6d22d9a [build] Organize cmake files (#6617) 2024-05-24 10:48:05 -07:00
Jade
8834cb1de4 [wpimath] ChassisSpeeds: add equals method (#6414) 2024-05-24 10:42:32 -07:00
Tyler Veness
ae655a3a71 Rename myRobot to developerRobot and move docs to subproject (#6283) 2024-05-24 10:41:23 -07:00
Ryan Blue
65f4505e3c [wpimath] Add constraints support to ProfiledPIDController Sendable implementation (#6354) 2024-05-24 10:39:56 -07:00
bovlb
badd090538 [wpimath] Document example usage for InterpolatingDoubleTreeMap (NFC) (#6456) 2024-05-24 10:35:42 -07:00
Gold856
2fd8dae503 [ci] Use LF line endings for pregenerate.yml (#6650) 2024-05-23 08:23:54 -07:00
Tyler Veness
27efd37c52 [upstream_utils] Upgrade Eigen to include GCC 14 patches (#6646) 2024-05-23 06:49:20 -07:00
Tyler Veness
0c822b45ab [wpimath] Fix Eigen maybe-uninitialized warnings (#6636) 2024-05-20 16:53:22 -07:00
Jade
58751338ec [ci] Remove workaround for sanitizers (#6638)
It's been added to the base image.
2024-05-20 12:20:12 -07:00
ncorrea210
0b5aec82ff [wpimath] Add ChassisSpeeds::ToTwist2d() to ChassisSpeeds (#6634)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-05-20 12:19:17 -07:00
Wispy
820f68dc08 [wpimath] Add InterpolatingDoubleTreeMap.ofEntries() (#6635)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2024-05-20 12:18:28 -07:00
Benjamin Hall
8c420fa4c1 [wpimath] Modify C++ LinearFilter::Reset(span<double>, span<double>) to take span<T> (#6628)
Previously, the overload took a span<double>. However, m_inputs and m_outputs store type T, so the function could not be called for any T that does not have an implicit constructor from double.
2024-05-15 14:46:10 -06:00
Nicholas Armstrong
ab315e24c8 [wpimath] LinearSystemSim Constructor and method cleanup (#6502)
Modified Java constructors to take a variable number of measurement std devs argument with checks in place to make sure the right amount (or none) are passed into the constructor. All changes passed down to classes utilizing LinearSystemSim.

Removed excess constructors

Removed Java and C++ CurrentDrawAmps method as it doesn't belong in a generic (non electrical) linear system. Kept a non override version in all derived electrical classes.

Also LinearSystemSim has now been made agnostic to electrical systems. Inputs don't have to be voltage. BatteryVoltage clamp function has been pushed down to electrical subclasses.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-05-15 11:40:30 -06:00
Tyler Veness
0f45fe9486 [upstream_utils] Fix Eigen macro name (#6627)
I've confirmed this fixes the build with GCC 14 in C++23 mode.
2024-05-15 07:42:53 -06:00
Nicholas Armstrong
7fc17811fa [wpimath] Add full state support to LinearSystemId functions (#6554)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-05-15 07:23:22 -06:00
Wispy
7fbbecb5b7 [wpiunits] Add Measure.divide(Measure<U2>) (#6611) 2024-05-15 07:22:38 -06:00
Michael Fisher
b0d3bf4ddf [build] cmake: add absl dependency for newer protobuf (#6609)
Works around a bug on some systems where protobuf does not correctly depend on required absl libraries.
2024-05-14 21:25:15 -06:00
Tyler Veness
40b35f0d51 [upstream_utils] Fix compilation failures on constexpr matrices with GCC 14 (#6626) 2024-05-14 21:22:32 -06:00
Tyler Veness
637647b941 [upstream_utils] Improve Eigen intellisense fix (#6621) 2024-05-14 18:47:51 -06:00
Tyler Veness
0a967e0e62 [upstream_utils] Suppress deprecation warnings for Eigen's has_denorm (#6619)
std::has_denorm and std::has_denorm_loss were deprecated in C++23.
This avoids deprecation warnings with Clang 18 set to C++23.
2024-05-14 16:33:57 -06:00
Thad House
4ce8f3f935 Change C APIs to a unified string implementation (#6299)
Currently in the entire C API of WPILib we have ~8 different ways of handling strings. The C API actually isn't built for pure C callers (We don't actually have any of those). Instead, they're built for interop between languages like LabVIEW and C# which can talk to C API's directly.

For output parameters, the choice was fairly obvious. An output struct containing a const string pointer and a length makes the most sense. Its easy to use these from most other languages, and doesn't require special null termination handling. Freeing these is also easy, as if you ever receive one of these string structures, theres just a single function call to free it.

Input parameters are a bit more complex. To be used from pure C, and from LabVIEW, a null terminated string is the best in most cases. However, null terminated strings in general have a lot of downsides. Additionally, from LabVIEW there are other considerations around encoding that having a wrapper struct helps make a bit easier. From a language like C#, a wrapper struct is by far the easiest, as custom marshalling can make it trivial to marshal both UTF8 and UTF16 strings down.

The final consideration is its nice to have an identical concept for both input and output. It makes the rules fairly easy to understand.

WPILib will not have any APIs that manipulate a string allocated externally. This means WPI_String can be const, as across the boundary it is always const.
If a WPILib API takes a const WPI_String*, WPILib will not manipulate or attempt to free that string, and that string is treated as an input. It is up to the caller to handle that memory, WPILib will never hold onto that memory longer than the call.
If a WPILib API takes a WPI_String*, that string is an output. WPILib will allocate that API with WPI_AllocateString(), fill in the string, and return to the caller. When the caller is done with the string, they must free it with WPI_FreeString().
If an output struct contains a WPI_String member, that member is considered read only, and should not be explicitly freed. The caller should call the free function for that struct.
If an array of WPI_Strings are returned, each individual string is considered read only, and should not be explicitly freed. The free function for that array should be called by the caller.
If an input struct containing a WPI_String, or an input array of WPI_Strings is passed to WPILib, the individual strings will not be manipulated or freed by WPILib, and the caller owns and should free that memory.
Callbacks also follow these rules. The most common is a callback either getting passed a const WPI_String* or a struct containing a WPI_String. In both of these cases, the callback target should consider these strings read only, and not attempt to free them or manipulate them.
2024-05-13 05:35:14 -07:00
Peter Johnson
178fe99f12 [wpiutil] Split DataLog background writer into different class (#6590)
DataLog is now a base class, with DataLogBackgroundWriter being the
background thread version and DataLogWriter being a non-threaded version.

Also split the C header into a separate file to make it more wpiformat friendly.
2024-05-12 14:09:43 -07:00
Gold856
305a0657e2 [cscore] Deprecate AxisCamera (#6579) 2024-05-12 10:28:51 -07:00
sciencewhiz
fb3e0e1ecb [docs] Update readme to say git clone is required (#6603) 2024-05-12 10:27:56 -07:00
Tyler Veness
2e828ae053 [upstream_utils] Fix fmtlib tautological-compare warning from GCC 14 (#6613)
The patch is from upstream.
2024-05-12 10:27:01 -07:00
Tyler Veness
d3af27be94 [wpiunits] Fix Javadoc warning (#6614) 2024-05-12 10:25:44 -07:00
sciencewhiz
4cb2edbb98 [docs] Run Doc lint with JDK 21 (#6612) 2024-05-12 07:55:15 -07:00
Tyler Veness
d88c71ffdc [wpiutil] Upgrade to fmt 10.2.1, add wpi::print (#6161)
We now use a wrapper (wpi::print) to catch exceptions since we can't patch
std::print() to not throw when we ultimately migrate to it.

fmtlib and std format/print throw the same exceptions and always have. We previously patched fmt::print() to not throw a write failure exception, but we can't do that for std::print(); wpi::print() is the migration plan.
2024-05-12 06:25:42 -07:00
Sam Carlberg
6c9dcc157e [wpiunits] Change units to track their base unit, instead of their base class (#6342)
Unit objects now have a reference to the base unit from which they're derived. Constructing a unit object without specifying a base unit implicitly signifies that it's its own base unit, eg new Angle(null, 1, "Radian", "rad") would be the base angle unit of radians, while new Angle(Radians, 2 * PI, "Rotation", "R") would be a new angle unit based on radians.

This fixes much of the hacky code surrounding the derived unit types Velocity, Per, and Mult, but is a breaking change for any user code that defines custom unit classes or uses the anonymous unit type.
2024-05-12 06:15:56 -07:00
Tyler Veness
dc00a13d83 [wpimath] Make cost and covariance matrix functions constexpr (#6444) 2024-05-07 15:32:14 -07:00
Tyler Veness
bdc7344df1 [upstream_utils] Upgrade Eigen to get more constexpr support (#6596) 2024-05-07 12:47:15 -07:00
Isaac Turner
a6dd95eb9e [wpilib] Remove deprecated Gyro interface (#6567) 2024-05-06 21:54:39 -07:00
Wispy
2563ff9f18 [wpimath] Add Pair.equals() (#6580) 2024-05-06 21:52:59 -07:00
sciencewhiz
f77d01c085 [docs] Build javadocs with JDK 17 (#6588)
Remove JDK 11 javadocs workarounds.
Also update readme to say to install JDK 17.
2024-05-06 21:52:22 -07:00
Kaya
408980462f [commands] CommandScheduler: Provide function to print watchdog epochs (#6582) 2024-05-06 15:53:14 -07:00
Ryan Blue
2e71e85b8d switch CI to temurin jdk (#6592) 2024-05-06 13:37:09 -07:00
Isaac Turner
6a73ca8c08 [build] Change source compatibility to Java 17 (#6585) 2024-05-05 07:52:42 -07:00
Tyler Veness
9ed2f66914 [build] Bump macOS deployment target to 13 (#6548)
macOS 12 is EOL in mid-October of 2024 based on when macOS 11 was
dropped last year.
2024-05-04 11:11:10 -07:00
Isaac Turner
d3060d8eba [wpilib] IterativeRobotBase: Provide function to print watchdog epochs (#6581) 2024-05-04 10:19:36 -07:00
Vasista Vovveti
27babe5584 [ci] Comment on command PRs to open a RobotPy PR (#6574) 2024-05-04 08:37:45 -07:00
Ryan Blue
7596aeda10 [wpilib] GenericHID.setRumble: Fix Java integer overflow (#6529) 2024-05-04 08:36:40 -07:00
Isaac Turner
c76b358290 [ci] Update gradle wrapper validation action version (#6335) 2024-05-03 12:41:47 -07:00
Tim Winters
bad56bcbe8 [commands] Add StartRun command factory (#6572) 2024-05-03 12:40:13 -07:00
Tyler Veness
e172aa66f7 [wpimath] Java: add static instantiations of common rotations (#6563)
C++ doesn't need this because it supports value types, which are much
cheaper to construct. constexpr is also available to make construction
zero-cost.
2024-05-03 12:39:35 -07:00
Isaac Turner
9c7120e6bf [wpilibc] Remove deprecated Joystick angle functions (#6569) 2024-05-03 12:38:58 -07:00
Drew Williams
0afc35f336 [commands] Fix C++ SysIdRoutine crashing when passed nullptr or {} (#6508)
Flattens parameter from a `std::optional<std::function<...>>` to just a `std::function<...>`.  This is a breaking change but a trivial one for teams to fix.
2024-05-01 09:09:15 -07:00
Tyler Veness
ae4bcefefc [wpimath] Fix incorrect docs for Rotation3d default constructor (#6571)
A Rotation3d is not defined by one angle.
2024-05-01 09:06:13 -07:00
Isaac Turner
513d1a0a15 [wpilib] Remove deprecated Accelerometer interface (#6568) 2024-05-01 09:04:50 -07:00
Tyler Veness
a85e7693de [examples] Use UDL for turns (#6570) 2024-05-01 09:02:18 -07:00
Tyler Veness
5359112b15 [wpimath] Deprecate RamseteController (#6494)
LTVUnicycleController is a drop-in replacement with better tuning knobs.

The RamseteCommand examples were removed instead of retrofitted with
LTVUnicycleController because we're planning on removing the command
controller classes anyway, so it would be wasted effort. The
SimpleDifferentialDriveSimulation example shows direct
LTVUnicycleController usage.
2024-04-29 22:01:42 -07:00
Tyler Veness
7601b7250a [upstream_utils] Upgrade Sleipnir to use a small vector type (#6565)
This sped up ArmFeedforward.Calculate() by up to 2x.
2024-04-29 22:00:32 -07:00
DeltaDizzy
a9cfd0d0f9 [commands] Deprecate proxy supplier constructor (#6553) 2024-04-29 21:11:29 -07:00
Isaac Turner
c71db8ea9c [wpiutil] Remove old InterpolatingTreeMap location (#6560) 2024-04-29 21:05:12 -07:00
Isaac Turner
70417f64da [wpimath] Remove deprecated TrapezoidProfile constructors (#6558) 2024-04-29 21:04:57 -07:00
Isaac Turner
f5e08652f8 [wpimath] Remove deprecated MatBuilder factory (#6557) 2024-04-29 21:04:43 -07:00
Thad House
eec99eb653 [wpilibj] Fix AsynchronousInterrupt (#6564) 2024-04-29 21:04:24 -07:00
Isaac Turner
9cae707065 [wpilib] Remove deprecated SetHandler function (#6556) 2024-04-29 21:03:45 -07:00
Isaac Turner
0f8aa8aedf [commands] Remove CommandBase (#6545) 2024-04-28 12:04:51 -07:00
Ryan Heuer
ac32f921f6 [glass] Add math expression input for NetworkTables numerical values (#6530) 2024-04-28 12:03:49 -07:00
Isaac Turner
67fe11f9cd [commands] Rename deadlineWith to deadlineFor (#6544)
Deprecate deadlineWith for backwards compatibility.
2024-04-28 12:02:29 -07:00
Nicholas Armstrong
1ec089c7f9 [wpimath] Add ArmFeedforward calculate() overload that takes current and next velocity instead of acceleration (#6540)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-04-28 12:01:08 -07:00
Isaac Turner
1727c74b80 [ntcore] remove deprecated flag (#6551) 2024-04-28 06:17:39 -07:00
Isaac Turner
890185acee [ntcore] Remove deprecated delete function (#6552) 2024-04-28 06:15:19 -07:00
Tyler Veness
fd363fdf5a [wpimath] Add Sleipnir (#6541)
This is useful for solving quadratic programs.
2024-04-27 22:42:42 -07:00
DeltaDizzy
1e4a647918 [commands] Disambiguate ProxyCommand and DeferredCommand (#6324) 2024-04-27 22:41:04 -07:00
Wispy
39d33bfca6 [wpiunits] Adds FeetPerSecondPerSecond (#6543) 2024-04-27 21:08:13 -07:00
Isaac Turner
5edc652c05 [commands] Fix multiple C++ warnings (#6546) 2024-04-27 21:07:50 -07:00
Isaac Turner
d9eb3691d8 [commands] Remove deprecated TrapzoidProfileCommand api (#6547) 2024-04-27 21:07:23 -07:00
Tyler Veness
a42ffb8fa4 [ci] Bump wpiformat to 2024.34 (#6549) 2024-04-27 21:06:57 -07:00
Joseph Eng
d4e6a068ac [apriltag] Deprecate loadAprilTagLayoutField() (#6550) 2024-04-27 21:04:30 -07:00
Joseph Eng
cdfa2ece6f [wpimath] Add PoseEstimator.sampleAt() (#6426) 2024-04-27 21:03:37 -07:00
Isaac Turner
962bf7ff10 [ntcore] Backup persistent file if it fails to parse (#6523) 2024-04-27 07:04:27 -07:00
DeltaDizzy
2cd3935aa8 [sysid] Remove obsolete WPILib presets, rename CTRE presets (#6460) 2024-04-27 06:55:19 -07:00
Isaac Turner
427b7dcc11 README: Add python to languages (#6542) 2024-04-26 10:38:34 -07:00
Tyler Veness
e73050a8fa [wpimath] Templatize formatters (#6535)
This is required for compatibility with libc++'s std::format.
2024-04-25 16:08:24 -07:00
Nicholas Armstrong
3e6c0d0b71 [wpiunits] Add Acceleration and MOI Units (#6495) 2024-04-22 19:09:18 -07:00
Jacob Hotz
dc4c63568a [commands] Add Trigger.onChange() (#6390) 2024-04-21 22:37:15 -07:00
Ryan Blue
b620b6a4dd [apriltag] Cache layout loaded from AprilTagFields resource json (#6385) 2024-04-21 22:36:22 -07:00
Isaac Turner
d7dfa63ae9 [commands] WaitCommand: add Measure<Time> overload (#6386)
Also add waitTime() factory.
2024-04-21 22:34:52 -07:00
vichik
e89c8c1008 [wpiunits] Add isNear function implementation (#6396)
This implementation uses a tolerance in the same units as the measure it checks.
2024-04-21 20:40:33 -07:00
Juan Jose Chong
abfe2488ff [wpilib] Add flash update capability to ADI IMUs (#6450) 2024-04-21 20:39:53 -07:00
Gold856
3e5187ff32 [wpilibj] DataLogManager: Fix behavior when low on space (#6486)
Uses getUsableSpace in Java, matching how C++ determines available space (C++ calls it available, but they mean the same thing.) This fixes a bug where logs wouldn't get deleted due to incorrect available space detection.

The DataLog thread now also checks if the state was marked as stopped after a call to StartLogFile.
2024-04-21 20:34:05 -07:00
DeltaDizzy
7bc0380694 [commands] WrappedCommand: Call wrapped command initSendable (#6471) 2024-04-21 20:30:43 -07:00
Starlight220
98d2f45fa9 [commands] Fix double composition error truncation (#6501) 2024-04-21 20:28:04 -07:00
Isaac Turner
d14dfed828 [wpimath] Rotation2d: add Measure<Angle> getter (Java) (#6492) 2024-04-21 20:23:36 -07:00
HarryXChen
f26adc556d [examples] Fix memory over-allocation in Apriltag examples (#6517)
Change hamming distance to 1, add comment about memory usage.
2024-04-21 20:21:48 -07:00
Gold856
3c14d87006 Update README-CMAKE.md (#6522) 2024-04-21 20:21:07 -07:00
Isaac Turner
77536e68f0 README.md: Link straight to contributing in contents (#6525)
Avoids need to click twice to get to contributing.md.
2024-04-21 20:19:53 -07:00
Peter Johnson
c88be31ec2 Merge branch 'development' 2024-04-21 20:15:51 -07:00
Tyler Veness
74f648689e [build] Add exports to CMake subprojects (#6505)
This allows consuming allwpilib via FetchContent.
2024-04-10 22:04:22 -07:00
Tyler Veness
2def62a1ef [wpimath] Document ChassisSpeeds::Discretize() math (NFC) (#6509) 2024-04-10 22:03:44 -07:00
Tyler Veness
3a5d24ab1d [ci] Revert "Use mirror repository for liblzma (#6499)" (#6506)
This reverts commit c46847b32a.
2024-04-10 10:04:15 -07:00
Isaac Turner
02c78bc9b6 MAINTAINERS.md: Remove reference to marketplace (#6470) 2024-04-04 09:21:53 -07:00
Carl Hauser
998340296d [wpilibj] Fix EncoderSim.setDistancePerPulse parameter name and comment (NFC) (#6481) 2024-04-04 09:21:05 -07:00
Tyler Veness
d26e6d9ecc [wpimath] Support formatting Eigen array types (#6496) 2024-04-04 09:19:50 -07:00
Nicholas Armstrong
fbb3669546 [wpilib] LinearSystemSim: Add missing clamp function and getInput() (#6493) 2024-04-04 09:19:13 -07:00
Ryan Blue
c46847b32a [ci] Use mirror repository for liblzma (#6499)
Uses https://github.com/bminor/xz to work around suspended repository.

We will revert this once vcpkg updates to point to an accessible repo.
2024-04-04 09:18:06 -07:00
Peter Johnson
33f12f0e31 Revert "[commands] Cache button and POV triggers"
Also revert the associated formatting commit.  This was an accidental merge.
This reverts commit ff929d4a5f.
This reverts commit 2392c9f278.
2024-03-26 00:08:07 -07:00
sciencewhiz
25ad6eafd5 Add reference to development to CONTRIBUTING.md (#6467) 2024-03-24 23:52:36 -07:00
Isaac Turner
84a55d13f3 [ci] Fix 2023 docker image usage (#6459) 2024-03-24 23:51:38 -07:00
Wispy
4a548935d3 [wpimath] Add Pair.toString() (#6463) 2024-03-24 23:51:08 -07:00
Tyler Veness
85ea5f8497 [wpimath] Make more LinearSystemId functions not throw if Kv = 0 (#6465) 2024-03-24 23:50:41 -07:00
Gold856
c32e7db8e3 [wpiutil] DataLog: Don't constantly retry creating logs when low on space (#6468)
When low on space, a log file won't be created. This is detected as a "deletion", and the DataLog thread will continously try to create a log, fail to do so because of low space, detect it as a "deletion", and do so in a loop.

If there's not enough space, the DataLog will be marked as stopped, preventing this infinite loop. Calls to start() will hit this code path and mark it as stopped again.
2024-03-24 23:50:18 -07:00
Tyler Veness
2392c9f278 Run java format (#6462) 2024-03-22 09:50:28 -07:00
Peter Johnson
0dbdbb2aac Merge branch 'main' into development 2024-03-20 22:54:42 -07:00
Tyler Veness
b38540e1af [ci] Pin wpiformat version in comment command (#6458) 2024-03-20 22:53:52 -07:00
Peter Johnson
ff929d4a5f [commands] Cache button and POV triggers
This is a common footgun for teams.
2024-03-20 22:52:12 -07:00
Tyler Veness
b2113d3a9a [ci] Pin wpiformat version in comment command (#6457) 2024-03-20 22:50:55 -07:00
Tyler Veness
5370f249a1 [build] Upgrade to wpiformat 2024.33 (#6449)
This upgrades to clang-format and clang-tidy 18.1.1. This has the
constructor attribute formatting fix, so we can remove our
WPI_DEPRECATED macro.
2024-03-18 23:11:20 -07:00
Peter Johnson
74057543aa [glass] Don't limit window name+label to 128 chars (#6447) 2024-03-18 14:28:00 -07:00
Tyler Veness
b4674bacb9 [wpiutil] Upgrade to LLVM 18.1.1 (#6405) 2024-03-17 18:39:03 -07:00
Peter Johnson
fd4424eb89 Merge branch 'main' into development 2024-03-16 11:06:44 -07:00
Peter Johnson
c10f7d91b7 [ci] Work around asan actions bug (#6442) 2024-03-16 11:06:01 -07:00
person4268
0b13459469 [commands] Trigger: pass m_loop to new Trigger in composition functions (#6441) 2024-03-15 12:05:48 -07:00
Sam Richter
a1af2357e8 [ntcore] Fix memory leak in WebSocketConnection (#6439) 2024-03-15 11:50:30 -07:00
Dean Brettle
3116f790ea [sysid] Fix wrong position Kd with unnormalized time (#6433) 2024-03-12 21:49:28 -07:00
Tyler Veness
0e013dc021 [sysid] Fix "Sample" docs typo (NFC) (#6435) 2024-03-11 20:23:03 -07:00
sciencewhiz
f74f6f1d42 [docs] Add docs for features not supported on PDH (NFC) (#6436) 2024-03-11 20:22:33 -07:00
Peter Johnson
11c60df3e0 [hal] Use SIGKILL instead of SIGILL (#6431)
Fix typo.
2024-03-11 09:43:33 -07:00
Peter Johnson
3d9152a461 [hal] Raise SIGKILL instead of calling abort() (#6427)
We don't need to generate a core dump here if core dumps are enabled.
2024-03-10 20:32:54 -07:00
Peter Johnson
fbd239d15e [sim] GUI: Use shift to enable docking features (#6429) 2024-03-10 20:29:20 -07:00
Tyler Veness
7cd4a75323 [sysid] Fix crash on negative feedforward gains (#6425)
LinearSystemId's linear system factories throw on negative feedforward
gains, but SysId can compute the feedback gains just fine in that case.
Now we construct the system manually instead.

Fixes #6423.
2024-03-10 17:43:02 -07:00
Tyler Veness
973bb55e66 [wpimath] LinearSystemId: Don't throw if Kv = 0 (#6424)
That's just a system with no back-EMF.
2024-03-10 08:11:18 -07:00
DeltaDizzy
7bd8c44570 [wpimath] Add structured data support for DifferentialDriveWheelPositions (#6412) 2024-03-09 10:09:02 -08:00
Peter Johnson
38c128fe6a Merge branch 'main' into development 2024-03-09 09:57:55 -08:00
Peter Johnson
18e57f7872 [wpilibj] Call abort() on Rio on caught Java exception (#6420)
On Rio, we simply want to restart the robot program as quickly as possible,
and don't want to risk a hang somewhere that will keep that from happening.

The main downside of this is it won't wait for threads to finish (e.g. data logs won't get a final flush).
2024-03-09 09:55:49 -08:00
Tyler Veness
ccb4cbed63 [sysid] Fix arm characterization crash (#6422)
Fixes #6421.
2024-03-09 09:54:37 -08:00
Thad House
c19ee8b0fe [wpiutil, hal] Crash on failure for SetupNowRio() and wpi::Now() when not configured (#6417)
This is an unrecoverable condition, so always terminate.
2024-03-08 00:26:53 -08:00
Tyler Veness
e64c20346d [examples] Remove unused private variables (#6403) 2024-02-28 19:58:15 -08:00
Peter Johnson
f1a1ffd7fc [wpiutil] Rate-limit FPGA error from Now() (#6394) 2024-02-25 11:25:46 -08:00
Peter Johnson
c27ddf5ef9 [ci] Windows cmake: update vcpkg version (#6397)
We need fmtlib 10.2.1 to work around a compiler bug.

Also, reducing the number of jobs is no longer required with Actions runner upgrades.
2024-02-24 18:55:10 -08:00
Dean Brettle
8b669330eb [sysid] Fix position feedback latency compensation (#6392) 2024-02-23 14:13:43 -08:00
Tyler Veness
ca6e307ea5 [ci] Upgrade wpiformat (#6395) 2024-02-23 14:12:28 -08:00
DeltaDizzy
607682b687 [wpiunits] Fix Distance class javadocs to state the correct dimension (NFC) (#6363) 2024-02-19 12:58:56 -08:00
Peter Johnson
4b94a64b06 [glass] Fix FMS game data display and editing (#6381)
Also don't require Enter for editing game data or match time.
2024-02-18 16:29:58 -08:00
Thad House
63d9e945b8 [hal] HAL_RefreshDSData: Zero out control word on DS disconnect, use cache in sim (#6380) 2024-02-18 14:30:40 -08:00
Joseph Eng
0ad6b3acb3 [apriltag] Add AprilTagFieldLayout.loadField() (#6377) 2024-02-17 21:12:59 -08:00
Eli Barnett
02aed35c6e [sysid] Relax peak acceleration search (#6378) 2024-02-17 21:12:00 -08:00
Peter Johnson
a8a352ed8c [ntcore] Add hidden subscribe option (#6376)
This allows creating subscribers that aren't communicated with the network.
2024-02-17 00:40:14 -08:00
Peter Johnson
0cdab55e5b [ntcore] Don't send value update to client setting value (#6375) 2024-02-16 14:18:07 -08:00
Thad House
ba15844c28 [hal,wpiutil] Error out of HAL_Initialize if SetupRioNow fails (#6374) 2024-02-15 22:57:06 -08:00
shueja
6afff99640 [wpimath] ExponentialProfile: Return copy of input state (#6370)
As State is mutable, this avoids accidental modification of the passed-in object by the caller modifying the return value.
2024-02-15 16:32:51 -08:00
Tyler Veness
d4d0545dc1 [apriltag] Fix field length in 2024 JSON (#6373)
Fixes #6371
2024-02-15 10:42:03 -08:00
Thad House
9ed0631ec9 [cscore] Add BGRA support (#6365) 2024-02-12 23:42:17 -08: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
Joe Wildfong
6b6a55b72e [build] Fix tcpsockets header publishing (#6367) 2024-02-12 19:44:31 -08:00
fodfodfod
1e168f363e [wpimath] Feed forwards: Use correct 'k' value in error message (#6360) 2024-02-11 10:42:04 -08:00
DeltaDizzy
da3abade83 [examples] Add angular subsystem to SysIdRoutine example (#6297)
Co-authored-by: Tim Winters <twinters@wpi.edu>
2024-02-10 10:44:57 -08:00
Asa Paparo
62cba9a4d3 [wpimath] Add vector projection and geometry vector conversions (#6343) 2024-02-10 10:43:58 -08:00
N0tACyb0rg
3207795d0d [wpimath] Add lastValue() method to filters (#6351) 2024-02-10 10:43:23 -08:00
Joseph Eng
e506e09a06 [wpilibc] Const-qualify SendableChooser::GetSelected() (#6356) 2024-02-10 10:42:53 -08:00
Joseph Eng
163f7ee704 [wpilibc] SendableChooser: Remove unusable std::unique_ptr case (#6357) 2024-02-10 10:41:57 -08:00
Thad House
e9c744c456 [wpimath] Quaternion::Log(): Remove duplicate calls to norm() (#6358) 2024-02-10 10:41:19 -08:00
Kython89
300419c151 [wpilibc] SysIdRoutineLog: Initialize m_stateInitialized (#6359)
This caused non-deterministic behavior as to if the `sysid-test-state-` will appear in the log.
2024-02-10 10:40:38 -08:00
Tyler Veness
1db3936965 [wpimath] Remove unused include from RamseteController.cpp (#6346) 2024-02-05 22:43:50 -08:00
Tyler Veness
4f9d73783b [wpimath] Make units math functions constexpr (#6345) 2024-02-05 22:43:12 -08:00
Tyler Veness
3b2a2381b6 [ci] Upgrade to new macOS runner (#6328) 2024-02-04 10:38:23 -08:00
Ryan Blue
6cc7e52de7 [commands] TrapezoidProfileSubsystem: Fix incorrect ordering of parameters (#6338) 2024-02-01 20:24:43 -08:00
Sam Carlberg
d4533a8900 [wpilibj] AddressableLEDBuffer: Add methods for reading individual RGB values (#6333)
This avoids the allocation/GC overhead of returning a Color8 value.

Also add an indexed iterator forEach to loop over the entire buffer.
2024-02-01 14:01:53 -08:00
vichik
90bb6cfffa [wpiunits] Fix measure isNear function (#6313)
Now the function allows comparison between negative numbers, positive numbers or both.
2024-01-31 13:18:47 -08:00
Ryan Blue
cb094e4ff6 [examples] Don't reset encoders when resetting odometry (#6329) 2024-01-31 13:18:07 -08:00
Isaac Turner
60c6ed9812 [ci] Bump python, java and react script versions (#6325) 2024-01-31 13:17:41 -08:00
Tim Winters
ee15cc172a [commands] Reset timer in quasistatic SysIdRoutine test (#6322) 2024-01-27 23:51:00 -08:00
Joseph Eng
1016e95242 [examples] Fix memory leak in C++ controller command examples (#6306) 2024-01-27 23:49:41 -08:00
Sam Carlberg
19f1903959 [wpiunits] Add singularized aliases for built in units (#6323) 2024-01-27 23:47:59 -08:00
DeltaDizzy
53ebb6679e [examples] Move triggers to subsystem fields (#6318) 2024-01-27 23:47:06 -08:00
Tyler Veness
177132fa2a Replace C++ unit .to<double>() with .value() (#6317)
The latter is shorter and is what we use everywhere else.
2024-01-27 07:58:25 -08:00
Thad House
bbb230491a Force cpp files to be LF line endings (#6319)
Just marking a file as text will cause git to override the local core.autocrlf setting, and assume you want it to be true, which isn't what you want.
2024-01-26 23:20:51 -08:00
Tyler Veness
84ef71ace0 [wpimath] Make Rotation2d implicitly convert from any angle unit (#6316)
Add unit category concepts to support this.
2024-01-26 12:49:22 -08:00
Tyler Veness
68736d802d [wpimath] Clean up profile classes (#6311)
* Reorder functions so they match between languages
* Copy more complete JavaDocs to C++
* Fix incorrect description for time parameter of
  TrapezoidProfile.calculate()
2024-01-25 22:22:42 -08:00
Tyler Veness
d895a0c09f [wpiutil] Add std::expected shim (#6310)
Its tests use Catch2 instead of GoogleTest, so we can't import them.
2024-01-25 22:21:37 -08:00
sciencewhiz
64a9d413bf Update contributing for addition of Python (NFC) (#6307) 2024-01-25 21:31:57 -08:00
Chris Gerth
a70e83ae2e [glass] Update field size defaults in Field2D.cpp (#6298)
Looks like the field length is longer in 2024. Used the onshape model to measure the size.
2024-01-23 21:28:17 -08:00
Isaac Turner
47652d7a3c [commands] Remove unused headers (#6300) 2024-01-23 21:27:24 -08:00
Tyler Veness
be78552db7 [sysid] Fix SSTO calculation (#6301) 2024-01-23 21:26:49 -08:00
Peter Johnson
3acae550d6 [ntcore] StructArrayTopic: Publish schema in span-taking setters (#6303) 2024-01-23 21:26:06 -08:00
Thad House
9d55941ce5 [build] Fix macOS apps not always being an application (#6286) 2024-01-21 20:41:08 -08:00
Peter Johnson
51d92c7027 [build] Fix compilation with musl (#6289) 2024-01-21 20:32:56 -08:00
Peter Johnson
9206b47d67 [wpilibc] ADIS16448, ADIS16470: Initialize member pointers (#6282) 2024-01-21 11:49:32 -08:00
Dustin Spicuzza
6fc16264ce [ntcore] NetworkTable: Actually use the I parameter for structs (#6280) 2024-01-21 10:57:11 -08:00
Peter Johnson
ad18f35477 [ntcore] Map int[] to int64[] for DataLog (#6279) 2024-01-21 00:50:27 -08:00
Thad House
0c6bd846bc [hal] Use 64 bit timestamp in DMA (#6278) 2024-01-20 22:34:03 -08:00
Asa Paparo
19c1556472 [commands] Fix SysIdRoutine naming (#6277)
Previously, this used mechanism.m_subsystem.getName(), instead of mechanism.m_name, meaning differently named SysId routines from the same subsystem would clobber each other when logged.
2024-01-20 22:10:19 -08:00
Peter Johnson
3928ed5647 [sim] Sim GUI DS: Add "Disconnected" state and start in it (#6218)
The default state for the DS in the simulated HAL is changed to disconnected.

The FMS view is now only editable in DS disconnected state.

This enables more robot and field-like testing of robot code, as the
alliance color and other parameters start in invalid states and are
only set when the DS connects.
2024-01-20 21:10:02 -08:00
Thad House
e408f3ad27 [rtns] Add functionality to enable and disable webserver (#6270) 2024-01-20 20:15:30 -08:00
Thad House
7957f4a625 [hal] Don't write a 0 length led string to the FPGA (#6271)
Due to something weird in the FPGA, calling strobeLoad() with a string length of 0 causes both CPUs to spin at 100%, basically shutting down everything else on the robot.

If a 0 length string happens to be passed, just bail out early.
2024-01-20 09:32:16 -08:00
Peter Johnson
1241dfdf68 [outlineviewer] Reduce NT log level 2024-01-20 07:24:16 -08:00
Peter Johnson
4d109309c9 [glass] Reduce NT log level 2024-01-20 07:24:16 -08:00
Peter Johnson
7560d18e09 [ntcore] Enable uv/WS debugging 2024-01-20 07:24:16 -08:00
Peter Johnson
f518e143d0 [wpinet] WebSocket: Utilize uv::Handle logging 2024-01-20 07:24:16 -08:00
Peter Johnson
6fab87fa4c [wpinet] uv::Stream: Add logging for Write and TryWrite 2024-01-20 07:24:16 -08:00
Peter Johnson
42c41785ac [wpinet] uv::Handle: Add wpi::Logger support
This allows the uv wrappers and any related classes to log directly to
a wpi::Logger.
2024-01-20 07:24:16 -08:00
Peter Johnson
1a7eeb6282 [ntcore] Enhance WebSocketConnection debug logging 2024-01-20 07:24:16 -08:00
Peter Johnson
98c0827236 [wpinet] WebSocket: serializer bugfixes (#6264) 2024-01-20 00:38:56 -08:00
Peter Johnson
57aa8ca0dd [ci] Unlimit Windows Gradle workers (#6268)
With the GitHub upgrade to 16 GB RAM, this should no longer be needed.
2024-01-19 23:56:00 -08:00
Peter Johnson
789af2ad26 [ntcore] Use last received time instead of last ping response
This relaxes the timeout constraint for long message transmissions.
2024-01-19 23:45:01 -08:00
Peter Johnson
9a5366bb83 [wpiutil] WebSocket: Add GetLastReceivedTime
This allows getting the timestamp that any data has been received.
2024-01-19 23:45:01 -08:00
Tyler Veness
77c09b9ce2 [docs] Build with JavaDoc 17 and add missing docs (#6220)
Co-authored-by: Sam Carlberg <sam.carlberg@gmail.com>
2024-01-19 23:42:09 -08:00
Peter Johnson
9ec27c1202 [ntcore] Don't disconnect with 1005 error code (#6265) 2024-01-19 23:34:25 -08:00
Peter Johnson
d653408873 [ntcore] Fix large text message splitting (#6263)
The written amount wasn't being tracked in the common case, so bulk
announcements after a subscribe would result in a very large WebSocket
frame.
2024-01-19 23:15:25 -08:00
Peter Johnson
24a24c9051 [wpinet] WebSocket: Improve disconnect reason reporting (#6262)
Add "remote close:" to messages coming from the remote end.
Previously it was impossible to tell if the error was on the local side
or communicated by the remote side.
2024-01-19 23:13:38 -08:00
Thad House
0e5eb3f35c [wpiutil] Fix DynamicStruct string handling (#6253)
Dynamic structs had a few major issues.

In C++, if the string was the last definition in the schema, attempting to set a string would trigger an assertion. This has been fixed

Setting a string value could truncate the string actually stored in the struct, if the definition was shorter than the string to set.
There was no way to detect if this case occurred. The set string function now returns a bool if the string was fully written or not.

Reading a string that had a value shorter than the schema definition would result in embedded trailing nulls in the string. This would make comparing string equality basically impossible, as those embedded nulls count for the length of the string.

The above truncating didn't take into account UTF8 code points. This means a truncation could happen in the middle of a unicode character. Depending on the language this had different behavior, but unpaired code points are problematic to detect in any case. On the decoding side, detect if a split UTF8 code point has occurred by the writer, and if so just ignore it and treat it as not part of the string. Doing this on the receive side means a newer receive side is all that is needed to fix this, which is generally a better option then requiring all senders to update.

Actual DynamicStruct instances have 0 units tests for them. Added a bunch of unit tests around strings to ensure things work properly.
2024-01-19 22:24:54 -08:00
Tyler Veness
4b15c73f64 [sysid] Rename motion threshold to velocity threshold to match GUI field name (#6240) 2024-01-19 22:23:51 -08:00
David Vo
a274e297cd Fix trivial errorprone warnings (NFC) (#6135) 2024-01-19 20:46:38 -08:00
David Vo
d198605562 [wpilibc] SysIdRoutineLog: Fix state log entry name typo (#6261)
The Java version has a hyphen between test-state and the mechanism name.
2024-01-19 20:42:57 -08:00
Thad House
dfaad7ca22 [ntcore] Add typed C GetEntryValue and ReadQueueValue functions (#6256) 2024-01-19 20:38:01 -08:00
Tyler Veness
2df82ec957 [sysid] Document using AdvantageScope for troubleshooting (#6247) 2024-01-19 20:37:27 -08:00
Thad House
3661f485af [wpilibj] Don't automatically pull in cscore for all robot projects (#6245) 2024-01-19 20:37:02 -08:00
Thad House
7f9389f101 [wpiutil] DataLog: Remove extra entry parameter from C AddSchema functions (#6246) 2024-01-19 20:35:44 -08:00
Tyler Veness
ca35bcd827 [wpimath] Use tolerance in rotation interpolation tests (#6237) 2024-01-19 20:35:13 -08:00
Tyler Veness
9227d09960 [wpilib] Fix outdated DifferentialDrive docs (#6249)
They accidentally got reverted when undeprecating MotorController in the
review process for #6053.
2024-01-19 20:34:58 -08:00
swirl
370126db38 [build] cmake: add wpinet dependency to cscore-config.cmake (#6242)
Attempting to build with cscore results in the project being unable to find wpinet unless explicitly found with `find_package` earlier.
2024-01-19 20:34:36 -08:00
HarryXChen
1330235918 [sysid] Show warning tooltips next to bad feedforward gains instead of throwing (#6251)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-01-19 20:33:56 -08:00
Jonah
d392570659 [wpilib] SysIdRoutineLog: Defer creation of state log entry (#6259) 2024-01-19 17:43:18 -08:00
Thad House
a2d45dbca4 [wpiutil] DataLog: Add AddSchema functions to C API (#6232) 2024-01-15 23:34:18 -08:00
Isaac Turner
30965b20cf [wpilibc] Use std::atomic in ADIS classes (#6217) 2024-01-15 22:42:19 -08:00
Thad House
5bc942f532 [wpiutil] StructArrayLogEntry: Use the same lock everywhere (#6231) 2024-01-15 22:41:31 -08:00
Tyler Veness
97828bd325 [sysid] Remove unused "gains to encoder counts" checkbox (#6234) 2024-01-15 22:40:45 -08:00
sciencewhiz
6da21c4943 [examples] Fix typo in AprilTag example (NFC) (#6230) 2024-01-14 20:51:52 -08:00
Peter Johnson
ecf1755e3e [glass] Default to 2024 field image (#6225)
Also relax field scale check a bit so 2024 field image passes.
2024-01-14 14:47:54 -08:00
sciencewhiz
154d920e67 [examples] Limit error bit correction in April Tag examples (#6224)
Values >3 are not supported. 64be6ab26a/apriltag.c (L261-L266)
2024-01-13 23:03:58 -08:00
sciencewhiz
d2ee423749 [fieldImages] Use Miklast high resolution field render (#6185)
Image from https://www.chiefdelphi.com/t/2024-crescendo-top-down-field-renders/447764

Imaged cropped to use less space.
2024-01-13 22:28:58 -08:00
Peter Johnson
7e3678b0a4 [glass] Fix Field2d position and scaling (#6222)
Also adds some border padding for the non-image case.
2024-01-13 21:09:02 -08:00
Tyler Veness
4a55d830e4 [wpilibcExamples] Remove redundant initializer (#6212) 2024-01-13 14:09:26 -08:00
Ben Goldberg
420020c0d5 [wpimath] Remove unused include in Quaternion.cpp (#6219) 2024-01-13 08:48:43 -08:00
Eli Barnett
077c8f4092 [sysid] Fix test duration slider responsiveness (#6216) 2024-01-12 23:05:46 -08:00
HarryXChen
84e3a22baa [sysid] Fix peak acceleration filtering behavior in dynamic velocity test (#6207) 2024-01-12 17:05:50 -08:00
Tyler Veness
b482321c0d [commands] Replace SysId hash map with if statements (#6209)
This is much more efficient.
2024-01-12 12:36:59 -08:00
Isaac Turner
d181e353a0 [wpilib] ADIS16470: Add no-param GetAngle and GetRate (#6184)
This helps with backwards compatibility.
2024-01-12 11:00:42 -08:00
Peter Johnson
2386e44f3a [sysid] Filter valid test names (#6200)
Currently the analysis portion only supports quasistatic and dynamic,
forward and reverse. Check for anything not matching and remove it,
along with providing diagnostics of what is being loaded.
2024-01-12 10:58:57 -08:00
Isaac Turner
fa5b604f16 [wpilibc] Remove unused includes (#6208) 2024-01-12 10:58:35 -08:00
Tyler Veness
67e8306819 gitattributes: Mark C++ source files as text (#6210)
Some C++ files had been checked in with CRLF line endings.
This fixes those and also fixes future commits.
2024-01-12 10:53:56 -08:00
Thad House
1981b8debd Fix multiple Java warnings (#6201) 2024-01-12 08:46:21 -08:00
Tyler Veness
ba9c21cf38 [wpilib] Fix SysId log key for acceleration (#6196)
Also add to docs that logging acceleration and current is optional.
2024-01-10 20:48:23 -08:00
Tyler Veness
211c2a375c [build] Run formatter on generate_usage_reporting.py (#6197) 2024-01-10 20:47:54 -08:00
Peter Johnson
75b2fa1cc3 [sysid] Data selector: use timestamps instead of ranges (#6193)
This is somewhat slower, but handles data files that are organized
differently (e.g. entries grouped instead of purely sorted by time).
2024-01-10 20:13:19 -08:00
Chris Gerth
84b089b209 [ntcore] Update alloy-model.adoc (NFC) (#6191)
URL changed
2024-01-10 11:11:35 -08:00
Peter Johnson
ce550705d7 [ntcore] Fix client "received unknown id -1" (#6186)
This was caused by not swallowing id=-1 messages after processing the
first one.
2024-01-09 14:13:05 -08:00
Peter Johnson
3989617bde [ntcore] NetworkTable::GetStruct: Add I template param (#6183) 2024-01-09 12:39:47 -08:00
sciencewhiz
f1836e1321 [fieldImages] Fix 2024 field json (#6179)
Field corners and field size were identical to 2023.
2024-01-08 19:27:55 -08:00
David Vo
d05f179a9a [build] Fix running apriltagsvision Java example (#6173) 2024-01-07 22:51:55 -08:00
sciencewhiz
b1b03bed85 [wpilib] Update MotorControllerGroup deprecation message (#6171)
The current message could be read as encouraging the use of CAN motor
controllers. This tries to make it more clear.
2024-01-07 17:06:26 -08:00
Michael Leong
fa63fbf446 LICENSE.md: Bump year to 2024 (#6169) 2024-01-07 07:17:41 -08:00
Tyler Veness
4809f3d0fc [apriltag] Add 2024 AprilTag locations (#6168) 2024-01-06 12:50:27 -08:00
Peter Johnson
dd90965362 [wpiutil] Fix RawFrame.setInfo() NPE (#6167) 2024-01-06 12:50:11 -08:00
sciencewhiz
8659372d08 [fieldImages] Add 2024 field image (#6166) 2024-01-06 12:06:15 -08:00
Eli Barnett
a2e4d0b15d [docs] Fix docs for SysID routine (#6164) 2024-01-05 22:05:09 -08:00
Tyler Veness
0a46a3a618 [wpilib] Make ADXL345 default I2C address public (#6163)
pybind needs it.
2024-01-05 16:59:30 -08:00
Peter Johnson
7c26bc70ab [sysid] Load DataLog files directly for analysis (#6103)
Co-authored-by: Oblarg <emichaelbrnett@gmail.com>
2024-01-05 16:24:31 -08:00
Tyler Veness
f94e3d81b9 [docs] Fix SysId routine JavaDoc warnings (#6159) 2024-01-05 16:03:52 -08:00
Tyler Veness
6bed82a18e [wpilibc] Clean up C++ SysId routine (#6160) 2024-01-05 15:22:52 -08:00
Starlight220
4595f84719 [wpilib] Report LiveWindow-enabled-in-test (#6158) 2024-01-05 11:57:14 -08:00
Eli Barnett
707cb06105 [wpilib] Add SysIdRoutine logging utility and command factory (#6033)
Co-authored-by: Drew Williams <williams.r.drew@gmail.com>
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-01-05 11:50:23 -08:00
Starlight220
3e40b9e5da [wpilib] Correct SmartDashboard usage reporting (#6157) 2024-01-05 11:18:29 -08:00
Tyler Veness
106518c3f8 [docs] Fix wpilibj JavaDoc warnings (#6154) 2024-01-05 07:35:59 -08:00
Tyler Veness
19cb2a8eb4 [wpilibj] Make class variables private to match C++ (#6153) 2024-01-05 00:59:34 -08:00
m10653
13f4460e00 [docs] Add missing docs to enum fields (NFC) (#6150)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-01-04 21:36:26 -08:00
Tyler Veness
4210f5635d [docs] Fix warnings about undocumented default constructors (#6151) 2024-01-04 13:57:21 -08:00
Peter Johnson
0f060afb55 [ntcore] Disable WebSocket fragmentation (#6149)
There seems to be a latent bug in the fragmentation code that we've not
been able to isolate.
2024-01-04 12:09:31 -08:00
Tyler Veness
f29a7d2e50 [docs] Add missing JavaDocs (#6146) 2024-01-04 08:38:06 -08:00
Tyler Veness
6e58db398d [commands] Make Java fields private (#6148)
They were already private in C++ and probably shouldn't be exposed. This
also means we don't need to write redundant documentation for them.
2024-01-04 00:57:52 -08:00
Gold856
4ac0720385 [build] Clean up CMake files (#6141) 2024-01-04 00:47:47 -08:00
Tyler Veness
44db3e0ac0 [sysid] Make constexpr variables outside class scope inline (#6145) 2024-01-03 14:27:51 -08:00
Peter Johnson
73c7d87db7 [glass] NTStringChooser: Properly set retained (#6144) 2024-01-03 09:38:10 -08:00
David Vo
25636b712f [build] Remove unnecessary native dependencies in wpilibjExamples (#6143)
These dependencies don't have any JNI, so there's no need to link them.
2024-01-02 20:14:37 -08:00
m10653
01fb98baaa [docs] Add Missing JNI docs from C++ (NFC) (#6139) 2024-01-02 20:13:46 -08:00
David Vo
5c424248c4 [wpilibj] Remove unused AnalogTriggerException (#6142) 2024-01-02 20:10:51 -08:00
Tyler Veness
c486972c55 [wpimath] Make ExponentialProfile.State mutable (#6138)
It was already mutable in the C++ ExponentialProfile and
TrapezoidProfile in both languages.
2024-01-02 11:39:55 -08:00
David Vo
783acb9b72 [wpilibj] Store long preferences as integers (#6136) 2024-01-01 23:38:02 -08:00
m10653
99ab836894 [wpiutil] Add missing JavaDocs (NFC) (#6132) 2024-01-01 23:37:39 -08:00
Tyler Veness
ad0859a8c9 [docs] Add missing JavaDocs (#6125) 2024-01-01 22:56:23 -08:00
Gold856
5579219716 [docs] Exclude quickbuf files and proto/struct packages from doclint (#6128) 2024-01-01 21:23:09 -08:00
Tyler Veness
98f06911c7 [sysid] Use eigenvector component instead of eigenvalue for fit quality check (#6131)
They're usually close, but this is a better metric.
2024-01-01 21:22:34 -08:00
Braykoff
e1d49b975c [wpimath] Add LinearFilter reset() overload to initialize input and output buffers (#6133) 2024-01-01 21:20:53 -08:00
m10653
8a0bf2b7a4 [hal] Add CANAPITypes to java (#6121) 2024-01-01 16:51:17 -08:00
Tyler Veness
91d8837c11 [wpilib] Make protected fields in accelerometers/gyros private (#6134)
This avoids needing add redundant JavaDocs to them, and better reflects
how we design our modern classes (the classes modified here were around
with minimal changes since 2008 or so).
2024-01-01 16:49:50 -08:00
Tyler Veness
e7c9f27683 [wpilib] Add functional interface equivalents to MotorController (#6053)
This does not deprecate any current functionality, but prepares the way for future deprecation.

The drive classes now accept void(double) functions, which makes them more flexible.

The C++ API ended up a bit more verbose, but the Java API is really concise with method references, which is >80% of our userbase. For example:

`DifferentialDrive drive = new DifferentialDrive(m_leftMotor::set, m_rightMotor::set);`

Lambdas can be passed to interoperate with vendor motor controller APIs that don't have e.g., set(double), so CTRE doesn't have to maintain their WPI_ classes anymore.

MotorControllerGroup was replaced with PWMMotorController.addFollower() for PWM motor controllers. Users of CAN motor controllers should use their vendor's follower functionality.
2024-01-01 13:37:51 -08:00
m10653
8aca706217 [glass] Add type information to SmartDashboard menu (#6117) 2024-01-01 11:58:13 -08:00
sciencewhiz
7d3e4ddba9 [docs] Add warning about using user button to docs (NFC) (#6129) 2024-01-01 11:53:21 -08:00
Tyler Veness
ec3cb3dcba [build] Disable clang-tidy warning about test case names (#6127)
These are the warnings being disabled:
```
== clang-tidy /__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp ==
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:51:16: warning: avoid using "_" in test name "NonInvertibleA_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
   51 | TEST(DARETest, NonInvertibleA_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:67:16: warning: avoid using "_" in test name "NonInvertibleA_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
   67 | TEST(DARETest, NonInvertibleA_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:89:16: warning: avoid using "_" in test name "InvertibleA_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
   89 | TEST(DARETest, InvertibleA_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:101:16: warning: avoid using "_" in test name "InvertibleA_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  101 | TEST(DARETest, InvertibleA_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:118:16: warning: avoid using "_" in test name "FirstGeneralizedEigenvalueOfSTIsStable_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  118 | TEST(DARETest, FirstGeneralizedEigenvalueOfSTIsStable_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:132:16: warning: avoid using "_" in test name "FirstGeneralizedEigenvalueOfSTIsStable_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  132 | TEST(DARETest, FirstGeneralizedEigenvalueOfSTIsStable_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:151:16: warning: avoid using "_" in test name "IdentitySystem_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  151 | TEST(DARETest, IdentitySystem_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:163:16: warning: avoid using "_" in test name "IdentitySystem_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  163 | TEST(DARETest, IdentitySystem_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:176:16: warning: avoid using "_" in test name "MoreInputsThanStates_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  176 | TEST(DARETest, MoreInputsThanStates_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:188:16: warning: avoid using "_" in test name "MoreInputsThanStates_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  188 | TEST(DARETest, MoreInputsThanStates_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:201:16: warning: avoid using "_" in test name "QNotSymmetricPositiveSemidefinite_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  201 | TEST(DARETest, QNotSymmetricPositiveSemidefinite_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:210:16: warning: avoid using "_" in test name "QNotSymmetricPositiveSemidefinite_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  210 | TEST(DARETest, QNotSymmetricPositiveSemidefinite_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:220:16: warning: avoid using "_" in test name "RNotSymmetricPositiveDefinite_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  220 | TEST(DARETest, RNotSymmetricPositiveDefinite_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:232:16: warning: avoid using "_" in test name "RNotSymmetricPositiveDefinite_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  232 | TEST(DARETest, RNotSymmetricPositiveDefinite_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:245:16: warning: avoid using "_" in test name "ABNotStabilizable_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  245 | TEST(DARETest, ABNotStabilizable_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:254:16: warning: avoid using "_" in test name "ABNotStabilizable_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  254 | TEST(DARETest, ABNotStabilizable_ABQRN) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:264:16: warning: avoid using "_" in test name "ACNotDetectable_ABQR" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  264 | TEST(DARETest, ACNotDetectable_ABQR) {
      |                ^
/__w/allwpilib/allwpilib/wpimath/src/test/native/cpp/DARETest.cpp:273:16: warning: avoid using "_" in test name "ACNotDetectable_ABQRN" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
  273 | TEST(DARETest, ACNotDetectable_ABQRN) {
      |                ^
```
2023-12-31 23:25:05 -08:00
sciencewhiz
495585b25d [examples] Update april tag family to 36h11 (#6126)
Changes size to 6.5 inches per https://www.firstinspires.org/robotics/frc/blog/2023-technology-updates-past-present-future-and-beyond
Uses 7 error bit correction as recommended in PhotonVision docs.
2023-12-31 22:46:31 -08:00
Thad House
f9aabc5ab2 [wpilib] Throw early when EventLoop is modified while running (#6115) 2023-12-31 22:45:10 -08:00
m10653
c16946c0ec [hal] Add CANJNI docs (NFC) (#6120) 2023-12-31 22:44:27 -08:00
sciencewhiz
b7f4eb2811 [doc] Update maven artifacts for units and apriltags (NFC) (#6123) 2023-12-31 22:43:43 -08:00
sciencewhiz
f419a62b38 [doc] Update maintainers.md (NFC) (#6124)
Update third party artifacts
Update installer publishing
Fixes #6106
2023-12-31 22:43:20 -08:00
Joseph Eng
938bf45fd9 [wpiutil] Remove type param from ProtobufSerializable and StructSerializable (#6122) 2023-12-31 14:36:11 -08:00
Tyler Veness
c34debe012 [docs] Link to external OpenCV docs (#6119)
This avoids thousands of warnings from JavaDoc 17 parsing the OpenCV
source.
2023-12-30 21:09:07 -06:00
David Vo
07183765de [hal] Fix formatting of HAL_ENUM enums (NFC) (#6114) 2023-12-30 09:22:46 -06:00
Thad House
af46034b7f [wpilib] Document only first party controllers are guaranteed to have correct mapping (#6112) 2023-12-30 09:16:59 -06:00
Thad House
636ef58d94 [hal] Properly error check readCANStreamSession (#6108) 2023-12-29 23:57:00 -06:00
Thad House
cc631d2a69 [build] Fix generated source set location in the HAL (#6113) 2023-12-29 23:56:38 -06:00
Tyler Veness
09f76b32c2 [wpimath] Compile with UTF-8 encoding (#6111)
This allows using Greek letters in variable names, which is helpful to
make implemented equations follow their source paper more closely.
2023-12-29 23:56:06 -06:00
Tyler Veness
47c5fd8620 [sysid] Check data quality before OLS (#6110) 2023-12-29 23:31:27 -06:00
Thad House
24a76be694 [hal] Add method to detect if the CAN Stream has overflowed (#6105) 2023-12-29 09:10:48 -08:00
Thad House
9333951736 [hal] Allocate CANStreamMessage in JNI if null (#6107) 2023-12-29 00:50:57 -06:00
Peter Johnson
6a2d3c30a6 [wpiutil] Struct: Add info template parameter pack (#6086)
This allows using Struct in a dynamically typed environment by passing
additional information to the Struct serialization functions.
2023-12-27 09:52:18 -06:00
Tyler Veness
e07de37e64 [commands] Mark ParallelDeadlineGroup.setDeadline() final (#6102)
Suppress this-escape warning.
2023-12-27 09:51:16 -06:00
Gold856
141241d2d6 [wpilib] Fix usage reporting for static classes (#6090) 2023-12-26 23:16:55 -06:00
Tyler Veness
f2c2bab7dc [sysid] Fix adjusted R² calculation (#6101)
It hardcoded p to 2.
2023-12-26 22:06:10 -06:00
Peter Johnson
5659038443 [wpiutil,cscore,apriltag] Fix RawFrame (#6098) 2023-12-26 22:05:02 -06:00
Joseph Eng
8aeee03626 [commands] Improve error message when composing commands twice in same composition (#6091)
Also disallow deadline command from also appearing in other commands.
2023-12-26 18:07:16 -08:00
Peter Johnson
55508706ff [wpiutil,cscore] Move VideoMode.PixelFormat to wpiutil (#6097)
This tracks the RawFrame move.
2023-12-26 16:47:17 -06:00
Bryce Roethel
ab78b930e9 [wpilib] ADIS16470: Add access to all 3 axes (#6074) 2023-12-26 13:39:37 -08:00
Tyler Veness
795d4be9fd [wpilib] Fix precision issue in Color round-and-clamp (#6100) 2023-12-26 13:38:15 -08:00
Joseph Eng
7aa9ad44b8 [commands] Deprecate C++ TransferOwnership() (#6095)
It has been completely replaced with ToPtr().
2023-12-26 15:14:34 -06:00
David Vo
92c81d0791 [ci] Update pregenerate workflow to actions/checkout@v4 (#6094) 2023-12-25 08:03:03 -06:00
David Vo
1ce617be07 [ci] Update artifact actions to v4 (#6092) 2023-12-24 11:51:53 -06:00
sciencewhiz
2441b57156 [wpilib] Add PWMSparkFlex MotorController (#6089) 2023-12-24 01:47:38 -06:00
Peter Johnson
21d1972d7a [wpiutil] DataLog: Ensure file is written on shutdown (#6087)
Previously the thread could end without the file being written.
2023-12-23 15:40:51 -06:00
Peter Johnson
c29e8c66cf [wpiutil] DataLog: Fix UB in AppendImpl (#6088) 2023-12-23 15:39:39 -06:00
truher
ab309e34ef [glass] Fix order of loading window settings (#6056) 2023-12-23 13:12:09 -08:00
Tyler Veness
22a322c9f3 [wpimath] Report error on negative PID gains (#6055)
Defaults PID gains to zero if any are invalid.
2023-12-23 12:15:29 -08:00
Asa Anderson
1dba26c937 [wpilib] Add method to get breaker fault at a specific channel in PowerDistribution[Sticky]Faults (#5521)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-12-23 12:14:13 -08:00
Ryan Blue
ef1cb3f41e [commands] Fix compose-while-scheduled issue and test all compositions (#5581) 2023-12-23 12:12:13 -08:00
Peter Johnson
aeb1a4aa33 [wpiutil] Add serializable marker interfaces (#6060) 2023-12-23 08:20:26 -08:00
NC GEARS FRC 1918
c1178d5add [wpilib] Add StadiaController and command wrapper (#6083) 2023-12-23 08:15:05 -08:00
ncorrea210
4e4a468d4d [wpimath] Make feedforward classes throw exceptions for negative Kv or Ka (#6084) 2023-12-23 08:12:46 -08:00
swirl
d1793f077d [build] cmake: Add NO_WERROR option to disable -Werror (#6071) 2023-12-22 14:38:38 -06:00
m10653
43fb6e9f87 [glass] Add Profiled PID controller support & IZone Support (#5959) 2023-12-22 11:29:25 -08:00
Drew Williams
bcef6c5398 [apriltag] Fix Java generation functions (#6063) 2023-12-22 11:03:02 -08:00
Ryan Blue
4059e0cd9f [hal,wpilib] Add function to control "Radio" LED (#6073) 2023-12-22 10:57:52 -08:00
Ryan Blue
0b2cfb3abc [dlt] Change datalogtool default folder to logs folder (#6079)
Also fix straggling documentation.
2023-12-22 10:54:17 -08:00
Tyler Veness
df5e439b0c [wpilib] PS4Controller: enable usage reporting (#6081) 2023-12-22 12:33:03 -06:00
Thad House
0ff7478968 [cscore] Fix RawFrame class not being loaded in JNI (#6077) 2023-12-21 19:58:12 -06:00
sciencewhiz
6f23d32fe1 [wpilib] AddressableLED: Update warning about single driver (NFC) (#6069)
Say that multiple strips can be used in series.
2023-12-20 22:32:16 -06:00
Isaac Turner
35a1c52788 [build] Upgrade quickbuf to 1.3.3 (#6072) 2023-12-20 22:30:45 -06:00
Tyler Veness
e4e2bafdb1 [sysid] Document timestamp units (#6065) 2023-12-19 22:37:41 -08:00
Peter Johnson
3d201c71f7 [ntcore] Fix overlapping subscriber handling (#6067) 2023-12-19 22:37:16 -08:00
Peter Johnson
f02984159f [glass] Check for null entries when updating struct/proto (#6059) 2023-12-18 11:31:08 -08:00
Eli Barnett
a004c9e05f [commands] SubsystemBase: allow setting name in constructor (#6052) 2023-12-16 11:05:53 -08:00
Tyler Veness
0b4c6a1546 [wpimath] Add more docs to SimulatedAnnealing (NFC) (#6054) 2023-12-16 11:03:54 -08:00
Tyler Veness
ab15dae887 [wpilib] ArcadeDrive: Fix max output handling (#6051) 2023-12-15 09:18:45 -08:00
Guinea Wheek
9599c1f56f [hal] Add usage reporting ids from 2024v2 image (#6041) 2023-12-14 20:53:40 -08:00
Gold856
f87c64af8a [wpimath] MecanumDriveWheelSpeeds: Fix desaturate() (#6040) 2023-12-14 20:52:45 -08:00
ncorrea210
8798700cec [wpilibcExamples] Add inline specifier to constexpr constants (#6049) 2023-12-14 20:52:02 -08:00
Thad House
85c9ae6eff [wpilib] Fix PS5 Controller mappings (#6050) 2023-12-14 20:51:32 -08:00
Thad House
7c8b7a97ad [wpiutil] Zero out roborio system timestamp (#6042)
There was also an issue where the clock zero offset would be incorrect due to the system time updating. This solves that issue for the Rio.
2023-12-13 15:20:24 -08:00
Peter Johnson
d9b504bc84 [wpilib] DataLogManager: Change sim location to logs subdir (#6039) 2023-12-11 20:21:06 -08:00
Peter Johnson
906b810136 [build] cmake: Fix ntcore generated header install (#6038) 2023-12-11 20:02:29 -08:00
Thad House
56e5b404d1 Update to final 2024 V2 image (#6034)
Update myRobot java command args
2023-12-10 23:52:28 -08:00
Joseph Eng
8723ee5c39 [ntcore] Add cached topic property (#5494) 2023-12-10 23:23:36 -08:00
Tyler Veness
192a28af47 Fix JDK 21 warnings (#6028) 2023-12-09 21:45:02 -08:00
Tyler Veness
d40bdd70ba [build] Upgrade to spotbugs Gradle plugin 6.0.2 (#6027) 2023-12-09 15:34:29 -08:00
Isaac Turner
7bfadf32e5 [wpilibj] Joystick: make remainder of get axis methods final (#6024) 2023-12-09 09:47:10 -08:00
Starlight220
a770110438 [commands] CommandCompositionError: Include stacktrace of original composition (#5984) 2023-12-09 09:45:02 -08:00
Thad House
54a55b8b53 [wpiutil,hal] Update image; init Rio Now() HMB with a FPGA session (#6016) 2023-12-08 23:22:59 -08:00
Tyler Veness
7d4e515a6b [wpimath] Simplify calculation of C for DARE precondition (#6022) 2023-12-08 20:25:03 -08:00
Peter Johnson
5200316c14 [ntcore] Update transmit period on topic add/remove (#6021)
- Correctly handle the first subscription being a send all
- Don't restart outgoing timer if period didn't change
2023-12-08 14:19:18 -08:00
Sam Carlberg
ddf79a25d4 [wpiunits] Overload Measure.per(Time) to return Measure<Velocity> (#6018)
As opposed to returning Measure<Per<U, Time>>
Now matches the overload on Unit
2023-12-08 13:39:28 -08:00
Tyler Veness
a71adef316 [wpiutil] Clean up circular_buffer iterator syntax (#6020) 2023-12-08 13:38:56 -08:00
Elliot Scher
39a0bf4b98 [examples] Call resetOdometry() when controller command is executed (#5905)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-12-06 22:14:54 -08:00
Gold856
f5fc101fda [build] cmake: Export jars and clean up jar installs (#6014) 2023-12-06 18:28:38 -08:00
Isaac Turner
38bf024c96 [build] Update to Gradle 8.5 (#6007) 2023-12-06 09:29:41 -08:00
Ashray._.g
9d11544c18 [wpimath] Rotate traveling salesman solution so input and solution have same initial pose (#6015) 2023-12-05 23:21:28 -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
Gold856
c2971c0bb3 [build] cmake: Export apriltag and wpimath (#6012) 2023-12-05 13:31:27 -08:00
Peter Johnson
41cfc961e4 gitattributes: Add linguist-generated locations (#6004) 2023-12-05 13:30:54 -08:00
Joseph Eng
14c3ade155 [wpimath] Struct cleanup (#6011) 2023-12-04 22:40:18 -08:00
Tyler Veness
90757b9e90 [wpilib] Make Color::HexString() constexpr (#5985)
Related improvements to wpi::ct_string:
* Implicitly convert to std::string
* Add operator== for std::string, std::string_view, and const Char*
2023-12-04 21:20:49 -08:00
PJ Reiniger
2676b77873 Fix compilation issues that occur when building with bazel (#6008) 2023-12-04 21:18:26 -08:00
ncorrea210
d32c10487c [examples] Update C++ examples to use CommandPtr (#5988)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-12-03 21:39:29 -08:00
Peter Johnson
9bc5fcf886 [build] cmake: Default WITH_JAVA_SOURCE to WITH_JAVA (#6005) 2023-12-03 20:14:34 -08:00
Tyler Veness
d431abba3b [upstream_utils] Fix GCEM namespace usage and add hypot(x, y, z) (#6002) 2023-12-03 16:40:08 -08:00
Tyler Veness
2bb1409b82 Clean up Java style (#5990)
Also make equivalent changes in C++ where applicable.

Co-authored-by: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com>
2023-12-03 16:21:32 -08:00
Gold856
66172ab288 Remove submodule (#6003) 2023-12-03 16:18:45 -08:00
Tyler Veness
e8f8c0ceb0 [upstream_utils] Update to latest Eigen HEAD (#5996)
There hasn't been a release in 2.5 years.

There's performance improvements for some NEON instructions, UB fixes, a lot of internal cleanup with the jump from C++11 to C++14, and more constexpr.
2023-12-03 16:18:19 -08:00
Gold856
890992a849 [hal] Commit generated usage reporting files (#5993) 2023-12-03 15:53:24 -08:00
Peter Johnson
a583ca01e1 [wpiutil] Change Struct to allow non-constexpr implementation (#5992)
This required changing the constant values (e.g. kSize) into functions
(e.g. GetSize()).

Fixed implementations of ForEachNested to be inline (as these are actually
templates).

Also added a ntcore Struct test.
2023-12-02 23:36:44 -08:00
Tyler Veness
ca272de400 [build] Fix Gradle compile_commands.json and clang-tidy warnings (#5977) 2023-12-02 21:20:43 -08:00
Peter Johnson
76ae090570 [wpiutil] type_traits: Add is_constexpr() (#5997) 2023-12-02 20:54:22 -08:00
Starlight220
5172ab8fd0 [commands] C++ CommandPtr: Prevent null initialization (#5991) 2023-12-02 16:45:04 -08:00
Tyler Veness
96914143ba [build] Bump native-utils to fix compile_commands.json (#5989) 2023-12-01 23:08:47 -08:00
Austin Shalit
464e6121ef [ci] Report failed status to Azure on failed tests (#2654) 2023-12-01 20:53:57 -08:00
PJ Reiniger
5dad46cd45 [wpimath] Commit generated files (#5986) 2023-12-01 20:52:38 -08:00
PJ Reiniger
54ab65a63a [ntcore] Commit generated files (#5962) 2023-12-01 15:31:06 -08:00
Sriman Achanta
7ed900ae3a [wpilib] Add hex string constructor to Color and Color8Bit (#5063)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-12-01 10:26:58 -08:00
Tyler Veness
74b85b76a9 [wpimath] Make gcem call std functions if not constant-evaluated (#5983)
The one exception is macOS, which doesn't support std::beta().
2023-12-01 09:08:04 -08:00
Tyler Veness
30816111db [wpimath] Fix TimeInterpolatableBuffer crash (#5972)
Don't decrement buffer iterator if it's at the beginning of the
container.
2023-11-30 23:18:38 -08:00
Peter Johnson
5cc923de33 [wpilib] DataLogManager: Use logs subdirectory on USB drives (#5975) 2023-11-30 23:13:51 -08:00
Ryan Blue
1144115da0 [commands] Add GetName to Subsystem, use in Scheduler tracer epochs (#5836) 2023-11-30 23:10:53 -08:00
Tyler Veness
ac7d726ac3 [wpimath] Add simulated annealing (#5961)
Co-authored-by: Ashray._.g <ashray.gupta@gmail.com>
2023-11-30 22:57:50 -08:00
Tyler Veness
e09be72ee0 [wpimath] Remove unused SimpleMatrixUtils class (#5979)
It looks like it was gradually replaced by JNI wrappers around Eigen.
2023-11-30 21:12:43 -08:00
Tyler Veness
0f9ebe92d9 [wpimath] Add generic circular buffer class to Java (#5969)
The original is now called DoubleCircularBuffer.
2023-11-30 21:12:23 -08:00
David Vo
9fa28eb07a [ci] Bump actions/checkout to v4 (#5736)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-11-30 21:09:56 -08:00
Thad House
ca684ac207 [hal] Add capability to read power distribution data as a stream (#4983) 2023-11-30 21:09:14 -08:00
Prateek Machiraju
51eecef2bd [wpimath] Optimize 2nd derivative of quintic splines (#3292)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-11-30 21:07:52 -08:00
Gold856
4fcf0b25a1 [build] Apply a formatter for CMake files (#5973) 2023-11-30 16:52:21 -08:00
Tyler Veness
9b8011aa67 [build] Pin wpiformat version (#5982) 2023-11-30 13:37:07 -08:00
swirl
e00a0e84c1 [build] cmake: fix protobuf dependency finding for certain distributions (#5981) 2023-11-30 13:36:41 -08:00
Tyler Veness
23dd591394 [upstream_utils] Remove libuv patch that adjusts whitespace (#5976) 2023-11-29 12:22:28 -08:00
Peter Johnson
b0719942f0 [wpiutil] Timestamp: Report errors on Rio HMB init failure (#5974) 2023-11-29 10:10:07 -08:00
Tyler Veness
7bc89c4322 [wpilib] Update getAlliance() docs (NFC) (#5971)
kInvalid was replaced with an optional.
2023-11-28 10:03:12 -08:00
Tyler Veness
841ea682d1 [upstream_utils] Upgrade to LLVM 17.0.5 (#5970) 2023-11-28 10:01:48 -08:00
Joseph Farkas
a74db52dae [cameraserver] Add getVideo() pixelFormat overload (#5966) 2023-11-27 09:51:42 -08:00
Thad House
a7eb422662 [build] Update native utils for new compile commands files (#5968) 2023-11-27 09:47:49 -08:00
Tyler Veness
544b231d4d [sysid] Add missing cassert include (#5967) 2023-11-26 21:01:40 -08:00
Tyler Veness
31cd015970 [wpimath] Add SysId doc links to LinearSystemId in C++ (NFC) (#5960)
They already exist in Java.
2023-11-24 23:46:09 -08:00
Thad House
9280054eab Revert "[build] Export wpimath protobuf symbols (#5952)"
This reverts commit c80b2d2017.
2023-11-23 22:40:47 -08:00
Thad House
2aba97c610 Export pb files from wpimath 2023-11-23 22:40:47 -08:00
Peter Johnson
c80b2d2017 [build] Export wpimath protobuf symbols (#5952) 2023-11-23 11:27:54 -08:00
Tyler Veness
3c0652c18a [cscore] Replace CS_PixelFormat with WPI_PixelFormat (#5954)
This fixes a compilation error introduced by #5923.
2023-11-23 11:27:30 -08:00
Andrew Gasser
95716eb0cb [wpiunits] Documentation improvements (#5932) 2023-11-23 10:57:58 -08:00
Starlight220
423fd75fa8 [wpilib] Default LiveWindowEnabledInTest to false (#5950) 2023-11-23 10:56:47 -08:00
Tyler Veness
dfdea9c992 [wpimath] Make KalmanFilter variant for asymmetric updates (#5951) 2023-11-23 10:56:15 -08:00
Drew Williams
ca81ced409 [wpiutil] Move RawFrame to wpiutil; add generation of RawFrame for AprilTags (#5923) 2023-11-23 10:55:10 -08:00
Joseph Farkas
437cc91af5 [cscore] CvSink: Allow specifying output PixelFormat (#5943) 2023-11-22 11:35:42 -08:00
Gold856
25b7dca46b [build] Remove CMake flat install option (#5944) 2023-11-21 11:48:32 -08:00
PJ Reiniger
bb05e20247 [wpimath] Add protobuf/struct for trivial types (#5935)
This implements de/serialization for the types that aren't templated (SwerveDriveKinematics) in C++ or where there is no trivial way to go round-trip (Splines) for the messages.
2023-11-21 10:14:06 -08:00
PJ Reiniger
35744a036e [wpimath] Move struct/proto classes to separate files (#5918)
Also add unit tests.
2023-11-21 10:11:57 -08:00
Ryan Blue
80d7ad58ea [build] Declare platform launcher dependency explicitly (#5909) 2023-11-21 10:09:20 -08:00
Peter Johnson
f8d983b154 [ntcore] Protobuf/Struct: Use atomic_bool instead of atomic_flag (#5946)
Some older compilers don't have atomic_flag::test().
2023-11-21 09:57:55 -08:00
Peter Johnson
4a44210ee3 [ntcore] NetworkTableInstance: Suppress unused lambda capture warning (#5947)
Clang warns that the "this" capture is not required, even though a
member function is being called.
2023-11-21 09:45:16 -08:00
Peter Johnson
bdc8620d55 [upstream_utils] Fix fmt compilation errors on Windows (#5948)
Using `this->` in decltype doesn't work in the latest MSVC.
2023-11-21 08:16:30 -08:00
Sam Carlberg
0ca1e9b5f9 [wpimath] Add basic wpiunits support (#5821)
To reduce the need for users to manually perform unit conversions, this allows Measure objects from wpiunits to be passed into most places in wpimath that currently expect doubles in terms of SI units like meters.

For example, users would need to know that unit conversion is required - and what the correct units are. Using units would be more difficult to write code for than just hardcoding a value or using Units.inchesToMeters.

Now, using units has no more developer overhead than using raw numbers.
2023-11-17 10:45:04 -06:00
Peter Johnson
cc30824409 [ntcore] Increase client meta-topic decoding limit (#5934) 2023-11-17 10:42:09 -06:00
Tyler Veness
b1fad062f7 [wpilib] Use RKDP in DifferentialDrivetrainSim (#5931) 2023-11-17 10:41:18 -06:00
Peter Johnson
ead9ae5a69 [build] Add generateProto dependency to test and dev (#5933) 2023-11-17 10:39:28 -06:00
Peter Johnson
cfbff32185 [wpiutil] timestamp: Fix startup race on Rio (#5930)
Note this doesn't use a full mutex, so there is still a shutdown race.
2023-11-15 21:58:51 -08:00
Tyler Veness
7d90d0bcc3 [wpimath] Clean up StateSpaceUtil (#5891) 2023-11-15 21:13:12 -08:00
Peter Johnson
7755e45aac [build] Add generated protobuf headers to C++ test include path (#5926) 2023-11-15 21:05:04 -08:00
Matt
3985c031da [ntcore] ProtobufSubscriber: Fix typos (#5928) 2023-11-15 05:20:40 -08:00
Peter Johnson
7a87fe4b60 [ntcore] ProtobufSubscriber: Make mutex and msg mutable (#5927) 2023-11-14 21:07:38 -08:00
DeltaDizzy
09f3ed6a5f [commands] Add static Trigger factories for robot mode changes (#5902) 2023-11-14 15:54:43 -08:00
Joseph Eng
79dd795bc0 [wpimath] Clean up VecBuilder and MatBuilder (#5906) 2023-11-14 12:23:50 -08:00
Peter Johnson
e117274a67 [wpilib] Change default Rio log dir from /home/lvuser to /home/lvuser/logs (#5899) 2023-11-14 12:20:51 -08:00
Tyler Veness
a8b80ca256 [upstream_utils] Update to libuv 1.47.0 (#5889) 2023-11-14 12:12:56 -08:00
Tyler Veness
b3a9c3e96b [build] Bump macOS deployment target to 12 (#5890) 2023-11-14 08:26:21 -08:00
Peter Johnson
0f8129677b [build] Distribute wpimath protobuf headers (#5925) 2023-11-13 19:50:42 -08:00
Peter Johnson
d105f9e3e9 [wpiutil] ProtobufBuffer: Fix buffer reallocation (#5924) 2023-11-13 15:49:41 -08:00
sciencewhiz
c5f2f6a0fb [fieldImages] Fix typo in field images artifact name (#5922)
Nothing appears to be using the existing name
2023-11-12 23:16:52 -08:00
Tyler Veness
c1a57e422a [commands] Clean up make_vector.h (#5917) 2023-11-12 20:23:34 -08:00
DeltaDizzy
78ebc6e9ec [wpimath] change G to gearing in LinearSystemId factories (#5834) 2023-11-12 20:22:39 -08:00
Isaac Turner
9ada181866 [hal] DriverStation.h: Add stddef.h include (#5897) 2023-11-11 21:30:23 -08:00
Peter Johnson
95fa5ec72f [wpilibc,ntcoreffi] DataLogManager: join on Stop() call (#5910)
This ensures the thread has finished prior to returning from Stop().
2023-11-10 21:03:30 -08:00
Ryan Blue
b6f2d3cc14 [build] Remove usage of Version.parse (#5911) 2023-11-10 21:02:08 -08:00
Elliot Scher
cc2cbeb04c [examples] Replace gyro rotation with poseEstimator rotation (#5900) 2023-11-10 15:12:54 -08:00
Tyler Veness
fa6b171e1c [wpiutil] Suppress protobuf warning false positives on GCC 13 (#5907) 2023-11-10 15:12:18 -08:00
Gold856
d504639bbe [apriltag] Improve AprilTag docs (#5895) 2023-11-08 12:48:52 -08:00
Tyler Veness
3a1194be40 Replace static_cast<void>() with [[maybe_unused]] attribute (#5892)
This clarifies intent. Not done for thirdparty libraries or
structured binding variables.
2023-11-08 12:47:23 -08:00
swirl
70392cbbcb [build] cmake: Add protobuf dependency to wpiutil-config (#5886)
Signed-off-by: swirl <swurl@swurl.xyz>
2023-11-06 12:47:35 -08:00
Peter Johnson
17c1bd5a83 [ntcore] Use json_fwd (#5881)
Also fix ProtobufEntry construction.
2023-11-05 09:55:40 -08:00
Peter Johnson
e69a9efeba [wpilibcExamples] Match array parameter bounds (#5880)
Required by newer versions of clang.
2023-11-04 23:55:13 -07:00
Peter Johnson
14dcd0d26f Use char instead of uint8_t for json::parse (#5877)
The uint8_t usage causes warnings on newer clang versions.

Add GetCharBuffer() to MemoryBuffer classes to make this easy.
2023-11-04 22:18:42 -07:00
Thad House
ec1d261984 [hal] Fix garbage data for match info before DS connection (#5879)
NetComm writes garbage data before the DS connects. Make sure this doesn't make it up to the user.
2023-11-04 22:15:24 -07:00
Peter Johnson
63dbf5c614 [wpiutil] MemoryBuffer: Fix normal read and file type check (#5875) 2023-11-04 18:41:39 -07:00
Peter Johnson
b2e7be9250 [ntcore] Only datalog meta-topics if specifically requested (#5873) 2023-11-04 18:40:52 -07:00
Tyler Veness
201a42a3cd [wpimath] Reorder TrapezoidProfile.calculate() arguments (#5874)
ProfiledPIDController and ExponentialProfile use current, then goal.
This isn't a breaking change because this overload of calculate() is
new for 2024.
2023-11-04 16:28:55 -07:00
Drew Williams
04a781b4d7 [apriltag] Add GetTags to C++ version of AprilTagFieldLayout (#5872) 2023-11-04 10:26:07 -07:00
Ryan Blue
87a8a1ced4 [docs] Exclude eigen and protobuf from doxygen (#5871)
They take up a significant portion of the generated output (protobuf ~55MB, eigen ~119MB).
2023-11-04 07:54:48 -07:00
Peter Johnson
f1a82828fe [wpiutil] Add DataLog and DataLogManager Stop() (#5860)
Restarting a stopped log results in creating a new log file with fresh copies of the same start records and schema data records.

Also check to see if the file has been deleted or if the log file exceeds 1.8 GB, and start a new one.
2023-11-03 20:34:43 -07:00
Ryan Blue
2a04e12c6f [apriltag] AprilTagFieldLayout: Add accessors for origin and field dimensions (#5869) 2023-11-03 20:24:23 -07:00
Ryan Blue
33e0089afb Cleanup usages of std::function<void(void)> (#5864) 2023-11-03 18:22:47 -07:00
Ryan Blue
d06fa633d5 [build] Fix protobuf generation when building with make (#5867) 2023-11-03 18:22:34 -07:00
Ryan Blue
049732afb8 [cscore] Make camera connection logging clearer (#5866) 2023-11-03 16:03:23 -07:00
Bryce Roethel
87f7c19f90 [wpimath] Make InterpolatingDoubleTreeMap constructor public (#5865) 2023-11-03 15:34:14 -07:00
Tyler Veness
6b53ef47cf [wpimath] Don't recreate TrapezoidProfile in ProfiledPIDController calculate() (#5863) 2023-11-03 15:21:58 -07:00
shueja-personal
8a3a268ae6 [commands] Add finallyDo with zero-arg lambda (#5862) 2023-11-03 15:21:21 -07:00
Tyler Veness
1c35d42cd0 [wpilib] Pop diagnostic for deprecated function use (#5859) 2023-11-03 08:34:08 -07:00
narmstro2020
ddc8db6c26 [wpimath] Add feedforward constant constructor to ElevatorSim (#5823)
Adds a subclass of ElevatorSim that uses kG, kV, and kA from sysId to simulate an Elevator.
2023-11-02 09:10:57 -07:00
Tyler Veness
c6aff2c431 [upstream_utils] Update to LLVM 17.0.4 (#5855) 2023-11-01 16:45:32 -07:00
Peter Johnson
a9c5b18a39 [build] Update OpenCV to 2024-4.8.0-2 (#5854)
This fixes rpath on cross-build targets to properly include $ORIGIN.
2023-11-01 09:45:40 -07:00
Kevin-OConnor
9540b6922d [hal] Add CAN IDs for AndyMark and Vivid Hosting (#5852) 2023-10-31 15:59:42 -07:00
Peter Johnson
83a7d33c47 [glass] Improve display of protobuf/struct type strings (#5850) 2023-10-30 20:29:29 -07:00
Ryan Blue
a4a8ad9c75 [commands] Make Java SelectCommand generic (#5849)
This allows users to use any type of map and selector without needing to explicitly match
Map<Object, Command>
2023-10-30 11:09:14 -07:00
Gold856
9eecf2a456 [build] Add CMake option to build Java sources jars (#5768) 2023-10-30 09:57:28 -07:00
David Baucum
9536a311cb [wpilib] Add support for the PS5 DualSense controller (#5257)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-10-30 08:25:16 -07:00
Dustin Spicuzza
8d5e6737fc [wpilibc] SolenoidSim: Add virtual destructor (#5848) 2023-10-30 08:24:11 -07:00
Peter Johnson
07e13d60a2 [ntcore] Fix write_impl (#5847)
The previous fix didn't handle all cases correctly. Instead, add a new
function to raw_ostream (SetNumBytesInBuffer) to allow always using the
full buffer size, and revamp write_impl to more cleanly handle all
cases.
2023-10-30 08:23:33 -07:00
Peter Johnson
1713386869 [wpiutil] ProtobufMessageDatabase: Fix out-of-order Add() rebuild (#5845) 2023-10-29 16:50:01 -07:00
Peter Johnson
35472f5fc9 [ntcore] Fix a use-after-free in client close (#5844) 2023-10-29 16:49:45 -07:00
Peter Johnson
ed168b522c [ntcore] Disable buf pool when asan is enabled (#5843)
This helps asan catch more errors.
2023-10-29 16:49:31 -07:00
Peter Johnson
3e7ba2cc6f [wpinet] WebSocket: Fix write behavior (#5841)
On Windows, TryWrite will always return 0 if there is a Write in progress. The previous behavior for SendFrames and SendControl just used a normal Write, which caused issues with code that combined these with TrySendFrames. Instead, have SendFrames and SendControl also use TryWrite under the hood if possible, and create write requests if not. The implementation preserves the priority of SendControl against an existing write request with multiple frames.
2023-10-29 16:48:25 -07:00
Gold856
80c47da237 [sim] Disable the robot program when DS disconnects (#5818) 2023-10-28 10:10:23 -07:00
sciencewhiz
abe1cec90c [wpilib] Update Usage Reporting ResourceType from NI Libraries (#5842)
Disable PS4 controller reporting until added by NI
2023-10-27 20:21:46 -07:00
Oliver
cdf981abba [glass] Fix position of data type in NT view (#5840) 2023-10-27 17:41:42 -07:00
Thad House
04dcd80adb [build] Publish unit tests for examples (#5838) 2023-10-27 16:57:38 -07:00
Jordan McMichael
49920234ac [build] Fix checkstyle rules to allow Windows paths (#5839) 2023-10-27 16:56:58 -07:00
Ryan Blue
366b715942 [wpilib] Fix SendableChooser test (#5835)
Using unique NT keys for each test seems to resolve the failure on Linux. Changed Java as well, for completeness.
2023-10-26 20:47:04 -07:00
Ryan Blue
3ba501f947 [commands] Java: Fix CommandXboxController.leftTrigger() parameter order (#5831) 2023-10-26 19:18:36 -07:00
Tyler Veness
ec569a58ef [wpimath] Make KalmanTypeFilter interface public (#5830) 2023-10-26 19:18:02 -07:00
Peter Johnson
b91317fd36 [wpiutil] DataLog.addSchema(): Don't add into a set view (#5829) 2023-10-26 19:17:47 -07:00
Peter Johnson
2ab4fcbc24 [wpiutil] ProtobufMessageDatabase: Clear messages first (#5827)
The message destructor appears to call something on the descriptor.
2023-10-26 19:17:29 -07:00
Tyler Veness
98c14f1692 [wpimath] Add EKF/UKF u-y-R correct overload (#5832)
Also clean up comments on other overloads and fix a typo.
2023-10-26 19:17:15 -07:00
Ryan Blue
60bcdeded9 [ci] Disable java in sanitizer builds (#5833) 2023-10-26 19:16:58 -07:00
Ryan Blue
c87f8fd538 [commands] Add DeferredCommand (#5566)
Allows commands to be constructed at runtime without proxying.
2023-10-26 19:16:33 -07:00
Ryan Blue
ad80eb3a0b [ci] Update actions for comment-command (#5824) 2023-10-25 14:33:22 -07:00
Peter Johnson
c7d6ad5a0b [ntcore] WebSocketConnection: Use weak capture (#5822)
Fixes a potential use-after-free on connection close.
2023-10-25 10:22:43 -07:00
Zhiquan Yeo
8a8e220792 [simgui] Add 'Invalid' option for AllianceStation (#5820) 2023-10-24 11:51:39 -07:00
Gold856
cfc6a47f76 [sim] DS plugin: Fix off-by-one error when setting alliance station (#5819) 2023-10-24 09:15:40 -07:00
Peter Johnson
8efa586ace [ntcore] Don't check type string on publishing an entry (#5816)
Only check the raw type value.
2023-10-24 00:12:02 -07:00
Peter Johnson
23ea188e60 [glass] Add protobuf decode error log message (#5812) 2023-10-23 23:36:23 -07:00
Ryan Blue
928e87b4f4 [build] Add combined test meta-task (#5813) 2023-10-23 23:35:44 -07:00
Benjamin Hall
63ef585d4b [wpiutil] Fix compilation of MathExtras.h on Windows with /sdl (#5809)
Fix copied from the LLVM main branch.
2023-10-23 21:35:13 -07:00
Ryan Blue
b03a7668f9 [build] Windows CMake/vcpkg fixes (#5807)
- Add builtin registry baseline (fixes building locally with msvc builtin vcpkg)
- Add protobuf as an explicit dependency (previously was installed as a dependency of opencv)
- In windows CI, checkout repository before running vcpkg (silences warning that vcpkg.json was not found)
2023-10-23 21:33:28 -07:00
Thad House
3f08bcde54 [hal] Fix HAL AllianceStation on rio (#5811) 2023-10-23 21:32:21 -07:00
Peter Johnson
196d963dc4 [ntcore] Fix off-by-one error in stream write (#5810) 2023-10-23 21:31:36 -07:00
sciencewhiz
f4cbcbc984 Fix typos (NFC) (#5804) 2023-10-23 09:15:58 -07:00
Thad House
ec0f7fefb0 [myrobot] Update the myRobot JRE (#5805) 2023-10-23 09:14:50 -07:00
Jonah
3d618bdbfd [wpiutil] Fix Java struct array unpacking (#5801) 2023-10-21 20:13:50 -07:00
Peter Johnson
1fa7445667 [ntcore] Check for valid client in incoming text and binary (#5799) 2023-10-20 23:25:05 -07:00
Ryan Blue
269b9647da [ci] Update JDK for combine step (#5794)
Also frees disk space from the combiner step.
2023-10-20 18:18:04 -07:00
Tyler Veness
bee32f080e [docs] Add wpiunits to JavaDocs (#5793)
Co-authored-by: Sam Carlberg <sam.carlberg@gmail.com>
2023-10-20 18:14:14 -07:00
Peter Johnson
25dad5a531 [wpinet] TCPConnector_parallel: Don't use thread_local (#5791)
Thread_local causes issues with LabVIEW, which makes calls on a thread
pool.
2023-10-20 16:45:07 -07:00
Tyler Veness
4a93581f1a [build] cmake: use default library type for libglassnt, libglass, wpigui, and imgui (#5797)
On Windows, imgui and wpigui need to be static.  On Mac, they must be dynamic.
2023-10-20 16:44:26 -07:00
Ryan Blue
abb2857e03 [wpilib] Counter: Fix default distance per pulse, add distance and rate to C++ (#5796)
- Default distance per pulse in java was 0; 1 is a more reasonable default
- C++ was missing this functionality
2023-10-19 23:42:53 -07:00
Peter Johnson
b14a61e1c0 [readme] Add link to QuickBuffers release page (#5795) 2023-10-19 22:07:40 -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
Jordan McMichael
ecb7cfa9ef [wpimath] Add Exponential motion profile (#5720) 2023-10-19 17:26:32 -07:00
Peter Johnson
7c6fe56cf2 [ntcore] Fix crash on disconnect (#5788)
The object was being destroyed due to the error handling path.
Instead, defer to the next loop cycle using a one-shot timer.

Properly handle error return values from Send functions.

Fix UB in accessing one past the end of a vector.
2023-10-19 14:36:22 -07:00
Peter Johnson
85147bf69e [wpinet] WebSocketSerializer: Fix UB (#5787) 2023-10-19 00:14:23 -07:00
Peter Johnson
244163acad [wpinet] uv::Stream::TryWrite(): Return 0 on EAGAIN (#5784)
EAGAIN is a normal return value, but we want to just map it to 0 rather than handling it as an error.
2023-10-19 00:12:34 -07:00
Gold856
820728503d [hal] Remove extra semicolon in RoboRioData (#5786) 2023-10-18 23:12:05 -07:00
Tyler Veness
45f307d87e [upstream_utils] Upgrade to LLVM 17.0.3 (#5785) 2023-10-18 19:18:35 -07:00
Peter Johnson
4ce4d63efc [wpilibj] Fix RobotBase.isSimulation() (#5783)
#3534 changed it from returning !isReal() to checking against a numeric value, but #3565 (merged earlier) had changed the value to an enum.
2023-10-18 14:15:35 -07:00
Ryan Blue
579007ceb3 [commands] Add requirements parameter to Commands.idle() (#5774) 2023-10-17 19:52:48 -07:00
Tyler Veness
3f3a169149 [wpilib] Make physics sim setState() functions public (#5779) 2023-10-17 19:52:02 -07:00
Tyler Veness
7501e4ac88 [wpilib] Close sim device in ADIS IMUs (#5776)
Fixes #5775.
2023-10-17 19:51:35 -07:00
Tyler Veness
99630d2e78 [wpimath] Upgrade to EJML 0.43.1 (#5778)
https://github.com/lessthanoptimal/ejml/blob/v0.43.1/change.txt
2023-10-17 19:51:17 -07:00
Tyler Veness
02cbbc997d [wpimath] Make Vector-Vector binary operators return Vector (#5772)
Fixes #5741.
2023-10-17 16:44:30 -07:00
Tyler Veness
ed93889e17 [examples] Fix typo in TimesliceRobot example name (#5773) 2023-10-17 16:44:18 -07:00
Tyler Veness
da70e4c262 [docs] Add jinja2 to CMake prerequisites (#5771)
Fixes #5769.
2023-10-17 11:05:34 -07:00
Brayden Zee
e814595ea7 [wpimath] Add ChassisSpeeds.fromRobotRelativeSpeeds() (#5744) 2023-10-17 10:13:04 -07:00
narmstro2020
f98c943445 [wpimath] LinearSystemId: Add DCMotorSystem overload (#5770)
The goal of this addition is to allow LinearSystemId.createDCMotorSystem to use kV and KA instead of the moment of inertia, DCMotor object, and gearing.
2023-10-17 10:11:34 -07:00
Peter Johnson
b3eb64b0f7 [wpiutil] ct_string: Use inline namespace for literals (#5767)
This avoids a conflict with json.
2023-10-15 07:53:08 -07:00
Peter Johnson
7d9ba256c2 Revert "[build] Add CMake option to build Java source jars (#5756)" (#5766)
This reverts commit 1c724884ca.

This commit broke local builds on the second run of cmake configure.
2023-10-14 23:53:27 -07:00
Tyler Veness
1f6492e3d8 [sysid] Update JSON library usage (#5765) 2023-10-14 23:52:50 -07:00
Peter Johnson
638f04f626 [wpiutil] Add protobuf to thirdparty sources (#5746) 2023-10-14 21:54:17 -07:00
PJ Reiniger
210255bfff [wpiutil] Update json to 3.11.2 (#5680) 2023-10-14 21:53:56 -07:00
Jordan McMichael
896772c750 [wpimath] Add DCMotor functions for Kraken X60 and Neo Vortex (#5759) 2023-10-14 21:52:01 -07:00
Tyler Veness
fd427f6c82 [wpimath] Fix hardcoded module count in SwerveDriveKinematics.resetHeading() (#5762)
Fixes #5761.
2023-10-14 21:51:15 -07:00
Anit Mangal
c0b4c6cce6 [wpimath] Add overloads for Transform2d and Transform3d (#5757)
Adds overloads for Transform2d() constructor to accept x, y, and heading and for Transform3d() to accept x, y, z and rotation as a shorthand for the normal constructors.
2023-10-12 23:21:39 -07:00
kully
9a0aafd8ab [examples] Make swerve examples multiply desired module speeds by cosine of heading error (#5758)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-10-12 23:20:57 -07:00
Gold856
1c724884ca [build] Add CMake option to build Java source jars (#5756) 2023-10-11 12:50:54 -07:00
Peter Johnson
5b0db6b93e [ci] Forward CI as well (#5755) 2023-10-10 22:59:17 -07:00
Peter Johnson
f8cbbbac12 [ci] Take 2 on passing GITHUB_REF (#5754) 2023-10-10 22:48:35 -07:00
Peter Johnson
b9944be09c [ci] Pass GITHUB_REF to docker container (#5753) 2023-10-10 22:03:44 -07:00
Peter Johnson
de5e4eda6c [build] Update apriltag, libssh, googletest for 2024 (#5752) 2023-10-10 20:35:30 -07:00
Tyler Veness
227e660e20 [upstream_utils] Upgrade to LLVM 17.0.2 (#5750) 2023-10-10 16:30:31 -07:00
Peter Johnson
36f94c9f21 [commands,romi,xrp] Add frcYear to vendordep (#5747)
Required by wpilibsuite/native-utils#170.
Also see wpilibsuite/native-utils#168.
2023-10-10 09:12:49 -07:00
Peter Johnson
741d166457 [glass] NT view: enhance array support (#5732)
- Break out array elements; this makes it easier to see array contents and
  allows plotting individual array elements
- Provide array editor
2023-10-10 00:28:54 -07:00
Peter Johnson
1d23513945 [ntcore] Fix string array value comparison (#5745)
It did not correctly check size prior to checking size=0.
2023-10-10 00:27:56 -07:00
Gold856
ff1849052e [commands] Make command scheduling order consistent (#5470) 2023-10-09 23:52:26 -07:00
Peter Johnson
58e8474368 [build] Disable armsimulation unit test (#5739)
This test regularly fails on Win64Debug in CI.
2023-10-09 20:11:51 -07:00
Zhiquan Yeo
fb07b0da49 [examples] Add XRP C++ Examples and Templates (#5743) 2023-10-09 16:55:54 -07:00
Tyler Veness
81893ad73d Run wpiformat with clang-format 17 (#5740) 2023-10-09 11:22:45 -07:00
narmstro2020
faa1e665ba [wpimath] Add ElevatorFeedforward.calculate(currentV, nextV) overload (#5715)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-10-09 08:16:45 -07:00
Peter Johnson
a789632052 [build] Update to native utils 2024.3.1 (#5738)
Also switch to 2024 docker images.
2023-10-08 20:16:08 -07:00
Peter Johnson
8f60ab5182 [build] Update OpenCV to 2024-4.8.0-1 (#5737) 2023-10-08 16:43:15 -07:00
Jordan McMichael
33243f982b [wpimath] Expand Quaternion class with additional operators (#5600)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-10-08 16:42:53 -07:00
Peter Johnson
420f2f7c80 [ntcore] Add RTT-only subprotocol (#5731)
This is useful for aliveness checking by clients that can't send
WebSocket PING messages.
2023-10-08 00:35:10 -07:00
Peter Johnson
2b63e35ded [ntcore] Fix moving outgoing queue to new period (#5735)
std::remove_if() is destructive--it can assume the removed elements are
not used, but NetworkOutgoingQueue needs them to stay intact to be moved
to a different queue. Use std::stable_partition() instead.
2023-10-08 00:34:36 -07:00
Peter Johnson
be939cb636 [ntcore] Fix notification of SetDefaultEntryValue (#5733) 2023-10-07 20:42:55 -07:00
Thad House
69a54de202 [build] Update enterprise plugin (#5730)
Removes a deprecation warning
2023-10-05 10:39:11 -07:00
Ryan Blue
fef03a3ff5 [commands] Clean up C++ includes after Requirements was added (#5719) 2023-10-04 22:09:28 -07:00
Peter Johnson
8b7c6852cf [ntcore] Networking improvements (#5659)
- Utilize TrySend to properly backpressure network traffic
- Split updates into reasonable sized frames using WS fragmentation
- Use WS pings for network aliveness (requires 4.1 protocol revision)
- Measure RTT only at start of connection, rather than periodically
  (this avoids them being affected by other network traffic)
- Refactor network queue
- Refactor network ping, ping from server as well
- Improve meta topic performance
- Implement unified approach for network value updates (currently client and server use very different approaches) that respects requested subscriber update frequency

This adds a new protocol version (4.1) due to WS bugs in prior versions.
2023-10-04 22:02:42 -07:00
Dustin Spicuzza
1d19e09ca9 [wpiutil] Set WPI_{UN}IGNORE_DEPRECATED to empty when all else fails (#5728) 2023-10-04 21:49:07 -07:00
Gold856
58141d6eb5 [wpilib] Make BooleanEvent more consistent (#5436)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
2023-10-04 21:22:57 -07:00
Gold856
6576d9b474 [wpilib] SendableChooser: implement Sendable instead of NTSendable (#5718) 2023-10-04 21:15:34 -07:00
Thad House
a4030c670f [build] Update to gradle 8.4, enable win arm builds (#5727) 2023-10-04 19:31:25 -07:00
Tyler Veness
0960f11eba [wpinet] Revert removal of uv_clock_gettime() (#5723)
GetSystemTimePreciseAsFileTime() is supposed to be available, and
wpiutil already uses it.
2023-10-03 20:39:09 -07:00
Peter Johnson
cb1bd0a3be [wpiutil] Get more precise system time on Windows (#5722)
Windows 8 added GetSystemTimePreciseAsFileTime().
2023-10-03 20:38:48 -07:00
Oliver
4831277ffe [wpigui] Fix loading a maximized window on second monitor (#5721) 2023-10-03 11:50:28 -07:00
Starlight220
3eb372c25a [wpiutil] SendableBuilder: Add PublishConst methods (#5158) 2023-10-02 08:23:11 -07:00
Peter Johnson
1fec8596a4 [ci] Fix -dirty version (#5716) 2023-10-01 22:44:12 -07:00
Gold856
f7e47d03f3 [build] Remove unnecessary CMake config installs (#5714) 2023-10-01 20:08:09 -07:00
Tyler Veness
a331ed2374 [sysid] Add SysId (#5672)
The source is copied from this commit:
625ff04784.
2023-10-01 15:09:09 -07:00
Peter Johnson
8d2cbfce16 [wpiutil] DataLog: Stop logging if insufficient free space (#5699)
The threshold is set to 5 MB.
2023-10-01 14:01:49 -07:00
Peter Johnson
48facb9cef [ntcoreffi] Add DataLogManager (#5702)
This is a copy of wpilibc's DataLogManager with shims for the HAL and
wpilibc functionality for LabView use.
2023-10-01 13:59:15 -07:00
Peter Johnson
aecbcb08fc [ntcore] Correctly start DataLog for existing publishers (#5703) 2023-10-01 06:43:18 -07:00
Peter Johnson
5e295dfbda [wpiutil] DataLog: Limit total buffer allocation (#5700)
Pause logging if more than 1 MB of outgoing buffers are allocated.
Limit free buffer list to 256 KB.
2023-09-30 20:19:28 -07:00
Peter Johnson
c7c7e05d9d [ci] Unbreak combiner (#5698) 2023-09-30 10:19:32 -07:00
Peter Johnson
c92bad52cb [wpilib] DataLogManager: Use system time valid function (#5697) 2023-09-30 09:24:06 -07:00
Peter Johnson
d404af5f24 [wpilib] RobotController: Add isSystemTimeValid() (#5696)
This returns true when the system date/time (wall clock) is valid.
2023-09-30 09:22:51 -07:00
Tyler Veness
e56f1a3632 [ci] Run combine but skip all steps (#5695)
This makes it show up as passed instead of skipped so the result
aggregator collapses.
2023-09-29 23:38:16 -07:00
Peter Johnson
8f5bcad244 [ci] Use sccache for cmake builds (#5692) 2023-09-29 23:38:01 -07:00
Tyler Veness
703dedc4a6 [ci] Upgrade get-cmake action to fix node12 deprecation warning (#5694) 2023-09-29 21:20:27 -07:00
Tyler Veness
c69a0d7504 [ci] Don't run example unit test that segfaults (#5693) 2023-09-29 17:26:03 -07:00
Tyler Veness
66358d103e Add menu items for online docs to GUI tools (#5689) 2023-09-29 17:25:28 -07:00
Tyler Veness
4be8384a76 [ci] Disable combine on PR builds (#5691)
It takes 30 minutes, and the artifacts aren't used. The combine step
changes so infrequently that it's unlikely to break in PRs, so it's a
net benefit to speed up PR builds.
2023-09-29 09:59:09 -07:00
Peter Johnson
90288f06a6 [ci] Fix Gradle disk space issues (#5688)
- Free up disk space on Linux by deleting unused packages
- Move build to C drive on Windows
2023-09-29 00:50:15 -07:00
Tyler Veness
9e9583412e [wpigui] Make wpi::gui::OpenURL() fork the process first (#5687)
execlp() replaces the current process image, which isn't desirable.
2023-09-28 13:01:56 -07:00
Peter Johnson
d4fcd80b7b [ci] Gradle: Use container only for build step (#5684) 2023-09-27 23:56:20 -07:00
Tyler Veness
7b70e66772 [outlineviewer] Fix thirdparty library include sorting (#5683) 2023-09-27 21:45:46 -07:00
Tyler Veness
5f651df5d5 [build] Clean up Gradle configs (#5685)
Putting an early exit if statement at the top instead of wrapping the
whole file contents unbreaks unit test configs, as was discovered for
SysId. It reduces nesting as well.

Unused plugins were removed from the beginnings of files as well.
2023-09-27 21:45:25 -07:00
Ryan Blue
65b26738d5 Add CMakeSettings.json to gitignore (#5682) 2023-09-26 20:57:44 -07:00
Tyler Veness
d0305951ad Fix GitHub inline warnings (#5681) 2023-09-23 19:57:18 -07:00
Ryan Blue
e8d4a20331 [build][cmake] Fix windows tests and re-enable CI tests (#5674) 2023-09-22 15:39:35 -07:00
Zhiquan Yeo
2b58bbde0b [xrp] Add Reflectance sensor and rangefinder classes (#5673)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-09-22 13:03:43 -07:00
PJ Reiniger
dd5612fbee [json] Add forward definition header (#5676) 2023-09-22 13:01:27 -07:00
Tyler Veness
eab44534c3 [wpimath] Remove unused SmallString include (#5677) 2023-09-22 08:01:01 -07:00
Tyler Veness
5ab54ff760 Replace wpi::raw_istream with wpi::MemoryBuffer (#5675)
Instances of wpi::raw_istream were left that are reading incrementally
from file descriptors like USB devices.
2023-09-21 23:20:09 -07:00
Tyler Veness
1b6ec5a95d [wpiutil] Upgrade to LLVM 17.0.1 (#5482) 2023-09-21 19:54:33 -07:00
Tyler Veness
07a0d22fe6 [build] Build examples in CMake CI (#5667) 2023-09-20 21:03:55 -07:00
Tyler Veness
97021f074a [build] Upgrade imgui and implot (#5668)
Upgrade implot to fix deprecation warning for sprintf(), and upgrade
imgui docking branch to match.
2023-09-19 23:38:17 -07:00
Gold856
87ce1e3761 [build] Fix wpilibNewCommands CMake install (#5671) 2023-09-19 21:19:35 -07:00
Colin Finn
6ef94de9b5 [wpimath] Add tests for ArmFeedforward and ElevatorFeedforward (#5663) 2023-09-18 22:25:08 -07:00
Peter Johnson
c395b29fb4 [wpinet] Add WebSocket::TrySendFrames() (#5607)
This takes advantage of the underlying byte-level TryWrite() functionality to minimize blocking behavior and enable higher layers to do things smartly when the network blocks.

Also:
- Fix handling of control packets in middle of fragmented
- Clean up debugging features
2023-09-18 19:49:54 -07:00
Zhiquan Yeo
c4643ba047 [romi/xrp] Fix version typo in vendordep json (#5664) 2023-09-18 19:42:27 -07:00
Zhiquan Yeo
51dcb8b55a [examples] Make Romi/XRP Examples use appropriate vendordeps (#5665) 2023-09-18 19:42:10 -07:00
Starlight220
daf7702007 [build] Test each example in a new environment (#5662)
In C++ each example is a separate source set, but in Java they were one source set and tested as one with the test task. Example-specific test tasks exist for Java, but they weren't used.
This modifies the test task to exclude the example tests, instead depending on each example's test task. The advantage of this is that each example is tested in a separate environment, so leftover state from one example isn't carried over.
2023-09-18 11:03:39 -07:00
Starlight220
e67df8c180 [wpilib] Const-qualify EncoderSim getters (#5660) 2023-09-18 08:18:18 -07:00
Peter Johnson
7be290147c [wpiutil] Refactor SpanMatcher and TestPrinters from ntcore (#5658) 2023-09-18 00:11:36 -07:00
Ryan Blue
9fe258427a [commands] Add proxy factory to Commands (#5603) 2023-09-17 20:49:02 -07:00
Joseph Eng
633c5a8a22 [commands] Add C++ Requirements struct (#5504) 2023-09-17 20:48:39 -07:00
Joseph Eng
b265a68eea [commands] Add interruptor parameter to onCommandInterrupt callbacks (#5461) 2023-09-17 20:47:37 -07:00
Peter Johnson
e93c233d60 [ntcore] Compute Value memory size when creating value (#5657)
This avoids a later switch-based computation in NetworkLoopQueue.
2023-09-17 20:01:57 -07:00
Peter Johnson
5383589f99 [wpinet] uv::Request: Return shared_ptr from Release() (#5656)
Use this in Stream to allow the finish() callback to reuse the request.
2023-09-17 20:01:43 -07:00
Peter Johnson
40b552be4a [wpinet] uv::Stream: Return error from TryWrite() (#5655) 2023-09-17 20:01:24 -07:00
Peter Johnson
202a75fe08 [wpinet] RequestImpl: Avoid infinite loop in shared_from_this() (#5654) 2023-09-17 20:01:10 -07:00
Peter Johnson
8896515eb7 [wpinet] uv::Buffer: Add bytes() accessor (#5653)
Also add uint8_t constructors.
2023-09-17 20:00:56 -07:00
Peter Johnson
ae59a2fba2 [wpinet] uv::Error: Change default error to 0 (#5652)
Was previously UV_UNKNOWN, which meant a default-constructed uv::Error
was actually an error.
2023-09-17 20:00:44 -07:00
Peter Johnson
3b51ecc35b [wpiutil] SpanExtras: Add take_back and take_front (#5651)
Also allow sized spans as input (return is always dynamic size).
2023-09-17 20:00:31 -07:00
Tyler Veness
17f1062885 Replace std::snprintf() with wpi::format_to_n_c_str() (#5645)
fmtlib uses consteval format string processing, which makes it more
efficient than std::snprintf().

snprintf()s in libuv, mpack, processstarter, and wpigui were left alone.
processstarter uses stdlib only, and wpigui only depends on imgui.

fmt::format_to_n() is analogous to std::format_to_n()
(https://en.cppreference.com/w/cpp/utility/format/format_to_n)

wpi::format_to_n_c_str() is a wrapper which adds the trailing NUL.
2023-09-17 20:00:16 -07:00
Zhiquan Yeo
bb39900353 [romi/xrp] Add Romi and XRP Vendordeps (#5644) 2023-09-17 16:20:06 -07:00
autoantwort
cb99517838 [build] cmake: Use default install location on windows for dlls (#5580) 2023-09-17 16:17:32 -07:00
autoantwort
25b0622d4c [build] Add Windows CMake CI (#5516) 2023-09-17 16:16:52 -07:00
Ryan Blue
34e7849605 Add warning to development builds instructions (NFC) (#5646)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2023-09-16 22:08:47 -07:00
Ryan Blue
e9e611c9d8 [cameraserver] Remove CameraServer.SetSize() (#5650) 2023-09-16 22:05:02 -07:00
Ryan Blue
94f58cc536 [wpilib] Remove Compressor.Enabled() (#5649)
Deprecated in #4147
2023-09-16 22:04:46 -07:00
Ryan Blue
4da5aee88a [wpimath] Remove SlewRateLimiter 2 argument constructor (#5648)
Deprecated in #4377
2023-09-16 22:04:29 -07:00
Ryan Blue
2e3ddf5502 Update versions in development builds instructions to 2024 (#5647) 2023-09-16 21:12:18 -07:00
Tyler Veness
19a8850fb1 [examples] Add TimesliceRobot templates (#3683) 2023-09-15 20:42:21 -07:00
Zhiquan Yeo
9047682202 [sim] Add XRP-specific plugin (#5631)
Provides an implementation of a XRP-specific plugin that sends binary messages over UDP (to account for the less performant hardware on the XRP).

This plugin leverages the work already done for the WebSocket protocol and does a translation to/from JSON/binary.
2023-09-15 20:08:02 -07:00
Tyler Veness
575348b81c [wpilib] Use IsSimulation() consistently (#3534) 2023-09-15 20:05:16 -07:00
Tyler Veness
12e2043b77 [wpilib] Clean up Notifier (#5630)
The user-facing docs were simplified, SetHandler() was renamed to
SetCallback(), and the internal documentation was synchronized.
2023-09-15 19:59:03 -07:00
Tyler Veness
4bac4dd0f4 [wpimath] Move PIDController from frc2 to frc namespace (#5640)
The old PIDController class in the frc namespace was removed for the
2023 season.
2023-09-15 19:57:31 -07:00
Tyler Veness
494cfd78c1 [wpiutil] Fix deprecation warning in LLVM for C++23 (#5642) 2023-09-15 19:57:14 -07:00
Ryan Blue
43a727e868 [apriltag] Make loadAprilTagFieldLayout throw an unchecked exception instead (#5629)
This eliminates the need for users to wrap initialization of the fields in a try/catch.
2023-09-15 14:25:21 -07:00
autoantwort
ad4b017321 [ci] Use Ninja for faster builds (#5626) 2023-09-15 10:42:57 -07:00
Tyler Veness
4f2114d6f5 Fix warnings from GCC 13 release build (#5637) 2023-09-15 10:37:52 -07:00
Tyler Veness
e7e927fe26 [build] Also compress debug info for CMake RelWithDebInfo build type (#5638) 2023-09-15 10:36:39 -07:00
Tyler Veness
205a40c895 [build] Specify zlib for debug info compression (#5636)
This is required to make compression actually occur.
2023-09-14 23:51:04 -07:00
Tyler Veness
707444f000 [apriltag] Suppress -Wtype-limits warning in asserts from GCC 13 (#5635) 2023-09-14 20:57:20 -07:00
Ryan Blue
3b79cb6ed3 [commands] Revert SubsystemBase deprecation/removal (#5634) 2023-09-14 20:56:48 -07:00
Tyler Veness
bc7f23a632 [build] Compress Linux debug info (#5633) 2023-09-14 20:46:44 -07:00
Thad House
57b2d6f254 [build] Update to image 2024 v1.0 (#5625) 2023-09-12 09:44:25 -07:00
Ryan Blue
339ef1ea39 [wpilib] DataLogManager: Warn user if logging to RoboRIO 1 internal storage (#5617) 2023-09-11 15:47:31 -07:00
autoantwort
7a9a901a73 [build] Fix cmake config files (#5624) 2023-09-11 13:27:00 -07:00
Gold856
298f8a6e33 [wpilib] Add Mechanism2d tests and make Java impl match C++ (#5527) 2023-09-10 22:01:33 -07:00
Ryan Blue
d7ef817bae [apriltag] Update apriltag library (#5619) 2023-09-10 22:00:50 -07:00
Ryan Blue
c3fb31fd0e [docs] Switch to Java 17 api docs (#5613) 2023-09-10 21:59:32 -07:00
Thad House
bd64f81cf9 [build] Run Google tests in release mode in CI (#5615)
This reduces disk space usage in CI. Local builds still use debug mode.
2023-09-10 08:08:28 -07:00
Joseph Eng
66e6bd81ea [wpimath] Cleanup wpimath/algorithms.md (NFC) (#5621) 2023-09-10 06:26:53 -07:00
autoantwort
4fa56fd884 [build] Add missing find_dependency call (#5623) 2023-09-09 18:57:12 -07:00
Thad House
f63d958995 [build] Update to native utils 2024.2.0 (#5601) 2023-09-08 20:15:24 -07:00
Tyler Veness
a9ab08f48b [wpimath] Rename ChassisSpeeds.fromDiscreteSpeeds() to discretize() (#5616)
This better reflects what's actually going on mathematically.
2023-09-08 20:14:59 -07:00
Tyler Veness
8e05983a4a [wpimath] Add math docs to plant inversion feedforward internals (NFC) (#5618) 2023-09-08 20:14:24 -07:00
Tyler Veness
3a33ce918b [ntcore] Add missing StringMap include (#5620) 2023-09-08 20:13:57 -07:00
Peter Johnson
a6157f184d [wpiutil] timestamp: Add ShutdownNowRio (#5610) 2023-09-07 09:59:39 -07:00
Tyler Veness
e9f612f581 [build] Guard policy setting for CMake versions below 3.24 (#5612) 2023-09-07 09:58:22 -07:00
Tyler Veness
1a6df6fec6 [wpimath] Fix DARE Q decomposition (#5611) 2023-09-05 10:48:43 -07:00
Ryan Blue
9b3f7fb548 [build] Exclude IntelliJ folders from spotless XML (#5602) 2023-09-05 08:59:12 -07:00
Tyler Veness
814f18c7f5 [wpimath] Fix computation of C for DARE (A, C) detectability check (#5609)
If Q has off-diagonal entries, C and Cᵀ are different.
2023-09-04 21:12:25 -07:00
Ryan Blue
ac23f92451 [hal] Add GetTeamNumber (#5596) 2023-09-01 23:34:18 -07:00
Tyler Veness
a750bee54d [wpimath] Use std::norm() in IsStabilizable() (#5599) 2023-08-31 22:52:18 -07:00
Gold856
8e2465f8a0 [wpimath] Add arithmetic functions to wheel speeds classes (#5465) 2023-08-31 11:57:24 -07:00
Tyler Veness
10d4f5b5df [wpimath] Clean up notation in DARE precondition docs (#5595) 2023-08-31 11:56:41 -07:00
Ryan Blue
b2dd59450b [hal] Fix unfinished/incorrect GetCPUTemp functions (#5598) 2023-08-31 11:51:57 -07:00
Tyler Veness
99f66b1e24 [wpimath] Replace frc/EigenCore.h typedefs with Eigen's where possible (#5597) 2023-08-31 11:03:37 -07:00
Tyler Veness
383289bc4b [build] Make custom CMake macros use lowercase (#5594)
Most of them already do use lowercase, and uppercase is like screaming
at the user.
2023-08-30 21:17:09 -07:00
Ryan Blue
45e7720ec1 [build] Add error message when downloading files in CMake (#5593)
CMake's file(DOWNLOAD) function fails silently, leading to an error occurring due to a missing file later in the build. This fails quickly and produces a better error message.
2023-08-30 21:16:48 -07:00
Gold856
4e0d785356 [wpimath] ChassisSpeeds: document that values aren't relative to the robot (NFC) (#5551) 2023-08-30 13:22:42 -07:00
Ryan Blue
3c04580a57 [commands] ProxyCommand: Use inner command name in unique_ptr constructor (#5570) 2023-08-30 13:21:49 -07:00
Ryan Blue
cf19102c4a [commands] SelectCommand: Fix leakage and multiple composition bug (#5571) 2023-08-30 13:21:17 -07:00
Peter Johnson
171375f440 [ntcoreffi] Link to NI libraries (#5589)
This is required because wpiutil depends on these libraries and is
statically linked.
2023-08-29 17:47:17 -07:00
Tyler Veness
89add5d05b Disable flaky tests (#5591) 2023-08-29 17:46:50 -07:00
Tyler Veness
a8d4b162ab [ntcore] Remove RPC manual tests (#5590)
NT4 doesn't support RPC.
2023-08-29 16:25:54 -07:00
Ryan Blue
39a73b5b58 [commands] C++: Add CommandPtr supplier constructor to ProxyCommand (#5572)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2023-08-29 13:23:00 -07:00
Ryan Blue
36d514eae7 [commands] Refactor C++ ScheduleCommand to use SmallSet (#5568)
Remove SetUtilities.h
2023-08-29 13:16:15 -07:00
Shai Grossman
52297ffe29 [commands] Add idle command (#5555) 2023-08-29 13:00:40 -07:00
Omar Zrien
67043a8eeb [wpimath] Add angular jerk unit (#5582) 2023-08-29 12:53:14 -07:00
Tyler Veness
51b0fb1492 [wpimath] Fix incorrect header inclusion in angular_acceleration.h (#5587)
Specific unit headers should only include units they use. In this case,
that's angle and time.
2023-08-29 12:52:39 -07:00
Tyler Veness
b7657a8e28 [wpimath] Split WPIMathJNI into logical chunks (#5552)
This makes things easier to find, and speeds up compilation.
2023-08-29 09:00:19 -07:00
Thad House
ea17f90f87 [build] Fix tool builds with multiple arm platforms installed (#5586) 2023-08-29 08:57:33 -07:00
Tyler Veness
f1d7b05723 [wpimath] Clean up unit formatter (#5584) 2023-08-29 08:56:48 -07:00
Tyler Veness
d7264ff597 Replace wpi::errs() usage with fmtlib (#5560)
This will make migration to C++23's std::print() easier later.

Fixes #5556.
2023-08-29 08:56:07 -07:00
Tyler Veness
ab3bf39e0e [wpiutil] Upgrade to fmt 10.1.1 (#5585)
This fixes a partial template specialization error internal to fmt that
was encountered in #5560.
2023-08-28 21:16:53 -07:00
Tyler Veness
165ebe4c79 Upgrade to fmt 10.1.0 (#5326) 2023-08-28 15:15:14 -07:00
Tyler Veness
8e2a7fd306 Include thirdparty libraries with angle brackets (#5578) 2023-08-28 15:13:34 -07:00
Tyler Veness
e322ab8e46 [wpimath] Fix docs for DARE ABQRN stabilizability check (NFC) (#5579) 2023-08-28 15:10:42 -07:00
Tyler Veness
360fb835f4 [upstream_utils] Handle edge case in filename matches (#5576)
endswith() leaves files out from subdirectories, which means projects
that add new subdirectories won't have those files included when they
probably should be.
2023-08-28 15:07:13 -07:00
Tyler Veness
9d86624c00 [build] Fix CMake configure warnings (#5577)
FetchContent requires CMake 3.11 (released Mar 28, 2018).

Fixed this warning:
```
CMake Warning (dev) at /usr/share/cmake/Modules/FetchContent.cmake:1316 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  imgui/CMakeLists.txt:23 (FetchContent_Declare)
```
2023-08-28 15:06:51 -07:00
Tyler Veness
969979d6c7 [wpiutil] Update to foonathan memory 0.7-3 (#5573) 2023-08-28 15:03:36 -07:00
Tyler Veness
0d2d989e84 [wpimath] Update to gcem 1.17.0 (#5575) 2023-08-28 15:03:06 -07:00
Tyler Veness
cf86af7166 [wpiutil] Update to mpack 1.1.1 (#5574) 2023-08-28 15:02:36 -07:00
Ryan Blue
a0c029a35b [commands] Fix dangling SelectCommand documentation (NFC) (#5567) 2023-08-25 09:41:25 -07:00
Tyler Veness
349141b91b [upstream_utils] Document adding a patch (NFC) (#5432)
Co-authored-by: autoantwort <41973254+autoantwort@users.noreply.github.com>
2023-08-24 15:00:07 -07:00
Tyler Veness
7889b35b67 [wpimath] Add RamseteController comparison to LTV controller docs (NFC) (#5559) 2023-08-24 00:04:54 -07:00
Ryan Blue
b3ef536677 [build] Ignore nt/sim json files in spotless (#5565) 2023-08-24 00:04:28 -07:00
Tyler Veness
ed895815b5 [build] Compile Java with UTF-8 encoding (#5564) 2023-08-24 00:03:38 -07:00
Joseph Eng
2e4ad35e36 [wpiutil] jni_util: Add JSpan and CriticalJSpan (#5554)
These replace JArrayRef et al and support statically sized arrays similar to std::span.
2023-08-24 00:02:56 -07:00
Tyler Veness
8f3d6a1d4b [wpimath] Remove discretizeAQTaylor() (#5562)
It gives incorrect results. Any replacement should just be an
implementation detail of discretizeAQ().

Closes #5339.
2023-08-23 10:47:32 -07:00
Tyler Veness
7c20fa1b18 [wpimath] Refactor DARE tests to reduce RAM usage at compile time (#5557) 2023-08-23 10:46:50 -07:00
Peter Johnson
89e738262c [ntcore] Limit buffer pool size to 64KB per connection (#5485)
Previously this was unlimited, which could result in holding on to a
large amount of memory if the connection got backlogged or a burst of
data transmission occurred.
2023-08-20 13:53:52 -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
Thad House
7a2d336d52 [wpinet] Leak multicast handles during windows shutdown (#5550)
Destructing either of the multicast objects during process shutdown will result in a crash due to attempting to start a task on the non-existent thread pool.

Solve this by just leaking all the handles upon destruction of the static multicast manager. This won't solve the case where the user statically allocates the object, but solves Java and C access, and most cases wouldn't be statically allocating the service announcer anyway in C++.
2023-08-18 19:15:16 -07:00
Tyler Veness
f9e2757d8f [wpimath] Use JDoubleArrayRef in all JNI functions (#5546) 2023-08-17 13:57:06 -07:00
Tyler Veness
0cf6e37dc1 [wpimath] Make LTV controller constructors use faster DARE solver (#5543)
Made JNI modifications to expose the faster function, made the API use
the typesafe Matrix API, and synchronized the documentation with C++.

Sped up C++ LTV diff drive test from 20 ms to 15 ms.
Sped up C++ LTV unicycle test from 15 ms to 10 ms.
2023-08-17 13:56:15 -07:00
autoantwort
6953a303b3 [build] Fix the windows build with fmt (#5544) 2023-08-16 17:07:23 -07:00
Joseph Eng
7a37e3a496 [wpimath] Correct Rotation3d::RotateBy doc comment (NFC) (#5541)
Improve transform doc comment consistency
2023-08-15 13:12:09 -07:00
Tyler Veness
186b409e16 [wpimath] Remove internal Eigen header include (#5539) 2023-08-15 08:47:48 -07:00
Tyler Veness
03764dfe93 [wpimath] Add static matrix support to DARE solver (#5536)
Using static matrices where possible results in a 2x performance
improvement.
2023-08-14 09:15:58 -07:00
Tyler Veness
394cfeadbd [wpimath] Use SDA algorithm instead of SSCA for DARE solver (#5526)
Both seem to work, but the SDA algorithm is specifically recommended for
solving DAREs as opposed to P-DAREs.

The QR decomposition was replaced with a partial pivoting LU
decomposition at the recommendation of section 2.4 of the paper.

More tests and a separate JNI function for each DARE solver variant were
added.
2023-08-12 19:45:45 -07:00
Ryan Blue
a4b7fde767 [wpilib] Add mechanism specific SetState overloads to physics sims (#5534) 2023-08-12 15:21:07 -07:00
amquake
8121566258 [wpimath] Fix CoordinateSystem.convert() Transform3d overload (#5532) 2023-08-12 15:20:22 -07:00
Peter Johnson
b542e01a0b [glass] Fix array crash when clearing existing workspace (#5535) 2023-08-12 15:17:43 -07:00
Oliver
e2e1b763b2 [wpigui] Fix PFD file dialogs not closing after window closing (#5530)
Also applies samhocevar/portable-file-dialogs#91 to properly retrieve the HWND on Windows.
2023-08-12 09:07:35 -07:00
Zhiquan Yeo
86d7bbc4e4 [examples] Add Java Examples and Templates for the XRP (#5529) 2023-08-11 23:31:35 -07:00
Tyler Veness
e8b5d44752 [wpimath] Make Java Quaternion use doubles instead of Vector (#5525)
This avoids allocation overhead on construction. times() was also
rewritten to not allocate any temporary objects.

Getter calls in the C++ Quaternion class were modified for parity.
2023-08-11 23:27:29 -07:00
Ryan Blue
38c198fa64 [myRobot] Add apriltags to myRobot build (#5528) 2023-08-11 23:26:05 -07:00
Tyler Veness
00450c3548 [wpimath] Upgrade to EJML 0.42 (#5531) 2023-08-11 23:25:43 -07:00
Joseph Eng
faf3cecd83 [wpimath] Don't copy Matrix and underlying storage in VecBuilder (#5524) 2023-08-09 22:15:39 -07:00
autoantwort
6b896a38dc [build] Don't enforce WITH_FLAT_INSTALL with MSVC (part 2) (#5517) 2023-08-07 08:57:34 -07:00
Peter Johnson
c01814b80e [wpiutil] Add C API for DataLog (#5509) 2023-08-06 20:18:50 -07:00
Joseph Eng
b5bd0771eb [wpimath] Document extrinsic vs intrinsic rotations (NFC) (#5508) 2023-08-06 19:59:42 -07:00
autoantwort
84ed8aec05 [build] Don't enforce WITH_FLAT_INSTALL with MSVC (#5515) 2023-08-06 19:58:41 -07:00
Peter Johnson
999f677d8c [ntcoreffi] Add WPI_Impl_SetupNowRio to exported symbols (#5510) 2023-08-05 20:18:27 -07:00
Tyler Veness
338f37d302 Fix header sorting of libssh (#5507) 2023-08-05 14:16:55 -07:00
Ryan Blue
75cbd9d6d0 [glass] Add background color selector to glass plots (#5506) 2023-08-05 14:16:04 -07:00
m10653
e2c190487b [examples] Add flywheel bang-bang controller example (#4071)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-08-05 14:15:05 -07:00
Peter Johnson
c52dad609e [wpinet] WebSocket: Send pong in response to ping (#5498)
This is required by the spec (RFC 6455 section 5.5.2).
2023-08-04 16:27:08 -07:00
Ryan Blue
e2d17a24a6 [hal] Expose power rail disable and cpu temp functionality (#5477) 2023-08-03 23:48:29 -07:00
Thad House
3ad5d2e42d [hal,wpiutil] Use HMB for FPGA Timestamps (#5499)
Current timestamp read code uses FPGA register reads. Through testing,
this read was slower then clock_gettime by about 4-5x. However, another
method of reading the FPGA time is available, using HMB. HMB
is memory mapped IO from RAM to the FPGA. So to code side,
reading the value is just a memory barrier and a memory read.

There is some latency on the write side, so a very small artifical delay
(5us) is added to avoid register reads such as interrupts being ahead
of current timestamps, which could cause issues.

Below is read times for 1000 calls to clock_gettime, register reads and
hmb reads.
```
Clock: Rise 1.72939400 s Fall 1.72990700 s Delta 0.00051300 s
FPGA : Rise 1.72999000 s Fall 1.73429300 s Delta 0.00430300 s
HMB  : Rise 1.73466800 s Fall 1.73481900 s Delta 0.00015100 s
```

Also add full HMB struct to HAL for future usage.
2023-08-03 23:46:55 -07:00
Peter Johnson
b46a872494 [ntcore] Remove pImpl from implementation (#5480)
Also change Timestamped into a template.
2023-08-03 23:43:55 -07:00
Tyler Veness
d8c59ccc71 [wpimath] Add tests for MathUtil clamp() and interpolate() (#5501) 2023-08-03 23:43:20 -07:00
Ryan Blue
0552c8621d [glass,ov] Improve Glass and OutlineViewer title bar message (#5502)
Detect changes to mode and update based on mode change and connection events.
2023-08-03 23:43:03 -07:00
Ryan Blue
90e37a129f [wpiutil,wpimath] Add generic InterpolatingTreeMap (#5372) 2023-08-03 21:46:17 -07:00
Thad House
d83a6edc20 [wpilib] Update GetMatchTime docs and units (#5232) 2023-08-03 21:45:26 -07:00
Tyler Veness
6db2c42966 [wpimath] Trajectory: Throw on empty lists of States (#5497)
Fixes #4141.
2023-08-03 08:24:20 -07:00
Tyler Veness
21439b606c [wpimath] Disallow LTV controller max velocities above 15 m/s (#5495)
15 m/s is about 50 ft/s, which is way above what FRC robots should be
able to achieve. This limit lets us catch user errors from bad unit
conversions immediately instead of the LUT generation in the LTV
controllers hanging for a really long time.

Fixes #5027.
2023-08-02 23:37:49 -07:00
Peter Johnson
7496e0d208 [ntcore] Value: More efficiently store arrays (#5484) 2023-08-01 22:26:36 -07:00
Joseph Eng
0c93aded8a [wpimath] Change kinematics.ToTwist2d(end - start) to kinematics.ToTwist2d(start, end) (#5493) 2023-08-01 22:25:26 -07:00
Tyler Veness
815a8403e5 [wpimath] Give infeasible trajectory constraints a better exception message (#5492)
Fixes #3146.
2023-07-31 21:43:22 -07:00
Tyler Veness
35a8b129d9 [wpimath] Add RotateBy() function to pose classes (#5491)
Fixes #5472.
2023-07-31 21:16:44 -07:00
Tyler Veness
26d6e68c8f [upstream_utils] Add GCEM to CI (#5483) 2023-07-31 19:18:32 -07:00
Tyler Veness
6aa469ae45 [wpilib] Document how to create LinearSystem object for physics sim classes (NFC) (#5488)
Fixes #4372.
2023-07-31 19:18:17 -07:00
Tyler Veness
a01b6467d3 [wpimath] Link to docs on LQR and KF tolerances (#5486)
Fixes #4151.
2023-07-31 19:17:44 -07:00
Tyler Veness
d814f1d123 [wpimath] Fix copy-paste error from Pose2d docs (NFC) (#5490) 2023-07-31 19:17:17 -07:00
Tyler Veness
98f074b072 [wpimath] Add folder prefix to geometry includes (#5489) 2023-07-31 19:17:02 -07:00
Ryan Blue
e9858c10e9 [glass] Add tooltips for NT settings (#5476) 2023-07-28 16:32:07 -07:00
Thad House
12dda24f06 [examples] Fix C robot template not correctly looping (#5474)
- The event wouldn't reset, causing infinite looping
- Refresh ds data was missing
2023-07-27 08:46:51 -07:00
Peter Johnson
fc75d31755 [apriltag] Update apriltaglib (#5475) 2023-07-26 22:48:09 -07:00
Peter Johnson
a95994fff6 [wpiutil] timestamp: Call FPGA functions directly (#5235)
This works around an exit race with wpi::Now() on Rio; it was overridden
to call HAL_GetFPGATime(), which calls chipobject, but on exit, because
there was not a library dependency, the chipobject could be destroyed
prior to wpiutil/wpinet being shut down.
2023-07-24 23:03:28 -07:00
Joseph Eng
2ba8fbb6f4 [wpimath] Improve documentation for SwerveModulePosition::operator- (#5468) 2023-07-24 22:46:59 -07:00
Thad House
b8cdf97621 [build] Prepare for Windows arm64 builds (#5390)
Builds aren't actually enabled yet due to a bug in Gradle.
2023-07-24 22:46:25 -07:00
Mihir Patankar
552f4b76b5 [wpimath] Add FOC-enabled Falcon constants to the DCMotor class (#5469) 2023-07-24 20:16:48 -07:00
Joseph Ruan
1938251436 [examples] Add Feedforward to ElevatorProfiledPid (#5300)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-07-23 21:40:34 -07:00
Gold856
873c2a6c10 [examples] Update ElevatorTrapezoidProfile example (#5466) 2023-07-23 21:36:47 -07:00
Gold856
99b88be4f3 [wpilib] Reduce usage of NTSendable (#5434) 2023-07-23 21:34:49 -07:00
Peter Johnson
d125711023 [hal] Fix Java REVPH faults bitfield (take 2) (#5464)
The previous PR had a typo in one of the bitmasks.
Change to using 1 << N.
2023-07-23 17:37:27 -07:00
Carl Hauser
c3fab7f1f2 [ntcore] Don't update timestamp when value is unchanged (#5356)
This fixes an issue with commands run/cancel.
2023-07-23 17:36:26 -07:00
Gold856
5ec7f18bdc [wpilib] EventLoop docs: Remove BooleanEvent references (NFC) (#5463) 2023-07-23 14:22:04 -07:00
Sam Carlberg
c065ae1fcf [wpiunits] Add subproject for a Java typesafe unit system (#5371)
# Background

Unit safety has always been a problem in WPILib. Any value corresponding to a physical measurement, such as current draw or distance traveled, is represented by a bare number with no unit tied to it; it's up to the programmer to know what units they're working and take care to remember that while working on their robot program. This leads to bugs when programmers accidentally mix units without knowing, or measure something (such as a wheel diameter) in one unit and program using another. `wpiunits` is intended to eliminate that class of bugs.

Another source of friction is the controllers and models in `wpimath` that expect all inputs to be in terms of SI units (meter, kilogram, and so on), while most FRC teams are US-based and most commonly use imperial units. wpimath does a good job of noting unit types in method names and argument names; however, it still relies on users properly converting values (and knowing they even have to do so).

# API

There are really only two core classes in this library: `Unit` and `Measure`. A `Unit` represents some dimension like distance or time. `Unit` is subclassed to define specific dimensions (eg `Distance` and `Time`) and those subclasses are instantiated to defined particular units in those dimensions, such as `Meters` and `Feet` being instances of the `Distance` class.

A `Measure` is a value tied to a particular dimension like distance and knows what unit that value is tied to. `Measure` has two implementations - one immutable and one mutable. The `Measure` interface only defines *read-only* operations; any API working with measurements should use the interface. The default implementation is `ImmutableMeasure`, which only implements those read-only operations and is useful for tracking constants. `MutableMeasure` also adds some methods that will allow for mutation of its internal state; this class is intended for use for things like sensors and controllers that track internal state and don't want to allocate new `Measure` objects every time something like `myEncoder.getDistance()` is called. However, the APIs for those methods should still only expose the read-only `Measure` interface so users can't (without casting or reflection) change the internal values.

A `Units` class provides convenient definitions for most of the commonly used unit types, such as `Meters`, `Feet`, and `Milliseconds`. I recommend static importing these units eg `import static edu.wpi.first.units.Units.Meters`) so they can be used like `Meters.of(1.234)` instead of `Units.Meters.of(1.234)`


# Examples

These examples are admittedly contrived. Users shouldn't be interacting much with measure objects themselves, since wpimath and wpilibj classes will be updated to support working with them; users will often just have to take a `Measure` output from one place (such as an encoder) and feed it as input to something else (such as a PID controller or kinematics model)

```java
// Using raw units
Encoder encoder = ...

int kPulsesPerRev = 2048;
double kWheelDiameterMeters = Units.inchesToMeters(6);
double kGearRatio = 10.86;
 // always have to remember this encoder will output in meters!
encoder.setDistancePerPulse(kWheelDiameterMeters * Math.PI / (kGearRatio * kPulsesPerRev));

Command driveDistance(double distance) {
  // have to know the distance argument needs to be in meters!
  return run(this::driveStraight).until(() -> encoder.getDistance() >= distance);
}

// Oops! This will go 16 feet, not 5!
Command driveFiveFeet = driveDistance(5);
Command driveOneMeter = driveDistance(1);
```
```java
// Using wpiunits

Encoder encoder = ...

int kPulsesPerRev = 2048;
Measure<Distance> kWheelDiameter = Inches.of(6);
double kGearRatio = 10.86;
encoder.setDistancePerPulse(kWheelDiameter.times(Math.PI).divide(kGearRatio * kPulsesPerRev));

Command driveDistance(Measure<Distance> distance) {
  // Measure#gte automatically handles unit conversions
  return run(this::driveStraight).until(() -> encoder.getDistance().gte(distance));
}

// Users HAVE to be explicit about their units
Command driveFiveFeet = driveDistance(Feet.of(5));
Command driveOneMeter = driveDistance(Meters.of(1));
```

```java
SmartDashboard.putNumber("Temperature (C)", pdp.getTemperature().in(Celsius));
SmartDashboard.putNumber("Temperature (F)", pdp.getTemperature().in(Fahrenheit));
```

```java
var InchSecond = Inch.mult(Second); // new combined unit types can be user-defined
var InchPerSecond = Inch.per(Second);

PIDController<Distance, ElectricPotential> heightController = new PIDController<>(
  /* kP */ Volts.of(0.2).per(Inch),
  /* kI */ Volts.of(0.002).per(InchSecond),
  /* kD */ Volts.of(0.008).per(InchPerSecond)
);

var elevatorTop = Feet.of(4).plus(Inches.of(6.125));
elevatorMotor.setVoltage(heightController.calculate(encoder.getDistance(), elevatorTop));
```
2023-07-23 14:18:17 -07:00
Peter Johnson
44acca7c00 [wpiutil] Add ClassPreloader (#5365)
This provides an easy-to-use way to preload classes by name at startup to
avoid later delays due to lazy classloading.
2023-07-23 11:18:38 -07:00
Starlight220
88b11832ec [hal] Fix Java REVPH faults bitfield (#5148) 2023-07-22 17:20:48 -07:00
Peter Johnson
fb57d82e52 [ntcore] Enhance Java raw value support
Add support for start, length, and ByteBuffers
2023-07-22 17:17:52 -07:00
Peter Johnson
3a6e40a44b [wpiutil] Enhance DataLog Java raw value support
Add support for start, length, and ByteBuffers
2023-07-22 17:17:52 -07:00
Peter Johnson
8dae5af271 [wpiutil] Add compile-time string utilities (ct_string) (#5462) 2023-07-22 17:16:37 -07:00
Thad House
fc56f8049a [wpilib] DriverStation: Change alliance station to use optional (#5229)
Many teams have issues trying to read the DS too early. By switching to an optional, we cause teams to check 2 things. Either 1) they explicitly check, and their code is correct, or 2) they just read .value() and their code reboots in a loop. However, because the DS will eventually connect, this 2nd case is ok, and should theoretically be undetectable on the field.
2023-07-22 15:19:28 -07:00
autoantwort
ef155438bd [build] Consume libuv via cmake config instead of via pkg-config (#5438)
The problem is that you have to use a different pkg-config file if you want to use a static variant of libuv, but the buildsystem should not care which variant of libuv should be used. This is not a problem with the cmake config.
2023-07-20 00:30:56 -07:00
Gold856
86e91e6724 [wpimath] Refactor TrapezoidProfile API (#5457) 2023-07-19 17:25:10 -07:00
Gold856
72a4543493 [wpilib] DutyCycleEncoderSim: Expand API (#5443) 2023-07-19 17:24:09 -07:00
Joseph Eng
657338715d [wpimath] Add ChassisSpeeds method to fix drifting during compound swerve drive maneuvers (#5425) 2023-07-18 21:19:55 -07:00
Tyler Veness
1af224c21b Add missing <functional> includes (#5459) 2023-07-18 21:18:32 -07:00
Gold856
0b91ca6d5a [wpilib] SendableChooser: Add onChange listener (#5458) 2023-07-18 16:33:45 -07:00
Joseph Eng
6f7cdd460e [wpimath] Pose3d: Switch to JNI for exp and log (#5444)
The pure Java implementations allocate a lot of temporary objects, and the JNI implementation is substantially more performant.
2023-07-18 16:32:11 -07:00
camaj
c69e34c80c [wpimath] ChassisSpeeds: Add arithmetic functions (#5293)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-07-18 16:30:21 -07:00
Sriman Achanta
335e7dd89d [wpilib] Simulation: Add ctor parameter to set starting state of mechanism sims (#5288)
- Add a constructor parameter to configure the initial angle of the arm
- Also reorganizes cascading constructors for Java
2023-07-18 13:00:27 -07:00
Tyler Veness
14f30752ab [wpilib] Deprecate Accelerometer and Gyro interfaces (#5445)
Accelerometer is hyper-specific to ADXL accelerometers, and Gyro is
less useful now that 3D IMUs are prevalent, and if those IMUs want to
support the Gyro interface, they also need to provide a way to set the
axis used for the Gyro interface, which is confusing. Higher-order
functions (e.g., lambdas) are a more flexible interface boundary than
interfaces, but they didn't exist when these interfaces were
created.
2023-07-18 12:52:43 -07:00
Gold856
70b60e3a74 [commands] Trigger: Fix method names in requireNonNullParam (#5454) 2023-07-18 08:12:50 -07:00
Joseph Eng
593767c8c7 [wpimath] Improve Euler angle calculations in gimbal lock (#5437) 2023-07-17 17:19:42 -07:00
Joseph Eng
daf022d3da [build] Make devImplementation inherit from implementation (#5450)
Remove manually adding dependencies to devImplementation.
Fix wpilibNewCommands devMain package.
2023-07-17 17:19:03 -07:00
Jason
9b8d90b852 [examples] Convert the unitless joystick inputs to actual physical units (#5451)
Taking the joystick inputs from -1 to 1, multiply them by the max speed (as defined in Constants.java) to get the target speed, rather than using the unitless raw joystick inputs.
2023-07-17 17:18:34 -07:00
Gold856
1f6428ab63 [ntcore] Fix undefined comparison behavior when array is empty (#5448)
If both arrays are empty, it returns true, avoiding UB with memcmp potentially getting a nullptr.
2023-07-17 17:16:54 -07:00
sciencewhiz
17eb9161cd Update code owners for removal of old commands (#5447) 2023-07-14 21:18:38 -07:00
Tyler Veness
3c4b58ae1e [wpinet] Upgrade to libuv 1.46.0 (#5446) 2023-07-14 18:55:32 -07:00
Ryan Blue
aaea85ff16 [commands] Merge CommandBase into Command and SubsystemBase into Subsystem (#5392)
Moves all CommandBase functionality into Command and deprecates CommandBase for removal.
Moves all SubsystemBase functionality into Subsystem and deprecates SubsystemBase for removal.
Adds a function to CommandScheduler to remove all registered Subsystems.
2023-07-13 22:12:01 -07:00
Peter Johnson
7ac932996a [ci] Use PAT for workflow dispatch (#5442) 2023-07-12 23:53:21 -07:00
Peter Johnson
efe1987e8b [ci] Trigger pages repo workflow (#5441) 2023-07-12 23:29:56 -07:00
Tyler Veness
828bc5276f [wpiutil] Upgrade to LLVM 16.0.6 (#5435)
Fixes #5332.
2023-07-12 22:50:13 -07:00
Peter Johnson
701df9eb87 [ci] Change documentation publish to single-commit (#5440)
Push to different branches for beta/release/development.
The pages repo workflow will do the combine for publishing.
2023-07-12 22:20:22 -07:00
Thad House
e5452e3f69 [wpiutil] Add WPICleaner and an example how to use it (#4850) 2023-07-10 09:59:36 -07:00
Ryan Blue
7a099cb02a [commands] Remove deprecated classes and functions (#5409)
Removes:
- PerpetualCommand
- Command.perpetually()
- CommandGroupBase
- Command.IsGrouped() (C++ only)
- Command.SetGrouped() (C++ only)
- Command.withInterrupt()
- ProxyScheduleCommand
- Button
- InternalButton, JoystickButton, NetworkButton and POVButton now subclass Trigger
- Old style Trigger functions:
    - Trigger.whenActive
    - Trigger.whileActiveOnce
    - Trigger.whileActiveContinuous
    - Trigger.whenInactive
    - Trigger.toggleWhenActive
    - Trigger.cancelWhenActive
- CommandScheduler.clearButtons()
- CommandScheduler.addButtons() (Java only)
- Command supplier constructor of SelectCommand
2023-07-10 09:56:18 -07:00
Thad House
b250a03944 [wpilib] Add function to wait for DS Connection (#5230) 2023-07-10 09:53:16 -07:00
autoantwort
a6463ed761 [wpiutil] Fix unused variable warning in release build (#5430) 2023-07-10 09:48:51 -07:00
Peter Johnson
f031513470 [ntcore] NetworkTable::GetSubTables(): Remove duplicates (#5076)
In Java, a set is used. Use a two-stage approach in C++ to achieve the
same result.
2023-07-09 21:31:58 -07:00
sciencewhiz
f8e74e2f7c [hal] Unify PWM simulation Speed, Position, and Raw (#5277)
Setting one will set the others, like it does in real hardware.
Add tests for boundary conditions and conversions.
Update PWM sendable implementation to include all forms.
Fixes #5264
Fixes #3606
2023-07-09 21:28:50 -07:00
Tyler Veness
fd5699b240 Remove references to Drake (#5427)
Fixes #5426.
2023-07-09 21:25:14 -07:00
autoantwort
e2d385d80a [build] cmake: Respect USE_SYSTEM_FMTLIB (#5429) 2023-07-09 21:24:46 -07:00
Ryan Blue
d37f990ce3 [hal] Fix HAL Relay/Main doc module (NFC) (#5422) 2023-07-05 21:21:59 -07:00
Ryan Blue
a7a8b874ac [docs] Expand HAL_ENUM in doxygen docs (#5421) 2023-07-05 21:20:21 -07:00
Peter Johnson
3a61deedde [wpimath] Rotation2d: Only use gcem::hypot when constexpr evaluated (#5419) 2023-07-04 12:05:55 -06:00
Peter Johnson
96145de7db [examples] Fix formatting (NFC) (#5420) 2023-07-04 07:14:06 -07:00
Starlight220
fffe6a7b9a [examples] Improve Pneumatics example coverage in Solenoid and RapidReactCmdBot examples (#4998) 2023-07-03 21:23:18 -07:00
Vasista Vovveti
6b5817836d [wpimath] Add tolerance for some tests (#5416) 2023-06-27 14:22:46 -07:00
Vasista Vovveti
3233883f3e [cscore] Fix warnings on macos arm (#5415) 2023-06-27 14:22:19 -07:00
Starlight220
c4fc21838f [commands] Add ConditionalCommand getInterruptionBehavior (#5161) 2023-06-23 08:21:05 -07:00
Starlight220
89fc51f0d4 Add tests for SendableChooser and Command Sendable functionality (#5179) 2023-06-23 08:18:38 -07:00
Ryan Blue
663bf25aaf [docs] Generate docs for symbols in __cplusplus (#5412) 2023-06-22 20:58:38 -07:00
Joseph Eng
fe32127ea8 [command] Clean up Command doc comments (NFC) (#5321) 2023-06-22 19:43:51 -07:00
Thad House
c1a01569b4 [wpilib][hal] PWM Raw using microseconds (#5283)
Co-authored-by: Joe <sciencewhiz@users.noreply.github.com>
2023-06-22 19:43:16 -07:00
Ryan Blue
1fca519fb4 [wpiutil] Remove remnants of ghc fs and tcb_span libraries (#5411) 2023-06-22 19:42:44 -07:00
sciencewhiz
90602cc135 [github] Update issue template to collect more project info (#5090) 2023-06-22 15:26:22 -07:00
sciencewhiz
34412ac57e [build] Exclude files in bin from Spotless (#5410)
Was causing failures in fieldImages.
2023-06-22 15:25:01 -07:00
Thad House
61aa60f0e3 [wpilib] Add robot callback that is called when the DS is initially connected (#5231) 2023-06-21 14:53:34 -07:00
Ryan Blue
ebae341a91 [commands] Add test for subsystem registration and periodic (#5408) 2023-06-20 20:29:59 -07:00
Tyler Veness
5d3a133f9f Remove spaces in NOLINT comments (#5407)
clang-tidy ignores the category filter if there's a space. wpiformat now
ignores categories it doesn't understand, so we can remove the spaces.
2023-06-20 20:29:23 -07:00
Tyler Veness
3a0e484691 [wpimath] Fix clang-tidy warnings (#5403) 2023-06-20 11:35:15 -07:00
Tyler Veness
eb3810c765 [wpiutil] Fix clang-tidy warnings (#5406) 2023-06-20 10:55:05 -07:00
Zhiquan Yeo
c4dc697192 [hal] WS Simulation: Add message filtering capability (#5395) 2023-06-20 08:26:03 -07:00
Tyler Veness
0eccc3f247 [ntcore] Fix clang-tidy warnings (#5405) 2023-06-20 08:21:44 -07:00
sciencewhiz
f4dda4bac0 [hal] Add javadocs for JNI (NFC) (#5298)
Docs are copied from the HAL and add references to the HAL files/methods
to aid discoverability.
2023-06-19 23:36:56 -07:00
Tyler Veness
1c20c69793 [cscore] Fix clang-tidy warnings (#5404) 2023-06-19 23:35:13 -07:00
Tyler Veness
1501607e48 [commands] Fix clang-tidy warnings (#5402) 2023-06-19 23:01:46 -07:00
Gold856
991f4b0f62 [wpimath] PIDController: Add IZone (#5315)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-06-19 23:01:01 -07:00
Gold856
f5b0d1484b [wpimath] Add isNear method to MathUtil (#5353)
This method is used to check if the given value matches an expected value within a certain tolerance.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-06-19 23:00:07 -07:00
Tyler Veness
2ce248f66c [hal] Fix clang-tidy warnings (#5401) 2023-06-19 22:59:07 -07:00
Gold856
5fc4aee2d2 [wpimath] SwerveDriveKinematics: Rename currentChassisSpeed to desiredChassisSpeed (#5393) 2023-06-19 22:58:38 -07:00
Gold856
50b90ceb54 [wpimath] SwerveDriveKinematics: Add reset method (#5398)
Adds a reset method where teams can pass in module headings for the kinematics object to use if it gets an all-zero ChassisSpeeds while converting ChassisSpeeds to module states. Also removes internal states array, replacing it with an internal headings array.
2023-06-19 22:57:55 -07:00
Joseph Eng
316cd2a453 [commands] Notify DriverStationSim in CommandTestBaseWithParam (#5400) 2023-06-19 22:56:56 -07:00
Sriman Achanta
d4ea5fa902 [cscore] VideoMode: Add equals override (Java) (#5397) 2023-06-19 17:12:07 -07:00
Ryan Blue
d6bd72d738 [wpimath] ProfiledPIDController: Add getConstraints (#5399) 2023-06-19 17:11:20 -07:00
Joseph Eng
25ad5017a9 [wpimath] Refactor kinematics, odometry, and pose estimator (#5355) 2023-06-19 17:10:39 -07:00
sciencewhiz
5c2addda0f [doc] Add missing pneumatics docs (NFC) (#5389)
Add missing HAL docs for PCM and PH
Fix references to PCM
Document different one shot durations for PCM and PH
2023-06-15 08:14:35 -07:00
Thad House
c3e04a6ea2 Fix loading tests on macos 12 (#5388) 2023-06-09 23:40:20 -07:00
Thad House
d5ed9fb859 [wpimath] Create separate archive with just units headers (#5383)
This will allow very low level deps to use the same units library we ship with wpilib
2023-06-08 21:11:51 -07:00
Ryan Blue
901ab693d4 [wpimath] Use UtilityClassTest for more utility classes (#5384) 2023-06-08 21:11:26 -07:00
Gold856
9d53231b01 [wpilib] DataLogManager: Add warning for low storage space (#5364) 2023-06-08 20:02:21 -07:00
Ryan Blue
d466933963 [wpiutil] Group doxygen into MPack module (#5380) 2023-06-08 20:00:16 -07:00
Tyler Veness
652d1c44e3 [wpiutil] Upgrade to macOS 12 to remove concept shims (#5379)
The macOS deployment target has been upgraded from 10.15 to 11. Also, a
deprecation warning for sprintf() in libuv was suppressed.
2023-06-08 19:59:54 -07:00
Ryan Blue
6414be0e5d [wpimath] Group units doxygen modules (#5382) 2023-06-08 19:58:55 -07:00
Ryan Blue
7ab5800487 [wpiutil] Fix docs typo in SmallVector (#5381) 2023-06-08 19:58:21 -07:00
Tyler Veness
59905ea721 Replace WPI_DEPRECATED() macro with [[deprecated]] attribute (#5373)
Continue to use WPI_DEPRECATED macro for constructors until clang-format is fixed.
2023-06-08 00:01:06 -07:00
Ryan Blue
753cb49a5e [ntcore] Fix doxygen module in generated C types (NFC) (#5374) 2023-06-07 09:56:20 -07:00
Ryan Blue
1c00a52b67 [hal] Expose CAN timestamp base clock (#5357) 2023-06-07 09:54:03 -07:00
Tyler Veness
91cbcea841 Replace SFINAE with concepts (#5361)
Concepts are cleaner to use and result in much better error messages for incorrect template use.
2023-06-07 09:50:09 -07:00
Tyler Veness
d57d1a4598 [wpimath] Remove unnecessary template argument from unit formatter (#5367) 2023-06-07 09:47:46 -07:00
Tyler Veness
5acc5e22aa [wpimath] Only compute eigenvalues with EigenSolvers (#5369)
We don't need the eigenvectors, so we're doing a lot of extra work we
don't need to.
2023-06-07 09:47:09 -07:00
Ryan Blue
d3c9316a97 extend shuffleboard test timeout (#5377) 2023-06-03 06:47:08 -07:00
Gold856
1ea868081a [ci] Fix /format command (#5376) 2023-06-03 06:43:08 -07:00
Tyler Veness
5fac18ff4a Update formatting to clang-format 16 (#5370) 2023-05-31 22:10:53 -07:00
Tyler Veness
a94a998002 [wpimath] Generalize Eigen formatter (#5360) 2023-05-30 23:35:15 -07:00
Tyler Veness
125f6ea101 [wpimath] Make SwerveDriveKinematics::ToChassisSpeeds() take const-ref argument (#5363) 2023-05-30 23:34:39 -07:00
Tyler Veness
51066a5a8a [wpimath] Move unit formatters into units library (#5358) 2023-05-26 01:05:27 -07:00
Ryan Blue
282c032b60 [wpilibc] Add unit-aware Joystick.GetDirection() (#5319) 2023-05-25 21:43:52 -07:00
Tyler Veness
073d19cb69 [build] Fix CMake warning (#5359)
```
CMake Warning (dev) at CMakeLists.txt:14 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.
```
2023-05-25 21:39:35 -07:00
Gold856
01490fc77b [wpiutil] DataLog: Add documentation for append methods (NFC) (#5348) 2023-05-18 21:56:21 -07:00
Tyler Veness
c9b612c986 [wpilibcExamples] Make C++ state-space elevator KF and LQR match Java (#5346) 2023-05-18 10:09:48 -07:00
Tyler Veness
eed1e6e3cb [wpimath] Replace DiscretizeAQTaylor() with DiscretizeAQ() (#5344)
Until #5339 is fixed, we have to use the slower, more accurate version.
2023-05-18 07:13:20 -07:00
Tyler Veness
c976f40364 [readme] Document how to run examples in simulation (#5340) 2023-05-17 21:09:22 -07:00
Ryan Blue
4d28bdc19e [ci] Update Github Pages deploy action parameters (#5343) 2023-05-17 21:02:43 -07:00
Ryan Blue
e0f851871f [ci] Fix github pages deploy version (#5342) 2023-05-17 20:42:52 -07:00
Tyler Veness
063c8cbedc Run wpiformat (NFC) (#5341) 2023-05-17 18:00:26 -07:00
sciencewhiz
96e41c0447 [ci] Update deploy and sshagent actions (#5338)
Fixes node deprecations
2023-05-16 20:50:03 -07:00
Tyler Veness
fd294bdd71 [build] Fix compilation with GCC 13 (#5322) 2023-05-16 13:31:58 -07:00
Peter Johnson
d223e4040b [dlt] Add delete without download functionality (#5329) 2023-05-16 09:42:06 -07:00
Tyler Veness
abc19bcb43 [upstream_utils] Zero out commit hashes and show 40 digits in index hashes (#5336) 2023-05-16 09:41:46 -07:00
Austin Shalit
e909f2e687 [build] Update gradle cache repo name (#5334)
Artifactory now does not allow repos that end in -cache. Update virtual repo naming to track this new limitation
2023-05-16 00:47:34 -07:00
Tyler Veness
52bd5b972d [wpimath] Rewrite DARE solver (#5328)
I timed the DARE unit tests, and the new solver is 0 to 100% faster in
all cases (that is, it's at least as fast as Drake's and up to 2x faster
in some cases).

The new solver is also much simpler, takes less time to compile, and
drops the libwpimath.so size from 325 MB to 301 MB.

I think most of the compilation time is coming from the eigenvalue
decompositions used to enforce argument preconditions.
2023-05-14 22:23:00 -07:00
Tyler Veness
3876a2523a [wpimath] Remove unused MatrixImpl() function (#5330)
It's an implementation detail left over from MakeMatrix().
2023-05-14 22:22:28 -07:00
Thad House
c82fcb1975 [wpiutil] Add reflection based cleanup helper (#4919)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2023-05-12 21:35:39 -07:00
Tyler Veness
15ba95df7e [wpiutil] Use std::filesystem (#4941) 2023-05-12 21:34:09 -07:00
Tyler Veness
77c2124fc5 [wpimath] Remove Eigen's custom STL types (#4945)
In C++20, overaligned types are handled properly, so Eigen's STL types
with custom allocators are no longer needed.
2023-05-12 21:32:58 -07:00
Peter Johnson
27fb47ab10 [glass] Field2D: Embed standard field images (#5159) 2023-05-12 21:31:38 -07:00
sciencewhiz
102e4f2566 [wpilib] Remove deprecated and broken SPI methods (#5249) 2023-05-12 21:30:53 -07:00
Ryan Blue
463a90f1df [wpilib, hal] Add function to read the RSL state (#5312) 2023-05-12 21:30:19 -07:00
Ryan Blue
7a90475eec [wpilib] Update RobotBase documentation (NFC) (#5320) 2023-05-12 21:29:39 -07:00
Ryan Blue
218cfea16b [wpilib] DutyCycleEncoder: Fix reset behavior (#5287)
reset should set the offset to the properly scaled position provided by getAbsolutePosition, not the raw duty cycle.
2023-05-12 21:28:32 -07:00
Thad House
91392823ff [build] Update to gradle 8.1 (#5303) 2023-05-12 21:27:31 -07:00
sciencewhiz
258b7cc48b [wpilibj] Filesystem.getDeployDirectory(): Strip JNI path from user.dir (#5317)
Fixes
https://www.chiefdelphi.com/t/filesystem-getdeploydirectory-returning-wrong-location-how-to-fix/427292
when unit tests are run with VS Code's java test runner due to VS Code
extension setting working directory which changes user.dir.
2023-05-12 21:26:52 -07:00
Ryan Blue
26cc43bee1 [wpilib] Add documentation to SPI mode enum (NFC) (#5324) 2023-05-12 21:26:10 -07:00
sciencewhiz
ac4da9b1cb [hal] Add HAL docs for Addressable LED (NFC) (#5304) 2023-05-07 22:56:40 -07:00
Tyler Veness
21d4244cf7 [wpimath] Fix DCMotor docs (NFC) (#5309) 2023-05-07 22:56:05 -07:00
sciencewhiz
1dff81bea7 [hal] Miscellaneous HAL doc fixes (NFC) (#5306) 2023-05-07 22:55:48 -07:00
Tyler Veness
7ce75574bf [wpimath] Upgrade to Drake v1.15.0 (#5310) 2023-05-07 22:54:58 -07:00
sciencewhiz
576bd646ae [hal] Add CANManufacturer for Redux Robotics (#5305)
Matches wpilibsuite/frc-docs#2225
2023-05-07 22:53:57 -07:00
Joseph Eng
ee3b4621e5 [commands] Add onlyWhile and onlyIf (#5291) 2023-04-30 14:09:02 -07:00
Joseph Eng
40ca094686 [commands] Fix RepeatCommand calling end() twice (#5261) 2023-04-28 20:57:33 -07:00
Cory
9cbeb841f5 [rtns] Match imaging tool capitalization (#5265) 2023-04-28 20:57:12 -07:00
Josiah Hamm
a63d06ff77 [examples] Add constants to java gearsbot example (#5248) 2023-04-28 20:56:14 -07:00
wmgrove
b6c43322a3 [wpilibc] XboxController: Add return tag to docs (NFC) (#5246) 2023-04-28 20:55:39 -07:00
Thad House
5162d0001c [hal] Fix and document addressable LED timings (#5272)
HAL_SetAddressableLEDBitTiming swapped high and low timings for whatever
was written to it. This fixes that bug.

Additionally, the API has been updated to take high time first, and then
low time. This is due to this being the physical data format, so having
the API match is clearer.

Additionally, update the docs with the defaults.
2023-04-28 20:54:58 -07:00
Tyler Veness
90fabe9651 [wpilibj] Use method references in drive class initSendable() (#5251) 2023-04-28 20:53:42 -07:00
Gold856
24828afd11 [wpimath] Fix desaturateWheelSpeeds to account for negative speeds (#5269) 2023-04-28 20:53:20 -07:00
Tyler Veness
e099948a77 [wpimath] Clean up rank notation in docs (NFC) (#5274) 2023-04-28 20:52:29 -07:00
Tyler Veness
fd2d8cb9c1 [hal] Use std::log2() for base-2 logarithm (#5278) 2023-04-28 20:52:03 -07:00
Sriman Achanta
ba8c64bcff [wpimath] Fix misspelled Javadoc parameters in pose estimators (NFC) (#5292) 2023-04-28 20:51:47 -07:00
Tyler Veness
f53c6813d5 [wpimath] Patch Eigen warnings (#5290) 2023-04-28 20:51:22 -07:00
Thad House
663703d370 [gitattributes] Mark json files as lf text files (#5256)
* Mark json files as lf text files

Otherwise spotless complains

* Formatting
2023-04-06 18:46:18 -07:00
Starlight220
aa34aacf6e [wpilib] Shuffleboard: Keep duplicates on SelectTab() (#5198) 2023-03-26 20:12:55 -07:00
Tyler Veness
63512bbbb8 [wpimath] Fix potential divide-by-zero in RKDP (#5242)
If f(x, u) has no dynamics, the truncation error can be zero.
2023-03-26 17:00:09 -07:00
Peter Johnson
9227b2166e [wpilibj] DriverStation: Fix joystick data logs (#5240)
Was logging relative to cached value rather than previously logged value.
Was also logging cached value instead of current loop value.
C++ implementation is correct.
2023-03-26 16:17:13 -07:00
Peter Johnson
fbf92e9190 [wpinet] ParallelTcpConnector: don't connect to duplicate addresses (#5169)
There can be duplicate addresses coming out of name resolution; if we
already started connecting to an address, don't start another connection
attempt.
2023-03-25 16:28:39 -07:00
Peter Johnson
2108a61362 [ntcore] NT4 client: close timed-out connections (#5175)
Pings are sent every 3 seconds.  If we don't see a response to the last
ping before it's time to send the next one, close the connection.
2023-03-25 16:27:40 -07:00
Peter Johnson
0a66479693 [ntcore] Optimize scan of outgoing messages (#5227)
The algorithm being used for scanning outgoing messages was O(n^2)
because it did a full linear search and then appended. This scan is
performed for each client. If there is a burst of outgoing changes, the
outgoing queue can get quite deep all at once and this scan can be very
slow. Replacing with a map fixes this.
2023-03-25 15:20:22 -07:00
Ryan Blue
b510c17ef6 [hal] Fix RobotController.getComments() mishandling quotes inside the comments string (#5197)
Previously, the comment would end at any quote, escaped or unescaped. This allows UnescapeCString to handle the unescaping of quotes and properly end the string.
2023-03-20 13:50:25 -07:00
Starlight220
e7a7eb2e93 [commands] WaitCommand: Remove subclass doc note (NFC) (#5200) 2023-03-20 13:46:26 -07:00
Starlight220
a465f2d8f0 [examples] Shuffleboard: Correct parameter order (#5204) 2023-03-20 13:45:34 -07:00
Mansour Quddus
a3364422fa LICENSE.md: Bump year to 2023 (#5195) 2023-03-18 07:12:08 -07:00
Tyler Veness
df3242a40a [wpimath] Fix NaN in C++ MakeCostMatrix() that takes an array (#5194)
Java's makeCostMatrix() and the C++ MakeCostMatrix() overload that takes
a parameter pack already do the right thing.
2023-03-17 07:05:28 -07:00
Peter Johnson
00abb8c1e0 [commands] RamseteCommand: default-initialize m_prevSpeeds (#5188) 2023-03-13 23:12:17 -07:00
Ryan Blue
c886273fd7 [wpilibj] DutyCycleEncoder.setDistancePerRotation(): fix simulation (#5147) 2023-03-13 21:28:55 -07:00
Peter Johnson
53b5fd2ace [ntcore] Use int64 for datalog type string (#5186)
There's a spec difference between NT4 and datalog for integers; NT4 uses
"int", datalog uses "int64". We were using "int" for datalog as well.

Also add backwards compatibility support to datalogtool for treating
"int" as "int64".
2023-03-13 21:28:07 -07:00
Peter Johnson
56b758320f [wpilib] DataLogManager: increase time for datetime to be valid (#5185)
There's no signal from NetComm as to when it is valid, and 1 second
seems to be marginal.  Increase to 6 seconds for just DS, 5 seconds for
FMS attached.
2023-03-13 21:27:52 -07:00
nt
08f298e4cd [wpimath] Fix Pose3d log returning Twist3d NaN for theta between 1E-8 and 1E-7 (#5168) 2023-03-13 21:27:32 -07:00
Jeffrey Morris
6d0c5b19db [commands] CommandScheduler.isComposed: Remove incorrect throws clause (NFC) (#5183) 2023-03-13 21:27:08 -07:00
Ryan Blue
0d22cf5ff7 [wpilib] Fix enableLiveWindowInTest crashing in disabled (#5173) 2023-03-10 19:24:40 -08:00
Ryan Blue
32ec5b3f75 [wpilib] Add isTestEnabled and minor docs cleanup (#5172) 2023-03-10 19:23:57 -08:00
Dustin Spicuzza
e5c4c6b1a7 [wpimath] Fix invalid iterator access in TimeInterpolatableBuffer (#5138) 2023-02-26 16:42:24 -08:00
nt
099d048d9e [wpimath] Fix Pose3d log returning Twist3d NaN for theta between 1E-9 and 1E-8 (#5143)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-26 16:41:36 -08:00
sciencewhiz
4af84a1c12 Fix Typos (NFC) (#5137) 2023-02-26 15:06:37 -08:00
Tyler Veness
ce3686b80d [wpimath] Check LTV controller max velocity precondition (#5142) 2023-02-26 15:05:41 -08:00
Colin Wong
4b0eecaee0 [commands] Subsystem: Add default command removal method (#5064) 2023-02-24 19:58:53 -08:00
Noah Andrews
edf4ded412 [wpilib] PH: Revert to 5V rail being fixed 5V (#5122) 2023-02-24 19:55:50 -08:00
Gabor Szita
4c46b6aff9 [wpilibc] Fix DataLogManager crash on exit in sim (#5125) 2023-02-23 20:13:20 -08:00
David Vo
490ca4a68a [wpilibc] Fix XboxController::GetBackButton doc (NFC) (#5131) 2023-02-23 20:11:10 -08:00
superpenguin612
cbb5b0b802 [hal] Simulation: Fix REV PH solenoids 8+ (#5132) 2023-02-23 20:10:44 -08:00
Thad House
bb7053d9ee [hal] Fix HAL_GetRuntimeType being slow on the roboRIO (#5130)
HAL_GetRuntimeType used to be a free call before the roboRIO2 was added. However, nLoadOut::getTargetClass() is not a free call, and it may hit the IPC layer. Cache this value so it is not called every time.
2023-02-23 00:59:59 -08:00
sciencewhiz
9efed9a533 Update .clang-format to c++20 (#5121)
This does not result in any reformatting
2023-02-20 10:54:55 -08:00
sciencewhiz
dbbfe1aed2 [wpilib] Use PH voltage to calc Analog pressure switch threshold (#5115)
The calculated trigger voltages were calculated with a hard coded 5v.
This introduces error when the 5V provided to the Analog pressure
sensor is not exactly 5v, as the pressure is a ratio of the analog
voltage and provided voltage.

This should improve
https://www.chiefdelphi.com/t/rev-pressure-sensor-enablecompressoranalog-not-reaching-configured-pressure/426868
where the 5v voltage was 4.92 volts, which introduces ~8 PSI of error.
2023-02-19 23:13:22 -08:00
Ryan Blue
de65a135c3 [wpilib] DutyCycleEncoderSim: Add channel number constructor (#5118) 2023-02-19 23:12:48 -08:00
sciencewhiz
3e9788cdff [docs] Strip path from generated NT docs (#5119)
Fixes #5117
2023-02-19 23:12:05 -08:00
Peter Johnson
ecb072724d [ntcore] Client::Disconnect(): actually close connection (#5113) 2023-02-17 23:56:49 -08:00
Peter Johnson
0d462a4561 [glass] NT view: Change string/string array to quoted (#5111) 2023-02-17 18:01:54 -08:00
Peter Johnson
ba37986561 [ntcore] NetworkClient::Disconnect: Add null check (#5112) 2023-02-17 16:48:34 -08:00
Peter Johnson
25ab9cda92 [glass,ov] Provide menu item to create topic from root (#5110) 2023-02-17 16:46:02 -08:00
Peter Johnson
2f6251d4a6 [glass] Set default value when publishing new topic (#5109) 2023-02-17 16:45:38 -08:00
Jonah
e9a7bed988 [wpimath] Add timestamp getter to MathShared (#5091)
This makes it possible to mock the timestamp for wpimath without affecting the rest of the library.

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2023-02-17 14:53:17 -08:00
Peter Johnson
9cc14bbb43 [ntcore] Add stress test to dev executable (#5107) 2023-02-16 22:49:36 -08:00
Peter Johnson
8068369542 [wpinet] uv: Stop creating handles when closing loop (#5102)
This prevents EventLoopRunner::Stop() from hanging in the case when
new handles are created after the async walk closes all the handles.
2023-02-16 22:49:14 -08:00
Peter Johnson
805c837a42 [ntcore] Fix use-after-free in server (#5101)
The client name deduplication didn't properly deduplicate.  Instead,
always append the client index to guarantee a unique name.
2023-02-16 22:45:50 -08:00
bovlb
fd18577ba0 [commands] Improve documentation of addRequirements (NFC) (#5103) 2023-02-16 22:08:46 -08:00
Tyler Veness
74dea9f05e [wpimath] Fix exception for empty pose buffer in pose estimators (#5106)
Fixes #5100.
2023-02-16 22:00:21 -08:00
sciencewhiz
9eef79d638 [wpilib] PneumaticHub: Document range of enableCompressorAnalog (NFC) (#5099) 2023-02-15 20:25:12 -08:00
Peter Johnson
843574a810 [ntcore] Use wpi::Now instead of loop time for transmit time
As the send function is called after local processing, there can be a
substantial delay between the loop time and the actual send.
2023-02-13 23:00:03 -08:00
Peter Johnson
226ef35212 [wpinet] WebSocket: Reduce server send frame overhead
Avoid allocating 4K buffer to send a 10-byte header per frame.
2023-02-13 23:00:03 -08:00
Peter Johnson
b30664d630 [ntcore] Reduce initial connection overhead
Mixing the announce and value messages causes significant downstream
inefficiency in both time and space.
2023-02-13 23:00:03 -08:00
sciencewhiz
804e5ce236 [examples] MecanumDrive: Fix axis comment in C++ example (NFC) (#5096) 2023-02-13 22:18:23 -08:00
Starlight220
49af88f2bb [examples] ArmSimulation: Fix flaky test (#5093) 2023-02-13 12:59:27 -08:00
Peter Johnson
d56314f866 [wpiutil] Disable mock time on the Rio (#5092) 2023-02-12 22:38:34 -08:00
Starlight220
43975ac7cc [examples] ArmSimulation, ElevatorSimulation: Extract mechanism to class (#5052) 2023-02-12 06:50:57 -08:00
Starlight220
5483464158 [examples, templates] Improve descriptions (NFC) (#5051) 2023-02-12 06:49:20 -08:00
Starlight220
785e7dd85c [wpilibc] SendableChooser: static_assert copy- and default-constructibility (#5078)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-12 06:24:00 -08:00
Peter Johnson
e57ded8c39 [ntcore] Improve disconnect error reporting (#5085)
Also fix memory leak in WebSocketConnection destructor.
2023-02-11 22:56:29 -08:00
Peter Johnson
01f0394419 [wpinet] Revert WebSocket: When Close() is called, call closed immediately (#5084)
This caused crashes in ntcore.

This reverts commit b879a6f8c6 (#5047).
2023-02-11 22:56:01 -08:00
Jordan McMichael
59be120982 [wpimath] Fix Pose3d exp()/log() and add rotation vector constructor to Rotation3d (#5072)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-08 21:31:03 -08:00
Tyler Veness
37f065032f [wpilib] Refactor TimedRobot tests (#5068) 2023-02-07 23:00:46 -08:00
Ryan Blue
22a170bee7 [wpilib] Add Notifier test (#5070) 2023-02-07 23:00:17 -08:00
Tyler Veness
2f310a748c [wpimath] Fix DCMotor.getSpeed() (#5061)
This bug didn't occur in C++ because the units system caught it at
compile time.
2023-02-05 13:21:16 -08:00
Nick Hadley
b43ec87f57 [wpilib] ElevatorSim: Fix WouldHitLimit methods (#5057) 2023-02-05 11:58:53 -08:00
Peter Johnson
19267bef0c [ntcore] Output warning on property set on unpublished topic (#5059)
Previously this was a debug-level message. This can primarily impact
users who call SetPersistent() on an entry before calling SetDefault().
2023-02-05 11:57:29 -08:00
Peter Johnson
84cbd48d84 [ntcore] Handle excludeSelf on SetDefault (#5058) 2023-02-05 11:57:09 -08:00
Peter Johnson
1f35750865 [cameraserver] Add GetInstance() to all functions (#5054)
GetInstance() is required to start the event listener that creates the
network table entries.

This is a C++ only change; Java uses static's and thus doesn't need this.

The right fix is to implement cscore's AddListener() immediate notification,
but that's much too invasive of a change to do this year.

This fixes the common use cases, but doesn't fix all cases, as e.g. creating
a UsbCamera manually before calling any CameraServer functions will still
have the issue, but there's an easy workaround--call
CameraServer::SetSize() prior to creating any cameras.
2023-02-05 11:28:53 -08:00
Peter Johnson
8230fc631d [wpilib] Revert throw on nonexistent SimDevice name in SimDeviceSim (#5053)
This breaks current vendor use of SimDeviceSim.

This reverts commit d991f6e435 (#5041).
2023-02-05 11:27:55 -08:00
Peter Johnson
b879a6f8c6 [wpinet] WebSocket: When Close() is called, call closed immediately (#5047)
This provides the closed callback with the real reason for the
connection being closed.  Keep closed from being called twice by adding
a check in SetClosed().
2023-02-03 22:59:19 -08:00
Peter Johnson
49459d3e45 [ntcore] Change wire timeout to fixed 1 second (#5048)
Previously the timeout was 10 times the update rate, so with low update
rates it could be as small as 50 ms, causing spurious disconnects when
large or many topics were published.
2023-02-03 22:05:41 -08:00
Jordan McMichael
4079eabe9b [wpimath] Discard stale pose estimates (#5045)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-03 22:04:30 -08:00
Peter Johnson
fe5d226a19 [glass] Fix option for debug-level NT logging (#5049) 2023-02-03 22:03:45 -08:00
Peter Johnson
b7535252c2 [ntcore] Don't leak buffers in rare WS shutdown case (#5046)
If the request called the callback after the WebSocket had been
destroyed, the buffers were leaked.
2023-02-03 21:56:35 -08:00
Peter Johnson
b61ac6db33 [ntcore] Add client disconnect function (#5022)
As setServer doesn't disconnect, it's useful to have a function that
disconnects without needing to completely stop the client.
2023-02-03 15:28:00 -08:00
Ryan Blue
7b828ce84f [wpimath] Add nearest to Pose2d and Translation2d (#4882)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2023-02-03 15:27:16 -08:00
Michael Leong
08a536291b [examples] Improvements to Elevator Simulation Example (#4937)
Co-authored-by: Abhay Shukla <105139789+aboombadev@users.noreply.github.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-02-03 15:23:06 -08:00
Peter Johnson
193a10d020 [wpigui] Limit frame rate to 120 fps by default (#5030)
Limiting with vsync is apparently unreliable on a number of systems;
this resulted in high CPU/GPU usage.

Also add current actual frame rate to about dialog of GUI tools.
2023-02-03 15:21:52 -08:00
sciencewhiz
7867bbde0e [wpilib] Clarify DS functions provided by FMS (NFC) (#5043) 2023-02-03 15:21:12 -08:00
Peter Johnson
fa7c01b598 [glass] Add option for debug-level NT logging (#5007) 2023-02-03 15:20:03 -08:00
truher
2b81610248 [wpiutil] Add msgpack to datalog Python example (#5032) 2023-02-03 15:19:44 -08:00
Tyler Veness
a4a369b8da CONTRIBUTING.md: Add unicodeit CLI to math docs guidelines (#5031) 2023-02-03 15:19:01 -08:00
Ryan Blue
d991f6e435 [wpilib] Throw on nonexistent SimDevice name in SimDeviceSim constructor (#5041)
Previously this would just create a object that was otherwise non-functional.
2023-02-03 15:18:31 -08:00
Peter Johnson
a27a047ae8 [hal] Check for null in getSimDeviceName JNI (#5038) 2023-02-01 23:25:55 -08:00
Starlight220
2f96cae31a [examples] Hatchbots: Add telemetry (#5011) 2023-01-31 23:44:18 -08:00
Peter Johnson
83ef8f9658 [simulation] GUI: Fix buffer overflow in joystick axes copy (#5036)
This was using an incorrect sizeof which would copy excessive data and
overwrite the button data.
2023-01-31 23:40:22 -08:00
Starlight220
4054893669 [commands] Fix C++ Select() factory (#5024)
Update example to use it.
2023-01-29 07:23:12 -08:00
Sriman Achanta
f75acd11ce [commands] Use Timer.restart() (#5023) 2023-01-29 07:21:07 -08:00
Tyler Veness
8bf67b1b33 [wpimath] PIDController::Calculate(double, double): update setpoint flag (#5021)
Fixes #5020.
2023-01-29 07:18:48 -08:00
Peter Johnson
49bb1358d8 [wpiutil] MemoryBuffer: Fix GetMemoryBufferForStream (#5017)
This would previously just write past the end of the buffer, smashing
the stack.  It's only called in the case when a non-file or block device
is used as the file.
2023-01-28 22:38:34 -08:00
Peter Johnson
9c4c07c0f9 [wpiutil] Remove NDEBUG check for debug-level logging (#5018)
This adds minimal overhead but is useful when debugging release
binaries.
2023-01-28 14:13:58 -08:00
Peter Johnson
1a47cc2e86 [ntcore] Use full handle when subscribing (#5013)
Just using the index is insufficient because of Subscriber overlap with
MultiSubscriber.
2023-01-27 09:14:38 -08:00
Ryan Blue
7cd30cffbc Ignore networktables.json (#5006) 2023-01-26 09:21:58 -08:00
DeltaDizzy
92aecab2ef [commands] Command controllers are not subclasses (NFC) (#5000) 2023-01-25 15:20:29 -08:00
Peter Johnson
8785bba080 [ntcore] Special-case default timestamps (#5003)
Previously, a setDefault() on the server could override a client doing a
real set() if the time offset between client and server was negative,
resulting in a negative timestamp from the client.  This is a not
uncommon situation with robot code, as the robot code always starts at
time 0, so any clients that set values earlier (in real time) would have
negative timestamps.

Also improve special casing of 0 in the transmit side to make sure a
normal timestamp will never get sent as 0.
2023-01-25 11:36:13 -08:00
Peter Johnson
9e5b7b8040 [ntcore] Handle topicsonly followed by value subscribe (#4991)
Previously this wouldn't send the last value on the value subscribe if a
topics only subscription already existed.

Also start adding server implementation unit tests.
2023-01-24 21:50:38 -08:00
Sriman Achanta
917906530a [wpilib] Add Timer::Restart() (#4963) 2023-01-23 14:50:46 -08:00
Tyler Veness
00aa66e4fd [wpimath] Remove extraneous assignments from DiscretizeAB() (#4967) 2023-01-23 09:46:12 -08:00
Starlight220
893320544a [examples] C++ RamseteCommand: Fix units (#4954)
Also fix the memory leak in the command-based auto.
2023-01-22 11:20:35 -08:00
Evan
b95d0e060d [wpilib] XboxController: Fix docs discrepancy (NFC) (#4993)
Comments for leftTrigger said they attach to the right trigger of the controller.
2023-01-21 22:09:55 -08:00
Peter Johnson
008232b43c [ntcore] Write empty persistent file if none found (#4996)
This avoids the warning appearing on every startup when persistent
values aren't used.

Also add note to message saying it can be ignored if persistent values
aren't expected.
2023-01-21 22:09:24 -08:00
Starlight220
522be348f4 [examples] Rewrite tags (NFC) (#4961) 2023-01-21 15:24:10 -08:00
Tyler Veness
d48a83dee2 [wpimath] Update Wikipedia links for quaternion to Euler angle conversion (NFC) (#4995) 2023-01-21 15:16:35 -08:00
Peter Johnson
504fa22143 [wpimath] Workaround intellisense Eigen issue (#4992)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-01-21 15:16:12 -08:00
Brady Schindler
b2b25bf09f [commands] Fix docs inconsistency for toggleOnFalse(Command) (NFC) (#4978) 2023-01-20 23:47:37 -08:00
Thad House
ce3dc4eb3b [hal] Properly use control word that is in sync with DS data (#4989) 2023-01-20 23:46:56 -08:00
Thad House
1ea48caa7d [wpilib] Fix C++ ADXRS450 and Java SPI gyro defs (#4988) 2023-01-20 13:25:13 -08:00
Thad House
fb101925a7 [build] Include wpimathjni in commands binaries (#4981) 2023-01-19 22:05:32 -08:00
Thad House
657951f6dd [starter] Add a process starter for use by the installer for launching tools (#4931) 2023-01-19 20:09:35 -08:00
Tyler Veness
a60ca9d71c [examples] Update AprilTag field load API usage (#4975) 2023-01-19 17:01:17 -08:00
Tyler Veness
f8a45f1558 [wpimath] Remove print statements from tests (#4977) 2023-01-19 17:00:35 -08:00
sciencewhiz
ecba8b99a8 [examples] Fix swapped arguments in MecanumControllerCommand example (#4976) 2023-01-18 21:25:49 -08:00
Berke Sinan Yetkin
e95e88fdf9 [examples] Add comment to drivedistanceoffboard example (#4877)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-01-18 20:46:41 -08:00
CarloWoolsey
371d15dec3 [examples] Add Computer Vision Pose Estimation and Latency Compensation Example (#4901)
This PR updates the existing differentialdriveposeestimator example to include computer vision pose estimation and latency compensation.

The example generates a simulated cameraToTarget transformation, which is then fed into ComputerVisionUtil.objectToRobotPose() to compute the robot's field-relative position exclusively from vision measurements. The vision measurements are applied through DifferentialDrivePoseEstimator.addVisionMeasurement().

The updated example constructs an AprilTagFieldLayout from JSON. This requires a deploy directory, something which isn't currently supported in wpilibjExamples and wpilibcExamples.
2023-01-18 20:46:05 -08:00
Peter Johnson
cb9b8938af [sim] Enable docking in the GUI (#4960) 2023-01-18 20:42:58 -08:00
Brennen Puth
3b084ecbe0 [apriltag] AprilTagFieldLayout: Improve API shape for loading builtin JSONs (#4949) 2023-01-18 20:42:39 -08:00
Matt
27ba096ea1 [wpilib] Fix MOI calculation error in SingleJointedArmSim (#4968)
Previous calculation derivation mixed up length and distance to CG.
2023-01-18 20:40:39 -08:00
Jordan McMichael
42c997a3c4 [wpimath] Fix Pose3d exponential and clean up Pose3d logarithm (#4970)
Implementation based on this paper: https://ethaneade.org/lie.pdf
2023-01-18 20:38:03 -08:00
Tyler Veness
5f1a025f27 [wpilibj] Fix typo in MecanumDrive docs (NFC) (#4969) 2023-01-18 13:47:27 -08:00
Tyler Veness
0ebf79b54c [wpimath] Fix typo in Pose3d::Exp() docs (NFC) (#4966) 2023-01-18 13:46:45 -08:00
Oliver W
a8c465f3fb [wpimath] HolonomicDriveController: Add getters for the controllers (#4948) 2023-01-16 08:33:15 -08:00
Starlight220
a7b1ab683d [wpilibc] Add unit test for fast deconstruction of GenericHID (#4953) 2023-01-16 08:28:06 -08:00
Starlight220
bd6479dc29 [build] Add Spotless for JSON (#4956) 2023-01-16 08:26:46 -08:00
Thad House
5cb0340a8c [hal, wpilib] Load joystick values upon code initialization (#4950)
During HAL_Initialize, wait up to 100ms for a DS packet to be received. Then in RobotBase, right after calling HAL_Initialize, call each language's RefreshData function to force a high level DS update. If the DS is connected, will get joystick data. If there is no data, nothing different will happen, but in that case there's no joysticks anyway.
2023-01-15 16:36:44 -08:00
sciencewhiz
ab0e8c37a7 [readme] Update build requirements (NFC) (#4947)
Change to adoptium, and add Xcode min version
2023-01-15 15:19:24 -08:00
Tyler Veness
b74ac1c645 [build] Add apriltag to C++ cmake example builds (#4944)
This fixes compilation of the apriltag vision example on my machine.
2023-01-13 23:24:14 -08:00
Doug Wegscheid
cf1a411acf [examples] Add example programs for AprilTags detection (#4932)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2023-01-13 23:08:45 -08:00
sciencewhiz
1e05b21ab5 [wpimath] Fix PID atSetpoint to not return true prematurely (#4906)
Wait until setpoint and measurement have been set.
2023-01-13 22:26:30 -08:00
ohowe
e5a6197633 [wpimath] Fix SwerveDriveKinematics not initializing a new array each time (#4942)
This is problematic if you call it twice before utilizing the result.
2023-01-13 20:16:50 -08:00
Peter Johnson
039edcc23f [ntcore] Queue current value on subscriber creation (#4938)
This fixes a potential race condition in code that only uses readQueue.
2023-01-13 20:07:24 -08:00
Matt
f7f19207e0 [wpimath] Allow multiple vision measurements from same timestamp (#4917)
Co-authored-by: Jordan McMichael <jlmcmchl@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-01-11 23:04:30 -08:00
Starlight220
befd12911c [commands] Delete UB-causing rvalue variants of CommandPtr methods (#4923)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-01-11 22:53:04 -08:00
superpenguin612
34519de60a [commands] Fix spacing in command composition exception (#4924) 2023-01-11 11:46:33 -08:00
Ryan Blue
dc4355c031 [hal] Add handle constructor and name getters for sim devices (#4925) 2023-01-11 11:45:15 -08:00
Ryan Blue
53d8d33bca [hal, wpilibj] Add missing distance per pulse functions to EncoderSim (#4928)
Also fix C++ and Java EncoderSim.setDistancePerPulse() not propagating value to SimEncoderData.
2023-01-11 11:43:56 -08:00
bovlb
530ae40614 [apriltag] Explain what April tag poses represent (NFC) (#4930) 2023-01-11 11:42:30 -08:00
Starlight220
79f565191e [examples] DigitalCommunication, I2CCommunication: Add tests (#4865) 2023-01-08 16:33:53 -08:00
Starlight220
2cd9be413f [wpilib, examples] Cleanup PotentiometerPID, Ultrasonic, UltrasonicPID examples (#4893)
Fix C++ Ultrasonic to return correct units.
2023-01-08 16:33:07 -08:00
Matt
babb0c1fcf [apriltag] Add 2023 field layout JSON (#4912) 2023-01-08 16:30:45 -08:00
ohowe
330ba45f9c [wpimath] Fix swerve kinematics util classes equals function (#4907)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-01-08 16:29:35 -08:00
sciencewhiz
51272ef6b3 [fieldImages] Add 2023 field (#4915) 2023-01-08 16:28:25 -08:00
Starlight220
0d105ab771 [commands] Deduplicate command test utils (#4897) 2023-01-08 07:44:53 -08:00
Tyler Veness
cf4235ea36 [wpiutil] Guard MSVC pragma in SymbolExports.h (#4911)
MinGW gives an unknown pragma warning on Windows.
2023-01-07 16:41:40 -08:00
Ryan Blue
2d4b7b9147 [build] Update opencv version in opencv.gradle (#4909) 2023-01-06 18:09:58 -08:00
Peter Johnson
aec6f3d506 [ntcore] Fix client flush behavior (#4903)
We need to ignore per-publisher send periods when flushing.

Also fix NT4 client to use flush async's (same as NT3 client).
2023-01-04 23:36:26 -08:00
Peter Johnson
bfe346c76a [build] Fix cmake java resources (#4898)
These need to be relative paths, but GLOB generates absolute paths by
default.
2023-01-04 08:16:47 -08:00
Ryan Blue
83f1860047 [wpilib] Add/update documentation to PneumaticBase and subclasses (NFC) (#4881)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2023-01-02 10:23:59 -08:00
Dustin Spicuzza
9872e676d8 [commands] Make Subsystem destructor virtual (#4892)
C++ best practice if there are other functions that are virtual.
2023-01-02 07:59:12 -08:00
Dustin Spicuzza
25db20e49d [hal] Fix segfault in various HAL functions (#4891) 2023-01-01 23:19:04 -08:00
ohowe
b0c6724eed [glass] Add hamburger menu icon to titlebars (#4874)
This does the same thing as right clicking, but provides a visual indicator.
The icon disappears if the window is too small or docked (right click keeps working).
2023-01-01 20:05:09 -08:00
Tyler Veness
f0fa8205ac Add missing compiler flags and fix warnings (#4889)
This makes the build fail on warnings. It caught two out-of-bounds reads
and a deprecation warning.
2023-01-01 08:14:19 -08:00
Dustin Spicuzza
42fc4cb6bc [wpiutil] SafeThread: Provide start/stop hooks (#4880)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2022-12-31 15:40:45 -08:00
Sriman Achanta
cc166c98d2 [templates] Add Command-based skeleton template (#4861)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-12-31 13:18:43 -08:00
Thad House
3f51f10ad3 [build] Update to 2023v3 image (#4886) 2022-12-31 13:16:41 -08:00
Peter Johnson
1562eae74a [ntcore] Refactor meta-topic decoding from glass (#4809) 2022-12-31 12:01:51 -08:00
Thad House
b632b288a3 Fix usages of std::min and std::max to be windows safe (#4887) 2022-12-31 12:00:45 -08:00
Dustin Spicuzza
c11bd2720f [wpilibc] Add internal function to reset Shuffleboard instance (#4884)
Needed for RobotPy test framework.
2022-12-31 10:43:48 -08:00
Peter Johnson
f1151d375f [ntcore] Add method to get server time offset (#4847)
Also exposes this as an event signaled when the offset is updated due to
a ping response from the server.
2022-12-30 20:15:57 -08:00
Ryan Blue
fe1b62647f [hal,wpilib] Update documentation for getComments (NFC) (#4879) 2022-12-30 04:15:37 -08:00
Thad House
c49a45abbd [build] Fix examples linking in incorrect jni library (#4873) 2022-12-29 08:07:59 -06:00
Griffin Della Grotte
bc3d01a721 [build] Add platform check to doxygen plugin (#4862)
This allows the build to work on aarch64 and other platforms without downloadable doxygen binaries.
2022-12-27 22:43:21 -06:00
Ryan Blue
bc473240ae Add Jetbrains Fleet folder to .gitignore (#4872) 2022-12-27 22:41:13 -06:00
Tyler Veness
2121bd5fb8 [wpimath] Remove RKF45 (#4870)
RKDP is strictly better in terms of accuracy per unit of work. We used
RKF45 for sim physics in the 2021 season, but we transitioned to RKDP
before the 2022 season.
2022-12-27 19:29:59 -06:00
Griffin Della Grotte
835f8470d6 [build] Fix roborio cross-compiler on arm hosts (#4864) 2022-12-27 10:26:53 -08:00
Peter Johnson
6cfe5de00d [ntcore] Don't deadlock server on early destroy (#4863)
It was possible to deadlock on instance destroy if the server had started
but had not yet fully initialized its handles.
2022-12-27 10:25:48 -08:00
Ryan Blue
2ac41f3edc [hal, wpilib] Add RobotController.getComments() (#4463) 2022-12-26 11:39:51 -08:00
Sriman Achanta
26bdbf3d41 Java optimization and formatting fixes (#4857) 2022-12-26 11:37:53 -08:00
Sriman Achanta
92149efa11 Spelling and grammar cleanups (#4849) 2022-12-26 11:32:13 -08:00
Ryan Blue
176fddeb4c [commands] Add functions to HID classes to allow use of axes as BooleanEvents/Triggers (#4762) 2022-12-26 11:29:14 -08:00
Starlight220
87a34af367 [templates] Add bindings to command-based template (#4838) 2022-12-26 11:28:06 -08:00
Starlight220
4534e75787 [examples] Remove redundant MotorControl example (#4837)
The MotorControlEncoder had the exact same content, with the addition of an encoder. No point in having both examples.
2022-12-26 11:27:20 -08:00
Griffin Della Grotte
1cbebaa2f7 [commands] Remove final semicolon from test macro definition (#4859) 2022-12-26 00:14:59 -06:00
Ryan Blue
6efb9ee405 [commands] Add constructor for SwerveControllerCommand that takes a HolonomicDriveController (#4785)
Also adds copy and move constructors to HolonomicDriveController.
2022-12-25 18:48:27 -08:00
Thad House
1e7fcd5637 [cscore] Change run loop functions to not be mac specific (#4854) 2022-12-25 13:37:59 -06:00
Peter Johnson
1f940e2b60 [apriltag] Add C++ wrappers, rewrite Java/JNI to match (#4842)
This provides a consistent class-based interface to the underlying C
library from both C++ and Java.

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2022-12-25 08:15:43 -08:00
Starlight220
a6d127aedf [build] Add missing task dependency in wpilibjExamples (#4852) 2022-12-25 07:37:10 -08:00
Thad House
b893b3d6d3 [cscore] Add support for USB cameras on macOS (#4846)
The main restriction is there must be an event loop running on the main thread.
No special action is required for GUI applications, but for non-GUI applications, a
RunOsxRunLoop() function is provided that needs to be called from the main thread.
2022-12-25 07:36:00 -08:00
Peter Johnson
1696a490fa [glass] Add support for alternate NT ports (#4848) 2022-12-24 20:18:07 -06:00
Peter Johnson
40a22d69bc [glass] Add support for alternate NT ports (#4848) 2022-12-24 20:17:45 -06:00
Sriman Achanta
e84dbfede0 [wpilib] GenericHID: Add rumble both option (#4843) 2022-12-24 11:28:52 -08:00
CarloWoolsey
8aa9dbfa90 [examples] Link apriltag package in examples build.gradle (#4845) 2022-12-23 20:04:59 -06:00
Ryan Blue
eda2fa8a17 [build] Update Spotless (#4840)
Removes JVM args workaround needed for old version of spotless to run on JDK 17.

2 files had formatting updates.
2022-12-21 08:54:41 -06:00
sciencewhiz
d20594db0d Fix typos (#4839) 2022-12-21 08:53:00 -06:00
Ryan Blue
dd8ecfdd54 [commands] Fix typo in waitUntil docs (NFC) (#4841) 2022-12-21 08:24:25 -06:00
Thad House
17ceebfff4 [apriltag] Clean up apriltag JNI (#4823) 2022-12-19 21:06:36 -08:00
Ryan Blue
8b74ab389d [examples] RapidReactCommandBot: Fix array indices (#4833) 2022-12-18 16:54:37 -06:00
David Vo
1aad3489c2 [sim] Implement PD total current and power (#4830) 2022-12-18 08:00:31 -06:00
Ashray._.g
2744991771 [wpimath] Fix docs in SwerveModulePosition (#4825)
Changed m/s and speeds to m and distance.
2022-12-16 05:48:20 -08:00
Peter Johnson
ffbf6a1fa2 [commands] Disable regularly failing unit test (#4824) 2022-12-15 21:53:08 -08:00
Starlight220
fbabd0ef15 [commands] Enhance Command Sendable implementations (#4822) 2022-12-15 18:28:52 -08:00
Thad House
7713f68772 [hal] Use atomic rather then mutex for DS Data updates (#4787)
Using an atomic here means we are never going against a lock that is touchable from user code. That should make reading the DS data from the DS callback even safer.
2022-12-15 18:27:52 -08:00
Starlight220
701995d6cc [examples] Update Command-based starter project (#4778) 2022-12-15 09:40:14 -08:00
Thad House
bf7068ac27 [wpilibc] Add missing PPS implementation for C++ (#4821) 2022-12-15 09:28:42 -08:00
Peter Johnson
aae0f52ca6 [ntcore] NetworkTable: fix visibility of get/set value (#4820) 2022-12-14 19:43:53 -08:00
Thad House
ee02fb7ba7 [hal] Add support for Pulse-Per-Second signal (#4819) 2022-12-14 18:15:34 -08:00
Thad House
518916ba02 [wpilib] Fix DS mode thread event being manual reset accidentally (#4818)
These need to be automatic reset.
2022-12-14 10:17:13 -08:00
Thad House
3997c6635b [hal] Update to new image, use new TCP notify callback and new duty cycle API (#4774) 2022-12-13 22:37:42 -08:00
Michael Leong
cc8675a4e5 [examples] Add comment on how to view elevator sim (NFC) (#4482) 2022-12-13 22:34:00 -08:00
Peter Johnson
fb2c170b6e [ntcore] Simplify local startup (#4803)
The current approach was slightly more efficient but didn't correctly
handle meta-topic publishing for topics published before the server was
started.
2022-12-13 22:31:44 -08:00
shueja-personal
7ba8a9ee1f [wpimath] ProfiledPIDController: Add to SendableRegistry (#4656)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-12-13 22:31:06 -08:00
Sriman Achanta
c569d8e523 [wpilib] Joystick.getMagnitude(): use hypot() function (#4816) 2022-12-13 22:29:09 -08:00
bovlb
2a5e89fa97 [apriltag] Improve description of pose coordinates (NFC) (#4810)
The "bottom-left" language appears to be based on [a 2-D diagram  on another page](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/geometry/coordinate-systems.html) and doesn't seem very helpful here.
2022-12-13 22:27:43 -08:00
Drew Williams
cc003c6c38 [apriltag] Fix AprilTagFieldLayout JSON name (#4814) 2022-12-13 22:27:08 -08:00
Sriman Achanta
5522916123 [commands] CommandXBoxController bumper documentation fix (NFC) (#4815) 2022-12-13 22:26:35 -08:00
Peter Johnson
967b30de3a [glass] Fix NT view UpdateClients() bug (#4808)
If UpdateClients() was called in the same update batch as an entry
removal, it could crash in GetEntry() due to a null entry caused by
deletion before a removal erase pass was made.
2022-12-12 23:38:36 -08:00
Tyler Veness
3270d4fc86 [wpimath] Rewrite pose estimator docs (#4807) 2022-12-12 20:30:52 -08:00
Thad House
be39678447 [apriltag] Add test to ensure apriltagjni loads (#4805) 2022-12-12 20:30:25 -08:00
Starlight220
61c75deb2a [commands] Test no-op behavior of scheduling a scheduled command (#4806) 2022-12-12 20:29:47 -08:00
Peter Johnson
a865f48e96 [ntcore] Pass pub/sub options as a unified PubSubOptions struct (#4794)
In Java, PubSubOption is still used for passing options, but this
simplifies C++ use substantially, as it allows aggregate construction.
2022-12-12 19:28:15 -08:00
Ryan Blue
f66a667321 [commands] Fix incorrect Trigger docs (NFC) (#4792) 2022-12-12 15:38:29 -08:00
Peter Johnson
f8d4e9866e [ntcore] Clean up ntcore_test.h (#4804)
The RPC functions are no longer implemented.

Also make header C-safe.
2022-12-12 15:36:54 -08:00
Tyler Veness
7e84ea891f [wpimath] Fix ComputerVisionUtil transform example in parameter docs (NFC) (#4800) 2022-12-11 22:44:08 -08:00
Charlie
da3ec1be10 [wpimath] Change terminology for ArmFeedforward gravity gain (NFC) (#4791) 2022-12-11 22:43:44 -08:00
Ryan Blue
944dd7265d [wpilibc] Add C++ Notifier error handling, update java notifier error message (#4795) 2022-12-11 22:42:22 -08:00
Ryan Blue
6948cea67a [wpiutil] Fix MemoryBuffer initialization (#4797)
Dereferencing an end iterator is undefined behavior and causes a failed assertion when running in Windows debug.
2022-12-11 07:39:04 -08:00
Ryan Blue
a31459bce6 [wpiutil] Fix UnescapeCString overflow when inputSize < 2 (#4796)
Add tests for empty, small, and string without escapes.
2022-12-11 07:36:38 -08:00
ohowe
4a0ad6b48c [wpimath] Rotation2d: Add reference to angleModulus in docs (NFC) (#4786) 2022-12-09 23:35:15 -08:00
Peter Johnson
e6552d272e [ntcore] Remove table multi-subscriber (#4789)
This wasn't well thought out, and leaks horribly in Java.

Reverts part of #4640.
2022-12-09 21:25:29 -08:00
Ryan Blue
bde383f763 [hal] Replace const char* with std::string_view in Driver Station sim functions (#4532) 2022-12-09 13:10:23 -08:00
Ryan Blue
5a52b51443 [hal] Add RobotController.getSerialNumber() (#4783) 2022-12-08 21:58:55 -08: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
sciencewhiz
989c9fb29a [wpimath] Revert Rotation2D change that limits angles (#4781)
Reverts "[wpimath] Constrain Rotation2d range to -pi to pi (#4611)"
This reverts commit d1d458db2b.

This broke multiple teams code in beta. It is also easier to limit the angle externally, then reconstruct a larger angle that got limited. This additionally adds comments to clarify the behavior and retains tests that were added in the reverted commit, and fixes a javadoc comment angle reference.
2022-12-08 18:10:44 -08:00
Peter Johnson
0f5b08ec69 [wpigui] Update imgui to 1.89.1+ (#4780) 2022-12-08 00:24:27 -08:00
Starlight220
fba191099c [examples] AddressableLED: Add unit test (#4779) 2022-12-07 21:47:47 -08:00
Peter Johnson
b390cad095 [wpilibj] Consistently use ErrorMessages.requireNonNullParam (#4776)
Also remove wpilibj version of ErrorMessages and consistently use static import.
2022-12-07 21:46:26 -08:00
Peter Johnson
b9772214d9 [wpilib] Sendable: Don't call setter for getter changes 2022-12-07 21:29:51 -08:00
Peter Johnson
342c375a71 [ntcore] Add subscriber option to exclude single publisher
This enables limited self-exclusion for entries seeing their own changes
or similarly with a pub/sub pair.
2022-12-07 21:29:51 -08:00
Peter Johnson
b0e4053087 [ntcore] Use int for options instead of double
Periodic time is stored in milliseconds.
2022-12-07 21:29:51 -08:00
Peter Johnson
f3e666b7bb [cscore] Convert YUYV and UYVY directly to grayscale (#4777)
This is significantly more efficient than converting by way of BGR.
2022-12-07 10:36:40 -08:00
William Toth
b300518bd1 [hal] Add CAN Stream API to Java through JNI bindings (#4193)
The CAN Stream API allows defining an buffer to receive an
arbitrary set of CAN messages, based on an ID and a mask. Messages
are added to this queue separate of other CAN APIs. This means the
messages can be receive without impacting other APIs such as
vendor APIs.

This enables things like detection of what devices are on the
bus, or custom decoding, without using vendor APIs.

Co-authored-by: Thad House <thadhouse1@gmail.com>
2022-12-06 21:58:09 -08:00
Peter Johnson
be27171236 [wpilibj] Shuffleboard: Check for null sendable (#4772)
Adding a null sendable to a container could result in a delayed NullPointerException.
2022-12-06 21:14:09 -08:00
Starlight220
4bbdbdfb48 [commands] Move GroupedCommands to CommandScheduler (#4728)
Move the command group checking functionality from CommandGroupBase into CommandScheduler.
Update references to grouping as composition for clarity (because explicitly grouping isn't the only way to do it).
Deprecate the static factory methods parallel, race, and deadline in CommandGroupBase in favor of the identical ones in Commands.
2022-12-06 21:13:31 -08:00
Tyler Veness
f18fd41ac3 [wpimath] Remove broken and obsoleted ComputerVisionUtil functions (#4775)
The ComputerVisionUtil class was added before AprilTag support was
announced. Now that it has, the functions for estimating a pose from
range and yaw are no longer needed; it's just better to get the pose
directly from the AprilTag.

The coordinate system on some function arguments was confusing or didn't
match the NWU convention the rest of the library uses. It's easier to
remove the functions now and add them back after they're fixed since the
fixes aren't trivial.

The range function was removed because it uses pitch and yaw in the
camera's spherical coordinate system, which is obsoleted by AprilTags.
AprilTags give you a 6DOF pose directly, so range can be obtained via
Pose2d.getTranslation().getDistance().

Fixes #4757.
2022-12-06 21:11:27 -08:00
Peter Johnson
2d0faecf4f [glass] DataSource: Add spinlock to protect value (#4771)
A lock is needed here due to HAL async callbacks.
2022-12-06 21:09:14 -08:00
Peter Johnson
348bd107fc [hal] Add CANManufacturer for The Thrifty Bot (#4773) 2022-12-06 21:08:45 -08:00
Starlight220
3149dc64b8 [examples] HatchbotInlined: Use Subsystem factories (#4765) 2022-12-06 15:10:39 -08:00
Jordan McMichael
8618dd4160 [glass, wpilib] Replace remaining references to Speed Controller with Motor Controller (#4769) 2022-12-05 20:06:43 -08:00
Peter Johnson
72e21a1ed1 [apriltag] Use wpilibsuite fork of apriltag (#4764) 2022-12-05 19:59:24 -08:00
Ryan Blue
eab0d929e6 [commands] CommandGenericHID POV methods: Fix docs (NFC) (#4760) 2022-12-05 13:46:46 -08:00
Ryan Blue
6789869663 [wpilib] Call set(0) rather than disable for stopMotor (#4763)
For PWM motor controllers, this is going to be the fastest way to stop the motor,
as disabling the PWM output will have a small delay due to the motor controller
needing to detect the missing signal.

Note Set(0) is not a safe approach for CAN motor controllers, which may have closed
loop operation, non-% output set() calls, etc.
2022-12-05 13:33:54 -08:00
Dustin Spicuzza
c9dea2968d [cscore] Emit warning that USB Camera isn't supported on OSX (#4766)
Reduces user confusion, as right now there's really no indication that something is wrong other than there's no camera,
2022-12-05 13:30:13 -08:00
sciencewhiz
8f402645f5 [commands] Fix PIDSubsystem setSetpoint behavior (#4759)
No longer stores a temporary setpoint in PIDSubsystem, instead
immediately sending to PIDController. This fixes an issue where the
setpoint didn't take effect until the Subsystem Periodic method ran, and
could cause commands to finish early if they were scheduled after the
subsystem periodic method ran because it used the old setpoint.
2022-12-03 11:32:46 -08:00
Tyler Veness
f24ad1d715 [build] Upgrade to googletest 1.12.1 (#4752)
This fixes GCC 12 warnings for googletest internals.
2022-12-03 11:32:08 -08:00
Jaci Brunning
ff88756864 [wpimath] Add new DCMotor functions for alternative calculations and reduction calculation (#4749) 2022-12-03 09:47:16 -08:00
superpenguin612
f58873db8e [wpimath] Remove extra terms in matrix for pose estimator docs (#4756) 2022-12-03 09:46:34 -08:00
superpenguin612
37e969b41a [wpimath] Add constructors to pose estimators with default standard deviations (#4754) 2022-12-03 09:46:10 -08:00
Tyler Veness
13cdc29382 [ci] Rename comment command from "/wpiformat" to "/format" (#4755)
It now runs more than just wpiformat.
2022-12-02 18:24:06 -08:00
Tyler Veness
6e23985ae6 [examples] Add main include directory to test builds (#4751)
This fixes the following compilation errors:
```
/home/tav/frc/wpilib/allwpilib/wpilibcExamples/src/main/cpp/examples/UnitTest/cpp/subsystems/Intake.cpp:5:10: fatal error: subsystems/Intake.h: No such file or directory
    5 | #include "subsystems/Intake.h"
      |          ^~~~~~~~~~~~~~~~~~~~~

/home/tav/frc/wpilib/allwpilib/wpilibcExamples/src/test/cpp/examples/UnitTest/cpp/subsystems/IntakeTest.cpp:11:10: fatal error: Constants.h: No such file or directory
   11 | #include "Constants.h"
      |          ^~~~~~~~~~~~~
```
2022-12-02 10:37:49 -08:00
Starlight220
66bb0ffb2c [examples] Add unit testing infrastructure (#4646) 2022-12-02 08:40:14 -08:00
Tyler Veness
74cc86c4c5 [wpimath] Make transform tests use pose/transform equality operators (#4675)
Also add more nonzeros to Transform3d tests to make them more
comprehensive.
2022-12-02 08:36:57 -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
Ryan Blue
68dba92630 [ci] Update mac and windows builds to Java 17 (#4750) 2022-12-02 08:31:38 -08:00
Tyler Veness
23bfc2d9ab [sim] Remove unmaintained Gazebo support (#4736) 2022-12-01 20:46:47 -08:00
Starlight220
1f1461e254 [wpilib] Add method to enable/disable LiveWindow in test mode (#4678) 2022-12-01 13:28:06 -08:00
Tyler Veness
eae68fc165 [wpimath] Add tolerance for Rotation3d rotation matrix special orthogonality (#4744) 2022-11-30 19:51:31 -08:00
Tyler Veness
4c4545fb4b [apriltag] Suppress warning (#4743) 2022-11-30 19:51:18 -08:00
Tyler Veness
16ffaa754d [docs] Generate docs for apriltag subproject (#4745) 2022-11-30 19:50:52 -08:00
Thad House
5e74ff26d8 [apriltag, build] Update native utils, add apriltag impl and JNI (#4733)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2022-11-30 00:16:29 -08:00
Dustin Spicuzza
53875419a1 [hal] Allow overriding stderr printing by HAL_SendError (#4742) 2022-11-29 23:19:15 -08:00
Peter Johnson
aa6499e920 [ntcore] Fix special topic multi-subscriber handling (#4740)
It now matches server behavior, where "" doesn't match special topics.

Also fixes duplicate notification that could occur in some cases.
2022-11-29 21:58:57 -08:00
Peter Johnson
df70351107 [build] Fix cmake install of thirdparty includes (#4741) 2022-11-29 21:58:38 -08:00
Peter Johnson
e9bd50ff9b [glass] NT view: clear meta-topic info on disconnect (#4732) 2022-11-29 21:57:48 -08:00
Peter Johnson
9b319fd56b [ntcore] Add sub option for local vs remote changes (#4731)
This is the subscriber readQueue version of the local value listener flag.
2022-11-29 21:57:20 -08:00
Peter Johnson
18d28ec5e3 [ntcore] Remove duplicate value checking from ClientImpl
This is no longer required with the duplicate value checking in
LocalStorage.
2022-11-29 09:49:47 -08:00
Peter Johnson
bdfb625211 [ntcore] Send duplicate values to network if necessary
Essentially this separates duplicate value detection between network and
local.
2022-11-29 09:49:47 -08:00
Ryan Blue
21003e34eb [commands] Update Subsystem factories and example to return CommandBase (#4729)
Also update rapidreactcommandbot example factories to fit this convention (as in #4655).

C++ does not need an update as CommandPtr already uses CommandBase (#4677).
2022-11-28 19:47:18 -08:00
Starlight220
70080457d5 [commands] Refactor ProxyScheduleCommand, SelectCommand into ProxyCommand (#4534) 2022-11-28 14:43:10 -08:00
Colin Wong
e82cd5147b [wpilib] Tweak Color HSV formula and use in AddressableLED (#4724)
The Color algorithm was tweaked to:
a) not produce incorrect values if the user happens to input a hue outside the [0, 180) range, and
b) more accurately convert the hue remainder from range 0-30 to 0-255. The current conversion vastly overshoots the multiplier (converts 0-30 to 0-270) and relies on clamping the value when constructing the Color object to produce a slightly incorrect result.
2022-11-28 14:42:22 -08:00
Colin Wong
ec124bb662 [commands] Allow unsetting a subsystem's default command (#4621) 2022-11-28 14:03:14 -08:00
Ryan Blue
2b2aa8eef7 [examples] Update all examples to use NWU coordinate conventions (#4725) 2022-11-28 13:49:49 -08:00
Starlight220
cb38bacfe8 [commands] Revert to original Trigger implementation (#4673)
Trigger was refactored to use BooleanEvent when it was introduced in #4104.
This reverts to the original implementation until edge-based BooleanEvents can be fixed.
2022-11-28 13:48:48 -08:00
Starlight220
15561338d5 [commands] Remove one more default command isFinished check (#4727) 2022-11-28 13:44:37 -08:00
Ryan Blue
ca35a2e097 Add simgui files to .gitignore (#4726) 2022-11-28 08:57:57 -08:00
Starlight220
20dbae0cee [examples] Renovate command-based examples (#4409)
Refactor some examples to use newer features, such as HID factories, library-provided command factories, CommandPtr (C++), as well as new idioms such as static/instance command factories.
2022-11-28 08:55:13 -08:00
Eli Barnett
1a59737f40 [commands] Add convenience factories (#4460)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-11-28 07:41:25 -08:00
Tyler Veness
42b6d4e3f7 Use defaulted comparison operators in C++ (#4723)
Comparison operators which compared against every class member variable
now use C++20's default comparison operators.

Also remove operator!= that in C++20 is now auto-generated from operator==.
2022-11-27 21:01:01 -08:00
Peter Johnson
135c13958f [wpigui] Add FontAwesome (#4713) 2022-11-27 20:00:17 -08:00
Peter Johnson
ffbfc61532 [ntcore] Add NetworkTable table-specific listeners (#4640)
These are similar, but not quite identical to, the NT3 NetworkTable
table listeners.

Also add table topic-only multi-subscriber to ensure functions like
getKeys() work properly regardless of other subscriptions.
2022-11-27 19:46:34 -08:00
Starlight220
8958b2a4da [commands] Add property tests for command compositions (#4715) 2022-11-27 16:23:56 -08:00
Starlight220
e4ac09077c [wpilib] Add link to MotorSafety article (#4720) 2022-11-27 16:23:06 -08:00
Starlight220
f40de0c120 [commands] Add C++ factory templates (#4686) 2022-11-27 11:27:44 -08:00
Peter Johnson
51fa3e851f [build] cmake: Use FetchContent instead of ExternalProject (#4714)
Also switch to using thirdparty-fonts instead of generating them.
2022-11-26 23:05:41 -08:00
Peter Johnson
1da84b2255 [wpigui] Reload fonts to scale rather than preloading (#4712) 2022-11-26 22:30:38 -08:00
Peter Johnson
e43e2fbc84 [wpiutil] StringExtras: Add UnescapeCString (#4707)
Based on implementation in glass but enhanced for generic use.
2022-11-26 18:21:45 -08:00
Peter Johnson
5804d8fa84 [ntcore] Server: Properly handle multiple subscribers (#4717)
Previously, only the first subscriber was actually matched to a topic
when a topic was created; this was a problem when later publishing
values as a client could have both a topic-only subscriber and a normal
subscriber, and only the first one would end up being subscribed to the
topic.
2022-11-26 17:02:22 -08:00
Peter Johnson
169ef5fabf [glass] Update NT view for topicsOnly and sendAll changes (#4718) 2022-11-26 17:01:40 -08:00
Starlight220
148759ef54 [examples] CANPDP: Expand properties shown (#4687) 2022-11-25 23:51:15 -08:00
Starlight220
58ed112b51 [commands] RepeatCommand: restart on following iteration (#4706)
This fixes InstantCommand.repeatedly().
2022-11-25 23:50:42 -08:00
Ryan Blue
dd1da77d20 [readme] Fix broken CI badge (#4710) 2022-11-25 23:49:47 -08:00
Ryan Blue
7cda85df20 [build] Check Gradle plugin repo last to fix CI (#4711) 2022-11-25 23:48:18 -08:00
Thad House
7ed9b13277 [build] Bump version plugin to fix null tag (#4705) 2022-11-24 22:10:59 -08:00
Tyler Veness
6b4f26225d [apriltag] Fix pluralization of apriltag artifacts (#4671) 2022-11-24 09:06:38 -08:00
Peter Johnson
b2d2924b72 [cscore] Add Y16 image support (#4702) 2022-11-24 09:06:06 -08:00
Peter Johnson
34ec89c041 [wpilibc] Shuffleboard SimpleWidget: Return pointer instead of reference (#4703)
Based on beta test feedback, returning a pointer is more intuitive, as
typically the return value is late bound to an instance variable.
2022-11-24 09:05:37 -08:00
Peter Johnson
e15200068d [ci] Disable HW testbench runs (#4704)
These are currently broken with no timetable to fix.
2022-11-24 09:04:57 -08:00
Starlight220
d5200db6cd [wpimath] Rename HolonomicDriveController.calculate params (#4683) 2022-11-23 23:13:50 -08:00
Tyler Veness
2ee3d86de4 [wpimath] Clarify Rotation3d roll-pitch-yaw direction (#4699) 2022-11-23 23:12:59 -08:00
Peter Johnson
9f0a8b930f [cscore] Use MFVideoFormat_L8 for Gray on Windows (#4701) 2022-11-23 22:15:56 -08:00
Peter Johnson
2bca43779e [cscore] Add UYVY image support (#4700) 2022-11-23 22:00:31 -08:00
ohowe
4307d0ee8b [glass] Plot: allow for more than 11 plots (#4685)
Since m_windows is sorted using the ascii, when "Plot <10>" is reached it will be before "Plot <2>" in `m_windows` which makes it so it will not add a new plot after the id 10 is reached. This also fixes a potential issue of someone manually changing an id in the file, which would break adding a new plot in some circumstances.
2022-11-23 13:57:29 -08:00
Starlight220
3fe8d355a1 [examples] StateSpaceDifferentialDriveSimulation: Use encoder reversed constants (#4682)
This matches the Java example.
2022-11-22 10:29:40 -08:00
Peter Johnson
b44034dadc [ntcore] Allow duplicate client IDs on server (#4676)
Currently, the server rejects duplicate client IDs. As we want to make
the client implementation as simple as possible, instead deduplicate the
name on the server side by appending "@" and a count.

NT4 spec has been updated for this change.
2022-11-22 10:27:49 -08:00
Starlight220
52d2c53888 [commands] Rename Java factory wait() to waitSeconds() (#4684)
This is needed to avoid a conflict with Object.wait() when using static imports.
C++ doesn't have this issue, and has units, so Wait() still makes sense there.
2022-11-22 10:16:27 -08:00
Thad House
76e918f71e [build] Fix JNI artifacts linking to incorrect libraries (#4680) 2022-11-21 20:33:46 -08:00
Starlight220
0bee875aff [commands] Change C++ CommandPtr to use CommandBase (#4677) 2022-11-21 09:45:50 -08:00
Peter Johnson
98e922313b [glass] Don't check IsConnected for NT widgets (#4674)
Checking this isn't required, and prevented these widgets from working
in the simulation GUI without another NT client connected.
2022-11-20 17:27:28 -08:00
amquake
9a36373b8f [apriltag] Switch 2022 apriltag layout length and width values (#4670) 2022-11-19 09:11:08 -08:00
Peter Johnson
cf8faa9e67 [wpilib] Update values on controllable sendables (#4667) 2022-11-18 23:50:41 -08:00
Peter Johnson
5ec067c1f8 [ntcore] Implement keep duplicates pub/sub flag (#4666)
Also don't save duplicate NT sets to data log (unless publish keep duplicates flag is set).
2022-11-18 23:50:08 -08:00
Peter Johnson
e962fd2916 [ntcore] Allow numeric-compatible value sets (#4620)
Also fix entry publishing behavior to allow numerically compatible set
default publish following a subscribe.
2022-11-18 22:46:24 -08:00
Ryan Blue
88bd67e7de [ci] Update clang repositories to jammy (#4665) 2022-11-18 20:42:55 -08:00
Jordan McMichael
902e8686d3 [wpimath] Rework odometry APIs to improve feature parity (#4645)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-11-18 20:42:00 -08:00
Thad House
e2d49181da Update to native utils 2023.8.0 (#4664) 2022-11-18 19:01:26 -08:00
Peter Johnson
149bac55b1 [cscore] Add Arducam OV9281 exposure quirk (#4663)
Reports exposure range as 1-5000 but real range is 1-75.
2022-11-18 14:15:30 -08:00
amquake
88f7a3ccb9 [wpimath] Fix Pose relativeTo documentation (#4661) 2022-11-18 14:07:50 -08:00
sciencewhiz
8acce443f0 [examples] Fix swerve examples to use getDistance for turning encoder (#4652) 2022-11-18 14:06:21 -08:00
Peter Johnson
295a1f8f3b [ntcore] Fix WaitForListenerQueue (#4662) 2022-11-18 14:01:52 -08:00
Dustin Spicuzza
388e7a4265 [ntcore] Provide mechanism to reset internals of NT instance (#4653) 2022-11-18 10:21:05 -08:00
Tyler Veness
13aceea8dc [apriltag] Fix FieldDimensions argument order (#4659) 2022-11-17 22:15:55 -08:00
Ryan Blue
c203f3f0a9 [apriltag] Fix documentation for AprilTagFieldLayout (#4657) 2022-11-17 19:40:51 -08:00
Thad House
f54d495c90 Fix non initialized hal functionality during motor safety init (#4658) 2022-11-17 18:54:45 -08:00
Starlight220
e6392a1570 [cmd] Change factories return type to CommandBase (#4655) 2022-11-17 15:44:16 -08:00
PJ Reiniger
53904e7cf4 [apriltag] Split AprilTag functionality to a separate library (#4578)
Add AprilTagFieldLayout JSON file and move class to edu.wpi.first.apriltag.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-11-17 14:29:29 -08:00
Drew Williams
2e88a496c2 [wpimath] Add support for swerve joystick normalization (#4516) 2022-11-17 10:53:49 -08:00
Jordan McMichael
ce4c45df13 [wpimath] Rework function signatures for Pose Estimation / Odometry (#4642)
Forcing the use of SwerveModulePostition[] and wpi::array<SwerveModulePosition, len> in place of variadic function signatures.
2022-11-17 10:36:33 -08:00
sciencewhiz
0401597d3b [readme] Add wpinet to MavenArtifacts.md (#4651)
Fixes #4639
2022-11-17 10:35:27 -08:00
Jordan McMichael
2e5f9e45bb [wpimath] Remove encoder reset comments on Swerve, Mecanum Odometry and Pose Estimation (#4643)
In both of these cases, encoder resets are not required for normal use.
2022-11-16 15:20:05 -08:00
sciencewhiz
e4b5795fc7 [docs] Disable Doxygen for memory to fix search (#4636) 2022-11-14 20:19:44 -08:00
Peter Johnson
03d0ea188c [build] cmake: Add missing wpinet to installed config file (#4637) 2022-11-14 20:19:13 -08:00
Thad House
3082bd236b [build] Move version file to its own source set (#4638) 2022-11-14 20:19:00 -08:00
Thad House
b7ca860417 [build] Use build cache for sign step (#4635)
The signing step does not get passed the username and password to the server, so it will just read from the build cache. Then to make sure the tasks are all updated correctly, use if developerid exists as a property to all sign tasks, so it will see the new variable value, and relink. Additionally only update the archives during signing, which will speed up signing.
2022-11-14 19:23:13 -08:00
Starlight220
64838e6367 [commands] Remove unsafe default command isFinished check (#4411) 2022-11-14 14:28:30 -08:00
Peter Johnson
1269d2b901 [myRobot] Disable spotbugs (#4565) 2022-11-14 14:26:41 -08:00
Tyler Veness
14d8506b72 [wpimath] Fix units docs for LinearSystemId::IdentifyDrivetrainSystem() (#4600) 2022-11-14 14:26:16 -08:00
ohowe
d1d458db2b [wpimath] Constrain Rotation2d range to -pi to pi (#4611)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-11-14 14:25:15 -08:00
Tyler Veness
f656e99245 [readme] Add links to development build documentation (#4481)
* Add links to development build documentation
* Use GitHub dev docs links in readme badges
2022-11-14 14:23:47 -08:00
Starlight220
6dd937cef7 [commands] Fix Trigger API docs (NFC) (#4599) 2022-11-14 14:21:35 -08:00
Starlight220
49047c85b9 [commands] Report error on C++ CommandPtr use-after-move (#4575) 2022-11-14 14:20:52 -08:00
Tyler Veness
d07267fed1 [ci] Upgrade containers to Ubuntu 22.04 and remove libclang installation (#4633) 2022-11-14 14:20:08 -08:00
Thad House
b53ce1d3f0 [build, wpiutil] Switch macos to universal binaries (#4628) 2022-11-14 10:36:33 -08:00
Ege Akman
5a320c326b [upstream_util, wpiutil] Refactor python scripts (#4614)
Co-authored-by: Sourcery AI <>
Co-authored-by: Vasista Vovveti <vasistavovveti@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2022-11-13 23:11:54 -08:00
Peter Johnson
c4e526d315 [glass] Fix NT Mechanism2D (#4626) 2022-11-13 23:09:23 -08:00
Ryan Blue
d122e4254f [ci] Run spotlessApply after wpiformat in comment command (#4623) 2022-11-13 14:07:26 -08:00
Peter Johnson
5a1e7ea036 [wpilibj] FieldObject2d: Add null check to close() (#4619) 2022-11-12 16:51:41 -08:00
Peter Johnson
179f569113 [ntcore] Notify locally on SetDefault (#4617)
This is necessary for the simulation GUI to pick up default publishes.
2022-11-12 06:33:10 -08:00
Peter Johnson
b0f6dc199d [wpilibc] ShuffleboardComponent.WithProperties: Update type (#4615)
ShuffleboardComponentBase::m_properties is now a StringMap<nt::Value>.
2022-11-11 15:08:05 -08:00
Tyler Veness
7836f661cd [wpimath] Add missing open curly brace to units/base.h (#4613) 2022-11-11 13:06:42 -08:00
CarloWoolsey
dbcc1de37f [wpimath] Add DifferentialDriveFeedforward classes which wrap LinearPlantInversionFeedforward (#4598)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-11-10 16:54:51 -08:00
Cory
93890c528b [wpimath] Add additional angular acceleration units (#4610)
Added Turns per second squared
Added Revolutions per minute squared
Added Revolutions per minute per second
2022-11-10 16:47:55 -08:00
Tyler Veness
3d8d5936f9 [wpimath] Add macro for disabling units fmt support (#4609) 2022-11-10 14:12:07 -08:00
Tyler Veness
2b04159dec [wpimath] Update units/base.h license header (#4608) 2022-11-10 14:11:44 -08:00
Thad House
2764004fad [wpinet] Fix incorrect jni definitions (#4605)
Also re-enables the check task that would have caught this.
2022-11-10 09:42:02 -08:00
Thad House
85f1bb8f2b [wpiutil] Reenable jni check task (#4606)
New option was added to JNI plugin to allow skipping specific symbols. This let us generally reenable the check task in wpiutil.
2022-11-10 09:33:26 -08:00
ohowe
231ae2c353 [glass] Plot: Fix Y-axis not being saved (#4594) 2022-11-08 21:33:02 -08:00
Tyler Veness
e92b6dd5f9 [wpilib] Fix AprilTagFieldLayout JSON property name typos (#4597) 2022-11-08 13:27:21 -08:00
Thad House
2a8e0e1cc8 Update all dependencies that use grgit (#4596) 2022-11-08 10:20:16 -08:00
Starlight220
7d06e517e9 [commands] Move SelectCommand factory impl to header (#4581)
It's templated, so it needs to be in the header.
2022-11-07 15:49:36 -08:00
Tyler Veness
323524fed6 [wpimath] Remove deprecated units/units.h header (#4572) 2022-11-07 10:18:36 -08:00
Starlight220
d426873ed1 [commands] Add missing PS4 triangle methods (#4576) 2022-11-07 10:15:54 -08:00
PJ Reiniger
5be5869b2f [apriltags] Use map as internal data model (#4577)
This leaves the file format as a list, but internally will transform the collection of tags into a map on de/serialization. The serialization will probably happen once on startup, but the tag lookup can happen 100s of times a second. This honestly probably doesn't make too much of a performance hit since N is small, but this is a simple O(n) -> O(1) change for lookups.
2022-11-07 10:09:06 -08:00
Griffin Della Grotte
b1b4c1e9e7 [wpimath] Fix Pose3d transformBy rotation type (#4545)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-11-07 09:57:33 -08:00
Dustin Spicuzza
a4054d702f [commands] Allow composing two triggers directly (#4580)
For backwards compatibility reasons.
2022-11-07 09:55:28 -08:00
Dustin Spicuzza
0190301e09 [wpilibc] Explicitly mark EventLoop as non-copyable/non-movable (#4579)
It's already not movable because m_bindings isn't copyable, but pybind11
isn't able to detect that
2022-11-07 09:30:03 -08:00
Peter Johnson
9d1ce6a6d9 [ntcore] Catch file open error when saving preferences (#4571) 2022-11-05 21:16:39 -07:00
Peter Johnson
5005e2ca04 [ntcore] Change Java event mask to EnumSet (#4564)
Also convert NetworkTableInstance.getNetworkMode() to return EnumSet.
2022-11-04 20:25:37 -07:00
PJ Reiniger
fa44a07938 [upstream-utils][mpack] Add upstream util for mpack (#4500) 2022-11-04 20:03:49 -07:00
Peter Johnson
4ba16db645 [ntcore] Various fixes and cleanups (#4544)
* NetworkTableInstance: set handle to 0 after destroy
* Fix multiple notifications of local values
* Detect mismatch between handles
* Server: fix setting min period when no topics
* Limit maximum number of subscribers/publishers/listeners
   This helps find resource leaks and prevents them from causing excessive
   slowdowns/crashes.  The limit on each is currently set to 512.
* Don't use std::swap in move operation
2022-11-04 20:01:21 -07:00
Thad House
837415abfd [hal] Fix joysticks either crashing or returning 0 (#4570) 2022-11-04 19:03:11 -07:00
amquake
2c20fd0d09 [wpilib] SingleJointedArmSim: Check angle equals limit on wouldHit (#4567) 2022-11-04 17:14:46 -07:00
Alex Ryker
64a7136e08 [wpimath] SwerveDrivePoseEstimator: Restore comment about encoder reset (#4569) 2022-11-04 15:03:49 -07:00
Brennen Puth
b2b473b24a [wpilib] Add AprilTag and AprilTagFieldLayout (#4421)
This is an API for looking up a Pose3d from a tag id, and includes functionality to load that map from a JSON file.

This also adds JSON support to Pose3d, Rotation3d. Translation3d, and Quaternion.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: AMereBagatelle <themerebagatelle@gmail.com>
2022-11-04 09:56:22 -07:00
Thad House
7aab8fa93a [build] Update to Native Utils 2023.6.0 (#4563) 2022-11-03 20:57:04 -07:00
Starlight220
12c2851856 [commands] WrapperCommand: inherit from CommandBase (#4561)
This makes WrapperCommand Sendable.
Only Java had this issue.
2022-11-03 06:27:23 -07:00
Tyler Veness
0da169dd84 [wpimath] Remove template argument from ElevatorFeedforward (#4554) 2022-11-02 22:54:32 -07:00
Tyler Veness
2416827c25 [wpimath] Fix docs for pose estimator local measurement models (#4558) 2022-11-02 22:53:21 -07:00
Michael Jansen
1177a3522e [wpilib] Fix Xbox/PS4 POV sim for port number constructors (#4548) 2022-11-02 22:52:26 -07:00
ohowe
102344e27a [commands] HID classes: Add missing methods, tweak return types (#4557)
- Make return type of getHID reflect the specific class
- Add getX and getY to CommandJoystick
2022-11-02 22:51:53 -07:00
Peter Johnson
1831ef3e19 [wpilib] Fix Shuffleboard SuppliedValueWidget (#4559)
It was creating duplicate publishers.
2022-11-02 22:49:52 -07:00
Starlight220
a9606ce870 [wpilib] Fix Xbox/PS4 POV sim (#4546) 2022-11-02 10:52:15 -07:00
Tyler Veness
6c80d5eab3 [wpimath] Remove unused SymbolExports.h include from units/base.h (#4541) 2022-11-01 17:18:24 -07:00
Peter Johnson
b114006543 [ntcore] Unify listeners (#4536)
This combines all 4 NT listener APIs (topic, value, connection, and
logging) into a single unified listener API.
2022-10-31 21:52:14 -07:00
Peter Johnson
32fbfb7da6 [build] cmake: Install ntcore generated include files (#4540) 2022-10-31 21:45:24 -07:00
Thad House
02465920fb [build] Update native utils to 2023.4.0 (#4539)
This has some decent changes to the toolchain plugin, so allwpilib is a great way to make sure nothing breaks.
2022-10-31 19:17:42 -07:00
David K Turner
3a5a376465 [wpimath] Increase constexpr support in geometry data types (#4231)
This uses std::is_constant_evaluated() to conditionally use the gcem library for constexpr calculations.
2022-10-31 09:17:00 -07:00
Peter Johnson
1c3c86e9f1 [ntcore] Cache GetEntry(name) values (#4531)
These are typically cached at higher levels anyway, but cache at lowest
C++ layer as well for consistency with NT3.
2022-10-27 23:34:58 -07:00
Starlight220
dcda09f90a [command] Rename trigger methods (#4210)
Motivation

Feedback from 2022 showed that the Trigger API is rather confusing, mostly due to the following:
- duplicate Trigger and Button APIs were available; users were confused searching for a nonexistent difference between them.
- the when terminology was ambiguous and unclear whether it refers to the high state or specifically the rising edge.
- the Active terminology didn't unambiguously refer to the high state; it wasn't unintuitive to understand it as "when the binding is active/polled".
- whileHeld vs whenHeld was very confusing, and the difference between them wasn't obvious. The parallel Trigger verbs, whileActiveContinuously and whileActiveOnce are much less confusing.

Solution

Deprecating Button and its binding methods. The rationale for deprecating Button (and not Trigger) is because Button uses terminology that is needlessly more specific and restricting to the button use case, making the use case of arbitrary trigger conditions unintuitive.

After consideration, deprecation of Button's subclasses was decided against:

- NetworkButton (a trigger condition based on a boolean NT entry/topic) is a use case that is not necessarily intuitive for teams to implement themselves, so it is an abstraction that should be provided in the library. A parallel class for the BooleanEvent level, NetworkBooleanEvent, was also added as part of NT4. NT listeners were considered as a alternative solution, but they require attention to thread safety, and aren't interoperable with the EventLoop API.
- JoystickButton/POVButton provide abstractions around HID buttons. The new Trigger-returning factories on the HID classes are an equal (if not more concise) alternative, but there is no reason not to keep them for those who find their use preferable.

At a later date in the deprecation cycle (perhaps for 2024), when Button is removed, these subclasses should be changed to inherit directly from Trigger.

Trigger's bindings are changed to use True/False terminology, as it should be unambiguous. Each binding type has both True and False variants; for brevity, only the True variants are listed here:

- onTrue (replaces whenActive): schedule on rising edge.
- whileTrue (replaces whileActiveOnce): schedule on rising edge, cancel on falling edge.
- toggleOnTrue (replaces toggleWhenActive): on rising edge, schedule if unscheduled and cancel if scheduled.

Two binding types are completely deprecated:

- cancelWhenActive: this is a fairly niche use case which is better described as having the trigger's rising edge (Trigger.rising()) as an end condition for the command (using Command.until()).
- whileActiveContinuously: however common, this relied on the no-op behavior of scheduling an already-scheduled command. The more correct way to repeat the command if it ends before the falling edge is using Command.repeatedly/RepeatCommand or a RunCommand -- the only difference is if the command is interrupted, but that is more likely to result in two commands perpetually canceling each other than achieve the desired behavior. Manually implementing a blindly-scheduling binding like whileActiveContinuously is still possible, though might not be intuitive.

Notes

It was considered to share BooleanEvent's digital signal terminology; however, once it was decided that Trigger should not inherit from BooleanEvent (due to overload incompatibility) the common terminology was not worth the unintuitiveness stemming from users' unfamiliarity with the signal processing terms.
2022-10-27 22:03:28 -07:00
Tyler Veness
66157397c1 [wpilib] Make drive classes follow NWU axes convention (#4079)
All trigonometric functions and vector classes assume North-West-Up axes
convention, so using North-East-Down convention with them is really
error-prone. We've broken something every time we touched the drive
classes.

We originally used North-East-Down to match the joystick convention, but
the volume of long-lived bugs has made this not worth it in retrospect.

The rest of WPILib also uses North-West-Up, so this makes things
consistent.

KilloughDrive was removed since no one uses it.
2022-10-27 21:59:11 -07:00
Peter Johnson
9e22ffbebf [ntcore] Fix null deref in NT3 client (#4530) 2022-10-27 21:56:15 -07:00
Thad House
648ab6115c [wpigui,dlt,glass,ov] Support arm in GUI tools (#4527) 2022-10-26 23:16:23 -07:00
Tyler Veness
8bc3b04f5b [wpimath] Make ComputerVisionUtil use 3D geometry classes (#4528)
Closes #4189.
2022-10-26 22:20:08 -07:00
Peter Johnson
cfb84a6083 [wpilibc] Don't hang waiting for NT server to start (#4524)
This matches Java behavior.
2022-10-26 10:29:56 -07:00
Tyler Veness
02c47726e1 [wpimath] Remove unused odometry instance from DifferentialDrivePoseEstimator test (#4522) 2022-10-25 22:19:44 -07:00
Peter Johnson
b2a0093294 [ci] Revert upgrade of github-pages-deploy-action (#4521)
It broke publishing
2022-10-25 19:20:30 -07:00
Justin
2a98d6b5d7 [wpimath] PIDController: Add getters for position & velocity tolerances (#4458) 2022-10-25 16:10:19 -07:00
Starlight220
9f36301dc8 [ci] Write wpiformat patch to job summary (#4519) 2022-10-25 12:30:43 -07:00
Jordan McMichael
901fc555f4 [wpimath] Position Delta Odometry for Mecanum (#4514) 2022-10-25 12:28:59 -07:00
Jordan McMichael
4170ec6107 [wpimath] Position Delta Odometry for Swerve (#4493) 2022-10-25 12:28:36 -07:00
sciencewhiz
fe400f68c5 [docs] Add wpinet to docs build (#4517)
Excludes libuv and libuv wrappers.
2022-10-25 08:47:28 -07:00
Peter Johnson
794669b346 [ntcore] Revamp listeners (#4511)
- In both C++ and Java, add listener functions to Instance class (same as NT3 provided)
- Add WaitForListenerQueue functions (same as NT3 provided)
- Move Java non-poller implementation to Instance (previously only handled single instance)
- Change C++ listeners to take non-const references for subscribers etc to help avoid footguns from use of temporary objects (also add doc comment)
- Fix Preferences making .type persistent
2022-10-24 23:27:24 -07:00
Peter Johnson
dcfa85a5d5 [ci] Build sanitizers with clang-14 (#4518) 2022-10-24 22:44:20 -07:00
Peter Johnson
15ad855f1d [ntcore] Add UnitTopic<T> (C++ only) (#4497)
This avoids the need for explicit value() calls (as compared to using
DoubleTopic).  The unit name is published as the "unit" property.

Implementation note: the test needs to be in wpilibc because ntcore does
not depend on wpimath.
2022-10-24 20:07:44 -07:00
Thad House
11244a49d9 [wpilib] Add IsConnected function to all gyros (#4465) 2022-10-24 20:04:16 -07:00
Thad House
1d2e8eb153 [build] Update myRobot deployment (#4515) 2022-10-24 20:03:39 -07:00
Thad House
ad53fb19b4 [hal] Use new HMB api for addressable LED (#4479)
Theres is now a built in HMB api, but you have to dlopen it to access it. Moved our existing infrastructure for this to its own class, added the new functions, then updated interrupts and LEDs to use it.
2022-10-24 18:26:07 -07:00
Thad House
ba850bac3b [hal] Add more shutdown checks and motor safety shutdown (#4510) 2022-10-23 21:59:04 -07:00
Peter Johnson
023a5989f8 [ntcore] Fix typo in NetworkServer client connect message (#4512) 2022-10-23 20:45:01 -07:00
sciencewhiz
c970011ccc [docs] Add Doxygen aliases used by Foonathan memory (#4509) 2022-10-23 18:12:24 -07:00
sciencewhiz
07a43c3d9a [readme] Document clang-format version and /wpiformat (#4503) 2022-10-23 15:59:33 -07:00
sciencewhiz
a05b212b04 [ci] Revert changes to wpiformat task from #4501 (#4508) 2022-10-23 15:49:59 -07:00
Starlight220
09faf31b67 [commands] Replace Command HID inheritance with delegation (#4470) 2022-10-23 12:09:44 -07:00
Starlight220
9e1f9c1133 [commands] Add command factories (#4476)
Co-authored-by: oblarg <emichaelbarnett@gmail.com>
2022-10-23 12:08:22 -07:00
Tyler Veness
f19d2b9b84 [ci] Add NUMBER environment variable to comment command commit script (#4507) 2022-10-23 11:34:03 -07:00
Tyler Veness
a28f93863c [ci] Push comment command commit directly to PR (#4506) 2022-10-23 11:17:52 -07:00
Tyler Veness
c9f61669b8 [ci] Fix comment command commit push (#4505) 2022-10-23 10:47:15 -07:00
Tyler Veness
dcce5ad3b3 [ci] Update github-script API usage (#4504) 2022-10-23 10:15:42 -07:00
Thad House
6836e5923d [wpilibc] Restore get duty cycle scale factor (#4502) 2022-10-23 07:05:09 -07:00
Peter Johnson
335188c652 [dlt] Add deselect/select all buttons to download view (#4499) 2022-10-22 22:12:47 -07:00
Peter Johnson
60a29dcb99 [glass] Field2D: Add "hidden" option for objects (#4498) 2022-10-22 22:12:25 -07:00
PJ Reiniger
b55d5b3034 [ci] Update deprecated github actions (#4501) 2022-10-22 21:09:44 -07:00
Peter Johnson
10ed4b3969 [ntcore] Various NT4 fixes (#4474)
* TopicListener: Fix Add() return values
* Update PubSubOption poll storage documentation
* Update NetworkTableEntry::GetValue() doc
* Add documentation regarding asynchronous callbacks
* Unpublish entry: set publisher to nullptr
* Implement ValueListenerPoller default constructor
* Remove SetNetworkIdentity, make parameter to StartClient
* URI-escape client ID, improve error message
* Add connected message with client id; also improve disconnected message a bit
* Handle SetServers either before or after StartClient
* Fix client use-after-free; also delay reconnect after disconnect to rate limit
* Don't re-announce to already subscribed client; we especially don't want to send the last value again
* Always accept in-order sets, only use timestamp for tiebreak
* Fix LocalStorage::StartNetwork race
* Remove unused/unimplemented function

Also:
* [glass] Remove debug print
* [glass] Fix mpack string decoding
* [cameraserver] Fix up startclient
2022-10-21 22:04:14 -07:00
Thad House
4a401b89d7 [hal, wpilib] New DS thread model and implementation (#3787)
The current DS thread model has some pretty major issues. It makes it difficult to know if all data is from the same remote packet, and if the data changes while the robot loop is running. Additionally, the DS thread is used for a few other things (MotorSafety and State Tracking for EducationalRobot). This also makes sim difficult, as user code has to wait for the thread to know it has new data.

This change completely rethinks how threading works in the driver station model.

First, the DS HAL system receives a new data callback, either from Netcomm or DriverStationSim. Inside the context of this callback, all the low latency data is read and put into a cache. Doing some investigation on the robot side, this is perfectly safe to do, and also ensures a ds packet will not be parsed before we finish reading the current packet data.

After all data is read, the cache is swapped with a 2nd buffer. This buffer just stores the data, none of the HAL DS calls read from this buffer. An event is then fired, stating there is new data ready to go.

Robot code calls HAL_UpdateDSData(). This swaps the 2nd buffer with a 3rd buffer, which always contains the current data. This data will not be updated until HAL_UpdateDSData is called again. Which solves the state problem.

The high level driver station classes have. an updateData() call, which calls HAL_UpdateDSData, and then update button state variables, then data log and update the NT FMS data table (Java also caches across the JNI boundary here, but that could trivially be removed). An extra event provider is provided, allowing other threads to know when this call has been completed.

IterativeRobotBase calls DS.updateData() at the beginning of each loop, and only once per loop. This means all commands will always have the same state.

All of this means there is no longer a DS thread. Everything happens synchronously. This means Sim and testing is easier, as you can just call DriverStationSim.NotifyNewData(), and then DriverStation.UpdateData(), and you can guarantee that all the DriverStation.*** data is up to date.

As for Motor Safety and Educational Robot State Handling, those can all be handled by their own threads. The Educational Thread only needs to run under EducationalRobot, and MotorSafety will only be started if there is a motor safety object enabled.
2022-10-21 22:01:55 -07:00
Tyler Veness
c195b4fc46 [wpimath] Clean up PoseEstimator nominal dt docs (#4496) 2022-10-21 19:53:58 -07:00
Tyler Veness
8f2e34c6a3 [build] Remove wpilib prefix from CMake flat install (#4492)
For system installs, `DESTDIR=/usr cmake --install buildfolder` installs
libraries to `/usr/lib` with the correct rpath. Example structure:
```
/usr/include/wpimath/frc/controller/LinearQuadraticRegulator.h
/usr/lib/libwpimath.so
```

Users need to provide `-I/usr/include/wpimath` in their projects. This
is an artifact of the install() commands being in the subdirectory CMake
files.

For other locations, `DESTDIR=/opt/wpilib cmake --install buildfolder`
installs libraries to `/opt/wpilib/lib`. Example structure:
```
/opt/wpilib/include/wpimath/frc/controller/LinearQuadraticRegulator.h
/opt/wpilib/lib/libwpimath.so
```
2022-10-21 19:23:56 -07:00
Tyler Veness
150d692df7 [wpimath] Remove unused private PoseEstimator function (#4495) 2022-10-21 19:22:37 -07:00
shueja-personal
3e5bfff1b5 [wpimath] FromFieldRelativeSpeeds: Add ChassisSpeeds overload (#4494) 2022-10-21 18:58:23 -07:00
Starlight220
9c7e66a27d [commands] C++: Add CommandPtr overload for SetDefaultCommand (#4488) 2022-10-21 06:35:58 -07:00
Tyler Veness
0ca274866b [build] Fix CMake system library opt-ins (#4487)
-DUSE_SYSTEM_EIGEN now only removes include paths for Eigen instead of
drake as well.

The USE_VCPKG flags were renamed to USE_SYSTEM since they seem general
enough for that to work (the find_package() commands work the same way
on Arch).

The system libuv CMake build now works with Linux libuv as well.
2022-10-20 19:47:12 -07:00
Starlight220
dc037f8d41 [commands] Remove EndlessCommand (#4483) 2022-10-20 17:24:54 -07:00
Tyler Veness
16cdc741cf [wpimath] Add Pose3d(Pose2d) constructor (#4485) 2022-10-20 17:23:00 -07:00
Tyler Veness
9d5055176d [build] cmake: Allow disabling ntcore build (#4486) 2022-10-20 17:21:31 -07:00
Thad House
d1e66e1296 [build] Compile all java code with inline string concatenation (#4490)
Workaround identified in https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8278540
2022-10-20 17:20:36 -07:00
Tyler Veness
1fc098e696 Enable log macros to work with no args (#4475)
This is enabled by the C++20 __VA_OPT__ feature.
Uses of "{}" format string were updated.
Some warning suppressions were required for older clang versions.
Also improve codegen of wpi::Logger::Log(), frc::ReportError(), and frc::MakeError();
these generate better and less redundant code if they use fmt::string_view for the
format string instead of templating on it.
2022-10-19 10:49:27 -07:00
Peter Johnson
878cc8defb [wpilib] LiveWindow: Add enableAllTelemetry() (#4480) 2022-10-17 14:39:57 -07:00
Thad House
8153911160 [build] Fix MSVC runtime archiver to grab default runtime (#4478) 2022-10-16 15:37:13 -07:00
Tyler Veness
fbdc810887 Upgrade to C++20 (#4239)
* Use explicit this capture required by C++20
* Use C++20 span
* Replace wpi::numbers with std::numbers
* Fix C++20 clang-tidy warning false positive in fmt
* Remove ciso646 include since C++20 removed that header
* Fix global-buffer-overflow asan warnings in ntcore tests
* Add DIOSetProxy constructor to HAL

* Upgrade MSVC compiler to 2022
* Bump native-utils to 2023.2.7 (changes to std=c++20)

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2022-10-15 16:33:14 -07:00
Thad House
396143004c [ntcore] Add ntcoreffi binary (#4471)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2022-10-15 01:02:38 -07:00
Peter Johnson
1f45732700 [build] Update to 2023.2.4 native-utils and new dependencies (#4473)
* Disable class-memaccess warning in Eigen
* Shim NiFpga_OpenHostMemoryBuffer
* Don't deploy .debug files in integration tests
2022-10-14 23:36:47 -07:00
Peter Johnson
574cb41c18 [ntcore] Various fixes (#4469)
* Fix C++ Publisher and Subscriber move assignment 
* Fix Publisher comment typo.
* Publish: check that properties is an object.
Print a warning, but still publish, just with empty properties.
Add error print for unassigned type publish.
* Return boolean from SetProperties
* Document exception-throw in Java for invalid JSON.
2022-10-14 20:50:55 -07:00
Thad House
d9d6c425e7 [build] Force Java 11 source compatibility (#4472)
We want to have the option of falling back to a Java 11 runtime, at least for this year.
2022-10-14 19:39:54 -07:00
Thad House
58b6484dbe Switch away from NI interrupt manager to custom implementation (#3705)
* Switch away from NI interrupt manager to custom implementation

* Formatting

* Fix tidy

* Formatting

* Fix loading

* Make interrupt api public

* Add multiple wait api

* Formatting

* Fix build

* Fix review comments

* wpiformat

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-13 17:25:54 -07:00
Tyler Veness
ca43fe2798 [wpimath] Use Units conversions in ComputerVisionUtil docs (NFC) (#4464) 2022-10-12 13:54:15 -07:00
Thad House
87a64ccedc [hal] Convert DutyCycle Raw output to be a high time measurement (#4466)
The existing raw time has an issue where it jumps around, as in the FPGA if the frequency is not a multiple or divisor of 25 Mhz it jumps around by 1 every second. While waiting on an FPGA change, update the API to make raw output give nanoseconds rather then a scaled value. This does a longer read cycle to get the correct value, but in the future if a fast FPGA function is added this can be easily changed.
2022-10-12 10:15:09 -07:00
Starlight220
89a3d00297 [commands] Add FinallyDo and HandleInterrupt decorators (#4412) 2022-10-11 09:53:27 -07:00
Starlight220
1497665f96 [commands] Add C++ versions of Java-only decorators (#4457) 2022-10-10 09:00:11 -07:00
Ryan Blue
27b173374e [wpimath] Add minLinearAccel parameter to DifferentialDriveAccelerationLimiter (#4422) 2022-10-10 08:57:37 -07:00
Ryan Blue
2a13dba8ac [wpilib] TrajectoryUtil: Fix ambiguous documentation (NFC) (#4461) 2022-10-10 08:56:40 -07:00
Peter Johnson
77301b126c [ntcore] NetworkTables 4 (#3217) 2022-10-08 10:01:31 -07:00
Peter Johnson
90cfa00115 [build] cmake: Fix libssh include directory order (#4459)
This broke the build if the directory where libssh was installed also
contained a system libuv install.
2022-10-07 22:53:22 -07:00
Starlight220
5cf961edb9 [commands] Refactor lambda-based commands to inherit FunctionalCommand (#4451) 2022-10-06 17:49:27 -05:00
Starlight220
b2276e47de [wpimath] Enable continuous angle input for HolonomicDriveController (#4453) 2022-10-06 17:46:22 -05:00
PJ Reiniger
893b46139a [fieldImages] Add utilities to simplify loading of fields (#4456) 2022-10-06 17:45:07 -05:00
Starlight220
60e29627c0 [commands] C++ unique_ptr migration (#4319)
Add a CommandPtr with an internal unique_ptr to enable not needing to move the underlying classes, which is error-prone due to the potential for lambda captures.
2022-10-05 17:19:28 -05:00
Starlight220
3b81cf6c35 [wpilib] Improve Color.toString (#4450) 2022-10-04 14:36:51 -05:00
Peter Johnson
5c067d30a0 [wpinet] WebSocket: Add SendFrames() (#4445) 2022-10-03 08:04:08 -05:00
Peter Johnson
ceaf493811 [wpiutil] MakeJByteArray: Use span<uint8> instead of string_view (#4446) 2022-10-02 08:28:50 -05:00
Starlight220
10e04e2b13 [examples] FrisbeeBot: Fix reference capture (#4449)
The parameter should be passed by value.
2022-10-02 08:18:43 -05:00
Peter Johnson
726f67c64b [build] Add exeSplitSetup (#4444) 2022-10-02 08:13:08 -05:00
Peter Johnson
c7b7624c1c [wpiutil] Add MessagePack utility functions (#4448)
Also add mpack to srcDirs.
2022-10-02 08:11:42 -05:00
Peter Johnson
d600529ec0 [wpinet] uv::Async: Add UnsafeSend() (#4447)
This version assumes the loop still exists, avoiding some overhead.
2022-10-02 08:10:54 -05:00
Tyler Veness
b53b3526a2 [wpimath] Add CoordinateSystem conversion for Transform3d (#4443)
I also refactored Pose3d's conversion implementation to use the
Translation3d and Rotation3d conversions, thereby giving Translation3d
and Rotation3d test coverage. No changes were made to the expected
values of the Pose3d conversion tests.

The expected values of the Transform3d conversion tests were copied from
the Pose3d conversion tests without modification.
2022-10-01 21:09:04 -07:00
Tyler Veness
38bb23eb18 [wpimath] Add scalar multiply and divide operators to all geometry classes (#4438)
Closes #4435.
2022-09-28 21:34:29 -07:00
Tyler Veness
3937ff8221 [wpilib] Remove deprecated Controller class (#4440)
Now that old command-based has been removed, this base class can be
removed too.
2022-09-28 21:33:55 -07:00
Oliver W
abbfe244b5 [wpilib] Improve Color FromHSV (#4439) 2022-09-28 21:33:33 -07:00
Dustin Spicuzza
4ddb8aa0dd [sim] Provide function that resets all simulation data (#4016)
Fixes #3867
2022-09-26 14:38:38 -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
Thad House
17f504f548 [hal,wpilib] Fix SPI Mode Setting (#4434)
SPI Mode setting was very broken. MSB and LSB sets did not work (MSB is the only one supported)
and if LSB was set (which was the default) the ioct to set clock phase would fail. This
deprecates all the individual functions, the LSB/MSB functions, and adds an SPI mode selection
function. This is usually more understandable, and shows up in a lot more documentation
2022-09-24 00:11:37 -07:00
Tyler Veness
773198537c [wpiutil] Add wpi::scope_exit (#4432)
This is based on std::scope_exit in the C++ library fundamentals TS v3.
2022-09-23 14:48:59 -07:00
Peter Johnson
5ac658c8f0 [wpiutil] Logger: Conditionalize around WPI_LOG (#4431)
The FMT_STRING() call used in the macro does formatter initialization,
overhead that's not required if Log() is not going to be called.
2022-09-22 23:14:46 -07:00
Peter Johnson
8767e4a941 [wpiutil] DataLog: Fix SetMetadata output (#4430) 2022-09-22 21:54:55 -07:00
Peter Johnson
8c4af073f4 [wpiutil] Synchronization: shutdown race protection (#4429) 2022-09-22 21:53:51 -07:00
Thad House
c79f38584a [build] Fix Java integration tests (#4428)
The new jni libraries for the libraries were never added, so they never get deployed.
2022-09-21 23:15:35 -07:00
Starlight220
36c08dd97c [build] Fix cmake install of fmtlib (#4426) 2022-09-20 09:48:44 -07:00
Peter Johnson
69b7b3dd7d [ci] Remove the Windows cmake job (#4425)
This currently is running into space issues due to vcpkg that are
difficult to fix.
2022-09-18 18:24:55 -07:00
Ryan Blue
738c75fed8 [readme] Fix formatting/linting link (#4423) 2022-09-18 15:12:28 -07:00
Tyler Veness
4eb1d03fb3 [wpimath] Document C++ LinearFilter exception (#4417) 2022-09-17 00:24:35 -07:00
Tyler Veness
ba4ec6c967 [build] Fix clang-tidy false positive on Linux (#4406)
* Fix clang-tidy false positive on Linux

```
== clang-tidy /home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp ==
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:12:33: error: expected class name [clang-diagnostic-error]
class StackTraceWalker : public StackWalker {
                                ^
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:16:17: error: unknown type name 'LPCTSTR' [clang-diagnostic-error]
  void OnOutput(LPCTSTR szText) override;
                ^
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:23:33: error: unknown type name 'LPCTSTR' [clang-diagnostic-error]
void StackTraceWalker::OnOutput(LPCTSTR szText) {
                                ^
```

* Fix false positives for macOS code
2022-09-17 00:23:59 -07:00
Ryan Blue
97836f0e55 [commands] Fix ProfiledPIDSubsystem setGoal behavior (#4414)
Remove m_goal from ProfiledPIDSubsystem

Delegate setGoal to backing controller
2022-09-17 00:22:45 -07:00
Tyler Veness
fdfb85f695 [wpimath] Remove Java LQR constructor that takes a controller gain matrix (#4419)
The controller gain matrix K should be computed from the solution to the
DARE, but this constructor does not do that. It effectively violates a
postcondition enforced by the other constructors by letting the user
throw in a controller gain matrix that didn't come from an LQR.

Removing this constructor is a breaking change, but it never should have
been included in the class in the first place. There's also no valid
reason to use it. I assume it was originally added for debugging the
class internals.

This constructor does not exist in C++.
2022-09-17 00:18:08 -07:00
Tyler Veness
ab1baf4832 [wpimath] Add rotation matrix constructor to Rotation3d (#4413) 2022-09-17 00:17:30 -07:00
Tyler Veness
9730032866 [wpimath] Document LQR and KalmanFilter exceptions (#4418) 2022-09-17 00:16:40 -07:00
Brandon Parsons
5b656eecf6 [wpimath] Fix HTML5 entity (#4420)
Replace &top; with \u22a4, since Unicode references are supported
but HTML5 entities are not. Should be fixed if JDK is ever
moved forward.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-09-17 00:15:40 -07:00
Starlight220
9ae38eaa7c [commands] Add owning overload to ProxyScheduleCommand (#4405) 2022-09-13 18:33:19 -07:00
Starlight220
cb33bd71df [commands] deprecate withInterrupt decorator (#4407)
until() was recently added as a more intuitive alias for this. At this point, keeping this decorator will just cause confusion, given the functionally-equivalent until() alias and the similarly-named getInterruptionBehavior/withInterruptBehavior
2022-09-11 10:37:55 -07:00
Starlight220
d9b4e7b8bf [commands] Revert "Change grouping decorator impl to flatten nested group structures (#3335)" (#4402)
This reverts commit ef4ea84cb5.
2022-09-07 09:04:21 -07:00
T Grinch
0389bf5214 [hal] REVPH: Improve handling of disconnected CAN Bus (#4169)
Force the status to be 0 (no error) upon initialization of the REV PneumaticHub.
This prevents a program crash in the case of a robot code restart with no CAN Bus present.
2022-09-07 09:01:55 -07:00
T Grinch
4267fa08d1 [wpilibc] ADIS IMUs: Fix memory leak (#4170) 2022-09-06 13:10:33 -07:00
Peter Johnson
65c8fbd452 [wpilib] MotorControllerGroup: Override setVoltage (#4403)
This causes setVoltage to be called on the lower level motor contollers,
which is benefical in cases when they are smart motor controllers.
Previously, the default implementation (using the bus voltage and
calling set()) was used in this case.

This does slightly pessimize the case when the lower level motor
controllers use the default setVoltage implementation, but given the
prevalence of smart motor controllers, this seems like an overall win.
2022-09-06 08:18:33 -07:00
Tyler Veness
f36162fddc [wpimath] Improve Discretization internal docs (#4400) 2022-09-04 17:24:38 -07:00
Tyler Veness
5149f7d894 [wpimath] Add two-vector Rotation3d constructor (#4398)
This is useful for turning a 3D vector into an orientation relative a
coordinate system vector.
2022-09-04 13:16:29 -07:00
Tyler Veness
20b5bed1cb [wpimath] Clean up Java Quaternion class (#4399)
Vector.norm() and Vector.dot() were added to make the implementation
simpler and match the C++ version more closely.
2022-09-04 09:45:02 -07:00
Peter Johnson
f18dd1905d [build] Include all thirdparty sources in distribution (#4397)
Was missing several.
2022-09-03 09:23:51 -07:00
Peter Johnson
aa9d7f1cdc [wpiutil] Import foonathan memory (#4306) 2022-09-02 20:32:21 -07:00
Peter Johnson
2742662254 [ci] Remove a couple of obsolete clang-tidy checks (#4396)
We no longer use LLVM StringRef or Twine.
2022-09-02 20:31:27 -07:00
Thad House
a5df391166 [hal, wpilib] Fix up DIO pulse API (#4387)
The FPGA API takes microseconds directly, instead of a scaled value. Also add a new HAL level API to trigger multiple DIOs with the same pulse at once.
2022-09-02 16:49:42 -07:00
Peter Johnson
59e6706b75 [glass] Turn on docking by default
This uses a full-viewport dockspace and shift to enable docking.
2022-09-02 15:43:54 -07:00
Peter Johnson
8461bb1e03 [glass] Add support for saving docking info 2022-09-02 15:43:54 -07:00
Peter Johnson
b873e208b4 [wpigui] Add support for imgui config flags 2022-09-02 15:43:54 -07:00
Peter Johnson
873e72df8c [build] Update imgui to 1.88 docking branch 2022-09-02 15:43:54 -07:00
Peter Johnson
c8bd6fc5b4 [ci] Fix comment-command (take 2) (#4395) 2022-09-02 08:51:07 -07:00
Peter Johnson
fed68b83b4 [ci] Fix comment-command action not running runners (#4393)
Triggering runners from a push from a runner requires use of a PAT.
https://stackoverflow.com/questions/67550727/push-event-doesnt-trigger-workflow-on-push-paths-github-actions
2022-09-02 08:16:31 -07:00
Tyler Veness
0ef8a4e1df [wpimath] Support formatting more Eigen types (#4391)
Added an Eigen::SparseMatrix formatter.

Also modified the Eigen::Matrix formatter to support Eigen::MatrixXd.
Eigen::MatrixXd sets both dimension template arguments to -1, so they
can't be used for iteration. rows() and cols() are now used instead.

rows() and cols() are constexpr for statically sized matrices, so
there's no performance loss there.
2022-09-02 01:00:05 -07:00
Thad House
c393b3b367 [build] Update to native utils 2023.1.0 and Gradle 7.5.1 (#4392) 2022-09-02 00:59:47 -07:00
ohowe
b5a17f762c [wpimath] Add direction to slew rate limiter (#4377) 2022-09-01 14:46:46 -07:00
Tyler Veness
fafc81ed1a [wpiutil] Upgrade to fmt 9.1.0 (#4389) 2022-09-01 14:45:18 -07:00
Peter Johnson
cc56bdc787 [wpiutil] SafeThread: Add Synchronization object variant (#4382)
This enables use of SafeThread with Synchronization's WaitForObjects() blocking.
2022-08-31 11:29:57 -07:00
Starlight220
4254438d8d [commands] Mark command group lifecycle methods as final (#4385)
This prevents accidental footguns due to overriding of command group lifecycle methods.
2022-08-31 09:15:28 -07:00
CarloWoolsey
97c15af238 [wpimath] LinearSystemId: Fix docs, move C++ impls out of header (#4388)
- Fix inaccuracies and inconsistencies in Java & C++ LinearSystemId documentation.
- Move LinearSystemId function definitions to LinearSystemId.cpp
2022-08-31 09:12:48 -07:00
Peter Johnson
d22ff8a158 [wpiutil] Add JNI access to C++ stderr (#4381)
This is useful in some debugging scenarios.  System.err is separately buffered, so when e.g. debugging test cases it doesn't interleave correctly with the C++ stdout/stderr logging. Even using flush() doesn't seem to help, I think because Gradle does its own buffering.
2022-08-30 20:40:16 -07:00
Peter Johnson
fdb5a2791f [wpiutil] jni_util: Add Mac-friendly MakeJLongArray/JArrayRef (#4383)
Mac has jlong == long long and int64_t = long, so the types are
incompatible despite being the same size.
2022-08-30 20:39:42 -07:00
Starlight220
c3a93fb995 [commands] Revamp Interruptible (#4192) 2022-08-29 21:53:47 -07:00
OmegaMetor
f2a8d38d2a [commands] Rename Command.repeat to repeatedly (#4379) 2022-08-29 15:20:17 -07:00
Peter Johnson
9e24c6eac0 [wpiutil] Logger: paren-protect instance usage in macro (#4384) 2022-08-29 13:25:53 -07:00
Tyler Veness
fe4d12ce22 [wpimath] Add LTV controller derivations and make enums private (#4380)
The LTV differential drive controller derivation wasn't included inline
because it's too long.
2022-08-28 23:04:52 -07:00
Brandon Parsons
eb08486039 [build] Fix MacOS binary rpath generation (#4376)
For RPATH on MacOS use '@loader_path' instead of '$ORIGIN' to reference the directory where the executable is located. The latter is the mechanism used on Linux.

I think this was exposed due to newer OS X ignoring $DYLD_LIBRARY_PATH for security reasons.
2022-08-25 18:17:16 -07:00
Tyler Veness
ccf83c634a [build] Use native-utils platform names instead of raw strings (#4375) 2022-08-25 12:54:11 -07:00
Peter Johnson
3fd69749e7 [docs] Upgrade to doxygen 1.9.4 (#4370)
Doxygen 1.9.2 requires libclang-9, which is no longer available on
Ubuntu 22.04.
2022-08-21 18:49:04 -07:00
Peter Johnson
594df5fc08 [wpinet] uv/util.h: Pull in ws2_32.lib on Windows for ntohs (#4371) 2022-08-21 18:48:49 -07:00
Tyler Veness
539070820d [ci] Enable asan for wpinet and wpiutil (#4369) 2022-08-21 14:59:07 -07:00
Peter Johnson
564a56d99b [wpinet] Fix memory leak in WorkerThreadTest (#4368) 2022-08-21 10:29:31 -07:00
Tyler Veness
5adf50d93c [upstream_utils] Refactor upstream_utils scripts (#4367)
* Root folder variable names are now more descriptive
* clone_repo() now restores the current working directory
* Removed setup_upstream_repo() since it's now identical to clone_repo()
* Moved am_patches()'s for loop into user scripts so the filename prefix
  doesn't need to be included in every patch filename
* Renamed am_patches() to git_am() since its only job now is to run "git am"
* Removed unused apply_patches() function
* Fixed typo in git_am()'s ignore_whitespace arg name
2022-08-20 07:26:34 -07:00
Tyler Veness
d80e8039d7 [wpiutil] Suppress fmtlib clang-tidy warning in C++20 consteval contexts (#4364) 2022-08-19 23:52:19 -07:00
Tyler Veness
0e6d67b23b [upstream_utils] Remove yapf format disable comment (#4366) 2022-08-19 23:51:57 -07:00
Tyler Veness
be5270697a [build] Suppress enum-enum deprecation warning in OpenCV (#4365) 2022-08-19 23:51:43 -07:00
Tyler Veness
8d28851263 Add Rosetta install command to build requirements (#4363) 2022-08-18 19:58:43 -07:00
Tyler Veness
3d2115c93e [wpinet] include-what-you-use in MulticastTest (#4360)
This fixes an MSVC compilation error with C++20.
2022-08-18 14:03:55 -07:00
Tyler Veness
91002ae3cc [wpimath] Upgrade to Drake 1.6.0 (#4361) 2022-08-18 14:03:28 -07:00
Tyler Veness
148c18e658 [wpinet] Upgrade to libuv 1.44.2 (#4362) 2022-08-18 13:57:49 -07:00
Tyler Veness
a2a5c926b6 Fix clang-tidy warnings (#4359)
The warnings included recommendations of braces for if statement
readability, a recommendation for default initialization of an int
array, and include-what-you-use (indirectly through clang-tidy reporting
undefined symbols).
2022-08-17 19:53:56 -07:00
Tyler Veness
ea6b1d8449 [wpiutil] Remove unused ManagedStatic class (#4358)
We migrated to magic statics for lazy construction like the following:
```cpp
class Singleton {
  static Singleton& GetSingleton() {
    static Singleton instance;
    return instance;
  }
};
```
2022-08-17 18:04:42 -07:00
Tyler Veness
ac9be78e27 Use stricter C++ type conversions (#4357)
Now, implicit narrowing conversions are only used with wpi::Now(). This
also fixes clang-tidy warnings about C-style casts. For example:
```
== clang-tidy /__w/allwpilib/allwpilib/wpilibNewCommands/src/main/native/include/frc2/command/SwerveControllerCommand.inc ==
/__w/allwpilib/allwpilib/wpilibNewCommands/src/main/native/include/frc2/command/SwerveControllerCommand.inc:95:18: warning: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting]
  auto curTime = units::second_t(m_timer.Get());
                 ^
```
In that case at least, the cast was removed entirely since Get() already
returns a units::second_t.
2022-08-17 13:42:36 -07:00
Tyler Veness
151dabb2af [wpiutil] Upgrade to fmt 9.0.0 (#4337)
fmt removed fmt::make_args_checked since it's no longer needed for
constexpr format string checks.

fmt deprecated implicit conversions from enums to integers in format
arguments, so I added explicit static casts.
2022-08-16 15:35:26 -07:00
Tyler Veness
340465c929 [ci] Upgrade to clang-format and clang-tidy 14 (NFC) (#4347) 2022-08-16 15:25:04 -07:00
Michael Leong
d45bcddd15 [examples] Add comments to StateSpaceDifferentialDrive (#4341) 2022-08-15 06:26:20 -07:00
Tyler Veness
0e0786331a Update LLVM libraries to 14.0.6 (#4350)
The main noticeable change is the SmallString conversion operator to std::string is now explicit instead of implicit.
2022-08-15 05:38:15 -07:00
Tyler Veness
c5db23f296 [wpimath] Add Eigen sparse matrix and iterative solver support (#4349)
These are useful for efficiently solving huge, but sparse systems of
equations that occur often in optimization problems.
2022-08-13 18:32:02 -07:00
Tyler Veness
44abc8dfa6 [upstream_utils] Remove git version from upstream patches (#4351)
This reduces commit noise when other git versions are used. The version
was removed by passing `--no-signature` to `git format-patch` which is
now documented in the readme.
2022-08-13 18:31:26 -07:00
Tyler Veness
3fdb2f767d [wpimath] Add comments with Ramsete equations (#4348) 2022-08-11 07:09:16 -07:00
Tyler Veness
0485f05da9 [wpilibjExamples] Upgrade jacoco to match allwpilib (#4346) 2022-08-05 10:21:40 -07:00
Thad House
0a5eb65231 [wpinet] Handle empty txt block for mdns announcer (#4072) 2022-08-03 11:15:56 -07:00
sciencewhiz
19ffebaf3e [wpilib] Add reference to I2C Lockup to API Docs (NFC) (#4340) 2022-07-29 21:01:21 -07:00
Tyler Veness
ce1a90d639 [hal] Replace SerialHelper "goto done" with continue (#4342)
The logic is already correct for closing all the objects. So we should just be continuing on error.
2022-07-27 14:37:32 -07:00
Tyler Veness
d25af48797 [ci] Make upstream_utils CI fail on untracked files (#4339)
This catches issues like update scripts putting new files in a different
directory from the old ones.
2022-07-24 19:34:16 -07:00
Jeffrey Morris
ebb836dacb [examples] Fix negations in event loop examples (#4334) 2022-07-24 19:33:52 -07:00
Tyler Veness
d83e202f00 [upstream_utils] Update paths in update_fmt.py (#4338) 2022-07-22 18:08:36 -07:00
Tyler Veness
3ccf806064 [wpimath] Remove redundant LinearFilter.finiteDifference() argument (#4335)
The number of samples is already determined by the length of the stencil
list.
2022-07-22 12:50:30 -05:00
Tyler Veness
6f1e01f8bd [wpimath] Document example of online filtering for LinearFilter.finiteDifference() (#4336) 2022-07-22 12:46:33 -05:00
sciencewhiz
1023c34b1c [readme] Update location of ni-libraries (#4333)
Fixes #4321
2022-07-09 17:44:03 -05:00
Tyler Veness
faa29d596c [wpilib] Improve Notifier docs (NFC) (#4326) 2022-07-01 06:45:00 -07:00
Tyler Veness
add00a96ed [wpimath] Improve DifferentialDriveAccelerationLimiter docs (NFC) (#4323)
Defined trackwidth, added skipped steps to the algorithm's internal
proof, and grouped the algorithm steps more logically with blank lines.
2022-07-01 06:43:57 -07:00
Tyler Veness
82fac41244 [wpimath] Better document trackwidth parameters (NFC) (#4324) 2022-07-01 06:42:49 -07:00
Tyler Veness
5eb44e22a9 Format Python scripts with black (NFC) (#4325) 2022-07-01 06:41:44 -07:00
Peter Johnson
2e09fa7325 [build] Fix mpack cmake (#4322) 2022-06-24 19:35:13 -07:00
Starlight220
fe3c24b1ee [command] Add ignoringDisable decorator (#4305) 2022-06-24 10:52:53 -07:00
Thad House
aa221597bc [build] Add M1 builds, change arm name, update to 2023 deps (#4315) 2022-06-20 12:28:46 -06:00
Tyler Veness
579a8ee229 [ci] Use one worker for Windows release Gradle build (#4318)
It was running out of heap space.
2022-06-18 22:45:12 -07:00
Justus
5105c5eab6 [wpilibj] Change "final" to "exit" in the IterativeRobotBase JavaDoc (NFC) (#4317)
"exit" is used in every other instance.
2022-06-18 15:02:36 -07:00
PJ Reiniger
787fe6e7a5 [wpiutil] Separate third party libraries (#4190) 2022-06-18 08:08:31 -07:00
ohowe
6671f8d099 [wpigui] Update portable file dialogs (#4316)
All commits from March 16, 2022 to June 1, 2022
This fixes the save button in sysid on macOS.
2022-06-17 22:47:22 -07:00
Starlight220
9ac9b69aa2 [command] Reorder Scheduler operations (#4261)
Fixes several cases where calling scheduler operations from a command callback could result in NPEs or other issues.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-06-15 23:32:16 -07:00
Tyler Veness
e61028cb18 [build] halsim_gui: Add wpinet dependency (#4313) 2022-06-15 23:14:31 -07:00
ohowe
661d23eaf5 [glass] Add precision setting for NetworkTable view (#4311) 2022-06-15 21:21:52 -07:00
Tyler Veness
666040e3e5 [hal] Throw exceptions for invalid sizes in I2C and SPI JNI (#4312)
GCC's static analyzer is correctly reporting that resize() requires an
unsigned integer, but the argument provided in the JNI function could be
negative since it's a signed byte. Throwing an exception if the argument
is negative fixes the warning.
2022-06-15 21:20:52 -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
Starlight220
fd884581e4 [wpilib] Add BooleanEvent/Trigger factories on HID classes (#4247) 2022-06-13 22:48:16 -07:00
Tyler Veness
9b1bf5c7f1 [wpimath] Move Drake and Eigen to thirdparty folders (#4307) 2022-06-11 21:07:15 -07:00
Starlight220
c9e620a920 [wpilibc] Change EventLoop data structure to vector (#4304) 2022-06-10 05:38:54 -07:00
Peter Johnson
41d40dd62f [wpinet] Fix libuv unused variable warning on Mac (#4299) 2022-06-09 23:30:16 -07:00
PJ Reiniger
30f5b68264 [wpinet] Fix JNI loading error (#4295) 2022-06-08 22:21:22 -07:00
DeltaDizzy
f7b3f4b90e [examples] Getting Started: Change Joystick to XboxController (#4194) 2022-06-08 22:20:33 -07:00
Connor Worley
a99c11c14c [wpimath] Replace UKF implementation with square root form (#4168)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-06-08 22:19:01 -07:00
Starlight220
45b7fc445b [wpilib] Add EventLoop (#4104)
This is a generic expansion of the command-based Trigger framework.
2022-06-08 22:16:51 -07:00
Peter Johnson
16a4888c52 [wpilib] Default off LiveWindow telemetry (#4301)
The original idea of LiveWindow telemetry was to automatically make
telemetry data visible to users.  This has proved increasingly
problematic in recent years due to the "spooky action at a distance"
of telemetry happening for objects that are only constructed but not
used, and blocking or slow object reads resulting in hard-to-debug
loop overrun conditions.
2022-06-08 22:13:00 -07:00
Thad House
17752f1337 [ci] Split debug and release Windows builds (#4277)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-06-06 17:25:02 -07:00
Starlight220
abb45a68db [commands] Remove custom test wrappers (#4296)
Use AtomicBoolean and AtomicInteger instead of
custom ConditionHolder and Counter classes.
2022-06-06 17:13:11 -07:00
Peter Johnson
1280a54ef3 [upstream_utils]: Make work with Python 3.8 (#4298)
str.removesuffix() is only available in Python 3.9, which is not in many
Linux installations.
2022-06-06 17:07:16 -07:00
Starlight220
f2d243fa68 [build] Change defaults for Java lints (#4300)
Removes the need to individually suppress the "serial" warning.
2022-06-06 17:06:43 -07:00
sciencewhiz
a4787130f4 Update using development build to work with 2023 gradlerio (#4294) 2022-06-04 13:58:51 -07:00
Prateek Machiraju
af7985e46c [wpiutil] Use invoke_result_t instead of result_of in future.h (#4293)
std::result_of is deprecated in C++17.
2022-06-02 23:04:20 -07:00
Tyler Veness
e9d1b5c2d0 [hal] Remove deprecated SimDevice functions (#4209) 2022-06-02 22:53:02 -07:00
Prateek Machiraju
45b598d236 [wpilibj] Add toString() methods to Color and Color8Bit (#4286) 2022-06-02 21:23:11 -07:00
Prateek Machiraju
fc37265da5 [wpimath] Add angle measurement convention to ArmFeedforward docs (NFC) (#4285) 2022-06-02 21:22:47 -07:00
Prateek Machiraju
a4ec13eb0e [wpilibjexamples] Remove unnecessary voltage desaturation 2022-06-02 21:22:19 -07:00
Prateek Machiraju
2fa52007af [wpilibc] Use GetBatteryVoltage() in MotorController::SetVoltage
This avoids having to cast to units::voltage_t
2022-06-02 21:22:19 -07:00
Prateek Machiraju
d9f9cd1140 [wpimath] Reset prev_time on pose estimator reset (#4283) 2022-06-02 21:21:42 -07:00
truher
8b6df88783 [wpilibj] Tachometer.getFrequency(): Fix bug (#4281)
Now it returns 1/period (like Tachometer.cpp); before it just returned period.
2022-06-01 10:13:19 -07:00
Tyler Veness
345cff08c0 [wpiutil] Make wpi::array constexpr (#4278) 2022-05-31 20:21:29 -07:00
Tyler Veness
57428112ac [wpimath] Upgrade to Drake v1.3.0 (#4279) 2022-05-31 20:20:01 -07:00
Thad House
a18d4ff154 [build] Fix tools not being copied when built with -Ponly* (#4276) 2022-05-29 22:09:00 -07:00
Peter Johnson
d1cd07b9f3 [wpigui] Add OpenURL (#4273)
This function opens a URL using the default browser.
2022-05-29 18:45:39 -07:00
Peter Johnson
e67f8e917a [glass] Use glfwSetKeyCallback for Enter key remap (#4275)
The imgui internals methods break with imgui >= 0.87.
2022-05-29 18:44:52 -07:00
Tyler Veness
be2fedfe50 [wpimath] Add stdexcept include for std::invalid_argument (IWYU) (#4274) 2022-05-29 15:33:19 -07:00
Peter Johnson
7ad2be172e [build] Update native-utils to 2023.0.1 (#4272)
Also remove x86 build bits.
2022-05-28 11:12:59 -07:00
Peter Johnson
abc605c9c9 [ci] Update workflows to 20.04 base image (#4271) 2022-05-27 23:33:33 -07:00
PJ Reiniger
3e94805220 [wpiutil] Reduce llvm collections patches (#4268) 2022-05-27 13:41:28 -07:00
Tyler Veness
db2e1d170e [upstream_utils] Document how to update thirdparty libraries (#4253)
Also, add a CI job to ensure the sources in the repo are consistent with
the update scripts.
2022-05-26 09:02:32 -07:00
Tyler Veness
96ebdcaf16 [wpimath] Remove unused Eigen AutoDiff module (#4267)
Drake's tests used to include it, but it's commented out since it's not
used.
2022-05-26 09:01:45 -07:00
PJ Reiniger
553b2a3b12 [upstream_utils] Fix stackwalker (#4265) 2022-05-24 21:51:32 -07:00
Tyler Veness
3e13ef42eb [wpilibc] Add missing std::array #include (include-what-you-use) (#4266) 2022-05-24 21:49:22 -07:00
Tyler Veness
d651a1fcec Fix internal deprecation warnings (#4257)
This allows us to error out on deprecation warnings for thirdparty
libraries and standard library features.

Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-05-24 13:56:48 -07:00
ohowe
b193b318c1 [commands] Add unless() decorator (#4244) 2022-05-24 09:22:19 -07:00
bovlb
ef3714223b [commands] Remove docs reference to obsolete interrupted() method (NFC) (#4262) 2022-05-24 09:19:38 -07:00
Dalton Smith
3d8dbbbac3 [readme] Add quickstart (#4225) 2022-05-22 20:19:50 -07:00
Peter Johnson
013efdde25 [wpinet] Wrap a number of newer libuv features (#4260) 2022-05-22 20:18:23 -07:00
Starlight220
816aa4e465 [wpilib] Add Pneumatics sim classes (#4033) 2022-05-22 07:21:40 -07:00
Tyler Veness
046c2c8972 [wpilibc] Rename SpeedControllerGroupTest.cpp (#4258)
Also move motor controller test files into motorcontrol folder to match
Java.
2022-05-21 16:20:26 -07:00
Tyler Veness
d80e9cdf64 [upstream_utils] Use shallow clones for thirdparty repos (#4255)
This makes update_llvm.py in particular much faster because the full
repo requires fetching 2 GB.
2022-05-20 18:59:33 -07:00
Tyler Veness
7576136b4a [upstream_utils] Make update_llvm.py executable (#4254) 2022-05-20 17:16:19 -07:00
PJ Reiniger
c3b223ce60 [wpiutil] Vendor llvm and update to 13.0.0 (#4224) 2022-05-20 15:59:53 -07:00
Tyler Veness
5aa67f56e6 [wpimath] Clean up math comments (#4252) 2022-05-20 15:16:56 -07:00
Tyler Veness
fff4d1f44e [wpimath] Extend Eigen warning suppression to GCC 12 (#4251)
It originally only applied to GCC 11. The CMake build passed without
this change, but not the Gradle build.
2022-05-19 18:50:29 -07:00
Tyler Veness
0d9956273c [wpimath] Add CoordinateSystem.convert() translation and rotation overloads (#4227) 2022-05-18 20:41:15 -07:00
Tyler Veness
3fada4e0b4 [wpinet] Update to libuv 1.44.1 (#4232) 2022-05-18 20:40:27 -07:00
Tyler Veness
65b23ac45e [wpilibc] Fix return value of DriverStation::GetJoystickAxisType() (#4230)
It was returning a pointer to the axis type array cast to a bool (always
1) instead of returning the desired axis type.
2022-05-18 14:36:11 -07:00
Tyler Veness
4ac34c0141 [upstream_utils] Cleanup update_libuv.py (#4249) 2022-05-18 14:34:34 -07:00
Tyler Veness
8bd614bb1e [upstream_utils] Use "git am" instead of "git apply" for patches (#4248)
This creates actual commits in the thirdparty repo, which makes rebasing
them onto new versions much easier.
2022-05-18 12:23:15 -07:00
Tyler Veness
4253d6d5f0 [upstream_utils] Apply "git am" patches individually (#4250)
Also, giving am_patches() zero patches isn't an error. The function will
just be a no-op.
2022-05-18 12:22:31 -07:00
Tyler Veness
6a4752dcdc Fix GCC 12.1 warning false positives (#4246) 2022-05-18 12:22:10 -07:00
Tyler Veness
5876b40f08 [wpimath] Memoize CoordinateSystem and CoordinateAxis statics (#4241) 2022-05-18 10:47:46 -07:00
Tyler Veness
5983434a70 [cameraserver] Replace IterativeRobot in comment sample code with TimedRobot (#4238) 2022-05-15 20:47:50 -07:00
Max Gordon
a3d44a1e69 [wpimath] Add Translation2d.getAngle() (#4217)
Co-authored-by: Max Gordon <tonald.drump2.0@gamil.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-05-14 21:22:00 -07:00
Tyler Veness
d364bbd5a7 [upstream_utils] Give vendor update scripts execute permissions (#4226) 2022-05-14 15:31:51 -07:00
Tyler Veness
f341e1b2be [wpimath] Document standard coordinate systems better (NFC) (#4228) 2022-05-14 15:31:06 -07:00
Peter Johnson
9af389b200 [wpinet] AddrToName: Initialize name (#4229) 2022-05-14 06:55:22 -07:00
Austin Shalit
2ae4adf2d7 [ci] Add wpiformat command to PRs (#4223) 2022-05-11 22:06:11 -07:00
sciencewhiz
178b2a1e88 Contributing.md: Correct version of clang-format used (#4222) 2022-05-10 23:48:08 -07:00
PJ Reiniger
18db343cdc [wpiutil, wpinet] Vendor libuv, stack walker (#4219) 2022-05-08 22:21:54 -07:00
Austin Shalit
f0c821282a [build] Use artifactory mirror (#4220) 2022-05-08 13:59:58 -07:00
Peter Johnson
d673ead481 [wpinet] Move network portions of wpiutil into new wpinet library (#4077) 2022-05-07 10:54:14 -07:00
Tyler Veness
b33715db15 [wpimath] Add CoordinateSystem class (#4214) 2022-05-07 10:25:19 -07:00
Dustin Spicuzza
99424ad562 [sim] Allow creating a PWMSim object from a PWMMotorController (#4039) 2022-05-06 08:44:59 -07:00
Tommy Beadle
dc6f641fd2 [wpimath] PIDController: Reset position and velocity error when reset() is called. (#4064)
In addition to m_prevError and m_totalError, m_positionError and
m_velocityError need to be reset to 0 when reset() is called.
Otherwise, the next time calculate() is called, the old values will be
used as the previous error, but this is inaccurate since the caller
wanted to reset the state of the PID controller.
2022-05-06 08:44:08 -07:00
Tyler Veness
f20a20f3f1 [wpimath] Add 3D geometry classes (#4175)
Also clean up 2D geometry documentation.
2022-05-06 08:41:23 -07:00
Kaitlyn Kenwell
708a4bc3bc [wpimath] Conserve previously calculated swerve module angles when updating states for stationary ChassisSpeeds (#4208)
* Calculated swerve module states now stored in a member variable
* If ChassisSpeeds(0, 0, 0) is converted to module speeds, the
previously calculated module angle will be conserved, with forward speed
set to 0
* New tests added
2022-05-06 08:38:20 -07:00
chen perach
ef7ed21a9d [wpimath] Improve accuracy of ComputerVisionUtil.calculateDistanceToTarget() (#4215) 2022-05-06 08:36:58 -07:00
Tyler Veness
b1abf455c1 [wpimath] LTVUnicycleController: Use LUT, provide default hyperparameters (#4213) 2022-05-04 22:04:08 -07:00
Tyler Veness
d5456cf278 [wpimath] LTVDifferentialDriveController: Remove unused variable (#4212) 2022-05-04 22:03:15 -07:00
Tyler Veness
99343d40ba [command] Remove old command-based framework (#4211) 2022-05-04 22:02:53 -07:00
Tyler Veness
ee03a7ad3b Remove most 2022 deprecations (#4205)
Excludes "old" commands and SimDevice functions.
2022-05-04 20:37:27 -07:00
Tyler Veness
ce1a7d698a [wpimath] Refactor WheelVoltages inner class to a separate file (#4203) 2022-05-01 11:01:20 -07:00
Tyler Veness
87bf70fa8e [wpimath] Add LTV controllers (#4094)
This adds a unicycle controller that's a drop-in replacement for Ramsete
and a differential drive controller that controls the full pose and
outputs voltages. The main benefit is LQR-like tuning knobs using a
system model.
2022-04-30 22:54:22 -07:00
Tyler Veness
ebd2a303bf [wpimath] Remove deprecated MakeMatrix() function (#4202) 2022-04-30 22:52:05 -07:00
Peter Johnson
e28776d361 [wpimath] LinearSystemLoop: Add extern templates for common cases 2022-04-30 20:38:55 -07:00
Peter Johnson
dac1429aa9 [wpimath] LQR: Use extern template instead of Impl class 2022-04-30 20:38:55 -07:00
Peter Johnson
e767605e94 [wpimath] Add typedefs for common types
This makes complex code significantly easier to read.

frc::Vectord<Size> = Eigen::Vector<double, Size>
frc::Matrixd<Rows, Cols> = Eigen::Matrix<double, Rows, Cols>
2022-04-30 20:38:55 -07:00
Peter Johnson
97c493241f [wpimath] UnscentedKalmanFilter: Move implementation out-of-line 2022-04-30 20:38:55 -07:00
Peter Johnson
8ea90d8bc9 [wpimath] ExtendedKalmanFilter: Move implementation out-of-line 2022-04-30 20:38:55 -07:00
Peter Johnson
ae7b1851ec [wpimath] KalmanFilter: Use extern template instead of Impl class 2022-04-30 20:38:55 -07:00
Peter Johnson
e3d62c22d3 [wpimath] Add extern templates for common cases
This helps reduce compile times and memory usage.
2022-04-30 20:38:55 -07:00
Peter Johnson
7200c4951d [wpiutil] SymbolExports: Add WPILIB_IMPORTS for dllimport 2022-04-30 20:38:55 -07:00
Peter Johnson
84056c9347 [wpiutil] SymbolExports: Add EXPORT_TEMPLATE_DECLARE/DEFINE 2022-04-30 20:38:55 -07:00
Oblarg
09cf6eeecb [wpimath] ApplyDeadband: add a scale param (#3865)
Also templates it in C++ so it can work with both doubles and units.
2022-04-30 20:29:48 -07:00
Austin Shalit
03230fc842 [build,ci] Enable artifactory build cache (#4200) 2022-04-30 20:27:23 -07:00
Jason Daming
63cf3aaa3f [examples] Don't square ArcadeDrive inputs in auto (#4201) 2022-04-30 20:19:32 -07:00
Starlight220
18ff694f02 [wpimath] Add Rotation2d.fromRadians factory (#4178) 2022-04-30 00:19:29 -07:00
Tyler Veness
4f79ceedd9 [wpilibc] Add missing #include (#4198) 2022-04-30 00:07:37 -07:00
Starlight220
f7ca72fb41 [command] Rename PerpetualCommand to EndlessCommand (#4177) 2022-04-28 09:38:38 -07:00
bovlb
a06b3f0307 [hal] Correct documentation on updateNotifierAlarm (#4156)
The previous documentation suggested that `triggerTime` is the interval until the next alarm, but the implementation is that it is the absolute alarm time.
2022-04-26 21:53:30 -07:00
Tyler Veness
d926dd1610 [wpimath] Fix pose estimator performance (#4111)
Fixes #4087.
2022-04-26 18:43:59 -07:00
ysthakur
51bc893bc5 [wpiutil] CircularBuffer: Change Java package-private methods to public (#4181)
The `size`, `getFirst`, `getLast`, and `resize` methods were all package-private.

Also make `size` return an `int` instead of a `double`.
2022-04-25 14:58:12 -07:00
Tyler Veness
fbe761f7f6 [build] Increase Gradle JVM heap size (#4172)
wpimath artifact publishing was running out of heap
2022-04-24 23:13:57 -07:00
Tyler Veness
5ebe911933 [wpimath] Add DifferentialDriveAccelerationLimiter (#4091) 2022-04-24 07:21:40 -07:00
Tyler Veness
3919250da2 [wpilibj] Remove finalizers (#4158)
They were deprecated for removal in Java 18 because they're error-prone.
Prefer AutoCloseable and Cleaner instead.

https://openjdk.java.net/jeps/421
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ref/Cleaner.html
2022-04-24 07:21:08 -07:00
ohowe
b3aee28388 [commands] Allow BooleanSupplier for Trigger operations (#4103) 2022-04-24 07:20:46 -07:00
Tyler Veness
9d20ab3024 [wpilib] Allow disabling ElevatorSim gravity (#4145)
Closes #4144.
2022-04-24 07:19:18 -07:00
Peter Johnson
aaa69f6717 [ci] Remove 32-bit Windows builds (#4078) 2022-04-24 07:18:49 -07:00
Tyler Veness
355a11a414 Update Java linters and fix new PMD errors (#4157)
PMD requires that variables only initialized in the constructor be
final. The compiler errors if those final variables aren't guaranteed to
be initialized, so extra else branches were added to ensure that.

PMD also requires that classes with only private constructors be final.
The equivalent C++ classes were finalized as well, except for
TimeInterpolatableBuffer because it doesn't expose factory functions.
2022-04-24 07:18:05 -07:00
Jason Daming
ffc69d406c [examples] Reduce suggested acceleration in Ramsete example (#4171)
This value mirrors the update to the documentation in wpilibsuite/frc-docs#1792.
2022-04-19 17:10:11 -07:00
camaj
922d50079a [wpimath] Units: fix comment in degreesToRotations (NFC) (#4159) 2022-04-13 22:32:55 -07:00
Jonah Snider
dd163b62ae [wpimath] Rotation2d: Add factory method that uses rotations (#4166)
Rotation2d.fromRotations(1).equals(new Rotation2d(2 * Math.PI)); // true

Also adds a member method to get the value of the Rotation2d in rotations.
2022-04-13 22:31:43 -07:00
Tyler Veness
bd80e220b9 [ci] Upgrade CMake actions (#4161) 2022-04-12 19:00:00 -07:00
Tyler Veness
aef4b16d4c [wpimath] Remove unnecessary NOLINT in LinearPlantInversionFeedforward (NFC) (#4155) 2022-04-08 21:31:42 -07:00
Spud
975171609e [wpilib] Compressor: Rename enabled to isEnabled (#4147)
This is a less confusing name, as enabled() can imply it enables the compressor.
2022-04-08 21:31:08 -07:00
Tyler Veness
5bf46a9093 [wpimath] Add ComputerVisionUtil (#4124)
Closes #4108.
2022-04-08 21:20:53 -07:00
ohowe
f27a1f9bfb [commands] Fix JoystickButton.getAsBoolean (#4131)
This previously always returned false; the get method it inherited was not used in the getAsBoolean defined in the Trigger class. The fix is to swap get() and getAsBoolean() implementations in the Trigger class.
2022-04-08 21:20:23 -07:00
Excalibur FRC | 6738
1b26e2d5da [commands] Add RepeatCommand (#4009)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-04-07 22:02:08 -07:00
apple
88222daa3d [hal] Fix misspelling in AnalogInput/Output docs (NFC) (#4153)
value -> valid
(NFC)
2022-04-07 21:57:01 -07:00
Tyler Veness
81c5b41ce1 [wpilibj] Document MechanismLigament2d angle unit (NFC) (#4142) 2022-03-31 00:29:44 -07:00
Peter Johnson
9650e6733e [wpiutil] DataLog: Document finish and thread safety (NFC) (#4140) 2022-03-29 12:28:59 -07:00
Tyler Veness
c8905ec29a [wpimath] Remove ImplicitModelFollower dt argument (#4119)
The math works just fine without model discretization.
2022-03-29 11:29:06 -07:00
Tyler Veness
b4620f01f9 [wpimath] Fix Rotation2d interpolation in Java (#4125)
Fixes #4112.
2022-03-29 08:42:43 -07:00
Tyler Veness
2e462a19d3 [wpimath] Constexprify units unary operators (#4138)
Fixes #4137.
2022-03-29 08:42:08 -07:00
Peter Johnson
069f932e59 [build] Fix gl3w cmake build (#4139) 2022-03-28 22:31:51 -07:00
Tyler Veness
126e3de91a [wpilibc] Remove unused SetPriority() call from Ultrasonic (#4123) 2022-03-24 07:24:12 -07:00
Tyler Veness
ba0dccaae4 [wpimath] Fix reference to Rotation2d.fromRadians() (#4118)
Rotation2d.fromRadians() doesn't exist. The constructor should be used
instead.
2022-03-20 21:57:03 -07:00
sciencewhiz
e1b6e5f212 [wpilib] Improve MotorSafety documentation (NFC) (#4120)
Remove OBE RobotDrive porting guide from MecanumDrive
2022-03-20 21:54:43 -07:00
Tyler Veness
8d79dc8738 [wpimath] Add ImplicitModelFollower (#4056) 2022-03-20 00:36:12 -07:00
Tyler Veness
78108c2aba [wpimath] Fix PIDController having incorrect error after calling SetSetpoint() (#4070) 2022-03-19 23:59:00 -07:00
Tyler Veness
cdafc723fb [examples] Remove unused LinearPlantInversionFeedforward includes (#4069) 2022-03-19 20:47:09 -07:00
Ashray._.g
0d70884dce [wpimath] Add InterpolatedTreeMap (#4073)
- Add InterpolatedTreeMap for Java from team 254's 2016 MIT licensed code
- Add InterpolatedMap for C++ from team 3512's code with @calcmogul (original author) permission

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-03-19 20:46:42 -07:00
Tyler Veness
765efa325e [wpimath] Remove redundant column index from vectors (#4116) 2022-03-19 20:44:14 -07:00
Tyler Veness
89ffcbbe41 [wpimath] Update TrapezoidProfile class name in comment (NFC) (#4107) 2022-03-19 20:41:53 -07:00
Tyler Veness
95ae23b0e7 [wpimath] Improve EKF numerical stability (#4093)
The Joseph form of the error covariance update equation is more
numerically stable when the Kalman gain isn't optimal. Numerical
instability and filter divergence can occur if the user goes long time
periods between updates and the error covariance becomes ill-conditioned
(the ratio between the largest and smallest eigenvalue gets too large).
2022-03-19 20:41:28 -07:00
Tyler Veness
d5cb6fed67 [wpimath] Support zero cost entries in MakeCostMatrix() (#4100)
The existing implementation will produce a cost of NaN if a tolerance of
infinity is entered, but the limit approaches zero. Being able to
specify that a state has no cost is useful, so this change adds support for
that.
2022-03-19 20:40:26 -07:00
Tyler Veness
d0fef18378 [wpimath] Remove redundant this. from ExtendedKalmanFilter.java (#4115) 2022-03-19 20:39:10 -07:00
Tyler Veness
d640c0f41f [wpimath] Fix pose estimator local measurement standard deviation docs (NFC) (#4113) 2022-03-19 20:38:32 -07:00
Dustin Spicuzza
a2fa5e3ff7 [wpilibc] BatterySim: Provide non-initializer list versions of Calculate (#4076) 2022-03-14 10:09:55 -07:00
sciencewhiz
a3eea9958e [hal] Add link to FRC CAN Spec (NFC) (#4086) 2022-03-14 10:07:44 -07:00
Tyler Veness
db27331d7b [wpilib] Update DifferentialDrive docs (NFC) (#4085)
Fixes #4084.
2022-03-14 10:07:06 -07:00
Peter Johnson
fdfb31f164 [dlt] Export boolean[] values (#4082) 2022-03-14 10:05:50 -07:00
Dustin Spicuzza
f93c3331b3 [wpigui] disable changing directory when initializing on MacOS (#4092)
- Seems to be intended for resource bundles in MacOS apps, which we don't use
2022-03-14 10:05:22 -07:00
Thad House
ab7ac4fbb9 [build] Fix various warnings in cmake builds (#4081) 2022-03-07 22:36:42 -08:00
Thad House
bc39a1a293 [wpilibc] Fix moved pneumatics objects not destructing properly (#4068) 2022-03-01 11:10:45 -08:00
Tyler Veness
2668130e70 [wpimath] Remove SwerveDrivePoseEstimator encoder reset warning (#4066)
SwerveDrivePoseEstimator uses velocities, so position resets aren't
needed.

Closes #4065.
2022-02-28 17:40:25 -08:00
Austin Shalit
d27ed3722b [ci] Set actions workflow concurrency (#4060)
This sets the workflow concurrency to 1 for all workflows. For PRs this means if you push an additional commit older jobs will be cancelled.

The documentation workflow already only runs on tags or merges to main. For this, we cancel previous runs if they are to the same destination (tag or main) but still prevent 2 jobs from running at once if they are spawned from different refs.
2022-02-27 20:13:58 -08:00
shueja-personal
dae18308c9 [wpimath] Minor fixes to Rotation2d docs (NFC) (#4055)
Fixed incorrect examples on .plus(), and a missing word.

Make example code snippets closer to actual use.
2022-02-27 16:56:56 -08:00
Peter Johnson
d66555e42f [datalogtool] Add datalogtool
This is a support tool for datalog file conversion (and eventually
download/remote datalog file management).
2022-02-26 09:49:34 -08:00
Peter Johnson
9f52d8a3b1 [wpilib] DriverStation: Add DataLog support for modes and joystick data 2022-02-26 09:49:34 -08:00
Peter Johnson
757ea91932 [wpilib] Add DataLogManager
This creates a default log file that captures NT changes and
automatically renames the log file based on time and match info.

DriverStation joystick logging will be implemented by the DriverStation
class instead.
2022-02-26 09:49:34 -08:00
Peter Johnson
02a804f1c5 [ntcore] Add DataLog support 2022-02-26 09:49:34 -08:00
Peter Johnson
9b500df0d9 [wpiutil] Add high speed data logging 2022-02-26 09:49:34 -08:00
Peter Johnson
5a89575b3a [wpiutil] Import customized LLVM MemoryBuffer 2022-02-26 09:49:34 -08:00
Peter Johnson
b8c4d7527b [wpiutil] Add MappedFileRegion 2022-02-26 09:49:34 -08:00
Alberto Jahuey Moncada
ac5d46cfa7 [wpilibc] Fix ProfiledPID SetTolerance default velocity value (#4054)
When trying to set the tolerance of a ProfiledPID, it fails if you don't give it a velocity value. It was missing a conversion from double to the appropiate unit.
2022-02-25 20:27:56 -08:00
Thad House
bc9e96e86f [wpilib] Absolute Encoder API and behavior fixes (#4052)
SetPositionOffset was added. Been requested multiple times, and easy to implement.

The javadocs mentioned GetPositionInRotation. It has tripped up many people how to get the absolute position from the encoder (You currently have to have precreated the DutyCycle object). Add this method (as GetAbsolutePostition) to make this easier to do.

The checks for making sure a matching set of values was read was doing direct double comparisions. This worked ok in the DutyCycle case, but has problems in the analog case. Solve this by using an epsilon comparison.

And finally, scale AnalogEncoders analog input to 0-1 instead of 0-5. This was reported a few years ago, but the issue was missed. This caused the encoder to count from 0-5, then 1-6, then 2-7 etc. This is solved and now works correctly.

Closes #3188
Closes #4046
Closes #4051

And fixes the following issue on CD
https://www.chiefdelphi.com/t/wpilib-analogencoder-java/372649
2022-02-24 22:45:15 -08:00
Dustin Spicuzza
f88c435dd0 [hal] Add mechanism to cancel all periodic callbacks (#4049) 2022-02-23 09:46:01 -08:00
Leonard Abbas
e4b91005cf [examples] Update SwerveModule constructor doc (NFC) (#4042)
Renamed "port" to "channel" for consistency.
2022-02-22 09:26:16 -08:00
Leonard Abbas
a260bfd83b [examples] Remove "this" keyword from SwerveModule (#4043) 2022-02-21 09:27:00 -08:00
Leonard Abbas
18e262a100 [examples] Fix multiple doc typos in SwerveControllerCommand example (NFC) (#4044) 2022-02-21 09:26:20 -08:00
Dustin Spicuzza
4bd1f526ab [wpilibc] Prevent StopMotor from terminating robot during MotorSafety check (#4038)
- Nothing else in that function can throw, so protecting StopMotor should be sufficient
- Fixes #4036
2022-02-19 20:42:10 -08:00
Dustin Spicuzza
27847d7eb2 [sim] Expose GUI control functions via HAL_RegisterExtension (#4034) 2022-02-19 20:40:25 -08:00
Dustin Spicuzza
b2a8d3f0f3 [wpilibc] Add mechanism to reset MotorSafety list (#4037) 2022-02-19 20:38:30 -08:00
Tyler Veness
49adac9564 [wpilib] Check for signedness in ArcadeDriveIK() (#4028)
If xSpeed == -0.0 and zRotation > 0, the algorithm assumes it's in the
third quadrant instead of the first since +0.0 == -0.0.

Also added tests for inverse kinematic functions, fixed some
MecanumDrive test bugs, and added Java MecanumDrive.driveCartesianIK()
and KilloughDrive.driveCartesianIK() overloads with defaulted gyro angle
that C++ already had.

Fixes #4022.
2022-02-17 18:03:59 -08:00
Peter Johnson
a19d1133b1 [wpiutil] libuv: Fix sign compare warnings in gcc 11.2 (#4031) 2022-02-13 16:56:53 -08:00
Peter Johnson
dde91717e4 [build] cmake: Add ability to customize target warnings (#4032) 2022-02-13 16:53:55 -08:00
Peter Johnson
e9050afd67 [sim] Update sim match time to match real robot (#4024)
The real robot has match time set to -1.0 until it's enabled, and then
counts down. Disabling the robot sets the time to -1.0.

The sim GUI has been updated to add preset buttons for auto and teleop
match times. The enable match timing checkbox has been removed as it's
no longer required.

The DS socket plugin has also been fixed to properly initialize
matchTime to -1.0 and reset it to -1.0 on disable.
2022-02-12 22:31:10 -08:00
sciencewhiz
165d2837cf [wpilib] Preferences: Set Persistent in Init methods (#4025)
Fixes #4018
2022-02-12 22:30:02 -08:00
Peter Johnson
ac7549edca [glass] Fix snprintf truncation warning (#4029) 2022-02-12 22:29:26 -08:00
Jonah Snider
4d96bc72e0 [wpilibj] Fix typos in error messages for non-null assertions (#4014) 2022-02-11 18:11:15 -08:00
Dustin Spicuzza
3411eee20f [hal] Replace hardcoded sim array sizes with constants (#4015) 2022-02-10 00:12:07 -08:00
Dustin Spicuzza
74de97eeca [wpilibc] Add mechanism to reset various global structures (#4007) 2022-02-09 22:14:12 -08:00
sciencewhiz
4e3cc25012 [examples] Fix periodic function rate comment (NFC) (#4013)
Fixes #3979
2022-02-08 13:19:31 -08:00
Dustin Spicuzza
90c1db393e [sim] Add exported functions to control the sim GUI (#3995) 2022-02-07 00:39:45 -08:00
sciencewhiz
2f43274aa4 [wpilibj] MechanismRoot2d: Add flush to setPosition (#4011)
Fixes #4010.
2022-02-06 22:47:33 -08:00
Peter Johnson
aeca09db09 [glass] Support remapping of Enter key (#3994)
This is useful for editing of values without disabling the DS.
2022-02-06 00:11:37 -08:00
Peter Johnson
c107f22c67 [sim] Sim GUI: don't force-show Timing and Other Devices (#4001)
Instead preserve their saved visible state.
2022-02-06 00:11:12 -08:00
Peter Johnson
68fe51e8da [wpigui] Update PFD to latest, fix kdialog multiselect (#4005) 2022-02-06 00:10:43 -08:00
modelmat
8d08d67cf1 [wpigui] PFD: Add console warning if file chooser unavailable (#4003)
Also remove iostream use.
2022-02-06 00:10:20 -08:00
Dustin Spicuzza
4f1782f66e [wpilibc] Only call HAL_Report when initializing SmartDashboard (#4006) 2022-02-06 00:07:55 -08:00
Tyler Veness
3f77725cd3 Remove uses of iostream (#4004)
Most of these were unused, the IMU ones were just debug messages.

The only one that wasn't removed is in portable-file-dialogs.cpp since
the replacement looks less trivial.
2022-02-05 23:00:31 -08:00
Peter Johnson
5635f33a32 [glass] Increase plot depth to 20K points (#3993)
2K was sufficient for simulation because it's possible to pause time,
but isn't quite enough for looking at real robot data. 20K points
is 400 seconds at 50 Hz which should make pausing plots much more
useful.

As every point is looped over, this does increase CPU utilization
somewhat but doesn't seem to have much of an impact for typical
use cases. Increasing this further will necessitate some greater
optimizations (e.g. an initial cull using binary search).
2022-02-04 22:20:38 -08:00
Peter Johnson
bca4b7111b [glass] Fix PlotSeries::SetSource() (#3991)
This can be called in a delayed manner, so it's possible for
m_size to already be at maximum, which results in writing past
the end of the array. Instead, just call AppendValue().
2022-02-04 20:47:11 -08:00
Oblarg
6a6366b0d6 [commands] Add until() as alias for withInterrupt() (#3981)
This is a clearer description for the functionality.
Will deprecate withInterrupt next year.
2022-02-03 22:14:52 -08:00
Thad House
16bf2c70c5 [wpilib] Fix joystick out of range error messages (#3988) 2022-02-03 22:10:44 -08:00
Thad House
4b3edb742c [wpilib] Fix ADIS16448 IMU default constructor not working in Java (#3989)
Also fixes a few related uninitialized variables in C++.
2022-02-03 22:09:12 -08:00
Thad House
fcf23fc9e9 [hal] Fix potential gamedata out of bounds read (#3983)
The size was uninitialized.  If the size is smaller than the data,
NetComm just updates the size and does not initialize the data.
2022-02-01 22:22:48 -08:00
Jan-Felix Abellera
af5ef510c5 [wpilibc] Fix REV PH pulse duration units (#3982) 2022-02-01 20:28:48 -08:00
Jan-Felix Abellera
05401e2b81 [wpilib] Write REV PH firmware version to roboRIO to display on driver station (#3977) 2022-02-01 20:27:43 -08:00
Thad House
9fde0110b6 Update to 2022 v4.0 image (#3944) 2022-01-31 23:26:05 -08:00
sciencewhiz
b03f8ddb2e [examples] fix incorrect variable in Arm Simulation Pref (#3980) 2022-01-31 22:01:31 -08:00
sciencewhiz
a26df2a022 [examples] Update ArmSimulation example to use Preferences (#3976)
This shows more real world usage then hardcoding the setpoint and PID
gains. There were no current examples using Preferences. This will also
be used to update frc-docs article for Preferences.
2022-01-31 00:17:04 -08:00
Oblarg
d68d6674e8 [examples] Armbot: rename kCos to kG (#3975) 2022-01-31 00:16:26 -08:00
sciencewhiz
a8f0f6bb90 [wpilibj] Fix ADIS16448 getRate to return rate instead of angle (#3974) 2022-01-29 20:17:57 -08:00
Thad House
dd9c92d5bf [build] Remove debug info from examples (#3971)
They take up a LOT of disk space.
2022-01-27 20:59:13 -08:00
Thad House
84df14dd70 [rtns] Fix icons (#3972) 2022-01-27 20:58:07 -08:00
sciencewhiz
560094ad92 [examples] Correct Mecanum example axes (#3955) 2022-01-27 20:57:41 -08:00
Jan-Felix Abellera
7ea1be9c01 [wpilibc] Fix typo in hardware version for REV PDH (#3969) 2022-01-27 17:54:38 -08:00
Jan-Felix Abellera
700f13bffd [wpilibj] Make methods public for Java REV PDH (#3970) 2022-01-27 17:54:14 -08:00
Jan-Felix Abellera
b6aa7c1aa9 [wpilibj] Make methods public for Java REVPH (#3968) 2022-01-27 17:53:45 -08:00
Tyler Veness
eb4d183e48 [wpimath] Fix clang-tidy bugprone-integer-division warning (#3966)
The integer conversion is deliberate.
2022-01-26 18:38:45 -08:00
Thad House
77e4e81e1e [wpilib] Add Field widget to BuiltInWidgets in shuffleboard (#3961) 2022-01-24 20:33:11 -08:00
Thad House
88f5cb6eb0 [build] Publish PDBs with C++ tools (#3960) 2022-01-24 20:32:17 -08:00
Tyler Veness
efae552f3e [wpimath] Remove DifferentialDriveKinematics include from odometry (#3958) 2022-01-24 16:02:00 -08:00
sciencewhiz
46b277421a [glass] Update Speed Controller Type name for 2022 WPILib (#3952) 2022-01-21 21:30:44 -08:00
modelmat
42908126b9 [wpilib] Add DCMotorSim (#3910) 2022-01-21 20:42:06 -08:00
Peter Johnson
a467392cbd [wpiutil] StackTrace: Add ability to override default implementation (#3951) 2022-01-21 17:22:41 -08:00
modelmat
78d0bcf49d [templates] Add SimulationInit()/SimulationPeriodic() to robot templates (#3943) 2022-01-21 16:23:46 -08:00
sciencewhiz
02a0ced9b0 [wpilib] MecanumDrive: update docs for axis to match implementation (NFC) (#3942)
Added note that implementation may change in the future, #3930.
2022-01-21 16:22:17 -08:00
shueja-personal
4ccfe1c9f2 [wpilib] Added docs clarification on units for drive class WheelSpeeds (NFC) (#3939) 2022-01-21 15:51:28 -08:00
Peter Johnson
830c0c5c2f [wpilib] MechanismLigament2d: Add getters for color and line weight (#3947)
Also add missing locking in C++.
2022-01-21 15:47:44 -08:00
Peter Johnson
5548a37465 [wpilib] PowerDistribution: Add module type getter (#3948) 2022-01-21 15:46:44 -08:00
Thad House
2f9a600de2 [hal] Fix PCM one shot (#3949) 2022-01-21 15:46:08 -08:00
Thad House
559db11a20 [myRobot] Skip deploying debug libraries for myRobot deploys (#3950) 2022-01-21 15:45:47 -08:00
Lenny Abbas
76c78e295b [examples] Reorder SwerveModules in SwerveControllerCommand example odometry update (#3934) 2022-01-21 11:04:43 -08:00
sciencewhiz
debbd5ff4b [wpilib] Improve PowerDistribution docs (NFC) (#3925)
Add docs for switchable channel.
Use PDP/PDH appropriately and clarify differences.
Fix typos.
2022-01-20 23:33:01 -08:00
Tyler Veness
841174f302 [commands] Change command vendordep JSON version number to 1.0.0 (#3938)
While the number doesn't matter, it being old is confusing a lot of
people.  We never increment the internal vendordep versions, so using a year
version number was a poor choice.

Closes #3921.
2022-01-20 23:32:02 -08:00
sciencewhiz
8c55844f91 [wpilib] Remove comment about Mecanum right side inverted (NFC) (#3929) 2022-01-18 01:00:55 -08:00
Thad House
0b990bf0f5 [hal] Fix PCM sticky faults clear function crashing (#3932)
A call to the PCM clear function was using the wrong handle passed down to the CAN layer, causing an error.
2022-01-18 00:59:51 -08:00
Thad House
104d7e2abc [hal] Don't throw exceptions in PCM JNI (#3933)
Since the CAN bus can easily become disconnected, we don't want this to crash. Instead, we just want this to report errors. This matches previous behavior.
2022-01-18 00:58:26 -08:00
Lenny Abbas
5ba69e1af1 [examples] Updated type in Java SwerveModule (#3928)
Changed turnOutput from var to double in SwerveModule. It doesn't make sense for driveOutput and turnOutput to have different types so they should both be doubles.
2022-01-17 12:20:55 -08:00
Chirag Kaushik
f3a0b5c7d7 [wpimath] Fix Java SimpleMotorFeedforward Docs (NFC) (#3926) 2022-01-17 09:59:04 -08:00
10165 changed files with 1274260 additions and 507708 deletions

20
.bazelignore Normal file
View File

@@ -0,0 +1,20 @@
build_cmake
build-cmake
# Auto generated by vscode
apriltag/bin
cameraserver/bin
cameraserver/multiCameraServer/bin
cscore/bin
fields/bin
hal/bin
developerRobot/bin
ntcore/bin
romiVendordep/bin
commandsv2/bin
wpilibj/bin
wpimath/bin
wpinet/bin
wpiutil/bin
wpiunits/bin
xrpVendordep/bin

91
.bazelrc Normal file
View File

@@ -0,0 +1,91 @@
try-import %workspace%/user.bazelrc
common --enable_bzlmod --enable_workspace
# Resolves to --config=linux on Linux, --config=macos on Mac, --windows on windows
common --enable_platform_specific_config
# Make bazel 8 work for us.
common --enable_workspace
build --experimental_cc_static_library
build --experimental_cc_shared_library
build --java_language_version=25
build --java_runtime_version=remotejdk_25
build --tool_java_language_version=25
build --tool_java_runtime_version=remotejdk_25
test --test_output=errors
test --test_verbose_timeout_warnings
import %workspace%/shared/bazel/compiler_flags/sanitizers.rc
import %workspace%/shared/bazel/compiler_flags/linux_flags.rc
import %workspace%/shared/bazel/compiler_flags/osx_flags.rc
import %workspace%/shared/bazel/compiler_flags/roborio_flags.rc
import %workspace%/shared/bazel/compiler_flags/systemcore_flags.rc
import %workspace%/shared/bazel/compiler_flags/windows_flags.rc
import %workspace%/shared/bazel/compiler_flags/coverage_flags.rc
# Alias toolchain names to what wpilibsuite uses for CI/Artifact naming
build:athena --config=roborio
build:linuxarm32 --config=raspibookworm32
build:linuxarm64 --config=bookworm64
build:build_java --test_tag_filters=allwpilib-build-java --build_tag_filters=allwpilib-build-java
build:build_cpp --test_tag_filters=+allwpilib-build-cpp --build_tag_filters=+allwpilib-build-cpp
build:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example
test:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example
common:skip_robotpy --test_tag_filters=-robotpy --build_tag_filters=-robotpy
# Build Buddy BES Setup
build:build_buddy_bes --bes_results_url=https://app.buildbuddy.io/invocation/
build:build_buddy_bes --bes_backend=grpcs://remote.buildbuddy.io
# Common Cache Settings
build:common_cache --remote_timeout=3600
build:common_cache --remote_cache_compression
build:common_cache --experimental_remote_cache_compression_threshold=100
# Build Buddy Cache Setup
build:build_buddy --config=common_cache
build:build_buddy --config=build_buddy_bes
build:build_buddy --remote_cache=grpcs://remote.buildbuddy.io
build:build_buddy --noslim_profile
build:build_buddy --experimental_profile_include_target_label
build:build_buddy --experimental_profile_include_primary_output
build:build_buddy --nolegacy_important_outputs
common:build_buddy_readonly --noremote_upload_local_results
# Bazel-remote cache setup
build:remote_cache --config=common_cache
build:remote_cache --remote_cache=grpcs://gitlib-bazel.wpi.edu
common:remote_cache_readonly --noremote_upload_local_results
# This config should be used locally. It downloads more than the CI version
build:remote_user --config=remote_cache
build:remote_user --config=remote_cache_readonly
build:remote_user --remote_download_toplevel
common:ci --color=yes
build:ci --remote_download_minimal
build:ci --progress_report_interval=60 --show_progress_rate_limit=60
build --build_metadata=REPO_URL=https://github.com/wpilibsuite/allwpilib.git
common --define="WPILIB_VERSION=2025.424242.3.1-unknown"
common --define="ROBOTPY_VERSION=2025.424242.3.1"
# List of artifact types to build in CI.
# Anything else gets skipped to speed up CI.
common:ci --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsarm64,windowsarm64debug,windowsarm64static,windowsarm64staticdebug,windowsx86-64,windowsx86-64debug,windowsx86-64static,windowsx86-64staticdebug"
# The 2 configurations for windows are very slow to build each time.
# Instead, skip the cross transition for ARM on x86, and the reverse on x86.
common:ci_windows_x86 --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsx86-64,windowsx86-64debug,windowsx86-64static,windowsx86-64staticdebug"
common:ci_windows_arm --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsarm64,windowsarm64debug,windowsarm64static,windowsarm64staticdebug"
build --@rules_python//python/config_settings:bootstrap_impl=script
build --@rules_python//python/config_settings:venvs_use_declare_symlink=no
try-import %workspace%/bazel_auth.rc

1
.bazelversion Normal file
View File

@@ -0,0 +1 @@
8.5.0

View File

@@ -3,110 +3,204 @@ Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterAttributes: Always
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
# C standard library headers
#
# https://en.cppreference.com/w/cpp/header:
# * C compatibility headers
# * Special C compatibility headers
# * Empty C headers
# * Meaningless C headers
# * Unsupported C headers
- Regex: '^<(assert\.h|ctype\.h|errno\.h|fenv\.h|float\.h|inttypes\.h|limits\.h|locale\.h|math\.h|setjmp\.h|signal\.h|stdarg\.h|stddef\.h|stdint\.h|stdio\.h|stdlib\.h|string\.h|time\.h|uchar\.h|wchar\.h|wctype\.h|stdatomic\.h|ccomplex|complex\.h|ctgmath|tgmath\.h|ciso646|cstdalign|cstdbool|iso646\.h|stdalign\.h|stdbool\.h|stdatomic\.h|stdnoreturn\.h|threads\.h)>'
Priority: 1
SortPriority: 0
# Linux system headers
- Regex: '^<((arpa\/|linux\/|net/|netinet\/|sys\/).*|arm_neon\.h|dirent\.h|dlfcn\.h|fcntl\.h|ifaddrs\.h|jni\.h|libgen\.h|poll\.h|spawn\.h|termios\.h|unistd\.h)>'
Priority: 1
SortPriority: 1
# winsock2.h
- Regex: '^<winsock2\.h>'
Priority: 1
SortPriority: 2
# windows.h
- Regex: '^<windows.\h>'
Priority: 1
SortPriority: 3
# Windows def.h headers
- Regex: '^<(comdef\.h|ws2def\.h|ws2ipdef\.h)>'
Priority: 1
SortPriority: 4
# Windows system headers
- Regex: '^<(dbghelp\.h|dbt\.h|delayimp\.h|dshow\.h|io\.h|iphlpapi\.h|ks\.h|ksmedia\.h|memoryapi\.h|mfapi\.h|mferror\.h|mfidl\.h|mfreadwrite\.h|netioapi\.h|ntstatus\.h|shellapi\.h|shlobj\.h|shlwapi\.h|sysinfoapi\.h|windns\.h|windowsx\.h|winternl\.h|ws2tcpip\.h)>'
Priority: 1
SortPriority: 5
# C++ standard library headers (lowercase and underscores with no .h suffix)
- Regex: '^<([a-z_]+|cxxabi\.h)>'
Priority: 2
SortPriority: 6
# Other library headers (angle brackets)
- Regex: '^<.*'
Priority: 3
SortPriority: 7
# Project headers (double quotes)
- Regex: '^".*'
Priority: 4
SortPriority: 8
IncludeIsMainRegex: '(Test|_bench|_test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
Macros:
- 'HAL_ENUM(name)=enum name'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
RawStringFormats:
- Language: Cpp
Delimiters:
@@ -133,34 +227,72 @@ RawStringFormats:
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: true
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: c++17
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: c++20
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

View File

@@ -35,7 +35,6 @@ Checks:
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-virtual-near-miss,
cert-dcl58-cpp,
cert-err52-cpp,
cert-err60-cpp,
cert-mem57-cpp,
@@ -46,14 +45,14 @@ Checks:
-clang-diagnostic-#warnings,
-clang-diagnostic-pedantic,
clang-analyzer-*,
-clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-security.FloatLoopCounter,
cppcoreguidelines-slicing,
google-build-namespaces,
google-explicit-constructor,
google-global-names-in-headers,
google-readability-avoid-underscore-in-googletest-name,
google-readability-casting,
google-runtime-operator,
llvm-twine-local,
misc-definitions-in-headers,
misc-misplaced-const,
misc-new-delete-overloads,
@@ -69,7 +68,8 @@ Checks:
modernize-use-override,
modernize-use-using,
readability-braces-around-statements'
FormatStyle: file
CheckOptions:
- key: bugprone-dangling-handle
value: 'wpi::StringRef;wpi::Twine'
- key: modernize-use-using.IgnoreExternC
value: 'true'
FormatStyle: file
HeaderFilterRegex: '^((?!thirdparty/).)*$'

4
.gersemirc Normal file
View File

@@ -0,0 +1,4 @@
definitions: [cmake/modules]
line_length: 100
list_expansion: favour-inlining
unsafe: false

29
.gitattributes vendored
View File

@@ -1,4 +1,33 @@
*.adoc text eol=lf
*.c text eol=lf
*.clang-format text eol=lf
*.clang-tidy text eol=lf
*.cmake text eol=lf
*.cpp text eol=lf
*.gradle text eol=lf
*.groovy text eol=lf
*.h text eol=lf
*.hpp text eol=lf
*.in text eol=lf
*.inc text eol=lf
*.java text eol=lf
*.jinja text eol=lf
*.json text eol=lf
*.m text eol=lf
*.md text eol=lf
*.mm text eol=lf
*.patch text eol=lf
*.plist text eol=lf
*.proto text eol=lf
*.py text eol=lf
*.txt text eol=lf
*.wpiformat text eol=lf
*.wpiformat-license text eol=lf
*.xml text eol=lf
*.yaml text eol=lf
*.yml text eol=lf
# Generated files
*/src/generated/** linguist-generated
*/robotpy_native_build_info.bzl linguist-generated
*/robotpy_pybind_build_info.bzl linguist-generated

4
.github/CODEOWNERS vendored
View File

@@ -27,9 +27,7 @@
/simulation/ @wpilibsuite/simulation
/wpilibNewCommands/ @wpilibsuite/commandbased
/wpilibOldCommands/ @wpilibsuite/commandbased
/commandsv2/ @wpilibsuite/commandbased
/wpilibcExamples/ @wpilibsuite/wpilib @wpilibsuite/documentation

View File

@@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
labels: 'type: bug'
assignees: ''
---
@@ -15,6 +15,8 @@ Steps to reproduce the behavior:
1. ...
2. ...
- Link to code:
**Expected behavior**
A clear and concise description of what you expected to happen.
@@ -22,10 +24,8 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- WPILib Version: [e.g. 2021.3.1]
- OS: [e.g. Windows 11]
- Java version [e.g. 1.10.2]
- C++ version [e.g. 17]
- Project Information: [In Visual Studio Code, press the WPILib button and choose WPILib: Open Project Information. Press the copy button and paste the data here. If not using VS Code, please include WPILib version, Gradle version, Java version, C++ version (if applicable), and any third party libraries and versions]
**Additional context**
Add any other context about the problem here.

View File

@@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
labels: 'type: feature'
assignees: ''
---

View File

@@ -2,7 +2,7 @@
name: Question
about: Ask about features or parts of this project
title: ''
labels: ''
labels: 'type: support'
assignees: ''
---

71
.github/actions/pregen/action.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: 'Setup and run pregeneration'
description: 'Sets up the dependencies needed to generate generated files and runs all generation scripts'
runs:
using: "composite"
steps:
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install jinja and protobuf
run: python -m pip install jinja2 protobuf grpcio-tools
shell: bash
- name: Install protobuf and perl dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler liblist-moreutils-perl
wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
chmod +x protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
shell: bash
- name: Regenerate ntcore
run: ./ntcore/generate_topics.py
shell: bash
- name: Regenerate mrccomm
run: ./hal/generate_nanopb.py
shell: bash
- name: Regenerate imgui
run: |
./thirdparty/imgui_suite/generate_fonts.sh
./thirdparty/imgui_suite/generate_gl3w.py
shell: bash
- name: Regenerate HIDs
run: |
./wpilibc/generate_hids.py
./wpilibj/generate_hids.py
./commandsv2/generate_hids.py
shell: bash
- name: Regenerate PWM motor controllers
run: |
./wpilibc/generate_pwm_motor_controllers.py
./wpilibj/generate_pwm_motor_controllers.py
shell: bash
- name: Regenerate mrcal minimath
run: ./tools/wpical/generate_mrcal.py
shell: bash
- name: Regenerate wpimath
run: |
./wpimath/generate_nanopb.py
./wpimath/generate_numbers.py
./wpimath/generate_quickbuf.py --quickbuf_plugin protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
shell: bash
- name: Regenerate Commands v3
run: |
./commandsv3/generate_files.py --quickbuf_plugin protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
shell: bash
- name: Regenerate wpiunits
run: ./wpiunits/generate_units.py
shell: bash
- name: Regenerate wpiutil nanopb
run: ./wpiutil/generate_nanopb.py
shell: bash

View File

@@ -0,0 +1,38 @@
name: 'Setup Bazel Cache'
description: 'Configures the Bazel remote cache. Prefers WPI bazel-remote (R/W), falls back to BuildBuddy, then readonly WPI cache.'
inputs:
bazel_remote_username:
description: 'WPI Bazel remote cache username'
bazel_remote_password:
description: 'WPI Bazel remote cache password'
bazel_remote_url:
description: 'WPI Bazel remote cache base URL (no credentials or protocol, e.g. gitlib-bazel.wpi.edu)'
default: 'gitlib-bazel.wpi.edu'
buildbuddy_token:
description: 'BuildBuddy API token'
runs:
using: "composite"
steps:
- name: Resolve Bazel cache configuration
env:
CACHE_USER: ${{ inputs.bazel_remote_username }}
CACHE_PASS: ${{ inputs.bazel_remote_password }}
REMOTE_URL: ${{ inputs.bazel_remote_url }}
BB_TOKEN: ${{ inputs.buildbuddy_token }}
shell: bash
run: |
if [ -n "${CACHE_USER}" ] && [ -n "${CACHE_PASS}" ]; then
echo "WPI bazel-remote credentials detected; configuring R/W access"
echo "build:remote_cache --remote_cache=grpcs://${CACHE_USER}:${CACHE_PASS}@${REMOTE_URL}" > bazel_auth.rc
echo "build:ci --config=remote_cache" >> bazel_auth.rc
elif [ -n "${BB_TOKEN}" ]; then
echo "BuildBuddy token detected; configuring BuildBuddy cache"
echo "build:build_buddy --remote_header=x-buildbuddy-api-key=${BB_TOKEN}" > bazel_auth.rc
echo "build:ci --config=build_buddy" >> bazel_auth.rc
else
echo "No cache credentials detected; falling back to readonly WPI cache"
echo "build:ci --config=remote_cache" > bazel_auth.rc
echo "build:ci --config=remote_cache_readonly" >> bazel_auth.rc
fi

96
.github/labeler.yml vendored Normal file
View File

@@ -0,0 +1,96 @@
"build":
- changed-files:
- any-glob-to-any-file:
[
.github/actions/**,
.github/workflows/**,
cmake/*,
shared/**,
upstream_utils/**,
"**/*.bzl",
"**/*.cmake",
"**/*.gradle",
"**/CMakeLists.txt",
"**/BUILD.bazel",
]
"component: apriltag":
- changed-files:
- any-glob-to-any-file: apriltag/**
"component: command-based":
- changed-files:
- any-glob-to-any-file: commandsv2/**
"component: commands v3":
- changed-files:
- any-glob-to-any-file: commandsv3/**
"component: cscore":
- changed-files:
- any-glob-to-any-file: cscore/**
"component: datalogtool":
- changed-files:
- any-glob-to-any-file: tools/datalogtool/**
"component: epilogue":
- changed-files:
- any-glob-to-any-file: epilogue-*/**
"component: examples":
- changed-files:
- any-glob-to-any-file: wpilib*Examples/**
"component: glass":
- changed-files:
- any-glob-to-any-file: glass/**
"component: hal":
- changed-files:
- any-glob-to-any-file: hal/**
"component: javac plugin":
- changed-files:
- any-glob-to-any-file: javacPlugin/**
"component: ntcore":
- changed-files:
- any-glob-to-any-file: ntcore/**
"component: outlineviewer":
- changed-files:
- any-glob-to-any-file: tools/outlineviewer/**
"component: romi":
- changed-files:
- any-glob-to-any-file: romiVendordep/**
"component: sysid":
- changed-files:
- any-glob-to-any-file: tools/sysid/**
"component: wpiannotations":
- changed-files:
- any-glob-to-any-file: wpiannotations/**
"component: wpilibc":
- changed-files:
- any-glob-to-any-file: wpilibc/**
"component: wpilibj":
- changed-files:
- any-glob-to-any-file: wpilibj/**
"component: wpimath":
- changed-files:
- any-glob-to-any-file: wpimath/**
"component: wpinet":
- changed-files:
- any-glob-to-any-file: wpinet/**
"component: wpiunits":
- changed-files:
- any-glob-to-any-file: wpiunits/**
"component: wpiutil":
- changed-files:
- any-glob-to-any-file: wpiutil/**
"component: wpical":
- changed-files:
- any-glob-to-any-file: tools/wpical/**
"component: xrp":
- changed-files:
- any-glob-to-any-file: xrpVendordep/**
"component: usage reporting":
- changed-files:
- any-glob-to-any-file: hal/src/generate/**
"os: simulation":
- changed-files:
- any-glob-to-any-file: "**/simulation/**"
"robotpy":
- changed-files:
- any-glob-to-any-file: "**python/**"
"type: testing":
- changed-files:
- any-glob-to-any-file: "**/test/**"

View File

@@ -0,0 +1,23 @@
{
"files": [
{
"aql": {
"items.find": {
"$or":[
{ "repo": "wpilib-generic-gradlecache" },
{ "repo": "wpilib-generic-cache-cmake" }
],
"$or":[
{
"stat.downloaded": { "$before":"1mo" }
},
{
"stat.downloaded": { "$eq":null }
}
],
"created": { "$before":"1mo" }
}
}
}
]
}

View File

@@ -0,0 +1,32 @@
{
"files": [
{
"aql": {
"items.find": {
"$or":[
{ "repo": "wpilib-mvn-development-local" },
{ "repo": "wpilib-mvn-development-2027-local" }
],
"path": { "$nmatch":"*edu/wpi/first/thirdparty*" },
"$or":[
{
"artifact.module.build.name": { "$eq":"allwpilib" }
},
{
"artifact.module.build.name": { "$eq":"combiner" }
}
],
"$or":[
{
"stat.downloaded": { "$before":"3mo" }
},
{
"stat.downloaded": { "$eq":null }
}
],
"created": { "$before":"3mo" }
}
}
}
]
}

View File

@@ -0,0 +1,33 @@
name: Artifactory Nightly Cleanup
on:
workflow_dispatch:
schedule:
- cron: '15 2 * * *'
jobs:
wpilib-mvn-development_unused_cleanup:
runs-on: ubuntu-latest
if: github.repository == 'wpilibsuite/allwpilib' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_ENV_1: ${{ secrets.ARTIFACTORY_CLI_SECRET }}
- name: Cleanup
run: jf rt del --spec=.github/workflows/aql/wpilib-mvn-development_unused.aql
wpilib-generic-gradle-cache_unused_cleanup:
runs-on: ubuntu-latest
if: github.repository == 'wpilibsuite/allwpilib' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_ENV_1: ${{ secrets.ARTIFACTORY_CLI_SECRET }}
- name: Cleanup
run: jf rt del --spec=.github/workflows/aql/wpilib-generic-gradle-cache_unused.aql

235
.github/workflows/bazel.yml vendored Normal file
View File

@@ -0,0 +1,235 @@
name: Bazel
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { name: "Linux System Core", classifier: "linuxsystemcore", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux System Core Debug", classifier: "linuxsystemcoredebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux System Core Static", classifier: "linuxsystemcorestatic", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux System Core Static Debug", classifier: "linuxsystemcorestaticdebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "build" }
- { name: "Linux x86-64", classifier: "linuxx86-64,headers,sources", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "Linux x86-64 Debug", classifier: "linuxx86-64debug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "Linux x86-64 Static", classifier: "linuxx86-64static", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "Linux x86-64 Static Debug", classifier: "linuxx86-64staticdebug", os: ubuntu-24.04, container: wpilib/debian-base:trixie, action: "test" }
- { name: "macOS", classifier: "osxuniversal,osxuniversaldebug,headers,sources,osxuniversalstatic,osxuniversalstaticdebug,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug", os: macOS-15, container: "", action: "test" }
- { name: "Windows x86-64", classifier: "windowsx86-64,windowsx86-64static,headers,sources", os: windows-2022, container: "", action: "test" }
- { name: "Windows x86-64 Debug", classifier: "windowsx86-64debug,windowsx86-64staticdebug", os: windows-2022, container: "", action: "test" }
- { name: "Windows ARM64", classifier: "windowsarm64,windowsarm64static", os: windows-2022, container: "", action: "build" }
- { name: "Windows ARM64 Debug", classifier: "windowsarm64debug,windowsarm64staticdebug", os: windows-2022, container: "", action: "build" }
- { name: "Windows System Core", classifier: "linuxsystemcore,linuxsystemcorestatic", os: windows-2022, container: "", action: "build" }
- { name: "Windows System Core Debug", classifier: "linuxsystemcoredebug,linuxsystemcorestaticdebug", os: windows-2022, container: "", action: "build" }
name: "${{ matrix.action == 'test' && 'Test' || 'Build' }} ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Check disk free space pre-cleanup
run: df -h
- name: Free disk space (Linux)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Free disk space (macOS)
if: runner.os == 'macOS'
# CodeQL: 5G
# go: 748M
# Android: 12G
run: |
rm -rf /Users/runner/hostedtoolcache/CodeQL
rm -rf /Users/runner/hostedtoolcache/go
rm -rf /Users/runner/Library/Android
- name: Check disk free space post-cleanup
run: df -h
- uses: actions/checkout@v6
with: { fetch-depth: 0 }
- id: Setup_bazel_cache
uses: ./.github/actions/setup-bazel-cache
with:
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Install apt dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev avahi-daemon
- name: Setup avahi-daemon
if: runner.os == 'Linux'
run: |
sudo service dbus start
sudo avahi-daemon -D
- if: runner.os == 'Linux'
uses: bazel-contrib/setup-bazel@0.15.0
with:
bazelisk-cache: true
repository-cache: true
bazelisk-version: 1.x
- name: bazel ${{ matrix.action }}
run: |
ACTION='${{ matrix.action }}'
if [ "${ACTION}" = "build" ]; then
TARGETS=:publish
else
TARGETS=...
fi
if [ "${{ runner.os }}" = "Windows" ]; then
bazel --output_user_root=C:\\bazelroot ${ACTION} ${TARGETS} --config=ci -c opt --repo_env=WPI_PUBLISH_CLASSIFIER_FILTER='${{ matrix.classifier }}'
else
bazel ${ACTION} ${TARGETS} --config=ci -c opt --repo_env=WPI_PUBLISH_CLASSIFIER_FILTER='${{ matrix.classifier }}'
fi
shell: bash
- name: Check disk free space
if: always()
run: df -h
buildifier:
name: "buildifier"
runs-on: ubuntu-24.04
steps:
- name: Set up Go 1.15.x
uses: actions/setup-go@v6
with:
cache: false
go-version: 1.15.x
id: go
- name: Install Buildifier
run: |
cd $(mktemp -d)
GO111MODULE=on go get github.com/bazelbuild/buildtools/buildifier@6.0.0
- uses: actions/checkout@v6
with: { fetch-depth: 0 }
- name: Run buildifier
run: buildifier -warnings all --lint=fix -r .
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > ${{ matrix.platform }}-bazel-lint-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
archive: false
path: "*-bazel-lint-fixes.patch"
if: ${{ failure() }}
mod-lock:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Check lockfile
run: bazel mod deps --lockfile_mode=error
- run: bazel mod deps --lockfile_mode=update
if: ${{ failure() }}
- name: Generate diff
run: git diff HEAD > bazel-mod-lock-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
archive: false
path: "bazel-mod-lock-fixes.patch"
if: ${{ failure() }}
non_robotpy_pregeneration:
name: "Non-RobotPy Pregen"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0 }
- id: Setup_bazel_cache
uses: ./.github/actions/setup-bazel-cache
with:
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
- name: Run Non-RobotPy pregeneration
run: bazel run --config=ci //:write_pregenerated_files
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > non-robotpy-pregeneration.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v6
with:
name: non-robotpy-pregeneration-fixes
path: non-robotpy-pregeneration.patch
if: ${{ failure() }}
robotpy_pregeneration:
name: "Robotpy Pregeneration"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0 }
- id: Setup_bazel_cache
uses: ./.github/actions/setup-bazel-cache
with:
bazel_remote_username: ${{ secrets.BAZEL_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.BAZEL_CACHE_PASSWORD }}
buildbuddy_token: ${{ secrets.BUILDBUDDY_API_KEY }}
# You should ensure the headers are correct before trying to pregen files
- name: Test Scan Headers
run: bazel test --config=ci //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
shell: bash
- name: Run yaml file generation
run: bazel run --config=ci //:write_robotpy_update_yaml_files
- name: Run build file generation
run: bazel run --config=ci //:write_robotpy_generated_pybind_files
- name: Check Output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > robotpy-pregeneration.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v6
with:
name: robotpy-pregeneration-fixes
path: robotpy-pregeneration.patch
if: ${{ failure() }}

52
.github/workflows/cmake-android.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: CMake Android
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
SCCACHE_WEBDAV_ENDPOINT: "https://frcmaven.wpi.edu/artifactory/wpilib-generic-cache-cmake-local"
SCCACHE_WEBDAV_KEY_PREFIX: "sccache"
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
name: Android Arm64
abi: arm64-v8a
- os: ubuntu-24.04
name: Android X64
abi: "x86_64"
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r27d
add-to-path: false
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y ninja-build
- name: configure
run: cmake --preset with-sccache -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_WPILIB=OFF -DWITH_GUI=OFF -DWITH_CSCORE=OFF -DWITH_TESTS=OFF -DWITH_SIMULATION_MODULES=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake -DANDROID_ABI="${{ matrix.abi }}" -DANDROID_PLATFORM=android-24
env:
SCCACHE_WEBDAV_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: build
run: cmake --build build-cmake --parallel $(nproc)
env:
SCCACHE_WEBDAV_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}

View File

@@ -2,64 +2,89 @@ name: CMake
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
SCCACHE_WEBDAV_ENDPOINT: "https://frcmaven.wpi.edu/artifactory/wpilib-generic-cache-cmake-local"
SCCACHE_WEBDAV_KEY_PREFIX: "sccache"
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-24.04
name: Linux
container: wpilib/roborio-cross-ubuntu:2022-20.04
flags: ""
- os: macOS-11
container: wpilib/systemcore-cross-debian:trixie
flags: "--preset with-sccache -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON"
- os: macOS-15
name: macOS
container: ""
flags: "-DWITH_JAVA=OFF"
flags: "--preset with-sccache -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON"
- os: windows-2022
name: Windows
container: ""
flags: '--preset with-sccache -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DUSE_SYSTEM_FMTLIB=ON -DUSE_SYSTEM_LIBUV=ON -DUSE_SYSTEM_EIGEN=OFF -DCMAKE_TOOLCHAIN_FILE="$Env:RUNNER_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_INSTALL_OPTIONS=--clean-after-build -DVCPKG_TARGET_TRIPLET=x64-windows-release -DVCPKG_HOST_TRIPLET=x64-windows-release'
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libopencv-dev ninja-build
- name: Setup avahi-daemon
if: runner.os == 'Linux'
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install opencv
fi
- name: Set up Python 3.8
uses: actions/setup-python@v2
sudo service dbus start
sudo avahi-daemon -D
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install opencv ninja
- uses: ilammy/msvc-dev-cmd@v1.13.0
if: runner.os == 'Windows'
- name: Install CMake (Windows only)
if: runner.os == 'Windows'
uses: lukka/get-cmake@v3.29.3
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.10
- uses: actions/checkout@v6
- name: Run vcpkg (Windows only)
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@v11.5
with:
python-version: 3.8
- name: Install jinja
run: python -m pip install jinja2
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
vcpkgGitCommitId: 74e6536215718009aae747d86d84b78376bf9e09 # HEAD on 2025-10-17
- name: configure
run: mkdir build && cd build && cmake ${{ matrix.flags }} ..
run: cmake ${{ matrix.flags }}
env:
SCCACHE_WEBDAV_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: build
working-directory: build
run: cmake --build . -j$(nproc)
run: cmake --build build-cmake --parallel $(nproc)
env:
SCCACHE_WEBDAV_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: test
working-directory: build
if: runner.os != 'Windows'
working-directory: build-cmake
run: ctest --output-on-failure
build-vcpkg:
name: "Build - Windows"
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: opencv
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
vcpkgTriplet: x64-windows
vcpkgGitCommitId: d781bd9ca77ac3dc2f13d88169021d48459c665f # HEAD on 2021-07-25
- name: Configure & Build
uses: lukka/run-cmake@v3
with:
buildDirectory: ${{ runner.workspace }}/build
cmakeAppendedArgs: -DWITH_JAVA=OFF
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
useVcpkgToolchainFile: true
- name: Run Tests
run: ctest -C "Debug" --output-on-failure
working-directory: ${{ runner.workspace }}/build
- name: test (windows)
if: runner.os == 'Windows'
working-directory: build-cmake
# UnitTest_test segfaults on exit occasionally
run: ctest --output-on-failure -E 'UnitTest'

View File

@@ -1,60 +0,0 @@
name: Documentation
on: [push, workflow_dispatch]
env:
BASE_PATH: allwpilib/docs
jobs:
publish:
name: "Documentation - Publish"
runs-on: ubuntu-latest
if: github.repository_owner == 'wpilibsuite' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-java@v1
with:
java-version: 13
- name: Install libclang-9
run: sudo apt update && sudo apt install -y libclang-cpp9 libclang1-9
- name: Set environment variables (Development)
run: |
echo "TARGET_FOLDER=$BASE_PATH/development" >> $GITHUB_ENV
if: github.ref == 'refs/heads/main'
- name: Set environment variables (Tag)
run: |
echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
echo "TARGET_FOLDER=$BASE_PATH/beta" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Set environment variables (Release)
run: |
echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
echo "TARGET_FOLDER=$BASE_PATH/release" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta')
- name: Build with Gradle
run: ./gradlew docs:generateJavaDocs docs:doxygen -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }}
- name: Install SSH Client 🔑
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.GH_DEPLOY_KEY }}
- name: Deploy Java 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
SSH: true
REPOSITORY_NAME: wpilibsuite/wpilibsuite.github.io
BRANCH: main
CLEAN: true
FOLDER: docs/build/docs/javadoc
TARGET_FOLDER: ${{ env.TARGET_FOLDER }}/java
- name: Deploy C++ 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
SSH: true
REPOSITORY_NAME: wpilibsuite/wpilibsuite.github.io
BRANCH: main
CLEAN: true
FOLDER: docs/build/docs/doxygen/html
TARGET_FOLDER: ${{ env.TARGET_FOLDER }}/cpp

48
.github/workflows/fix_compile_commands.py vendored Executable file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env python3
import argparse
import json
def main():
parser = argparse.ArgumentParser(
description="Fix compile_commands.json generated by Gradle"
)
parser.add_argument("filename", help="compile_commands.json location")
cmd_args = parser.parse_args()
# Read JSON
with open(cmd_args.filename) as f:
data = json.load(f)
for obj in data:
out_args = []
iter_args = iter(obj["arguments"])
for arg in iter_args:
# Filter out -isystem flags that cause false positives
if arg == "-isystem":
next_arg = next(iter_args)
# /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/include/xmmintrin.h:54:1:
# error: conflicting types for '_mm_prefetch' [clang-diagnostic-error]
if not next_arg.startswith("/usr/lib/gcc/"):
out_args += ["-isystem", next_arg]
# Replace GCC warning argument with one Clang recognizes
elif arg == "-Wno-maybe-uninitialized":
out_args.append("-Wno-uninitialized")
# Skip GCC-specific warning argument
elif arg == "-Wno-error=restrict":
pass
else:
out_args.append(arg)
obj["arguments"] = out_args
# Write JSON
with open(cmd_args.filename, "w") as f:
json.dump(data, f, indent=2)
if __name__ == "__main__":
main()

View File

@@ -1,15 +0,0 @@
name: Gazebo
on: [pull_request, push]
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
container: wpilib/gazebo-ubuntu:18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build with Gradle
run: ./gradlew simulation:frc_gazebo_plugins:build simulation:halsim_gazebo:build -PbuildServer -PforceGazebo

View File

@@ -1,10 +0,0 @@
name: "Validate Gradle Wrapper"
on: [pull_request, push]
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1

View File

@@ -2,163 +2,347 @@ name: Gradle
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: gradle/actions/wrapper-validation@v5
build-docker:
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2022-18.04
artifact-name: Athena
build-options: "-Ponlylinuxathena"
- container: wpilib/raspbian-cross-ubuntu:10-18.04
artifact-name: Raspbian
build-options: "-Ponlylinuxraspbian"
- container: wpilib/aarch64-cross-ubuntu:bionic-18.04
artifact-name: Aarch64
build-options: "-Ponlylinuxaarch64bionic"
- container: wpilib/ubuntu-base:18.04
- container: wpilib/systemcore-cross-debian:trixie
artifact-name: Systemcore
build-options: "-Ponlylinuxsystemcore"
- container: wpilib/aarch64-cross-debian:trixie
artifact-name: Arm64
build-options: "-Ponlylinuxarm64"
- container: wpilib/systemcore-cross-debian:trixie
artifact-name: Linux
build-options: "-Dorg.gradle.jvmargs=-Xmx2g"
build-options: "-Ponlylinuxx86-64"
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
runs-on: ubuntu-24.04
needs: [validation]
steps:
- uses: actions/checkout@v2
- name: Check disk free space pre-cleanup
run: df -h
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Check disk free space post-cleanup
run: df -h
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew build -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
- uses: actions/upload-artifact@v2
uses: wpilibsuite/docker-run-action@v4
with:
image: ${{ matrix.container }}
options: -v ${{ github.workspace }}:/work -w /work -e ARTIFACTORY_PUBLISH_USERNAME -e ARTIFACTORY_PUBLISH_PASSWORD -e GITHUB_REF -e CI
# Start avahi-daemon and build
run: |
service dbus start
avahi-daemon -D
./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs
- name: Check disk free space
if: always()
run: df -h
build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 10.14
MACOSX_DEPLOYMENT_TARGET: 13.3
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
artifact-name: Win64
- os: windows-2022
artifact-name: Win64Debug
architecture: x64
- os: windows-2019
artifact-name: Win32
architecture: x86
- os: macOS-11
task: "build"
build-options: "-PciDebugOnly"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: Win64Release
architecture: x64
build-options: "-PciReleaseOnly"
task: "copyAllOutputs"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: WinArm64Debug
architecture: x64
task: "build"
build-options: "-PciDebugOnly -Pbuildwinarm64 -Ponlywindowsarm64"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: WinArm64Release
architecture: x64
build-options: "-PciReleaseOnly -Pbuildwinarm64 -Ponlywindowsarm64"
task: "copyAllOutputs"
outputs: "build/allOutputs"
- os: macOS-15
artifact-name: macOS
architecture: aarch64
task: "build"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: Win64FFI
architecture: x64
task: ":ntcoreffi:build"
build-options: "-Pntcoreffibuild -Pbuildwinarm64"
outputs: "ntcoreffi/build/outputs"
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
needs: [validation]
steps:
- uses: actions/checkout@v2
- name: Check disk free space pre-cleanup
run: df -h
- name: Free disk space (macOS)
if: runner.os == 'macOS'
# CodeQL: 5G
# go: 748M
# Android: 12G
run: |
rm -rf /Users/runner/hostedtoolcache/CodeQL
rm -rf /Users/runner/hostedtoolcache/go
rm -rf /Users/runner/Library/Android
- name: Check disk free space post-cleanup
run: df -h
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v1
- uses: actions/setup-java@v5
with:
java-version: 11
distribution: 'temurin'
java-version: 25
architecture: ${{ matrix.architecture }}
- name: Import Developer ID Certificate
uses: wpilibsuite/import-signing-certificate@v1
uses: wpilibsuite/import-signing-certificate@v3
with:
certificate-data: ${{ secrets.APPLE_CERTIFICATE_DATA }}
certificate-passphrase: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
keychain-password: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' &&
matrix.artifact-name == 'macOS' && (github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
- name: Set Keychain Lock Timeout
run: security set-keychain-settings -lut 3600
run: security set-keychain-settings -lut 21600
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' &&
matrix.artifact-name == 'macOS' && (github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
shell: bash
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew build -PbuildServer -PskipJavaFormat ${{ env.EXTRA_GRADLE_ARGS }}
run: ./gradlew ${{ matrix.task }} --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Sign Libraries with Developer ID
run: ./gradlew build -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ env.EXTRA_GRADLE_ARGS }}
run: ./gradlew copyAllOutputs --build-cache -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' &&
matrix.artifact-name == 'macOS' && (github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs
path: ${{ matrix.outputs }}
- name: Check disk free space
if: always()
run: df -h
build-documentation:
name: "Build - Documentation"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: [validation]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v1
- uses: actions/setup-java@v5
with:
java-version: 13
- name: Install libclang-9
run: sudo apt update && sudo apt install -y libclang-cpp9 libclang1-9
distribution: 'temurin'
java-version: 25
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew docs:zipDocs -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }}
- uses: actions/upload-artifact@v2
run: ./gradlew docs:zipDocs --build-cache -PbuildServer -PdocWarningsAsErrors ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v7
with:
name: Documentation
path: docs/build/outputs
publish:
name: "Documentation - Publish"
runs-on: ubuntu-22.04
if: github.repository == 'wpilibsuite/allwpilib' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
needs: [build-documentation]
concurrency: ci-docs-publish
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Download docs artifacts
uses: actions/download-artifact@v7
with:
name: Documentation
- name: Make output directories
run: |
mkdir -p docs/tmp/doxygen/html
mkdir -p docs/tmp/javadoc
- name: Extract docs
run: |
unzip _GROUP_org_wpilib_wpilibc_ID_documentation_CLS.zip -d docs/tmp/doxygen/html
unzip _GROUP_org_wpilib_wpilibj_ID_documentation_CLS.zip -d docs/tmp/javadoc
- name: Set environment variables (Development)
run: |
echo "BRANCH=development" >> $GITHUB_ENV
if: github.ref == 'refs/heads/main'
- name: Set environment variables (Tag)
run: |
echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
echo "BRANCH=beta" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Set environment variables (Release)
run: |
echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
echo "BRANCH=release" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta')
- name: Install SSH Client 🔑
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.GH_DEPLOY_KEY }}
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
ssh-key: true
repository-name: wpilibsuite/wpilibsuite.github.io
branch: allwpilib-${{ env.BRANCH }}
clean: true
single-commit: true
folder: docs/tmp
- name: Trigger Workflow
uses: actions/github-script@v8
with:
github-token: ${{ secrets.DISPATCH_PAT_TOKEN }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: 'wpilibsuite.github.io',
workflow_id: 'static.yml',
ref: 'main',
})
combine:
name: Combine
needs: [build-docker, build-host, build-documentation]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Free disk space
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- uses: actions/checkout@v6
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
with:
repository: wpilibsuite/build-tools
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v7
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
with:
path: combiner/products/build/allOutputs
- name: Flatten Artifacts
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs/
- name: Check version number exists
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
run: |
cat combiner/products/build/allOutputs/version.txt
test -s combiner/products/build/allOutputs/version.txt
- uses: actions/setup-java@v1
- uses: actions/setup-java@v5
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
with:
java-version: 11
distribution: 'temurin'
java-version: 25
- name: Combine
if: |
!startsWith(github.ref, 'refs/tags/v') &&
github.ref != 'refs/heads/main'
run: cd combiner && ./gradlew publish -Pallwpilib
- name: Combine (Master)
if: |
github.repository_owner == 'wpilibsuite' &&
github.repository == 'wpilibsuite/allwpilib' &&
github.ref == 'refs/heads/main'
run: cd combiner && ./gradlew publish -Pallwpilib
run: cd combiner && ./gradlew publish -Pallwpilib -Pbuild2027
env:
RUN_AZURE_ARTIFACTORY_RELEASE: "TRUE"
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Combine (Release)
if: |
github.repository_owner == 'wpilibsuite' &&
github.repository == 'wpilibsuite/allwpilib' &&
startsWith(github.ref, 'refs/tags/v')
run: cd combiner && ./gradlew publish -Pallwpilib -PreleaseRepoPublish
run: cd combiner && ./gradlew publish -Pallwpilib -PreleaseRepoPublish -Pbuild2027
env:
RUN_AZURE_ARTIFACTORY_RELEASE: "TRUE"
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v7
if: |
github.repository == 'wpilibsuite/allwpilib' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
with:
name: Maven
path: ~/releases

14
.github/workflows/labeler.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v6
with:
sync-labels: true

View File

@@ -6,77 +6,104 @@ on:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: gradle/actions/wrapper-validation@v5
wpiformat:
name: "wpiformat"
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2022-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: 3.8
- name: Install clang-format
run: |
sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-12
python-version: '3.12'
- name: Install wpiformat
run: pip3 install wpiformat
run: |
python -m venv ${{ runner.temp }}/wpiformat
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.57
- name: Run
run: wpiformat -clang 12
run: ${{ runner.temp }}/wpiformat/bin/wpiformat
- name: Check output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > wpiformat-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v7
with:
name: wpiformat fixes
archive: false
path: wpiformat-fixes.patch
if: ${{ failure() }}
- name: Write to job summary
run: |
echo '```diff' >> $GITHUB_STEP_SUMMARY
cat wpiformat-fixes.patch >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if: ${{ failure() }}
tidy:
name: "clang-tidy"
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2022-20.04
runs-on: ubuntu-24.04
needs: [validation]
container: wpilib/debian-base:trixie
steps:
- uses: actions/checkout@v2
- name: Fetch all history and metadata
run: |
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install clang-tidy
run: |
sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-tidy-12 clang-format-12
- name: Install wpiformat
run: pip3 install wpiformat
- name: Create compile_commands.json
run: ./gradlew generateCompileCommands -Ptoolchain-optional-roboRio
- name: List changed files
run: wpiformat -list-changed-files
- name: Run clang-tidy
run: wpiformat -clang 12 -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv
javaformat:
name: "Java format"
runs-on: ubuntu-latest
container: wpilib/ubuntu-base:18.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/allwpilib/allwpilib
git checkout -b pr
git branch -f main origin/main
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install wpiformat
run: |
python -m venv ${{ runner.temp }}/wpiformat
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.57
- name: Create compile_commands.json
run: |
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio
./.github/workflows/fix_compile_commands.py build/TargetedCompileCommands/linuxx86-64release/compile_commands.json
./.github/workflows/fix_compile_commands.py build/TargetedCompileCommands/linuxx86-64debug/compile_commands.json
- name: List changed files
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -list-changed-files
- name: Run clang-tidy release
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64release
- name: Run clang-tidy debug
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64debug
javaformat:
name: "Java format"
runs-on: ubuntu-24.04
needs: [validation]
container: wpilib/debian-base:trixie
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/allwpilib/allwpilib
git checkout -b pr
git branch -f main origin/main
- name: Run Java format
run: ./gradlew javaFormat spotbugsMain spotbugsTest spotbugsDev
- name: Check output
@@ -84,17 +111,39 @@ jobs:
- name: Generate diff
run: git diff HEAD > javaformat-fixes.patch
if: ${{ failure() }}
documentation:
name: "Documentation"
runs-on: ubuntu-latest
- uses: actions/upload-artifact@v7
with:
archive: false
path: javaformat-fixes.patch
if: ${{ failure() }}
- name: Write to job summary
run: |
echo '```diff' >> $GITHUB_STEP_SUMMARY
cat javaformat-fixes.patch >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if: ${{ failure() }}
check-spelling:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: misspell
uses: reviewdog/action-misspell@v1
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 13
- name: Install libclang-9
run: sudo apt update && sudo apt install -y libclang-cpp9 libclang1-9
- name: Build with Gradle
run: ./gradlew docs:zipDocs -PbuildServer -PdocWarningsAsErrors ${{ env.EXTRA_GRADLE_ARGS }}
reporter: "github-check"
fail_level: "error"
exclude: |
**/*.svg
**/thirdparty/**
**/upstream_utils/**
**/generated/**
./wpigui/src/main/native/cpp/portable-file-dialogs.*
./wpimath/src/main/native/include/wpi/units/base.hpp
./wpinet/src/main/native/linux/AvahiClient.*
./wpinet/src/main/native/cpp/http_parser.cpp
./wpinet/src/main/native/include/wpi/net/http_parser.hpp
./wpiutil/src/main/native/include/wpi/util/FastQueue.hpp
./wpiutil/src/test/native/cpp/json/**
./wpiutil/src/test/native/cpp/llvm/**
./wpiutil/src/test/native/cpp/span/**

34
.github/workflows/pregenerate.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Check Pregenerated Files
on:
pull_request:
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
update:
name: "Update"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Run pregen
uses: ./.github/actions/pregen
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > pregenerated-files-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v7
with:
archive: false
path: pregenerated-files-fixes.patch
if: ${{ failure() }}

View File

@@ -2,6 +2,14 @@ name: Sanitizers
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
SCCACHE_WEBDAV_ENDPOINT: "https://frcmaven.wpi.edu/artifactory/wpilib-generic-cache-cmake-local"
SCCACHE_WEBDAV_KEY_PREFIX: "sccache"
jobs:
build:
strategy:
@@ -11,39 +19,45 @@ jobs:
- name: asan
cmake-flags: "-DCMAKE_BUILD_TYPE=Asan"
ctest-env: ""
ctest-flags: "-E 'wpiutil|ntcore|wpilibc'"
ctest-flags: ""
- name: tsan
cmake-flags: "-DCMAKE_BUILD_TYPE=Tsan"
ctest-env: "TSAN_OPTIONS=second_deadlock_stack=1"
ctest-flags: "-E 'ntcore|cscore|cameraserver|wpilibc|wpilibNewCommands'"
ctest-env: "TSAN_OPTIONS=second_deadlock_stack=1:suppressions=$GITHUB_WORKSPACE/tsan_suppressions.txt"
ctest-flags: "-E 'cscore|cameraserver'"
- name: ubsan
cmake-flags: "-DCMAKE_BUILD_TYPE=Ubsan"
ctest-env: ""
ctest-flags: ""
name: "${{ matrix.name }}"
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2022-20.04
runs-on: ubuntu-24.04
container: wpilib/debian-base:trixie
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install -y gcc-11 g++-11
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-11 11 \
--slave /usr/bin/g++ g++ /usr/bin/g++-11
sudo update-alternatives --set gcc /usr/bin/gcc-11
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install jinja
run: python -m pip install jinja2
run: sudo apt-get update && sudo apt-get install -y libopencv-dev clang-18 ninja-build avahi-daemon
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.10
- uses: actions/checkout@v6
- name: configure
run: mkdir build && cd build && cmake ${{ matrix.cmake-flags }} ..
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang-18 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++-18 ${{ matrix.cmake-flags }} ..
env:
SCCACHE_WEBDAV_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Setup avahi-daemon
run: |
sudo service dbus start
sudo avahi-daemon -D
- name: build
working-directory: build
run: cmake --build . -j$(nproc)
run: cmake --build . --parallel $(nproc)
env:
SCCACHE_WEBDAV_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: test
working-directory: build
run: ${{ matrix.ctest-env }} ctest --output-on-failure ${{ matrix.ctest-flags }}

169
.github/workflows/sentinel-build.yml vendored Normal file
View File

@@ -0,0 +1,169 @@
name: Sentinel Build (No Cache)
on:
workflow_dispatch:
schedule:
- cron: "15 3 * * Sat" # 11:15PM EST every Friday
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: gradle/actions/wrapper-validation@v5
build-docker:
if: (github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main') || github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/systemcore-cross-debian:trixie
artifact-name: Systemcore
build-options: "-Ponlylinuxsystemcore"
- container: wpilib/aarch64-cross-debian:trixie
artifact-name: Arm64
build-options: "-Ponlylinuxarm64"
- container: wpilib/systemcore-cross-debian:trixie
artifact-name: Linux
build-options: "-Ponlylinuxx86-64"
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ubuntu-24.04
needs: [validation]
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Build with Gradle
uses: wpilibsuite/docker-run-action@v4
with:
image: ${{ matrix.container }}
options: -v ${{ github.workspace }}:/work -w /work -e GITHUB_REF -e CI
# Start avahi-daemon and build
run: |
service dbus start
avahi-daemon -D
./gradlew build -PbuildServer -PskipJavaFormat ${{ matrix.build-options }}
- name: Check free disk space
run: df .
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs
build-host:
if: (github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main') || github.event_name != 'schedule'
env:
MACOSX_DEPLOYMENT_TARGET: 13.3
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
artifact-name: Win64Debug
architecture: x64
task: "build"
build-options: "-PciDebugOnly"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: Win64Release
architecture: x64
build-options: "-PciReleaseOnly"
task: "copyAllOutputs"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: WinArm64Debug
architecture: x64
task: "build"
build-options: "-PciDebugOnly -Pbuildwinarm64 -Ponlywindowsarm64"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: WinArm64Release
architecture: x64
build-options: "-PciReleaseOnly -Pbuildwinarm64 -Ponlywindowsarm64"
task: "copyAllOutputs"
outputs: "build/allOutputs"
- os: macOS-15
artifact-name: macOS
architecture: aarch64
task: "build"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: Win64FFI
architecture: x64
task: ":ntcoreffi:build"
build-options: "-Pntcoreffibuild -Pbuildwinarm64"
outputs: "ntcoreffi/build/outputs"
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
needs: [validation]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 25
architecture: ${{ matrix.architecture }}
- name: Import Developer ID Certificate
uses: wpilibsuite/import-signing-certificate@v3
with:
certificate-data: ${{ secrets.APPLE_CERTIFICATE_DATA }}
certificate-passphrase: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
keychain-password: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main')
- name: Set Keychain Lock Timeout
run: security set-keychain-settings -lut 21600
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main')
- name: Check disk free space (Windows)
if: runner.os == 'Windows'
run: wmic logicaldisk get caption, freespace
- name: Check disk free space pre-cleanup (macOS)
if: runner.os == 'macOS'
run: df -h .
- name: Cleanup disk space
if: runner.os == 'macOS'
# CodeQL: 5G
# go: 748M
# Android: 12G
run: |
rm -rf /Users/runner/hostedtoolcache/CodeQL
rm -rf /Users/runner/hostedtoolcache/go
rm -rf /Users/runner/Library/Android
- name: Check disk free space post-cleanup (macOS)
if: runner.os == 'macOS'
run: df -h .
- name: Build with Gradle
run: ./gradlew ${{ matrix.task }} -PbuildServer -PskipJavaFormat ${{ matrix.build-options }}
- name: Sign Libraries with Developer ID
run: ./gradlew copyAllOutputs -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }}
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main')
- name: Check disk free space (Windows)
if: runner.os == 'Windows'
run: wmic logicaldisk get caption, freespace
- name: Check disk free space (macOS)
if: runner.os == 'macOS'
run: df -h .
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.outputs }}

163
.github/workflows/upstream-utils.yml vendored Normal file
View File

@@ -0,0 +1,163 @@
name: Upstream utils
on:
pull_request:
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
update:
name: "Update"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git checkout -b pr
git branch -f main origin/main
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Configure committer identity
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- name: Run apriltag.py
run: |
cd upstream_utils
./apriltag.py clone
./apriltag.py copy-src
./apriltag.py format-patch
- name: Run argparse_lib.py
run: |
cd upstream_utils
./argparse_lib.py clone
./argparse_lib.py copy-src
./argparse_lib.py format-patch
- name: Run benchmark.py
run: |
cd upstream_utils
./benchmark.py clone
./benchmark.py copy-src
./benchmark.py format-patch
- name: Run double-conversion.py
run: |
cd upstream_utils
./double-conversion.py clone
./double-conversion.py copy-src
./double-conversion.py format-patch
- name: Run eigen.py
run: |
cd upstream_utils
./eigen.py clone
./eigen.py copy-src
./eigen.py format-patch
- name: Run expected.py
run: |
cd upstream_utils
./expected.py clone
./expected.py copy-src
./expected.py format-patch
- name: Run fmt.py
run: |
cd upstream_utils
./fmt.py clone
./fmt.py copy-src
./fmt.py format-patch
- name: Run gcem.py
run: |
cd upstream_utils
./gcem.py clone
./gcem.py copy-src
./gcem.py format-patch
- name: Run gl3w.py
run: |
cd upstream_utils
./gl3w.py clone
./gl3w.py copy-src
./gl3w.py format-patch
- name: Run glfw.py
run: |
cd upstream_utils
./glfw.py clone
./glfw.py copy-src
./glfw.py format-patch
- name: Run googletest.py
run: |
cd upstream_utils
./googletest.py clone
./googletest.py copy-src
./googletest.py format-patch
- name: Run imgui.py
run: |
cd upstream_utils
./imgui.py clone
./imgui.py copy-src
./imgui.py format-patch
- name: Run implot.py
run: |
cd upstream_utils
./implot.py clone
./implot.py copy-src
./implot.py format-patch
- name: Run json.py
run: |
cd upstream_utils
./json.py clone
./json.py copy-src
./json.py format-patch
- name: Run libuv.py
run: |
cd upstream_utils
./libuv.py clone
./libuv.py copy-src
./libuv.py format-patch
- name: Run llvm.py
run: |
cd upstream_utils
./llvm.py clone
./llvm.py copy-src
./llvm.py format-patch
- name: Run mpack.py
run: |
cd upstream_utils
./mpack.py clone
./mpack.py copy-src
./mpack.py format-patch
- name: Run sleipnir.py
run: |
cd upstream_utils
./sleipnir.py clone
./sleipnir.py copy-src
./sleipnir.py format-patch
- name: Run stb.py
run: |
cd upstream_utils
./stb.py clone
./stb.py copy-src
./stb.py format-patch
- name: Run upb.py
run: |
cd upstream_utils
./upb.py clone
./upb.py copy-src
./upb.py format-patch
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
run: |
set +e
git --no-pager diff --exit-code HEAD ':!*.bazel'
git_exit_code=$?
if test "$git_exit_code" -ne "0"; then
echo "::error ::upstream_utils check failed. This is usually caused by a bad script or the copied files differing from what the script outputs. You can learn more about using upstream_utils to modify thirdparty libraries at https://github.com/wpilibsuite/allwpilib/blob/main/upstream_utils/README.md"
exit $git_exit_code
fi

37
.gitignore vendored
View File

@@ -5,6 +5,18 @@ doxygen.log
build*/
!buildSrc/
simgui-ds.json
simgui-window.json
simgui.json
networktables.json
*.bck
ntcore/connectionlistenertest.json
ntcore/timesynctest.json
nanopb_pb2.py
# Created by the jenkins test script
test-reports
@@ -15,6 +27,12 @@ test-reports
.idea/
out/
# Fleet
.fleet
# jdtls
.factorypath
# Created by http://www.gitignore.io
### Linux ###
@@ -121,6 +139,7 @@ CMakeCache.txt
CMakeFiles
cmake_install.cmake
install_manifest.txt
CMakeUserPresets.json
### Gradle ###
@@ -196,6 +215,7 @@ NO
*.user
*.userosscache
*.sln.docstates
CMakeSettings.json
# Visual C++ cache files
ipch/
@@ -221,7 +241,7 @@ compile_commands.json
# clang configuration and clangd cache
.clang
.clangd/
.clangd
.cache/
imgui.ini
@@ -231,3 +251,18 @@ imgui.ini
/bazel-*
user.bazelrc
coverage_report/
bazel_auth.rc
# ctest
/Testing/
# Meson
.meson-subproject*
# Copybara user config
shared/bazel/copybara/.copybara.json
# Nix files
shell.nix
flake.nix
flake.lock

View File

@@ -1,47 +0,0 @@
cppHeaderFileInclude {
\.h$
\.hpp$
\.inc$
\.inl$
}
cppSrcFileInclude {
\.cpp$
}
modifiableFileExclude {
\.patch$
gradlew
}
generatedFileExclude {
FRCNetComm\.java$
simulation/gz_msgs/src/include/simulation/gz_msgs/msgs\.h$
fieldImages/src/main/native/resources/
}
repoRootNameOverride {
wpilib
}
includeOtherLibs {
^Eigen/
^cameraserver/
^cscore
^drake/
^fmt/
^hal/
^imgui
^implot
^mockdata/
^networktables/
^ntcore
^opencv2/
^support/
^units/
^unsupported/
^vision/
^wpi/
^wpigui
^wpimath/
}

44
.wpiformat Normal file
View File

@@ -0,0 +1,44 @@
cHeaderFileInclude {
_c\.h$
}
cppHeaderFileInclude {
(?<!_c)\.h$
\.inc$
\.inl$
}
generatedFileExclude {
assets/
docs/theme\.css$
generated/
hal/src/main/native/systemcore/rev/
python/
robotpyExamples/
resources/
thirdparty/
wpigui/src/main/native/cpp/portable-file-dialogs\.cpp$
wpigui/src/main/native/include/wpi/gui/portable-file-dialogs\.h$
wpimath/src/main/native/include/wpi/units/base\.hpp$
wpinet/src/main/native/cpp/http_parser\.cpp$
wpinet/src/main/native/include/wpi/net/http_parser\.hpp$
wpiutil/src/main/native/include/wpi/util/FastQueue\.hpp$
wpiutil/src/test/native/cpp/json/
wpiutil/src/test/native/cpp/llvm/
wpiutil/src/test/native/cpp/span/
}
modifiableFileExclude {
objcpp/
wpimath/src/test/native/cpp/UnitsTest\.cpp$
wpiutil/src/main/native/cpp/fs\.cpp$
wpiutil/src/main/native/include/wpi/util/fs\.hpp$
}
licenseUpdateExclude {
cscore/src/main/native/cpp/default_init_allocator\.hpp$
wpiutil/src/main/native/cpp/Base64\.cpp$
wpiutil/src/main/native/cpp/sha1\.cpp$
wpiutil/src/main/native/include/wpi/util/sha1\.hpp$
wpinet/src/main/native/linux/AvahiClient\.hpp$
}

283
BUILD.bazel Normal file
View File

@@ -0,0 +1,283 @@
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@rules_java//java:java_binary.bzl", "java_binary")
load("@rules_java//java:java_plugin.bzl", "java_plugin")
load("@rules_pkg//:mappings.bzl", "pkg_files")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("//shared/bazel/rules:publishing.bzl", "publish_all")
load("//shared/bazel/rules/robotpy:compatibility_select.bzl", "robotpy_compatibility_select")
java_plugin(
name = "avaje_jsonb_generator",
processor_class = "io.avaje.jsonb.generator.JsonbProcessor",
visibility = ["//visibility:public"],
deps = [
"@maven//:io_avaje_avaje_jsonb_generator",
],
)
exports_files([
"LICENSE.md",
"ThirdPartyNotices.txt",
])
pkg_files(
name = "license_pkg_files",
srcs = [
"LICENSE.md",
"ThirdPartyNotices.txt",
],
visibility = ["//visibility:public"],
)
# bazel build //:requirements.lock
compile_pip_requirements(
name = "requirements",
extra_args = ["--allow-unsafe"],
requirements_in = "requirements.txt",
requirements_txt = "requirements_lock.txt",
requirements_windows = "//:requirements_windows_lock.txt",
# compile_pip_requirements does not respect target_compatible_with for some of the targets it generates under the hood
tags = ["no-systemcore"],
)
alias(
name = "quickbuf_protoc",
actual = select({
"@platforms//os:windows": "@quickbuffer_protoc_windows//file",
"@rules_bzlmodrio_toolchains//conditions:osx_aarch64": "@quickbuffer_protoc_osx_aarch64//file",
"@rules_bzlmodrio_toolchains//conditions:osx_x86_64": "@quickbuffer_protoc_osx_x86-64//file",
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": "@quickbuffer_protoc_linux//file",
}),
tags = ["pregeneration"],
visibility = ["//visibility:public"],
)
java_binary(
name = "copybara",
main_class = "com.google.copybara.Main",
runtime_deps = ["@com_github_google_copybara//jar"],
)
# This is a helper to run all of the pregeneration scripts at once.
write_source_files(
name = "write_pregenerated_files",
additional_update_targets = [
"//hal:write_hal",
"//ntcore:write_ntcore",
"//wpilibc:write_wpilibc",
"//wpilibcExamples:write_example_project_list",
"//wpilibj:write_wpilibj",
"//wpilibjExamples:write_example_project_list",
"//commandsv2:write_wpilib_new_commands",
"//commandsv3:write_commandsv3",
"//wpimath:write_wpimath",
"//wpiunits:write_wpiunits",
"//wpiutil:write_wpiutil",
"//robotpyExamples:write_example_project_list",
],
tags = ["pregeneration"],
)
publish_all(
name = "publish",
targets = [
"//apriltag:apriltag-cpp_publish.publish",
"//apriltag:apriltag-java_publish.publish",
"//cameraserver:cameraserver-cpp_publish.publish",
"//cameraserver:cameraserver-java_publish.publish",
"//commandsv2:commandsv2-cpp_publish.publish",
"//commandsv2:commandsv2-java_publish.publish",
"//commandsv3:commandsv3-java_publish.publish",
"//cscore:cscore-cpp_publish.publish",
"//cscore:cscore-java_publish.publish",
"//cscore:cscorejnicvstatic-cpp_publish.publish",
"//datalog:datalog-cpp_publish.publish",
"//datalog:datalog-java_publish.publish",
"//docs:wpilibj_publish.publish",
"//epilogue-processor:processor-java_publish.publish",
"//epilogue-runtime:epilogue-java_publish.publish",
"//fields:fields-cpp_publish.publish",
"//fields:fields-java_publish.publish",
"//glass:glass-cpp_publish.publish",
"//glass:glassapp_publish.publish",
"//glass:glassnt-cpp_publish.publish",
"//hal:hal-java_publish.publish",
"//hal:wpiHal-cpp_publish.publish",
"//javacPlugin:javacPlugin_publish.publish",
"//ntcore:ntcore-cpp_publish.publish",
"//ntcore:ntcore-java_publish.publish",
"//ntcoreffi:ntcoreffi-cpp_publish.publish",
"//romiVendordep:romiVendordep-cpp_publish.publish",
"//romiVendordep:romiVendordep-java_publish.publish",
"//simulation/halsim_ds_socket:halsim_ds_socket-cpp_publish.publish",
"//simulation/halsim_gui:halsim_gui-cpp_publish.publish",
"//simulation/halsim_ws_client:halsim_ws_client-cpp_publish.publish",
"//simulation/halsim_ws_core:halsim_ws_core-cpp_publish.publish",
"//simulation/halsim_ws_server:halsim_ws_server-cpp_publish.publish",
"//simulation/halsim_xrp:halsim_xrp-cpp_publish.publish",
"//thirdparty/catch2:catch2-cpp_publish.publish",
"//thirdparty/googletest:googletest-cpp_publish.publish",
"//thirdparty/imgui_suite:imguiSuite-cpp_publish.publish",
"//tools/datalogtool:datalogtool_publish.publish",
"//tools/outlineviewer:outlineviewer_publish.publish",
"//tools/processstarter:processstarter_publish.publish",
"//tools/sysid:sysid_publish.publish",
"//tools/wpical:wpical_publish.publish",
"//wpiannotations:wpiannotations_publish.publish",
"//wpigui:wpigui-cpp_publish.publish",
"//wpilibc:wpilibc-cpp_publish.publish",
"//wpilibcExamples:commands_publish.publish",
"//wpilibcExamples:examples_publish.publish",
"//wpilibcExamples:templates_publish.publish",
"//wpilibj:wpilibj-java_publish.publish",
"//wpilibjExamples:commands_publish.publish",
"//wpilibjExamples:examples_publish.publish",
"//wpilibjExamples:templates_publish.publish",
"//wpimath:wpimath-cpp_publish.publish",
"//wpimath:wpimath-java_publish.publish",
"//wpinet:wpinet-cpp_publish.publish",
"//wpinet:wpinet-java_publish.publish",
"//wpiunits:wpiunits-java_publish.publish",
"//wpiutil:wpiutil-cpp_publish.publish",
"//wpiutil:wpiutil-java_publish.publish",
"//xrpVendordep:xrpVendordep-cpp_publish.publish",
"//xrpVendordep:xrpVendordep-java_publish.publish",
] + select({
"@platforms//cpu:x86_64": [
"//docs:wpilibc_publish.publish",
],
"//conditions:default": [],
}),
)
write_source_files(
name = "write_robotpy_generated_native_files",
additional_update_targets = [
"//apriltag:robotpy-native-apriltag-generator.generate_build_info",
"//datalog:robotpy-native-datalog-generator.generate_build_info",
"//hal:robotpy-native-wpihal-generator.generate_build_info",
"//ntcore:robotpy-native-ntcore-generator.generate_build_info",
"//romiVendordep:robotpy-native-xrp-generator.generate_build_info",
"//wpilibc:robotpy-native-wpilib-generator.generate_build_info",
"//wpinet:robotpy-native-wpinet-generator.generate_build_info",
"//wpimath:robotpy-native-wpimath-generator.generate_build_info",
"//wpiutil:robotpy-native-wpiutil-generator.generate_build_info",
"//xrpVendordep:robotpy-native-xrp-generator.generate_build_info",
],
tags = [
"pregeneration",
"robotpy",
],
target_compatible_with = robotpy_compatibility_select(),
)
write_source_files(
name = "write_robotpy_generated_pybind_files",
additional_update_targets = [
"//apriltag:robotpy-apriltag-generator.generate_build_info",
"//datalog:robotpy-datalog-generator.generate_build_info",
"//hal:robotpy-hal-generator.generate_build_info",
"//ntcore:pyntcore-generator.generate_build_info",
"//romiVendordep:robotpy-romi-generator.generate_build_info",
"//wpilibc:robotpy-wpilib-generator.generate_build_info",
"//wpinet:robotpy-wpinet-generator.generate_build_info",
"//wpimath:robotpy-wpimath-generator.generate_build_info",
"//wpimath:robotpy-wpimath_test-generator.generate_build_info",
"//wpiutil:robotpy-wpiutil-generator.generate_build_info",
"//xrpVendordep:robotpy-xrp-generator.generate_build_info",
],
tags = [
"pregeneration",
"robotpy",
],
target_compatible_with = robotpy_compatibility_select(),
)
write_source_files(
name = "write_robotpy_update_yaml_files",
additional_update_targets = [
"//apriltag:write_robotpy-apriltag-update-yaml",
"//datalog:write_robotpy-wpilog-update-yaml",
"//hal:write_robotpy-hal-update-yaml",
"//ntcore:write_pyntcore-update-yaml",
"//romiVendordep:write_robotpy-romi-update-yaml",
"//wpilibc:write_robotpy-wpilib-update-yaml",
"//wpinet:write_robotpy-wpinet-update-yaml",
"//wpimath:write_robotpy-wpimath-update-yaml",
"//wpimath:write_robotpy-wpimath-test-update-yaml",
"//wpiutil:write_robotpy-wpiutil-update-yaml",
"//xrpVendordep:write_robotpy-xrp-update-yaml",
],
tags = [
"manual",
"pregeneration",
"robotpy",
],
target_compatible_with = robotpy_compatibility_select(),
)
write_source_files(
name = "write_robotpy_create_imports",
additional_update_targets = [
"//apriltag:robotpy-apriltag-create-imports",
"//datalog:robotpy-wpilog-create-imports",
"//hal:robotpy-hal-create-imports",
"//ntcore:pyntcore-create-imports",
"//romiVendordep:robotpy-romi-create-imports",
"//wpilibc:robotpy-wpilib-create-imports",
"//wpinet:robotpy-wpinet-create-imports",
"//wpimath:robotpy-wpimath-create-imports",
"//wpimath:robotpy-wpimath-test-create-imports",
"//wpiutil:robotpy-wpiutil-create-imports",
"//xrpVendordep:robotpy-xrp-create-imports",
],
tags = [
"manual",
"pregeneration",
"robotpy",
],
target_compatible_with = robotpy_compatibility_select(),
)
write_source_files(
name = "write_robotpy_files",
additional_update_targets = [
":write_robotpy_generated_native_files",
":write_robotpy_generated_pybind_files",
":write_robotpy_update_yaml_files",
],
tags = [
"manual",
"pregeneration",
],
)
write_source_files(
name = "write_all",
additional_update_targets = [
":write_pregenerated_files",
":write_robotpy_files",
],
tags = [
"manual",
"pregeneration",
],
)
# Helper easily run the semiwrap parsing tools on all of the robotpy projects.
filegroup(
name = "robotpy_generated_files",
srcs = [
"//apriltag:robotpy-apriltag.generated_files",
"//datalog:robotpy-wpilog.generated_files",
"//hal:robotpy-hal.generated_files",
"//ntcore:pyntcore.generated_files",
"//wpilibc:robotpy-wpilib.generated_files",
"//wpimath:robotpy-wpimath.generated_files",
"//wpimath:robotpy-wpimath-test.generated_files",
"//wpinet:robotpy-wpinet.generated_files",
"//wpiutil:robotpy-wpiutil.generated_files",
],
tags = ["manual"],
target_compatible_with = robotpy_compatibility_select(),
)

View File

@@ -1,176 +1,119 @@
# Disable in-source builds to prevent source tree corruption.
if(" ${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL " ${CMAKE_CURRENT_BINARY_DIR}")
message(FATAL_ERROR "
message(
FATAL_ERROR
"
FATAL: In-source builds are not allowed.
You should create a separate directory for build files.
")
"
)
endif()
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
set(CMAKE_SYSTEM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE)
set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE)
message(STATUS "Platform version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
endif()
# Set default build type to release with debug info (i.e. release mode optimizations
# are performed, but debug info still exists).
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
endif()
cmake_minimum_required(VERSION 3.21)
project(allwpilib)
cmake_minimum_required(VERSION 3.3.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
message(STATUS "Platform version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
# Make timestamps of extracted files from FetchContent the time of extraction
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
set(WPILIB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
INCLUDE(CPack)
include(CMakeDependentOption)
include(CPack)
include(OptionValidation)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
if(MSVC)
add_compile_options(/Zc:__cplusplus)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/bin)
set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${WPILIB_BINARY_DIR}/jar)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/wpilib/lib")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/wpilib/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/wpilib/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Options for building certain parts of the repo. Everything is built by default.
option(BUILD_SHARED_LIBS "Build with shared libs (needed for JNI)" ON)
option(WITH_JAVA "Include java and JNI in the build" ON)
option(BUILD_SHARED_LIBS "Build with shared libs" ON)
option(WITH_DOCS "Build Doxygen docs (needs Git for versioning)" OFF)
cmake_dependent_option(
DOCS_WARNINGS_AS_ERRORS
"Make docs warnings into errors"
OFF
WITH_DOCS
OFF
)
option(WITH_CSCORE "Build cscore (needs OpenCV)" ON)
option(WITH_NTCORE "Build ntcore" ON)
option(WITH_WPICAL "Build wpical" OFF)
option(WITH_WPIMATH "Build wpimath" ON)
option(WITH_WPILIB "Build hal, wpilibc/j, and myRobot (needs OpenCV)" ON)
option(WITH_OLD_COMMANDS "Build old commands" OFF)
option(WITH_WPILIB "Build hal, wpilibc/j, and developerRobot (needs OpenCV)" ON)
option(WITH_EXAMPLES "Build examples" OFF)
option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
option(WITH_GUI "Build GUI items" ON)
option(WITH_SIMULATION_MODULES "Build simulation modules" ON)
option(WITH_BENCHMARK "Build the benchmark project" ON)
# Options for external HAL.
option(WITH_EXTERNAL_HAL "Use a separately built HAL" OFF)
set(EXTERNAL_HAL_FILE "" CACHE FILEPATH "Location to look for an external HAL CMake File")
# Options for using a package manager (e.g., vcpkg) for certain dependencies.
option(USE_SYSTEM_FMTLIB "Use system fmtlib" OFF)
option(USE_SYSTEM_LIBUV "Use system libuv" OFF)
option(USE_SYSTEM_EIGEN "Use system eigen" OFF)
option(USE_LINKED_AVAHI "Use directly linked Avahi instead of loading at runtime" OFF)
# Options for using a package manager (vcpkg) for certain dependencies.
option(USE_VCPKG_FMTLIB "Use vcpkg fmtlib" OFF)
option(USE_VCPKG_LIBUV "Use vcpkg libuv" OFF)
option(USE_VCPKG_EIGEN "Use vcpkg eigen" OFF)
# Options for compilation flags.
option(NO_WERROR "Disable -Werror flag during compilation" OFF)
# Options for installation.
option(WITH_FLAT_INSTALL "Use a flat install directory" OFF)
wpilib_config(OPTIONS WITH_SIMULATION_MODULES REQUIRES BUILD_SHARED_LIBS WITH_WPILIB WITH_NTCORE)
# Options for location of OpenCV Java.
set(OPENCV_JAVA_INSTALL_DIR "" CACHE PATH "Location to search for the OpenCV jar file")
wpilib_config(OPTIONS WITH_CSCORE REQUIRES WITH_NTCORE)
# Set default build type to release with debug info (i.e. release mode optimizations
# are performed, but debug info still exists).
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
wpilib_config(OPTIONS WITH_GUI REQUIRES WITH_NTCORE WITH_WPIMATH)
wpilib_config(OPTIONS WITH_WPILIB REQUIRES WITH_NTCORE WITH_WPIMATH)
set(include_dest include)
if(WITH_DOCS)
find_package(Doxygen REQUIRED)
find_package(Git REQUIRED)
include(AddDoxygenDocs)
add_doxygen_docs()
endif()
# We always want flat install with MSVC.
if (MSVC)
set(WITH_FLAT_INSTALL ON)
if(WITH_WPICAL)
find_package(Ceres CONFIG REQUIRED)
endif()
if (WITH_JAVA AND NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "
FATAL: Cannot build static libs with Java enabled.
Static libs requires both BUILD_SHARED_LIBS=OFF and
WITH_JAVA=OFF
")
endif()
if (WITH_SIMULATION_MODULES AND NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "
FATAL: Cannot build static libs with simulation modules enabled.
Static libs requires both BUILD_SHARED_LIBS=OFF and
WITH_SIMULATION_MODULES=OFF
")
endif()
if (NOT WITH_JAVA OR NOT WITH_CSCORE)
if(NOT "${OPENCV_JAVA_INSTALL_DIR}" STREQUAL "")
message(WARNING "
WARNING: OpenCV Java dir set but java is not enabled!
It will be ignored.
")
endif()
endif()
if (NOT WITH_WPILIB AND WITH_SIMULATION_MODULES)
message(FATAL_ERROR "
FATAL: Cannot build simulation modules with wpilib disabled.
Enable wpilib by setting WITH_WPILIB=ON
")
endif()
if (NOT WITH_WPIMATH AND WITH_WPILIB)
message(FATAL_ERROR "
FATAL: Cannot build wpilib without wpimath.
Enable wpimath by setting WITH_WPIMATH=ON
")
endif()
set( wpilib_dest wpilib)
set( include_dest wpilib/include )
set( main_lib_dest wpilib/lib )
set( java_lib_dest wpilib/java )
set( jni_lib_dest wpilib/jni )
if (WITH_FLAT_INSTALL)
set (wpilib_config_dir ${wpilib_dest})
else()
set (wpilib_config_dir share/wpilib)
endif()
if (USE_VCPKG_LIBUV)
set (LIBUV_VCPKG_REPLACE "find_package(unofficial-libuv CONFIG)")
endif()
if (USE_VCPKG_EIGEN)
set (EIGEN_VCPKG_REPLACE "find_package(Eigen3 CONFIG)")
endif()
find_package(LIBSSH 0.7.1)
if (WITH_FLAT_INSTALL)
set(WPIUTIL_DEP_REPLACE "include($\{SELF_DIR\}/wpiutil-config.cmake)")
set(NTCORE_DEP_REPLACE "include($\{SELF_DIR\}/ntcore-config.cmake)")
set(CSCORE_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cscore-config.cmake)")
set(CAMERASERVER_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cameraserver-config.cmake)")
set(HAL_DEP_REPLACE_IMPL "include(\${SELF_DIR}/hal-config.cmake)")
set(WPIMATH_DEP_REPLACE "include($\{SELF_DIR\}/wpimath-config.cmake)")
set(WPILIBC_DEP_REPLACE_IMPL "include(\${SELF_DIR}/wpilibc-config.cmake)")
set(WPILIBNEWCOMMANDS_DEP_REPLACE "include(\${SELF_DIR}/wpilibNewcommands-config.cmake)")
set(WPILIBOLDCOMMANDS_DEP_REPLACE "include(\${SELF_DIR}/wpilibOldcommands-config.cmake)")
else()
set(WPIUTIL_DEP_REPLACE "find_dependency(wpiutil)")
set(NTCORE_DEP_REPLACE "find_dependency(ntcore)")
set(CSCORE_DEP_REPLACE_IMPL "find_dependency(cscore)")
set(CAMERASERVER_DEP_REPLACE_IMPL "find_dependency(cameraserver)")
set(HAL_DEP_REPLACE_IMPL "find_dependency(hal)")
set(WPIMATH_DEP_REPLACE "find_dependency(wpimath)")
set(WPILIBC_DEP_REPLACE_IMPL "find_dependency(wpilibc)")
set(WPILIBNEWCOMMANDS_DEP_REPLACE "find_dependency(wpilibNewCommands)")
set(WPILIBOLDCOMMANDS_DEP_REPLACE "find_dependency(wpilibOldCommands)")
endif()
set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)")
set(SELF_DIR "$\{SELF_DIR\}")
find_package(LIBSSH CONFIG 0.7.1)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
@@ -185,7 +128,15 @@ if(isMultiConfig)
list(APPEND CMAKE_CONFIGURATION_TYPES Ubsan)
endif()
else()
set(allowedBuildTypes Asan Tsan Ubsan Debug Release RelWithDebInfo MinSizeRel)
set(allowedBuildTypes
Asan
Tsan
Ubsan
Debug
Release
RelWithDebInfo
MinSizeRel
)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowedBuildTypes}")
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE IN_LIST allowedBuildTypes)
@@ -194,106 +145,177 @@ else()
endif()
set(CMAKE_C_FLAGS_ASAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler for Asan build type or configuration." FORCE)
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
CACHE STRING
"Flags used by the C compiler for Asan build type or configuration."
FORCE
)
set(CMAKE_CXX_FLAGS_ASAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler for Asan build type or configuration." FORCE)
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
CACHE STRING
"Flags used by the C++ compiler for Asan build type or configuration."
FORCE
)
set(CMAKE_EXE_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING
"Linker flags to be used to create executables for Asan build type." FORCE)
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address"
CACHE STRING
"Linker flags to be used to create executables for Asan build type."
FORCE
)
set(CMAKE_SHARED_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING
"Linker lags to be used to create shared libraries for Asan build type." FORCE)
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address"
CACHE STRING
"Linker flags to be used to create shared libraries for Asan build type."
FORCE
)
set(CMAKE_C_FLAGS_TSAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler for Tsan build type or configuration." FORCE)
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer"
CACHE STRING
"Flags used by the C compiler for Tsan build type or configuration."
FORCE
)
set(CMAKE_CXX_FLAGS_TSAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler for Tsan build type or configuration." FORCE)
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer"
CACHE STRING
"Flags used by the C++ compiler for Tsan build type or configuration."
FORCE
)
set(CMAKE_EXE_LINKER_FLAGS_TSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread" CACHE STRING
"Linker flags to be used to create executables for Tsan build type." FORCE)
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread"
CACHE STRING
"Linker flags to be used to create executables for Tsan build type."
FORCE
)
set(CMAKE_SHARED_LINKER_FLAGS_TSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread" CACHE STRING
"Linker lags to be used to create shared libraries for Tsan build type." FORCE)
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread"
CACHE STRING
"Linker flags to be used to create shared libraries for Tsan build type."
FORCE
)
set(CMAKE_C_FLAGS_UBSAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler for Ubsan build type or configuration." FORCE)
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer"
CACHE STRING
"Flags used by the C compiler for Ubsan build type or configuration."
FORCE
)
set(CMAKE_CXX_FLAGS_UBSAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler for Ubsan build type or configuration." FORCE)
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer"
CACHE STRING
"Flags used by the C++ compiler for Ubsan build type or configuration."
FORCE
)
set(CMAKE_EXE_LINKER_FLAGS_UBSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all" CACHE STRING
"Linker flags to be used to create executables for Ubsan build type." FORCE)
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all"
CACHE STRING
"Linker flags to be used to create executables for Ubsan build type."
FORCE
)
set(CMAKE_SHARED_LINKER_FLAGS_UBSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined" CACHE STRING
"Linker lags to be used to create shared libraries for Ubsan build type." FORCE)
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined"
CACHE STRING
"Linker flags to be used to create shared libraries for Ubsan build type."
FORCE
)
if (WITH_TESTS)
if(WITH_TESTS)
enable_testing()
add_subdirectory(googletest)
add_subdirectory(thirdparty/googletest)
include(GoogleTest)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/catch2/extras")
add_subdirectory(thirdparty/catch2)
include(Catch)
endif()
add_subdirectory(wpiutil)
add_subdirectory(ntcore)
if(USE_SYSTEM_LIBUV)
set(LIBUV_SYSTEM_REPLACE "find_dependency(libuv CONFIG)")
endif()
if (WITH_WPIMATH)
if(USE_SYSTEM_EIGEN)
set(EIGEN_SYSTEM_REPLACE "find_package(Eigen3 CONFIG)")
endif()
set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)")
set(SELF_DIR "$\{SELF_DIR\}")
set(WPIUTIL_DEP_REPLACE "find_dependency(wpiutil)")
set(DATALOG_DEP_REPLACE "find_dependency(datalog)")
add_subdirectory(wpiutil)
add_subdirectory(datalog)
if(WITH_NTCORE)
set(NTCORE_DEP_REPLACE "find_dependency(ntcore)")
set(WPINET_DEP_REPLACE "find_dependency(wpinet)")
add_subdirectory(wpinet)
add_subdirectory(ntcore)
endif()
if(WITH_WPIMATH)
set(WPIMATH_DEP_REPLACE "find_dependency(wpimath)")
add_subdirectory(wpimath)
endif()
if (WITH_GUI)
add_subdirectory(fieldImages)
add_subdirectory(imgui)
if(WITH_GUI)
add_subdirectory(fields)
add_subdirectory(thirdparty/imgui_suite)
add_subdirectory(wpigui)
add_subdirectory(glass)
add_subdirectory(outlineviewer)
if (LIBSSH_FOUND)
add_subdirectory(roborioteamnumbersetter)
add_subdirectory(tools/outlineviewer)
add_subdirectory(tools/sysid)
if(WITH_WPICAL)
add_subdirectory(tools/wpical)
endif()
if(LIBSSH_FOUND)
add_subdirectory(tools/datalogtool)
endif()
endif()
if (WITH_WPILIB OR WITH_SIMULATION_MODULES)
set(HAL_DEP_REPLACE ${HAL_DEP_REPLACE_IMPL})
if(WITH_WPILIB OR WITH_SIMULATION_MODULES)
set(HAL_DEP_REPLACE "find_dependency(hal)")
add_subdirectory(hal)
endif()
if (WITH_CSCORE)
set(CSCORE_DEP_REPLACE ${CSCORE_DEP_REPLACE_IMPL})
set(CAMERASERVER_DEP_REPLACE ${CAMERASERVER_DEP_REPLACE_IMPL})
if(WITH_CSCORE)
set(CAMERASERVER_DEP_REPLACE "find_dependency(cameraserver)")
set(CSCORE_DEP_REPLACE "find_dependency(cscore)")
find_package(OpenCV REQUIRED)
add_subdirectory(cscore)
add_subdirectory(cameraserver)
endif()
if (WITH_WPILIB)
set(WPILIBC_DEP_REPLACE ${WPILIBC_DEP_REPLACE_IMPL})
add_subdirectory(wpilibj)
if(WITH_WPILIB)
set(APRILTAG_DEP_REPLACE "find_dependency(apriltag)")
set(WPILIBC_DEP_REPLACE "find_dependency(wpilibc)")
set(COMMAND_DEP_REPLACE "find_dependency(commandsv2)")
add_subdirectory(apriltag)
add_subdirectory(wpilibc)
add_subdirectory(wpilibNewCommands)
if (WITH_OLD_COMMANDS)
add_subdirectory(wpilibOldCommands)
endif()
if (WITH_EXAMPLES)
add_subdirectory(commandsv2)
add_subdirectory(romiVendordep)
add_subdirectory(xrpVendordep)
if(WITH_EXAMPLES)
add_subdirectory(wpilibcExamples)
endif()
add_subdirectory(myRobot)
add_subdirectory(developerRobot)
endif()
if (WITH_SIMULATION_MODULES AND NOT WITH_EXTERNAL_HAL)
if(WITH_BENCHMARK)
add_subdirectory(benchmark)
endif()
if(WITH_SIMULATION_MODULES)
add_subdirectory(simulation)
endif()
configure_file(wpilib-config.cmake.in ${WPILIB_BINARY_DIR}/wpilib-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/wpilib-config.cmake DESTINATION ${wpilib_config_dir})
configure_file(wpilib-config.cmake.in ${WPILIB_BINARY_DIR}/wpilib-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/wpilib-config.cmake DESTINATION share/wpilib)

29
CMakePresets.json Normal file
View File

@@ -0,0 +1,29 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "default",
"displayName": "Default Config",
"description": "Default build using Ninja generator",
"binaryDir": "build-cmake",
"generator": "Ninja",
"cacheVariables": {}
},
{
"name": "with-sccache",
"displayName": "",
"description": "Ninja config with sccache",
"generator": "Ninja",
"binaryDir": "build-cmake",
"cacheVariables": {
"CMAKE_C_COMPILER_LAUNCHER": "sccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
}
}
]
}

View File

@@ -1,69 +1,46 @@
# Contributor Covenant Code of Conduct
# Contributor Community Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
As members, contributors, and leaders, we commit to fostering a community where everyone feels safe, respected, and valued. We are dedicated to ensuring that participation in this community is harassment-free, inclusive, and welcoming, regardless of age, body type, abilities (visible or invisible), ethnicity, gender identity or expression, sexual orientation, socioeconomic background, education, nationality, personal appearance, race, or religion.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
Positive and respectful behavior is essential to creating a thriving community. This includes:
* Exhibiting Gracious Professionalism® at all times. Gracious Professionalism
* Practicing **Gracious Professionalism®** at all times. Gracious Professionalism
is a way of doing things that encourages high-quality work, emphasizes the
value of others, and respects individuals and the community.
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
* Showing empathy, kindness, and patience.
* Respecting diverse perspectives and experiences.
* Giving and receiving constructive feedback with openness and humility.
* Owning mistakes, apologizing when necessary, and learning from them.
* Prioritizing the well-being and success of the entire community over individual interests.
Examples of unacceptable behavior include:
Unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Using sexualized language, imagery, or making inappropriate advances
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
* Harassment in any form, whether public or private.
* Sharing private information (e.g., email or physical addresses) without explicit consent.
* Any behavior that is unprofessional, harmful, or exclusionary.
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
Community leaders are responsible for maintaining these standards and will take appropriate action to address any behavior deemed harmful, threatening, or inappropriate. Actions may include removing content, issuing warnings, or, when necessary, banning individuals. Moderation decisions will be communicated transparently where appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
This Code of Conduct applies to all community spaces, events, and instances where individuals represent the community (e.g., official email accounts, social media posts, or in-person/virtual events).
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[conduct@wpilib.org](mailto:conduct@wpilib.org).
[wpilib@wpi.edu](mailto:wpilib@wpi.edu).
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
@@ -79,7 +56,7 @@ the consequences for any action they deem in violation of this Code of Conduct:
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
**Consequence**: A warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
@@ -115,6 +92,9 @@ individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## A Note on Kindness
Building a community isnt just about rules—its about connection. Every interaction is an opportunity to be understanding, compassionate, and supportive. Being a good human is the key to our ethos.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],

View File

@@ -4,6 +4,8 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont
- [General Contribution Rules](#general-contribution-rules)
- [What to Contribute](#what-to-contribute)
- [Design Philosophy](#design-philosophy)
- [Contribution Process](#contribution-process)
- [Coding Guidelines](#coding-guidelines)
- [Submitting Changes](#submitting-changes)
- [Pull Request Format](#pull-request-format)
@@ -12,43 +14,64 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont
## General Contribution Rules
- Everything in the library must work for the 3000+ teams that will be using it.
- Everything in the library must work for the 14000+ teams that will be using it.
- We need to be able to maintain submitted changes, even if you are no longer working on the project.
- Tool suite changes must be generally useful to a broad range of teams
- Excluding bug fixes, changes in one language generally need to have corresponding changes in other languages.
- Some features, such the addition of C++11 for WPILibC or Functional Interfaces for WPILibJ, are specific to that version of WPILib only.
- Substantial changes often need to have corresponding LabVIEW changes. To do this, we will work with NI on these large changes.
- Some features, such the addition of C++26 for WPILibC or Functional Interfaces for WPILibJ, are specific to that version of WPILib only. New language features added to C++ must be wrappable in Python for [RobotPy](https://github.com/robotpy).
- Changes should have tests.
- Code should be well documented.
- This involves writing tutorials and/or usage guides for your submitted feature. These articles are then hosted on the [WPILib](https://docs.wpilib.org/) documentation website. See the [frc-docs repository](https://github.com/wpilibsuite/frc-docs) for more information.
- This involves writing tutorials and/or usage guides for your submitted feature. These articles are then hosted on the [WPILib](https://docs.wpilib.org/) documentation website. See the [wpilib-docs repository](https://github.com/wpilibsuite/wpilib-docs) for more information.
## What to Contribute
- Bug reports and fixes
- We will generally accept bug fixes without too much question. If they are only implemented for one language, we will implement them for any other necessary languages. Bug reports are also welcome, please submit them to our GitHub issue tracker.
- While we do welcome improvements to the API, there are a few important rules to consider:
- Features must be added to both WPILibC and WPILibJ, with rare exceptions.
- During competition season, we will not merge any new feature additions. We want to ensure that the API is stable during the season to help minimize issues for teams.
- Ask about large changes before spending a bunch of time on them! You can create a new issue on our GitHub tracker for feature request/discussion and talk about it with us there.
- Features must be added to Java (WPILibJ), C++ (WPILibC), and Python with rare exceptions.
- Most of Python (RobotPy) is created by wrapping WPILibC with pybind11 via semiwrap. In general, new user-facing functions or classes should have the proper wrapper configs updated, typically located in a YAML file with the same name as the header. See the [in-repo RobotPy README](./README-RobotPy.md) for more info and how to partially auto-update the configs. However, the command framework is reimplemented in Python, and requires code to be ported instead of being wrapped via semiwrap.
- During competition season, we will not merge any new feature additions or removals. We want to ensure that the API is stable during the season to help minimize issues for teams.
- Ask about large changes before spending a bunch of time on them! See [Contribution Process](#contribution-process) for where to ask.
- Features that make it easier for teams with less experience to be more successful are more likely to be accepted.
- Features in WPILib should be broadly applicable to all teams. Anything that is team specific should not be submitted.
- As a rule, we are happy with the general structure of WPILib. We are not interested in major rewrites of all of WPILib. We are open to talking about ideas, but backwards compatibility is very important for WPILib, so be sure to keep this in mind when proposing major changes.
- Generally speaking, we do not accept code for specific sensors. We have to be able to test the sensor in hardware on the WPILib test bed. Additionally, hardware availability for teams is important. Therefore, as a general rule, the library only directly supports hardware that is in the Kit of Parts. If you are a company interested in getting a sensor into the Kit of Parts, please contact FIRST directly at frcparts@firstinspires.org.
- While the library may contain support for specific sensors, these are typically items contained in the FIRST Robotics Competition Kit of Parts or commonly used hardware identified by FIRST or core WPILib Developers. If you think a certain sensor should be supported in WPILib, you may submit an issue justifying the reasons why it should be supported and approval will be determined by FIRST or core WPILib Developers. If you are a company interested in getting a sensor into the Kit of Parts, please contact FIRST directly at frcparts@firstinspires.org.
## Design Philosophy
WPILib's general design philosophy strays far away from the traditional Object-Oriented Programming architectures dominant in enterprise codebases. The general points to follow for WPILib are as follows:
- Prefer functions and composition over inheritance. Inheritance is rigid and often prevents evolution, as adding or removing methods from an inherited class risks breakage. For similar reasons, functional interfaces (`std::function` in C++) are preferred over actual interfaces.
- Avoid opaque black-boxes of functionality. Classes like RamseteCommand or HolonomicDriveController (both removed in 2027) are good examples of this. While they look like a good abstraction that helps beginners, the black-box nature means they are [difficult to debug](https://github.com/wpilibsuite/allwpilib/issues/3350) and it's impossible to instrument the internals to figure out what's going on, or they are extremely clunky to use compared to composing the individual components (thus defeating the point of abstracting it away; SwerveControllerCommand construction was [a huge pile of opaque arguments glued together](https://github.com/wpilibsuite/allwpilib/blob/v2026.2.2/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervecontrollercommand/RobotContainer.java#L104-L114)). Composition is strongly preferred, with strong documentation and examples describing how to do that composition.
- Error at compile time, not runtime. Despite our best efforts, there will always be people who don't read stack traces (understandable for beginner programmers). Compile time errors show up in builds and in an IDE, which is much easier and faster for people to pinpoint and debug. Use language features to make invalid code impossible to build.
- The Matrix class in Java is an example of this. While clunky due to Java's weak generics system, it enforces correct Matrix dimensions at compile time, with the MatBuilder factory method throwing if the array passed in is the wrong size, which leads to the next point:
- Try to only throw exceptions at code startup, and only for things that are obviously incorrect. Robots shouldn't quit, and it's a real "feels bad" moment when yours does, especially in a match. It's oftentimes better to have a robot continue running when it sees nonsensical state as opposed to outright crashing, since other components are often still functional. If you can't make invalid code a compile time error, throwing at the start of the robot program is the next best solution, but avoid throwing in functions likely to be called throughout a robot's runtime.
- Sometimes the behavior of functions are just incorrect if invalid data is passed in, and throwing is one of the only options. This is a judgement call, but if there are no other options, throwing can be okay.
- An alternative to throwing is logging an error, typically with [the Alerts framework](https://docs.wpilib.org/en/latest/docs/software/telemetry/persistent-alerts.html); this is a good choice for runtime errors. Also see https://github.com/wpilibsuite/allwpilib/issues/6766 for an example of not throwing exceptions, but simply logging an error on invalid data.
- Note that hardware configuration issues such as a sensor not existing isn't necessarily obviously incorrect; it could be that the wrong port was specified, but it could also be unplugged due to external factors. Throwing just because it's unplugged can make for a "feels bad" moment, and should be avoided.
## Contribution Process
Have an idea to make WPILib better? Here's some steps to go from idea to implementation:
1. (Optional) **Discuss it in the Discord.** The programming discussion channel in the [Unofficial FIRST Robotics Competition Discord Server](https://discord.com/invite/frc) is a popular choice for initial discussion about ideas because many WPILib developers are active there and the live messaging nature of the platform is well suited for initial discussion (particularly for smaller changes). Note that the unofficial Discord server is not a mandatory step in the development process and is not endorsed by FIRST®.
2. (Recommended) **Open a GitHub issue.** GitHub issues are another way to get initial feedback about an idea before working on an implementation. Compared to the unofficial Discord server, GitHub issues have much wider visibility and are better suited for serious discussions about major changes. Getting feedback about an idea (whether in the unofficial Discord server or in a GitHub issue) before working on the implementation is recommended to avoid working on a change that will be rejected, though some ideas are pretty safe.
3. (Rare) **Create a design document in GitHub.** Sometimes, a change is so large that a design document is necessary to fully flesh out the details (and get feedback on them) before starting on an implementation. This is done through a pull request that adds the design document (as a Markdown file) to the repository. This is extremely rare, and it is sometimes done concurrently with the implementation if the change doesn't need much debate but is large enough to require a design document.
4. (Mandatory) **Create a GitHub pull request.** This is how you implement the changes, and is the focus of most of the rest of this document.
## Coding Guidelines
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system. We currently use clang-format 10.0 with wpiformat.
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system.
While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.
When writing math expressions in documentation, use https://www.unicodeit.net/ to convert LaTeX to a Unicode equivalent that's easier to read. Not all expressions will translate (e.g., superscripts of superscripts) so focus on making it readable by someone who isn't familiar with LaTeX. If content on multiple lines needs to be aligned in Doxygen/Javadoc comments (e.g., integration/summation limits, matrices packed with square brackets and superscripts for them), put them in @verbatim/@endverbatim blocks in Doxygen or `<pre>` tags in Javadoc so they render with monospace font.
## Submitting Changes
### Pull Request Format
Changes should be submitted as a Pull Request against the main branch of WPILib. For most changes, commits will be squashed upon merge. For particularly large changes, multiple commits are ok, but assume one commit unless asked otherwise. We may ask you to break a PR into multiple standalone PRs or commits for rebase within one PR to separate unrelated changes. No change will be merged unless it is up to date with the current main branch. We do this to make sure that the git history isn't too cluttered.
Particularly large and/or breaking changes should be targeted to the 2027 branch, which targets the [Systemcore Robot Controller](https://community.firstinspires.org/introducing-the-future-mobile-robot-controller). The intent is minimize changes for 2026, to allow development to focus on preparing for 2027.
### Merge Process
When you first submit changes, GitHub Actions will attempt to run `./gradlew check` on your change. If this fails, you will need to fix any issues that it sees. Once Actions passes, we will begin the review process in more earnest. One or more WPILib team members will review your change. This will be a back-and-forth process with the WPILib team and the greater community. Once we are satisfied that your change is ready, we will allow our hosted instance to test it. This will run the full gamut of checks, including integration tests on actual hardware. Once all tests have passed and the team is satisfied, we will merge your change into the WPILib repository.

87
DevelopmentBuilds.md Normal file
View File

@@ -0,0 +1,87 @@
# Installing Development Builds
This article contains instructions on building projects using a development build and a local WPILib build.
**Note:** This only applies to Java/C++ teams.
> [!WARNING]
> **There are no stability or compatibility guarantees for builds outside of [tagged releases](https://github.com/wpilibsuite/allwpilib/releases). Changes may not be fully documented. Use them at your own risk!**
>
> Development builds may be non-functional between the end of the season and the start of beta testing. Development builds are also likely to be incompatible with vendor libraries during this time.
## Development Build
Development builds are the per-commit build hosted every time a commit is pushed to the [allwpilib](https://github.com/wpilibsuite/allwpilib/) repository. These builds are then hosted on [artifactory](https://frcmaven.wpi.edu/artifactory/webapp/#/home).
To build a project using a development build, find the build.gradle file and open it. Then, add the following code below the plugin section and replace YEAR with the year of the development version. It is also necessary to use a 2027 GradleRIO version, ie `2027.0.0-alpha-5`
```groovy
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.+'
```
The top of your ``build.gradle`` file should now look similar to the code below. Ignore any differences in versions.
Java
```groovy
plugins {
id "java"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-5"
}
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = '2027.+'
```
C++
```groovy
plugins {
id "cpp"
id "google-test-test-suite"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-5"
}
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = '2027.+'
```
### Development Build Documentation
* C++: https://github.wpilib.org/allwpilib/docs/development/cpp/
* Java: https://github.wpilib.org/allwpilib/docs/development/java/
## Local Build
Building with a local build is very similar to building with a development build. Ensure you have built and published WPILib by following the instructions attached [here](https://github.com/wpilibsuite/allwpilib#building-wpilib). Next, find the ``build.gradle`` file in your robot project and open it. Then, add the following code below the plugin section and replace ``YEAR`` with the year of the local version.
Java
```groovy
plugins {
id "java"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-5"
}
wpi.maven.useLocal = false
wpi.maven.useWpilibMavenLocalDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.424242.+'
```
C++
```groovy
plugins {
id "cpp"
id "google-test-test-suite"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-5"
}
wpi.maven.useLocal = false
wpi.maven.useWpilibMavenLocalDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.424242.+'
```
# Systemcore Development
See the [developerRobot](developerRobot/README.md) subproject.

28
GeneratedFiles.md Normal file
View File

@@ -0,0 +1,28 @@
# Maintaining Generated Files
WPILib extensively uses [metaprogramming](https://en.wikipedia.org/wiki/Metaprogramming#Code_generation) to generate code that would otherwise be tedious and error-prone to maintain. We use [Jinja](https://jinja.palletsprojects.com), a templating engine with a Python API, alongside JSON files that contain data to generate code. This document explains how to maintain these generated files and create new ones.
## File hierarchy
The Python script used to generate a subproject's files will always be located in the subproject's directory, e.g. wpilibc. It will always be called `generate_<thing>.py` where `<thing>` is the name for what you're generating.
The templates will be located under `subproject/src/generate/main`, and generated files will be located under `subproject/src/generated/main`.
If the generated file is for C++, the hierarchy should be symmetrical, so if a generated header is located under `subproject/src/generated/main/native/include/wpi/header.h`, the template to generate it should be located under `subproject/src/generate/main/native/include/wpi/template.h.jinja`. You should pretend like `subproject/src/generate/main` is just like `subproject/src/main`, in that the file hierarchy must make sense if the files weren't generated, e.g, headers that would go in `subproject/src/main/native/include/blah` should be in `subproject/src/generated/main/native/include/blah`.
If the generated file is for Java, templates should be located under `subproject/src/generate/main/java`, and the hierarchy for output files should reflect the declared package of the output Java files. For example, a Jinja template at `subproject/src/main/java/template.java.jinja` with the package `org.wpilib.wpilibj` would be used to generate Java files located at `subproject/src/generated/main/java/org/wpilib/wpilibj`
The JSON files live under `subproject/src/generate` since they apply to both languages. One unique case is JSON files that are used by multiple subprojects, currently only JSON files shared by wpilibc and wpilibj. In that specific case, the JSON files will always be located in wpilibj since Java is the most used language.
## Using code generation
If you've identified a set of files which are extremely similar, one file with lots of repetitive code, or both, you can create Jinja templates, a JSON file, and a Python script to automatically generate the code instead.
### Preparing files for codegen
Once you've identified the files you want to codegen, you will need to identify parts of code that are similar, and extract the data that's different. Code needs to go into your Jinja template, while data that will be used to fill in the template goes into a JSON file. Using game controllers as an example, they have lots of similar methods to read the value of a button, check if a button has been pressed since the last check, and check if a button has been released since the last check. Those methods are code that goes in a Jinja template, with the specific button replaced with a Jinja expression. The buttons, both the name and value, go into a JSON file.
### Writing a Python script
To maintain consistency with other Python scripts, copy an existing `generate_*.py` script. [generate_pwm_motor_controllers.py](./wpilibj/generate_pwm_motor_controllers.py) is a good start, since it's relatively basic. Modify the script to reference your templates and JSON file, modify the paths so the files end up in the right place, and rename the functions so they match what you're generating. An important part of the script is to give the files the correct name. Depending on files you're generating, this could be the name of the template itself (see [ntcore/generate_topics.py](./ntcore/generate_topics.py)) or it could be part of the data in the JSON file.
### (Re)Generating files and committing them
Once your Python script is complete, you can run `python generate_<thing>.py` to generate the files. Once you're finished with your files, commit these files to Git. If you regenerated the files and Git indicates the files have changed, but the diff doesn't show any changes, only the line endings have changed. If you expected changes to the generated code, you didn't correctly make changes. If you didn't expect changes, you can ignore this and discard the changes. Also ensure that you've marked the Python script as executable, since this is necessary for CI workflows to run your scripts. To add your script to the CI workflows, edit [.github/workflows/pregen_all.py](.github/workflows/pregen_all.py), and add your script alongside the rest of the scripts.
#### (Re)Generating QuickBuffers files
Regenerating QuickBuffers files requires the Protocol Buffers compiler (protoc), and the QuickBuffers plugin, which can be found on [their releases page](https://github.com/HebiRobotics/QuickBuffers/releases). Once you have both, you can pass their paths into the generation scripts with `--protoc` and `--quickbuf_plugin` and regenerate the files.

View File

@@ -1,4 +1,4 @@
Copyright (c) 2009-2022 FIRST and other WPILib contributors
Copyright (c) 2009-2026 FIRST and other WPILib contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -1,27 +1,27 @@
## Publishing Third Party Dependencies
Currently the 3rd party deps are imgui, opencv, and google test
Currently the 3rd party external deps are opencv, libssh, ceres, and gtsam.
For publishing these dependencies, the version needs to be manually updated in the publish.gradle file of their respective repository.
Then, in the azure build for the dependency you want to build for, manually start a pipeline build (As of current, this is the `Run Pipeline` button).
A variable needs to be added called `RUN_AZURE_ARTIFACTORY_RELEASE`, with a value of `true`. Then when the pipeline gets started, the final build outputs will be updated to artifactory.
Then, upload a new tag for the dependency you want to build for, which will automatically start a build.
The CI workflow should set `RUN_AZURE_ARTIFACTORY_RELEASE` to `true` on tagged runs. Then when the pipeline gets started, the final build outputs will be uploaded to artifactory.
To use newer versions of C++ dependencies, in `shared/config.gradle`, update the version related to the specific dependency.
For Java dependencies, there is likely a file related to the specific dependency in the shared folder. Update the version in there.
Note, changing artifact locations (This includes changing the artifact year currently, I have an issue open to change this) requires updating the `native-utils` plugin
Note, changing artifact locations requires updating the `native-utils` plugin; specifically, the `configureDependencies` method in the `WPINativeUtilsExtension` class.
## Publishing allwpilib
allwpilib publishes to the development repo on every push to main. To publish a release build, upload a new tag, and a release will automatically be built and published.
## Publishing desktop tools
Desktop tools publish to the development repo on every push to main. To publish a release build, upload a new tag, and a release will automatically be built and published.
### Adding a new robot code dependency/subproject
If a new subproject has been added that is meant for use from robot code, both GradleRIO and the `native-utils` plugin need to be updated. `native-utils` is updated in the same way as 3rd party dependencies. For GradleRIO, update the `WPIJavaDepsExtension` to contain your new subproject's artifacts.
## Publishing VS Code
Before publishing, make sure to update the gradlerio version in `vscode-wpilib/resources/gradle/version.txt` Also make sure the gradle wrapper version matches the wrapper required by gradlerio.
Upon pushing a tag, a release will be built, and the files will be uploaded to the releases on GitHub. For publishing to the marketplace, you need a Microsoft account and to be added as a maintainer.
Before publishing, make sure to update the GradleRIO version in `vscode-wpilib/resources/gradle/version.txt`. Also make sure the Gradle Wrapper version matches the wrapper required by GradleRIO.
Upon pushing a tag, a release will be built, and the files will be uploaded to the releases on GitHub.
## Publishing GradleRIO
Before publishing, make sure to update the version in build.gradle. Publishing must happen locally, using the command `./gradlew publishPlugin`. This does require your API key for publishing to be set.
## Building the installer
Update the GradleRIO version in gradle.properties, and in the scripts folder in vscode, update the vscode extension. Then push, it will build the installer on azure.
Update the GradleRIO version in gradle.properties, and in the scripts folder in vscode, update the vscode extension. To publish a release build, upload a new tag, and a release will automatically be built and published to artifactory and cloudflare.

125
MODULE.bazel Normal file
View File

@@ -0,0 +1,125 @@
module(
name = "allwpilib",
version = "0.0.0",
)
include("//docs:doxygen.MODULE.bazel")
include("//shared/bazel/thirdparty/mrclib:mrclib.MODULE.bazel")
bazel_dep(name = "apple_support", version = "2.0.0", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "bazel_features", version = "1.33.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.14.0")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_java", version = "8.16.1")
bazel_dep(name = "rules_python", version = "1.7.0")
bazel_dep(name = "rules_pycross", version = "0.8.1")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.13",
)
use_repo(
python,
"python_3_13",
"python_3_13_x86_64-unknown-linux-gnu",
)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "allwpilib_pip_deps",
python_version = "3.13",
requirements_lock = "//:requirements_lock.txt",
requirements_windows = "//:requirements_windows_lock.txt",
)
use_repo(pip, "allwpilib_pip_deps")
bazel_dep(name = "rules_jvm_external", version = "6.8")
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "maven",
artifacts = [
"org.ejml:ejml-simple:0.44.0",
"io.avaje:avaje-jsonb:3.14",
"io.avaje:avaje-jsonb-generator:3.14",
"us.hebi.quickbuf:quickbuf-runtime:1.4",
"com.google.code.gson:gson:2.13.1",
"org.wpilib.thirdparty.opencv:opencv-java:2027-4.13.0-1",
"org.junit.jupiter:junit-jupiter:5.10.1",
"org.junit.platform:junit-platform-console:1.10.1",
"org.junit.platform:junit-platform-launcher:1.10.1",
"org.junit.platform:junit-platform-reporting:1.10.1",
"org.hamcrest:hamcrest-all:1.3",
"com.googlecode.junit-toolbox:junit-toolbox:2.4",
"org.apache.ant:ant:1.10.12",
"org.apache.ant:ant-junit:1.10.12",
"org.mockito:mockito-core:4.1.0",
"com.google.testing.compile:compile-testing:0.21.0",
],
lock_file = "//:maven_install.json",
repositories = [
"https://repo1.maven.org/maven2",
"https://frcmaven.wpi.edu/artifactory/release/",
],
)
use_repo(maven, "maven", "unpinned_maven")
bazel_dep(name = "caseyduquettesc_rules_python_pytest", version = "1.1.1", repo_name = "rules_python_pytest")
bazel_dep(name = "eigen", version = "5.0.1")
local_path_override(
module_name = "eigen",
path = "wpimath/src/main/native/thirdparty/eigen/include",
)
bazel_dep(name = "rules_license", version = "1.0.0")
http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
http_file(
name = "quickbuffer_protoc_linux",
executable = True,
sha256 = "02767f5f662720c121dfaaa9109aefa9b0b1e2415cbe1af9e4713a7b00663696",
urls = ["https://repo1.maven.org/maven2/us/hebi/quickbuf/protoc-gen-quickbuf/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe"],
)
http_file(
name = "quickbuffer_protoc_osx_x86-64",
executable = True,
sha256 = "cdc0b4b188f944dddd4430bcd6f6266ca1aaf8c33940d7bee1ed63fc962d8525",
urls = ["https://repo1.maven.org/maven2/us/hebi/quickbuf/protoc-gen-quickbuf/1.3.3/protoc-gen-quickbuf-1.3.3-osx-x86_64.exe"],
)
http_file(
name = "quickbuffer_protoc_osx_aarch64",
executable = True,
sha256 = "95fa0a22ad2d9fa8f84a31cf3a0670b18c0ad954f73035f60cfb77c2814fb41c",
urls = ["https://repo1.maven.org/maven2/us/hebi/quickbuf/protoc-gen-quickbuf/1.3.3/protoc-gen-quickbuf-1.3.3-osx-aarch_64.exe"],
)
http_file(
name = "quickbuffer_protoc_windows",
executable = True,
sha256 = "8a30b2eaebefbedc3b592118670de1ab6ea1aa19dcf8cdab220e25485ccd4a0a",
urls = ["https://repo1.maven.org/maven2/us/hebi/quickbuf/protoc-gen-quickbuf/1.3.3/protoc-gen-quickbuf-1.3.3-windows-x86_64.exe"],
)
bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2025-1.bcr6")
archive_override(
module_name = "rules_bzlmodrio_toolchains",
integrity = "sha256-ECtFB2KOlySwweRBcndiw0TkAXD2WsYFFhaBeOozqJo=",
urls = ["https://github.com/wpilibsuite/rules_bzlmodrio_toolchains/releases/download/2025-1.bcr6/rules_bzlmodrio_toolchains-2025-1.bcr6.tar.gz"],
)
bazel_dep(name = "protobuf", version = "32.1", repo_name = "com_google_protobuf")
http_jar = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
http_jar(
name = "com_github_google_copybara",
integrity = "sha256-IHW6y6WXJFjX9RYD+IwVAMwAbEo36fLqonIKR+FaqpQ=",
urls = ["https://github.com/google/copybara/releases/download/v20251027/copybara_deploy.jar"],
)

1168
MODULE.bazel.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -14,100 +14,82 @@ The development repository is where development releases of every commit to [mai
## Artifact classifiers
We provide two base types of artifacts.
The first types are Java artifacts. These are usually published as `jar` files. Usually, the actual jar file is published with no classifier. The sources are published with the `-sources` classifier, and the javadocs are published with the `-javadoc` classifier.
The second types are native artifacts. These are usually published as `zip` files (except for the `JNI` artifact types, which are `jar` files. See below for information on this). The `-sources` and `-headers` classifiers contain the sources and headers respecively for the library. Each artifact also contains a classifier for each platform we publish. This platform is in the format `{os}{arch}`. The platform artifact only contains the binaries for a specific platform. In addition, we provide a `-all` classifier. This classifer combines all of the platform artifacts into a single artifact. This is useful for tools that cannot determine what version to use during builds. However, we recommend using the platform specific classifier when possible. Note that the binary artifacts never contain the headers, you always need the `-headers` classifier to get those.
## Artifact Names
WPILib builds four different types of artifacts.
##### C++ Only Libraries
When we publish C++ only libraries, they are published with the base artifact name as their artifact name, with a `-cpp` extension. All dependencies for the library are linked as shared libraries to the binary.
The first types are Java artifacts. These are usually published as `jar` files. Usually, the actual jar file is published with no classifier. The sources are published with the `-sources` classifier, and the javadocs are published with the `-javadoc` classifier. These artifacts are published with the base artifact name as their artifact ID, with a `-java` extension.
Example:
```
edu.wpi.first.wpilibc:wpilibc-cpp:version:classifier@zip
org.wpilib.wpilibj:wpilibj-java:version
```
#### Java Only Libraries
When we publish Java only libraries, they are published with the base artifact name as their artifact name, with a `-java` extension.
The second types are native artifacts. These are usually published as `zip` files. The `-sources` and `-headers` classifiers contain the sources and headers respectively for the library. Each artifact also contains a classifier for each platform we publish. This platform is in the format `{os}{arch}`. The full list of supported platforms can be found in [native-utils in the Platforms nested class](https://github.com/wpilibsuite/native-utils/blob/main/src/main/java/org/wpilib/nativeutils/WPINativeUtilsExtension.java). If the library is built statically, it will have `static` appended to the classifier. Additionally, if the library was built in debug mode, `debug` will be appended to the classifier. The platform artifact only contains the binaries for a specific platform. Note that the binary artifacts never contain the headers, you always need the `-headers` classifier to get those.
If the library is Java and C++ and has a JNI component, the native artifact will have a shared library containing JNI entrypoints alongside the C++ shared library. This JNI shared library will have a `jni` suffix in the file name.
Native artifacts are published with the base artifact name as their artifact ID, with a `-cpp` extension.
Example:
```
edu.wpi.first.wpilibj:wpilibj-java:version
```
#### C++/Java Libraries without JNI
For libraries that are both C++ and Java, but without a JNI component, the C++ component is published with the `basename-cpp` artifact name, and the Java component is published with the `basename-java` artifact name.
Example:
```
edu.wpi.first.wpiutil:wpiutil-cpp:version:classifier@zip (C++)
edu.wpi.first.wpiutil:wpiutil-java:version (Java)
```
#### C++/Java Libraries with JNI
For libraries that are both C++ and Java with a JNI component there are three different artifact names. For Java, the component is published as `basename-java`. For C++, the `basename-cpp` artifact contains the C++ artifacts with all dependencies linked as shared libraries to the binary. These binaries DO contain the JNI entry points. The `basename-jni` artifact contains identical C++ binaries to the `-cpp` artifact, however all of its dependencies are statically linked, and only the JNI and C entry points are exported.
The `-jni` artifact should only be used in cases where you want to create a self contained Java application where the native artifacts are embedded in the jar. Note in an extraction scenario, extending off of the library is never supported, which is why the C++ entry points are not exposed. The name of the library is randomly generated during extraction. For pretty much all cases, and if you ever want to extend from a native library, you should use the `-cpp` artifacts. GradleRIO uses the `-cpp` artifacts for all platforms, even desktop, for this reason.
Example:
```
edu.wpi.first.ntcore:ntcore-cpp:version:classifier@zip (C++)
edu.wpi.first.ntcore:ntcore-jni:version:classifier (JNI jar library)
edu.wpi.first.ntcore:ntcore-java:version (Java)
org.wpilib.wpimath:wpimath-cpp:version:classifier@zip
org.wpilib.wpimath:wpimath-cpp:version:windowsx86-64staticdebug@zip
```
## Provided Artifacts
This repository provides the following artifacts. Below each artifact is its dependencies. Note if ever using the `-jni` artifacts, no dependencies are needed for native binaries.
This repository provides the following artifacts. Below each artifact is its dependencies.
For C++, if building with static dependencies, the listed order should be the link order in your linker.
All artifacts are based at `edu.wpi.first.artifactname` in the repository.
All artifacts are based at `org.wpilib.artifactname` in the repository.
* wpiutil
* wpigui
* imgui
* ntcore
* wpiutil
* wpimath
* wpiutil
* glass/libglass
* wpinet
* wpiutil
* wpimath
* ntcore
* wpinet
* wpiutil
* glass/libglass
* wpigui
* wpimath
* wpiutil
* glass/libglassnt
* wpiutil
* ntcore
* wpimath
* wpigui
* ntcore
* wpinet
* wpimath
* wpiutil
* hal
* ntcore
* wpiutil
* halsim
* wpiutil
* libglassnt
* libglass
* ntcore
* wpimath
* wpigui
* libglass
* libglassnt
* wpinet
* wpiutil
* cscore
* opencv
* wpinet
* wpiutil
* cameraserver
* ntcore
* cscore
* opencv
* wpinet
* wpiutil
* wpilibj
@@ -115,6 +97,7 @@ All artifacts are based at `edu.wpi.first.artifactname` in the repository.
* cameraserver
* ntcore
* cscore
* wpinet
* wpiutil
* wpilibc
@@ -123,33 +106,37 @@ All artifacts are based at `edu.wpi.first.artifactname` in the repository.
* ntcore
* cscore
* wpimath
* wpinet
* wpiutil
* wpilibNewCommands
* commandsv2
* wpilibc
* hal
* cameraserver
* ntcore
* cscore
* wpimath
* wpinet
* wpiutil
* wpilibOldCommands
* wpilibc
* hal
* cameraserver
* ntcore
* cscore
* wpiutil
* wpiunits
* apriltag
* wpiutil
* wpimath
### Third Party Artifacts
This repository provides the builds of the following third party software.
All artifacts are based at `edu.wpi.first.thirdparty.frcYEAR` in the repository.
This repository provides the builds of the following third party software:
* googletest
* imgui
* opencv
* libssh
Other software can be found in their corresponding GitHub repositories:
* ceres: https://github.com/wpilibsuite/thirdparty-ceres
* gtsam: https://github.com/wpilibsuite/thirdparty-gtsam
* opencv: https://github.com/wpilibsuite/thirdparty-opencv
* libssh: https://github.com/wpilibsuite/thirdparty-libssh
All artifacts are based at `org.wpilib.thirdparty` in the repository.

View File

@@ -1,93 +0,0 @@
# Installing Development Builds
This article contains instructions on building projects using a development build and a local WPILib build.
**Note:** This only applies to Java/C++ teams.
## Development Build
Development builds are the per-commit build hosted everytime a commit is pushed to the [allwpilib](https://github.com/wpilibsuite/allwpilib/) repository. These builds are then hosted on [artifactory](https://frcmaven.wpi.edu/artifactory/webapp/#/home).
In order to build a project using a development build, find the build.gradle file and open it. Then, add the following code below the plugin section and replace YEAR with the year of the development version.
```groovy
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.+'
wpi.versions.wpimathVersion = 'YEAR.+
```
The top of your ``build.gradle`` file should now look similar to the code below. Ignore any differences in versions.
Java
```groovy
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2022.1.1"
}
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = '2022.+'
wpi.versions.wpimathVersion = '2022.+'
```
C++
```groovy
plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2022.1.1"
}
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = '2022.+'
wpi.versions.wpimathVersion = '2022.+'
```
## Local Build
Building with a local build is very similar to building with a development build. Ensure you have built and published WPILib by following the instructions attached [here](https://github.com/wpilibsuite/allwpilib#building-wpilib). Next, find the ``build.gradle`` file in your robot project and open it. Then, add the following code below the plugin section and replace ``YEAR`` with the year of the local version.
Java
```groovy
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2022.1.1"
}
wpi.maven.useLocal = false
wpi.maven.useFrcMavenLocalDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.424242.+'
wpi.versions.wpimathVersion = 'YEAR.424242.+'
```
C++
```groovy
plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2022.1.1"
}
wpi.maven.useLocal = false
wpi.maven.useFrcMavenLocalDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.424242.+'
wpi.versions.wpimathVersion = 'YEAR.424242.+'
```
# roboRIO Development
This repo contains a myRobot project built in way to do full project development without needing to do a full publish into GradleRIO. These also only require building the minimum amount of binaries for the roboRIO, so the builds are much faster as well.
The setup only works if the roboRIO is USB connected. If an alternate IP address is preferred, the `address` block in myRobot\build.gradle can be changed to point to another address.
The following 3 tasks can be used for deployment:
* `:myRobot:deployShared` deploys the C++ project using shared dependencies. Prefer this one for most C++ development.
* `:myRobot:deployStatic` deploys the C++ project with all dependencies statically linked.
* `:myRobot:deployJava` deploys the Java project and all required dependencies. Also installs the JRE if not currently installed.
Deploying any of these to the roboRIO will disable the current startup project until it is redeployed.
From here, ssh into the roboRIO using the `admin` account (`lvuser` will fail to run in many cases). In the admin home directory, a file for each deploy type will exist (`myRobotCpp`, `myRobotCppStatic` and `myRobotJavaRun`). These can be run to start up the corresponding project.

55
README-Bazel.md Normal file
View File

@@ -0,0 +1,55 @@
# WPILib Bazel Support
WPILib is normally built with Gradle, but [Bazel](https://www.bazel.build/) can also be used to increase development speed due to the superior caching ability and the ability to use remote caching and remote execution (on select platforms).
## Prerequisites
- Install [Bazelisk](https://github.com/bazelbuild/bazelisk/releases) and add it to your path. Bazelisk is a wrapper that will download the correct version of Bazel specified in the repository. Note: You can alias/rename the binary to `bazel` if you want to keep the familiar `bazel build` vs `bazelisk build` syntax.
## Building
To build the entire repository, simply run `bazel build //...`. To run all of the unit tests, run `bazel test //...`
Other examples:
- `bazel build //wpimath/...` - Builds every target in the wpimath folder
- `bazel test //wpiutil:wpiutil-cpp-test` - Runs only the cpp test target in the wpiutil folder
- `bazel coverage //wpiutil/...` - (*Nix only) - Runs a code coverage report for both C++ and Java on all the targets under wpiutil
## User settings
When invoking Bazel, it will check if `user.bazelrc` exists for additional, user specified flags. You can use these settings to do things like always ignore builds in a specific folder, or limiting the CPU/RAM usage during a build.
Examples:
- `build --build_tag_filters=-wpi-example` - Do not build any targets tagged with `wpi-example` (Currently all of the targets in wpilibcExamples and wpilibjExamples contain this tag)
- `build -c opt` - Always build optimized targets. The default compiler flags were chosen to build as fast as possible, and thus don't contain many optimizations
- `build -k` - `-k` is analogous to the MAKE flag `--keep-going`, so the build will not stop on the first error.
- ```
build --local_resources=memory=HOST_RAM*.5 # Don't use more than half my RAM when building
build --local_resources=cpu=HOST_CPUS-1 # Leave one core alone
```
Bazel's RAM usage estimation is simplistic and hardcoded, so limiting the allowed number of CPU cores is the best way to reduce memory usage if it becomes a problem.
The default settings build all the release artifact variants relevant for your platform. The overall list of options ends up being, essentially, all the variants of (linux, osx, windows) x (debug, release) x (static, shared) x (aarch64, x86). OSX and Windows are hard to compile for from any other OS, so we by default build for your local OS and the system core, with all the variants.
This can be a bit expensive. If you would like to build a subset, you can specify the repo environmental variable, `WPI_PUBLISH_CLASSIFIER_FILTER`, and pick what you build for. The default is, in the .bazelrc file,
```
common --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsarm64,windowsarm64debug,windowsarm64static,windowsarm64staticdebug,windowsx86-64,windowsx86-64debug,windowsx86-64static,windowsx86-64staticdebug"
```
Modify this to your likings if you want to build less.
## Pregenerating Files
allwpilib uses extensive use of pre-generating files that are later used to build C++ / Java libraries that are tracked by version control. Quite often,
these pre-generation scripts use some configuration file to create multiple files inside of an output directory. While this process could be accomplished
with a `genrule` that would require an explicit listing of every output file, which would be tedious to maintain as well as potentially confusing to people
adding new features those libraries. Therefore, we use `@aspect_bazel_lib` and their `write_source_files` feature to generate these directories. In the event that the generation process creates more than a small handful of predictable files, a custom rule is written to generate the directory.
## Remote Caching
One of the huge benefits of Bazel is its remote caching ability. However, due to Bazel's strict build definitions, it is hard to share remote cache artifacts between different computers unless our toolchains are fully hermetic, which means you are unlikely to be able to reuse the cache artifacts published from the `main` branch on your local machine like you might be able to with the `gradle` or `cmake` caches. Luckily, the GitHub Actions CI machines are generally stable between runs and can reuse cache artifacts, and your local machine should remain stable, so if you set up a free buildbuddy account you can have your fork's CI actions be able to use a personalized cache, as well as your local machine.
For the main `allwpilib` upstream, the cache is only updated on the main branch; pull requests from forks will not be able to modify the cache. However, you can set up your fork to enable its own cache by following the steps below.
### Setting Up API keys
Follow the [buildbuddy authentication](https://www.buildbuddy.io/docs/guide-auth) guide to create keys. For your local machine, it is recommended that you place the following configuration line in either a `user.bazelrc` or `bazel_auth.rc` file in the repositories root directory.
```
build --remote_header=<your api key>
```
To get your forks CI actions using your own buildbuddy cache, follow [GitHub's](https://docs.github.com/en/actions/how-tos/security-for-github-actions/security-guides/using-secrets-in-github-actions) documentation for setting up a repository secret. The secrets key should be `BUILDBUDDY_API_KEY`, and the value should be your buildbuddy API key.

View File

@@ -1,151 +0,0 @@
# WPILib CMake Support
WPILib is normally built with Gradle, however for some systems, such as Linux based coprocessors, Gradle doesn't work correctly, especially if cscore is needed, which requires OpenCV. Furthermore, the CMake build can be used for C++ development because it provides better build caching compared to Gradle. We provide the CMake build for these cases. Although it is supported on Windows, these docs will only go over Linux builds.
## Libraries that get built
* wpiutil
* ntcore
* cscore
* cameraserver
* hal
* wpilib
* halsim
* wpigui
* wpimath
By default, all libraries except for the HAL and WPILib get built with a default CMake setup. The libraries are built as shared libraries, and include the JNI libraries as well as building the Java JARs.
## Prerequisites
The most common prerequisite is going to be OpenCV. OpenCV needs to be findable by CMake. On systems like the Jetson, this is installed by default. Otherwise, you will need to build OpenCV from source and install it.
In addition, if you want JNI and Java, you will need a JDK of at least version 11 installed. In addition, you need a `JAVA_HOME` environment variable set properly and set to the JDK directory.
If you are building with unit tests or simulation modules, you will also need an Internet connection for the initial setup process, as CMake will clone google-test and imgui from GitHub.
## Build Options
The following build options are available:
* `WITH_JAVA` (ON Default)
* This option will enable Java and JNI builds. If this is on, `WITH_SHARED_LIBS` must be on. Otherwise CMake will error.
* `WITH_SHARED_LIBS` (ON Default)
* This option will cause cmake to build static libraries instead of shared libraries. If this is off, `WITH_JAVA` must be off. Otherwise CMake will error.
* `WITH_TESTS` (ON Default)
* This option will build C++ unit tests. These can be run via `make test`.
* `WITH_CSCORE` (ON Default)
* This option will cause cscore to be built. Turning this off will implicitly disable cameraserver, the hal and wpilib as well, irrespective of their specific options. If this is off, the OpenCV build requirement is removed.
* `WITH_WPIMATH` (ON Default)
* This option will build the wpimath library. This option must be on to build wpilib.
* `WITH_WPILIB` (ON Default)
* This option will build the hal and wpilibc/j during the build. The HAL is the simulator hal, unless the external hal options are used. The cmake build has no capability to build for the RoboRIO.
* `WITH_SIMULATION_MODULES` (ON Default)
* This option will build simulation modules, including wpigui and the HALSim plugins.
* `WITH_EXTERNAL_HAL` (OFF Default)
* TODO
* `EXTERNAL_HAL_FILE`
* TODO
* `OPENCV_JAVA_INSTALL_DIR`
* Set this option to the location of the archive of the OpenCV Java bindings (it should be called opencv-xxx.jar, with the x'es being version numbers). NOTE: set it to the LOCATION of the file, not the file itself!
## Build Setup
The WPILib CMake build does not allow in source builds. Because the `build` directory is used by Gradle, we recommend a `build-cmake` directory in the root. This folder is included in the gitignore.
Once you have a build folder, run CMake configuration in that build directory with the following command.
```
cmake path/to/allwpilib/root
```
If you want to change any of the options, add `-DOPTIONHERE=VALUE` to the `cmake` command. This will check for any dependencies. If everything works properly this will succeed. If not, please check out the troubleshooting section for help.
If you want, you can also use `ccmake` in order to visually set these properties as well. [Here](https://cmake.org/cmake/help/v3.0/manual/ccmake.1.html) is the link to the documentation for that program.
## Building
Once you have cmake setup. run `make` from the directory you configured CMake in. This will build all libraries possible. If you have a multicore system, we recommend running `make` with multiple jobs. The usual rule of thumb is 1.5x the number of cores you have. To run a multiple job build, run the following command with x being the number of jobs you want.
```
make -jx
```
The `ninja` generator is also supported, and can be enabled by passing `-GNinja` to the initial `cmake` command.
## Installing
After build, the easiest way to use the libraries is to install them. Run the following command to install the libraries. This will install them so that they can be used from external cmake projects.
```
sudo make install
```
## Using the installed libraries for C++.
Using the libraries from C++ is the easiest way to use the built libraries.
To do so, create a new folder to contain your project. Add the following code below to a `CMakeLists.txt` file in that directory.
```
cmake_minimum_required(VERSION 3.5)
project(vision_app) # Project Name Here
find_package(wpilib REQUIRED)
add_executable(my_vision_app main.cpp) # executable name as first parameter
target_link_libraries(my_vision_app cameraserver ntcore cscore wpiutil)
```
If you are using them, `wpilibc` and `hal` should be added before the `cameraserver` declaration in the `target_link_libraries` function.
Add a `main.cpp` file to contain your code, and create a build folder. Move into the build folder, and run
```
cmake /path/to/folder/containing/CMakeLists
```
After that, run `make`. That will create your executable. Then you should be able to run `./my_vision_app` to run your application.
## Using the installed libraries for Java
TODO
## Troubleshooting
Below are some common issues that are run into when building.
#### Missing OpenCV
If you are missing OpenCV, you will get an error message similar to this.
```
CMake Error at cscore/CMakeLists.txt:3 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
```
If you get that, you need make sure opencv was installed, and then reattempt to configure. If that doesn't work, set the `OpenCV_DIR` variable to the directory where you built OpenCV.
#### Missing Java
If you are missing Java, you will get a message like the following.
```
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE
Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
```
If this happens, make sure you have a JDK of at least version 8 installed, and that your JAVA_HOME variable is set properly to point to the JDK.
In addition, if you do not need Java, you can disable it with `-DWITH_JAVA=OFF`.

163
README-CMake.md Normal file
View File

@@ -0,0 +1,163 @@
# WPILib CMake Support
WPILib is normally built with Gradle, however for some systems, such as Linux based coprocessors, Gradle doesn't work correctly, especially if cscore is needed, which requires OpenCV. Furthermore, the CMake build can be used for C++ development because it provides better build caching compared to Gradle. We provide the CMake build for these cases. Although macOS is supported, these docs will only go over Linux and Windows builds, but should mostly work for macOS as well. If you are stuck, you can look at the GitHub workflows for any OS to see how it works. The CMake build does not build Java or Python, only C++.
## Libraries that get built
* apriltag
* cameraserver
* commandsv2
* cscore
* datalog
* fields
* hal (simulation HAL only)
* ntcore
* romiVendordep
* simulation extensions
* wpigui
* wpilib (wpilibc, wpilibj, and developerRobot)
* wpimath
* wpinet
* wpiutil
* xrpVendordep
## GUI apps that get built
* datalogtool
* glass
* outlineviewer
* sysid
* wpical
* halsim_gui (if simulation extensions are enabled)
By default, all libraries get built with a default CMake setup. The libraries are built as shared libraries. Data Log Tool is only built if libssh is available.
## Prerequisites
OpenCV needs to be findable by CMake. On systems like the Jetson, this is installed by default. Otherwise, you will need to build OpenCV from source and install it.
## Build Options
The following build options are available:
* `BUILD_SHARED_LIBS` (ON Default)
* This option will cause CMake to build static libraries instead of shared libraries.
* `WITH_CSCORE` (ON Default)
* This option will cause cscore to be built. Turning this off will implicitly disable cameraserver. If this is off, the OpenCV build requirement is removed.
* `WITH_EXAMPLES` (OFF Default)
* This option will build C++ examples.
* `WITH_GUI` (ON Default)
* This option will build GUI items. If this is off, and `WITH_SIMULATION_MODULES` is on, the simulation GUI will not be built.
* `WITH_NTCORE` (ON Default)
* This option will cause ntcore to be built. Turning this off will implicitly disable wpinet, and will cause an error if `WITH_WPILIB` is enabled.
* `WITH_SIMULATION_MODULES` (ON Default)
* This option will build simulation modules.
* `WITH_TESTS` (ON Default)
* This option will build C++ unit tests. These can be run via `ctest -C <config>`, where `<config>` is the build configuration, e.g. `Debug` or `Release`.
* `WITH_WPILIB` (ON Default)
* This option will build the HAL and wpilibc during the build. The HAL is the simulation HAL, unless the external HAL options are used. The CMake build has no capability to build for Systemcore.
* `WITH_WPIMATH` (ON Default)
* This option will build the wpimath library. This option must be on to build wpilib.
* `NO_WERROR` (OFF Default)
* This option will disable the `-Werror` compilation flag for non-MSVC builds.
* `WPILIB_TARGET_WARNINGS`
* Add compiler flags to this option to customize compiler options like warnings.
## Build Setup
The WPILib CMake build does not allow in source builds. Because the `build` directory is used by Gradle, we recommend a `build-cmake` directory in the root. This folder is included in the gitignore. We support building with Ninja; other options like Makefiles may be broken.
Once you have a build folder, run CMake configuration in the root directory with the following command.
```
cmake --preset default
```
If you want to change any of the options, add `-DOPTIONHERE=VALUE` to the `cmake` command. This will check for any dependencies. If everything works properly this will succeed. If not, please check out the troubleshooting section for help.
If you want, you can also use `ccmake` in order to visually set these properties as well. [Here](https://cmake.org/cmake/help/v3.0/manual/ccmake.1.html) is the link to the documentation for that program. On Windows, you can use `cmake-gui` instead.
## Presets
The WPILib CMake setup has a variety of presets for common configurations and options used. The default sets the generator to Ninja and build directory to `build-cmake`. The other preset is `sccache` (sets the C/C++ compiler launcher to sccache).
## Building
Once you have CMake setup. run `cmake --build .` from the directory you configured CMake in. This will build all libraries possible. We recommend running `cmake --build .` with multiple jobs. For allwpilib, a good rule of thumb is one worker for every 2 GB of available RAM. To run a multi-job build, run the following command with x being the number of jobs you want.
```
cmake --build . --parallel x
```
Note: wpimath takes gigabytes of RAM to compile. Because of this, the compilers may crash while building due to a lack of memory and your computer may slow down. If you have less than 16 GB of RAM available, you may want to consider building it separately first by adding `--target wpimath` and running it with ~3 jobs to prevent crashes from running out of memory.
To build with a certain configuration, like `Debug` or `Release`, add `--config <config>`, where `<config>` is the name of the configuration you want to build with.
## Installing
After build, the easiest way to use the libraries is to install them. Run the following command to install the libraries. This will install them so that they can be used from external CMake projects.
```
sudo cmake --build . --target install
```
## Preparing to use the installed libraries
On Windows, make sure the directories for the libraries you built are on PATH. For wpilib, the default install location is `C:\Program Files (x86)\allwpilib`. If you built other libraries like OpenCV from source, install them, and add the install directories to PATH. This ensures CMake can locate the libraries.
You will also want to add the directories where the DLLs are located (usually the `bin` subdirectory of the install directory) to PATH so they can be loaded by your program.
## Using the installed libraries for C++.
Using the libraries from C++ is the easiest way to use the built libraries.
To do so, create a new folder to contain your project. Add the following code below to a `CMakeLists.txt` file in that directory.
```cmake
cmake_minimum_required(VERSION 3.11)
project(vision_app) # Project Name Here
find_package(wpilib REQUIRED)
add_executable(my_vision_app main.cpp) # executable name as first parameter
target_link_libraries(my_vision_app cameraserver ntcore cscore wpiutil)
```
If you want to use other libraries or are building a robot program, `wpilibc` and `hal` should be added in the `target_link_libraries` function, along with any other libraries you plan on using, e.g. `wpimath`.
Add a `main.cpp` file to contain your code, and create a build folder. Move into the build folder, and run
```
cmake /path/to/folder/containing/CMakeLists
```
After that, run `cmake --build .`. That will create your executable. Then you should be able to run `./my_vision_app` to run your application.
## Using vendordeps
Vendordeps are not included as part of the `wpilib` CMake package. However, if you want to use a vendordep, you need to use `find_package(VENDORDEP)`, where `VENDORDEP` is the name of the vendordep (case-sensitive), like `xrpVendordep` or `romiVendordep`. Note that commandsv2, while a vendordep in normal robot projects, is not built as a vendordep in CMake, and is instead included as part of the `wpilib` CMake package. After you used `find_package`, you can reference the vendordep library like normal (using `target_link_libraries`).
## Troubleshooting
Below are some common issues that are run into when building.
#### Missing OpenCV
If you are missing OpenCV, you will get an error message similar to this.
```
CMake Error at cscore/CMakeLists.txt:3 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
```
If you get that, you need make sure OpenCV was installed, and then reattempt to configure. If that doesn't work, set the `OpenCV_DIR` variable to the directory where you built OpenCV.

96
README-RobotPy.md Normal file
View File

@@ -0,0 +1,96 @@
# robotpy in allwpilib
allwpilib hosts a mirror of RobotPy that can be built with Bazel on Linux. The intent of the mirror is to have breaking changes identified early and fixed by the PR creator so that when WPILib releases are made, there is much less work required to release a RobotPy version that wraps it. It is not a goal for allwpilib to replace the RobotPy repo; it will still be considered the "source of truth" for Python builds and will be responsible for building against all of the applicable architectures and multiple versions of Python.
## Build Process
The upstream RobotPy repository uses TOML configuration files and semiwrap to produce Meson build scripts. The allwpilib fork uses these TOML configuration files to auto-generate Bazel build scripts. In general, each project (wpiutil, wpimath, etc) defines two pybind extensions; one that simply wraps the native library, and another that adds extension(s) that and contains all of the Python files for the library. Both of these subprojects have auto-generated build files; a `robotpy_native_build_info.bzl` for the native wrapper and `robotpy_pybind_build_info.bzl` which defines the extensions and Python library.
## Disabling RobotPy builds
Building the RobotPy software on top of the standard C++/Java software can result in more than doubling the amount of time it takes to compile. To skip building the RobotPy tooling, you can add `--config=skip_robotpy` to the command line or to your `user.bazelrc`.
# Syncing with RobotPy
[Copybara](https://github.com/google/copybara) is used to maintain synchronization between the upstream RobotPy repositories and the allwpilib mirror. GitHub Actions can be manually run, which will create pull requests that will update all of the RobotPy files between the two repositories. The ideal process is that the allwpilib mirror is always building in CI, and once a release is created, the RobotPy team can run the `wpilib -> robotpy` Copybara task, make any fine tuned adjustments and create their release. In the event that additional changes are made on the RobotPy side, they can run the `robotpy -> wpilib` task to push the updates back to the mirror. However, the goal of the mirroring the software here is to be able to more rapidly test changes and will hopefully overwhelmingly eliminate the need for syncs in this direction.
## Creating a user config
The Copybara scripts needs to know information about what repositories it will be pushing the synced changes to. These can be specified on the command line, or you can create a `shared/bazel/copybara/.copybara.json` config file to save your personalized settings to avoid having to type things out every time. To run the full suite of migrations, you need a fork of [allwpilib](https://github.com/wpilibsuite/allwpilib), a fork of [mostrobotpy](https://github.com/robotpy/mostrobotpy), and a fork of RobotPy's [commands-v2](https://github.com/robotpy/robotpy-commands-v2). If you only wish to run a subset of commands (i.e. not sync the commands project), you do not need to include that in your user config.
Example config:
```json
{
"mostrobotpy_local_repo_path": "/home/<username>/git/robotpy/robotpy_monorepo/mostrobotpy",
"mostrobotpy_fork_repo": "https://github.com/<username>/mostrobotpy.git",
"allwpilib_fork_repo": "https://github.com/<username>/allwpilib.git",
"robotpy_commandsv2_fork_repo": "https://github.com/<username>/robotpy-commands-v2.git"
}
```
## Running syncs
- **Pulling changes from mostrobotpy**:
`python3 shared/bazel/copybara/run_copybara.py mostrobotpy_to_allwpilib`
- **Pulling changes from the commands library**:
`python3 shared/bazel/copybara/run_copybara.py commandsv2_to_allwpilib`
- **Pushing changes to the commands library**:
`python3 shared/bazel/copybara/run_copybara.py allwpilib_to_commandsv2`
- **Pushing changes to mostrobotpy**:
This process is slightly more complicated, because you will almost certainly also need to update the Maven artifacts that mostrobopy is using. Because of this, you must also specify the version number that has been published to WPILib's Maven repository. If you are trying to get an early, non-released development build pushed over, you can also add the `--development_build` flag:
`python3 shared/bazel/copybara/run_copybara.py allwpilib_to_mostrobotpy --wpilib_bin_version=2027.0.0-alpha-3-86-g418b381 --development_build -y`
# Debugging Build Errors
The build process is highly automated and automatically parses C++ header files to generate pybind11 bindings. Some of these steps here are considered "pregeneration" steps, and the Bazel build system will update build files as necessary. If a new header is added, or if the contents of a header file has changed, some of the pregeneration scripts might need to be run. If you encounter an error building `robotpy` code, it is recommended that you go through these steps to make sure everything is set up correctly. The examples are for `wpilibc`, but similar build tasks and tests exist for each wrapped project.
## 1. scan-headers
This can be the first source of problems if a new header file has been added. `semiwrap` will look through all of the headers for a library and notify you if a file is not covered by the projects `pyproject.toml` file. Bazel has a test case to ensure the files are up to date.
An example test failure when a new header being introduced. You can run the test with the following command:
bazel run //wpilibc:robotpy-wpilib-scan-headers
```
# wpi
ExpansionHub = "wpi/ExpansionHub.hpp"
ExpansionHubCRServo = "wpi/ExpansionHubCRServo.hpp"
ExpansionHubMotor = "wpi/ExpansionHubMotor.hpp"
ExpansionHubPidConstants = "wpi/ExpansionHubPidConstants.hpp"
ExpansionHubServo = "wpi/ExpansionHubServo.hpp"
```
To fix this, you can copy the lines from the console, and add them to the pyproject.toml file, located here `wpilibc/src/main/python/pyproject.toml`
## 2. update-yaml
This process parses all of the header files, and creates a representation of the classes / enums / etc in YAML. Occasionally, some functions might be ignored or need custom pybind code, which can be added to these files by the user.
There is a Bazel task that you can run to automatically update the files:
`bazel run //wpilibc:write_robotpy-wpilib-update-yaml`
## 3. generate-build-info
This step takes the yaml files, and auto-generates a Bazel build script for the library.
There is a Bazel task that you can run to automatically update the files:
`bazel run //wpilibc:robotpy-wpilib-generator.generate_build_info`
## semiwrap errors
If all of the above steps go smoothly and have their tests pass, but the generated cpp files still won't compile, it is possible that either an update needs to be made to the semiwrap tool to handle the new complex functionality, the new functionality can be ignored, or the new functionality might be better handled with a custom pybind11 implementation. In any case, it is best to reach out to the RobotPy team for guidance.
## Running multiple projects at once
Each project has its own `scan-headers` and various pregeneration tools, but you can run all of them at once with the following commands. Note: Sometimes if something in the dependency chain for a library fails, these amalgamation commands will also fail. If that happens, fix your way up the dependency chain project by project.
```
# Scan Headers
bazel test //... -k --test_tag_filters=robotpy_scan_headers --build_tests_only
# All pregen
bazel run //:write_robotpy_files
```

148
README.md
View File

@@ -1,10 +1,11 @@
# WPILib Project
![CI](https://github.com/wpilibsuite/allwpilib/workflows/CI/badge.svg)
[![C++ Documentation](https://img.shields.io/badge/documentation-c%2B%2B-blue)](https://first.wpi.edu/wpilib/allwpilib/docs/development/cpp/)
[![Java Documentation](https://img.shields.io/badge/documentation-java-orange)](https://first.wpi.edu/wpilib/allwpilib/docs/development/java/)
[![Gradle](https://github.com/wpilibsuite/allwpilib/actions/workflows/gradle.yml/badge.svg?branch=main)](https://github.com/wpilibsuite/allwpilib/actions/workflows/gradle.yml)
[![C++ Documentation](https://img.shields.io/badge/documentation-c%2B%2B-blue)](https://github.wpilib.org/allwpilib/docs/development/cpp/)
[![Java Documentation](https://img.shields.io/badge/documentation-java-orange)](https://github.wpilib.org/allwpilib/docs/development/java/)
[![Python Documentation](https://img.shields.io/badge/documentation-python-blue)](https://robotpy.readthedocs.io/projects/robotpy/en/latest/)
Welcome to the WPILib project. This repository contains the HAL, WPILibJ, and WPILibC projects. These are the core libraries for creating robot programs for the roboRIO.
Welcome to the WPILib project. This repository contains the HAL, CameraServer, Commands (v2 and v3), NTCore, WPIMath, and WPILib projects. These are the core libraries for creating robot programs for Systemcore.
- [WPILib Project](#wpilib-project)
- [WPILib Mission](#wpilib-mission)
@@ -15,41 +16,55 @@ Welcome to the WPILib project. This repository contains the HAL, WPILibJ, and WP
- [Faster builds](#faster-builds)
- [Using Development Builds](#using-development-builds)
- [Custom toolchain location](#custom-toolchain-location)
- [Gazebo simulation](#gazebo-simulation)
- [Formatting/linting with wpiformat](#formattinglinting-with-wpiformat)
- [Formatting/Linting](#formattinglinting)
- [CMake](#cmake)
- [Bazel](#bazel)
- [Running examples in simulation](#running-examples-in-simulation)
- [Publishing](#publishing)
- [Structure and Organization](#structure-and-organization)
- [Contributing to WPILib](#contributing-to-wpilib)
- [Contributing to WPILib](./CONTRIBUTING.md)
## WPILib Mission
The WPILib Mission is to enable FIRST Robotics teams to focus on writing game-specific software rather than focusing on hardware details - "raise the floor, don't lower the ceiling". We work to enable teams with limited programming knowledge and/or mentor experience to be as successful as possible, while not hampering the abilities of teams with more advanced programming capabilities. We support Kit of Parts control system components directly in the library. We also strive to keep parity between major features of each language (Java, C++, and NI's LabVIEW), so that teams aren't at a disadvantage for choosing a specific programming language. WPILib is an open source project, licensed under the BSD 3-clause license. You can find a copy of the license [here](LICENSE.md).
The WPILib Mission is to enable FIRST Robotics Competition (FRC) and FIRST Tech Challenge (FTC) teams to focus on writing game-specific software rather than focusing on hardware details - "raise the floor, don't lower the ceiling". We work to enable teams with limited programming knowledge and/or mentor experience to be as successful as possible, while not hampering the abilities of teams with more advanced programming capabilities. We support the FRC Kit of Parts/FTC control system components directly in the library. We also strive to keep parity between major features of each language (Java, C++, and Python), so that teams aren't at a disadvantage for choosing a specific programming language. WPILib is an open source project, licensed under the BSD 3-clause license. You can find a copy of the license [here](LICENSE.md).
# Quick Start
Below is a list of instructions that guide you through cloning, building, publishing and using local allwpilib binaries in a robot project. This quick start is not intended as a replacement for the information further listed in this document.
1. Clone the repository with `git clone https://github.com/wpilibsuite/allwpilib.git`
2. Build the repository with `./gradlew build` or `./gradlew build --build-cache` if you have an internet connection
3. Publish the artifacts locally by running `./gradlew publish`
4. [Update your](DevelopmentBuilds.md) `build.gradle` [to use the artifacts](DevelopmentBuilds.md)
# Building WPILib
Using Gradle makes building WPILib very straightforward. It only has a few dependencies on outside tools, such as the ARM cross compiler for creating roboRIO binaries.
Using Gradle makes building WPILib very straightforward. It only has a few dependencies on outside tools, such as the ARM cross compiler for creating Systemcore binaries.
## Requirements
- [JDK 11](https://adoptopenjdk.net/)
- [JDK 25](https://adoptium.net/temurin/releases/?version=25)
- Note that the JRE is insufficient; the full JDK is required
- On Ubuntu, run `sudo apt install openjdk-11-jdk`
- On Windows, install the JDK 11 .msi from the link above
- On macOS, install the JDK 11 .pkg from the link above
- On Ubuntu, run `sudo apt install openjdk-25-jdk`
- On Windows, install the JDK 25 .msi from the link above
- On macOS, install the JDK 25 .pkg from the link above
- C++ compiler
- On Linux, install GCC 8 or greater
- On Windows, install [Visual Studio Community 2022 or 2019](https://visualstudio.microsoft.com/vs/community/) and select the C++ programming language during installation (Gradle can't use the build tools for Visual Studio)
- On macOS, install the Xcode command-line build tools via `xcode-select --install`
- ARM compiler toolchain
- Run `./gradlew installRoboRioToolchain` after cloning this repository
- If the WPILib installer was used, this toolchain is already installed
- On Linux, install GCC 11 or greater
- On Windows, install [Visual Studio Community 2022](https://visualstudio.microsoft.com/vs/community/) and select the C++ programming language during installation (Gradle can't use the build tools for Visual Studio)
- On macOS, install the Xcode command-line build tools via `xcode-select --install`. Xcode 14 or later is required.
- Raspberry Pi toolchain (optional)
- Run `./gradlew installRaspbianToolchain` after cloning this repository
- Run `./gradlew installArm64Toolchain` after cloning this repository
- Systemcore toolchain (required for Systemcore development)
- Run `./gradlew installSystemCoreToolchain` after cloning this repository
- If the WPILib installer was used, this toolchain is already installed
On macOS ARM, run `softwareupdate --install-rosetta`. This is necessary to be able to use the macOS x86 Systemcore toolchain on ARM.
On linux, run `sudo apt install libx11-dev libgl-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev` to be able to build things depending on glfw.
## Setup
Clone the WPILib repository and follow the instructions above for installing any required tooling.
Clone the WPILib repository and follow the instructions above for installing any required tooling. The build process uses versioning information from git. Downloading the source is not sufficient to run the build.
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/main/README.md) for wpiformat setup instructions.
@@ -77,45 +92,54 @@ If opening from a fresh clone, generated java dependencies will not exist. Most
`./gradlew build` builds _everything_, which includes debug and release builds for desktop and all installed cross compilers. Many developers don't need or want to build all of this. Therefore, common tasks have shortcuts to only build necessary components for common development and testing tasks.
`./gradlew testDesktopCpp` and `./gradlew testDesktopJava` will build and run the tests for `wpilibc` and `wpilibj` respectively. They will only build the minimum components required to run the tests.
`./gradlew testDesktopCpp` and `./gradlew testDesktopJava` will build and run the tests for `wpilibc` and `wpilibj` respectively. They will only build the minimum components required to run the tests. `./gradlew testDesktop` will run both `testDesktopJava` and `testDesktopCpp`.
`testDesktopCpp` and `testDesktopJava` tasks also exist for the projects `wpiutil`, `ntcore`, `cscore`, `hal` `wpilibOldCommands`, `wpilibNewCommands` and `cameraserver`. These can be ran with `./gradlew :projectName:task`.
`testDesktopCpp`, `testDesktopJava`, and `testDesktop` tasks also exist for the following projects:
- `apriltag`
- `cameraserver`
- `cscore`
- `hal`
- `ntcore`
- `commandsv2`
- `wpimath`
- `wpinet`
- `wpiunits`
- `wpiutil`
- `romiVendordep`
- `xrpVendordep`
These can be ran with `./gradlew :projectName:task`.
`./gradlew buildDesktopCpp` and `./gradlew buildDesktopJava` will compile `wpilibcExamples` and `wpilibjExamples` respectively. The results can't be ran, but they can compile.
### Build Cache
Run with `--build-cache` on the command-line to use the shared [build cache](https://docs.gradle.org/current/userguide/build_cache.html) artifacts generated by the continuous integration server. Example:
```bash
./gradlew build --build-cache
```
### Using Development Builds
Please read the documentation available [here](OtherVersions.md)
Please read the documentation available [here](DevelopmentBuilds.md)
### Custom toolchain location
If you have installed the FRC Toolchain to a directory other than the default, or if the Toolchain location is not on your System PATH, you can pass the `toolChainPath` property to specify where it is located. Example:
If you have installed the WPILib Toolchain to a directory other than the default, or if the Toolchain location is not on your System PATH, you can pass the `toolChainPath` property to specify where it is located. Example:
```bash
./gradlew build -PtoolChainPath=some/path/to/frc/toolchain/bin
./gradlew build -PtoolChainPath=some/path/to/wpilib/toolchain/bin
```
### Gazebo simulation
If you also want to force building Gazebo simulation support, add -PforceGazebo. This requires gazebo_transport. We have tested on 14.04 and 15.05, but any correct install of Gazebo should work, even on Windows if you build Gazebo from source. Correct means CMake needs to be able to find gazebo-config.cmake. See [The Gazebo website](https://gazebosim.org/) for installation instructions.
```bash
./gradlew build -PforceGazebo
```
If you prefer to use CMake directly, the you can still do so.
The common CMake tasks are wpilibcSim, frc_gazebo_plugins, and gz_msgs
```bash
mkdir build #run this in the root of allwpilib
cd build
cmake ..
make
```
### Formatting/linting
Once a PR has been submitted, formatting can be run in CI by commenting `/format` on the PR. A new commit will be pushed with the formatting changes.
> [!NOTE]
> The `/format` action has been temporarily disabled. The individual formatting commands can be run locally as shown below. Alternately, the Lint and Format action for a PR will upload a patch file that can be downloaded and applied manually.
#### wpiformat
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms.
@@ -126,9 +150,27 @@ The Java code quality tools Checkstyle, PMD, and Spotless can be run via `./grad
If you only want to run the Java autoformatter, run `./gradlew spotlessApply`.
### Generated files
Several files within WPILib are generated using Jinja. If a PR is opened that modifies these templates then the files can be generated through CI by commenting `/pregen` on the PR. A new commit will be pushed with the regenerated files. See [GeneratedFiles.md](GeneratedFiles.md) for more information.
### CMake
CMake is also supported for building. See [README-CMAKE.md](README-CMAKE.md).
CMake is also supported for building. See [README-CMake.md](README-CMake.md).
### Bazel
Bazel is also supported for building. See [README-Bazel.md](README-Bazel.md).
## Running examples in simulation
Examples can be run in simulation with the following command:
```bash
./gradlew wpilibcExamples:runExample
./gradlew wpilibjExamples:runExample
```
where `Example` is the example's folder name.
## Publishing
@@ -139,22 +181,16 @@ If you are building to test with other dependencies or just want to export the b
- stable - Publishes to ~/releases/maven/stable.
- release - Publishes to ~/releases/maven/release.
The maven artifacts are described in [MavenArtifacts.md](MavenArtifacts.md)
The Maven artifacts are described in [MavenArtifacts.md](MavenArtifacts.md)
## Structure and Organization
The main WPILib code you're probably looking for is in WPILibJ and WPILibC. Those directories are split into shared, sim, and athena. Athena contains the WPILib code meant to run on your roboRIO. Sim is WPILib code meant to run on your computer with Gazebo, and shared is code shared between the two. Shared code must be platform-independent, since it will be compiled with both the ARM cross-compiler and whatever desktop compiler you are using (g++, msvc, etc...).
The main WPILib code you're probably looking for is in WPILibJ and WPILibC. Those directories contain the high-level hardware/robot classes used for interacting with hardware, the Driver Station, and contain the core framework that almost all robot projects use.
The Simulation directory contains extra simulation tools and libraries, such as gz_msgs and JavaGazebo. See sub-directories for more information.
The src/test directories under each subproject for C++ and Java contain test code that runs on GitHub Actions. When you submit code for review, it is tested by GitHub Actions' runners. If you add new functionality you should make sure to write tests for it so we don't break it in the future.
The integration test directories for C++ and Java contain test code that runs on our test-system. When you submit code for review, it is tested by those programs. If you add new functionality you should make sure to write tests for it so we don't break it in the future.
The hal directory contains more C++ code meant to run on the roboRIO. HAL is an acronym for "Hardware Abstraction Layer", and it interfaces with the NI Libraries. The NI Libraries contain the low-level code for controlling devices on your robot. The NI Libraries are found in the ni-libraries folder.
The hal directory contains more C++ code meant to run on Systemcore. HAL is an acronym for "Hardware Abstraction Layer", and it interfaces with the robot controller to enable hardware interactions. The HAL is split into cpp, sim, and systemcore. The systemcore directory contains the WPILib code meant to run on your Systemcore. Sim is WPILib code meant to run on your computer, and cpp is code shared between the two. Code in the cpp directory must be platform-independent, since it will be compiled with both the ARM cross-compiler and whatever desktop compiler you are using (g++, MSVC, etc...).
The upstream_utils directory contains scripts for updating copies of thirdparty code in the repository.
The [styleguide repository](https://github.com/wpilibsuite/styleguide) contains our style guides for C++ and Java code. Anything submitted to the WPILib project needs to follow the code style guides outlined in there. For details about the style, please see the contributors document [here](CONTRIBUTING.md#coding-guidelines).
# Contributing to WPILib
See [CONTRIBUTING.md](CONTRIBUTING.md).

File diff suppressed because it is too large Load Diff

47
WORKSPACE.bzlmod Normal file
View File

@@ -0,0 +1,47 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//thirdparty/ceres:repositories.bzl", "ceres_repositories")
ceres_repositories()
http_archive(
name = "pybind11_bazel",
integrity = "sha256-iwRj1wuX2pDS6t6DqiCfhIXisv4y+7CvxSJtZoSAzGw=",
strip_prefix = "pybind11_bazel-2b6082a4d9d163a52299718113fa41e4b7978db5",
urls = ["https://github.com/pybind/pybind11_bazel/archive/2b6082a4d9d163a52299718113fa41e4b7978db5.tar.gz"],
)
http_archive(
name = "pybind11",
build_file = "@pybind11_bazel//:pybind11-BUILD.bazel",
integrity = "sha256-LyCgrwuSGBXg4Wnqf+xjkJhpMjWBuJ194VU0aFU/ai0=",
strip_prefix = "pybind11-3.0.2",
url = "https://github.com/pybind/pybind11/archive/refs/tags/v3.0.2.tar.gz",
)
http_archive(
name = "bzlmodrio-opencv",
sha256 = "947df6f399593a54779b7706da8abaa43865769e02b15533519c800e23be419f",
url = "https://github.com/wpilibsuite/bzlmodRio-opencv/releases/download/2027.4.13.0-3/bzlmodRio-opencv-2027.4.13.0-3.tar.gz",
)
load("@bzlmodrio-opencv//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_opencv_cpp_dependencies")
setup_legacy_bzlmodrio_opencv_cpp_dependencies()
http_archive(
name = "bzlmodrio-libssh",
sha256 = "f8fef627c7b393f7f6ed638e12b80ff90b2cfea11488b15214f25ce1e470723a",
url = "https://github.com/wpilibsuite/bzlmodRio-libssh/releases/download/2024.0.105-1.bcr1/bzlmodrio-libssh-2024.0.105-1.bcr1.tar.gz",
)
load("@bzlmodrio-libssh//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_libssh_cpp_dependencies")
setup_legacy_bzlmodrio_libssh_cpp_dependencies()
# Capture the repository environmental variables which specify the filter list for what architectures to build in CI.
load("//shared/bazel/rules:publishing_rule.bzl", "publishing_repo")
publishing_repo(
name = "com_wpilib_allwpilib_publishing_config",
)

274
apriltag/BUILD.bazel Normal file
View File

@@ -0,0 +1,274 @@
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_java//java:defs.bzl", "java_binary")
load("@rules_pkg//:mappings.bzl", "pkg_files")
load("@rules_python//python:defs.bzl", "py_binary")
load("//apriltag:robotpy_native_build_info.bzl", "define_native_wrapper")
load("//apriltag:robotpy_pybind_build_info.bzl", "apriltag_extension", "define_pybind_library")
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_library", "wpilib_cc_shared_library", "wpilib_cc_static_library")
load("//shared/bazel/rules:java_rules.bzl", "wpilib_java_junit5_test")
load("//shared/bazel/rules:jni_rules.bzl", "wpilib_jni_cc_library", "wpilib_jni_java_library")
load("//shared/bazel/rules:packaging.bzl", "package_default_jni_project")
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
load("//shared/bazel/rules/robotpy:build_info_gen.bzl", "generate_robotpy_native_wrapper_build_info", "generate_robotpy_pybind_build_info")
load("//shared/bazel/rules/robotpy:pytest_util.bzl", "robotpy_py_test")
filegroup(
name = "doxygen-files",
srcs = glob([
"src/main/native/include/**/*",
"src/main/native/thirdparty/apriltag/include/**/*",
]),
visibility = ["//visibility:public"],
)
pkg_files(
name = "thirdparty-apriltag-src-pkg",
srcs = glob(["src/main/native/thirdparty/apriltag/include/**"]),
strip_prefix = "src/main/native/thirdparty/apriltag/include",
)
cc_library(
name = "thirdparty-apriltag",
srcs = glob(["src/main/native/thirdparty/apriltag/src/**"]),
hdrs = glob(["src/main/native/thirdparty/apriltag/include/**"]),
copts = select({
"@platforms//os:osx": [
"-Wno-format-nonliteral",
"-Wno-gnu-zero-variadic-macro-arguments",
"-Wno-uninitialized",
"-Wno-sign-compare",
"-Wno-type-limits",
],
"@platforms//os:windows": [
"/wd4005",
"/wd4018",
"/wd4244",
"/wd4267",
"/wd4996",
],
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": [
"-Wno-format-nonliteral",
"-Wno-maybe-uninitialized",
"-Wno-sign-compare",
"-Wno-type-limits",
],
}),
includes = ["src/main/native/thirdparty/apriltag/include/common"],
strip_include_prefix = "src/main/native/thirdparty/apriltag/include",
)
generate_resources(
name = "generate-resources",
namespace = "wpi::apriltag",
prefix = "APRILTAG",
resource_files = glob(["src/main/native/resources/**"]),
)
wpilib_cc_library(
name = "apriltag",
srcs = [":generate-resources"] + glob(
["src/main/native/cpp/**"],
exclude = ["src/main/native/cpp/jni/**"],
),
hdrs = glob(["src/main/native/include/**/*"]),
extra_hdr_pkg_files = [":thirdparty-apriltag-src-pkg"],
extra_src_pkg_files = [":apriltag-java-jni-hdrs-pkg"],
local_defines = ["WPILIB_EXPORTS"],
strip_include_prefix = "src/main/native/include",
visibility = ["//visibility:public"],
deps = [
":thirdparty-apriltag",
"//wpimath",
"//wpiutil",
],
)
wpilib_cc_shared_library(
name = "shared/apriltag",
auto_export_windows_symbols = False,
dynamic_deps = [
"//wpimath:shared/wpimath",
"//wpiutil:shared/wpiutil",
],
visibility = ["//visibility:public"],
deps = [
":apriltag",
":thirdparty-apriltag",
],
)
wpilib_cc_static_library(
name = "static/apriltag",
static_deps = [
"//wpimath:static/wpimath",
"//wpiutil:static/wpiutil",
],
visibility = ["//visibility:public"],
deps = [
":apriltag",
],
)
wpilib_jni_cc_library(
name = "apriltagjni",
srcs = glob(["src/main/native/cpp/jni/**"]),
java_dep = ":apriltag-java",
visibility = ["//visibility:public"],
deps = [
":apriltag",
],
)
wpilib_cc_shared_library(
name = "shared/apriltagjni",
auto_export_windows_symbols = False,
dynamic_deps = [
":shared/apriltag",
"//wpimath:shared/wpimath",
"//wpiutil:shared/wpiutil",
],
use_debug_name = False,
visibility = ["//visibility:public"],
deps = [":apriltagjni"],
)
wpilib_jni_java_library(
name = "apriltag-java",
srcs = glob(["src/main/java/**/*.java"]),
extra_source_pkgs = ["resources"],
maven_artifact_name = "apriltag-java",
maven_group_id = "org.wpilib.apriltag",
native_libs = [":apriltagjni"],
plugins = [
"//:avaje_jsonb_generator",
],
resource_strip_prefix = "apriltag/src/main/native/resources",
resources = glob(["src/main/native/resources/**"]),
visibility = ["//visibility:public"],
deps = [
"//wpimath:wpimath-java",
"//wpiutil:wpiutil-java",
"@bzlmodrio-opencv//libraries/java/opencv",
"@maven//:io_avaje_avaje_json_core",
"@maven//:io_avaje_avaje_jsonb",
],
)
pkg_files(
name = "resources",
srcs = glob(["src/main/native/resources/**"]),
strip_prefix = "src/main/native/resources/",
)
cc_test(
name = "apriltag-cpp-test",
size = "small",
srcs = glob(["src/test/native/cpp/**"]),
tags = [
"no-asan",
],
deps = [
":apriltag",
"//thirdparty/googletest",
],
)
wpilib_java_junit5_test(
name = "apriltag-java-test",
srcs = glob(["src/test/java/**/*.java"]),
resource_strip_prefix = "apriltag/src/test/resources",
resources = glob(["src/test/resources/**"]),
deps = [
":apriltag-java",
"//wpimath:wpimath-java",
"//wpiutil:wpiutil-java",
"@bzlmodrio-opencv//libraries/java/opencv",
"@maven//:io_avaje_avaje_jsonb",
],
)
cc_binary(
name = "DevMain-Cpp",
srcs = ["src/dev/native/cpp/main.cpp"],
deps = [
":apriltag",
],
)
java_binary(
name = "DevMain-Java",
srcs = ["src/dev/java/org/wpilib/vision/apriltag/DevMain.java"],
main_class = "org.wpilib.vision.apriltag.DevMain",
deps = [
":apriltag-java",
],
)
py_binary(
name = "convert_apriltag_layouts",
srcs = ["convert_apriltag_layouts.py"],
target_compatible_with = select({
"@rules_bzlmodrio_toolchains//constraints/is_systemcore:systemcore": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)
package_default_jni_project(
name = "apriltag",
maven_artifact_name = "apriltag-cpp",
maven_group_id = "org.wpilib.apriltag",
)
generate_robotpy_native_wrapper_build_info(
name = "robotpy-native-apriltag-generator",
pyproject_toml = "src/main/python/native-pyproject.toml",
third_party_dirs = ["apriltag"],
)
define_native_wrapper(
name = "robotpy-native-apriltag",
pyproject_toml = "src/main/python/native-pyproject.toml",
)
PYBIND_PKGCFG_DEPS = [
"//apriltag:native/apriltag/robotpy-native-apriltag.pc",
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
"//wpimath:robotpy-wpimath.generated_pkgcfg_files",
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
"//wpiutil:robotpy-wpiutil.generated_pkgcfg_files",
]
generate_robotpy_pybind_build_info(
name = "robotpy-apriltag-generator",
additional_srcs = [":robotpy-native-apriltag.copy_headers"],
package_root_file = "src/main/python/robotpy_apriltag/__init__.py",
pkgcfgs = PYBIND_PKGCFG_DEPS,
yaml_files = glob(["src/main/python/semiwrap/*.yml"]),
)
apriltag_extension(
srcs = ["src/main/python/robotpy_apriltag/src/main.cpp"],
includes = [
"src/main/python/datalog/",
],
)
define_pybind_library(
name = "robotpy-apriltag",
pkgcfgs = PYBIND_PKGCFG_DEPS,
)
robotpy_py_test(
"python_tests",
srcs = glob(["src/test/python/**/*.py"]),
data = glob([
"src/test/python/*.png",
"src/test/python/*.jpg",
]),
deps = [
":robotpy-apriltag",
requirement("pytest"),
requirement("opencv-python"),
],
)

83
apriltag/CMakeLists.txt Normal file
View File

@@ -0,0 +1,83 @@
project(apriltag)
include(CompileWarnings)
include(GenResources)
file(
GLOB_RECURSE apriltaglib_src
src/main/native/thirdparty/apriltag/src/*.c
src/main/native/thirdparty/apriltag/src/*.cpp
)
# Disable apriltag C library warnings
if(MSVC)
set_source_files_properties(
${apriltaglib_src}
PROPERTIES COMPILE_FLAGS "/wd4005 /wd4018 /wd4244 /wd4267 /wd4996"
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_source_files_properties(
${apriltaglib_src}
PROPERTIES
COMPILE_FLAGS
"-Wno-format-nonliteral -Wno-gnu-zero-variadic-macro-arguments -Wno-uninitialized -Wno-sign-compare -Wno-type-limits"
)
else()
set_source_files_properties(
${apriltaglib_src}
PROPERTIES
COMPILE_FLAGS
"-Wno-format-nonliteral -Wno-gnu-zero-variadic-macro-arguments -Wno-maybe-uninitialized -Wno-sign-compare -Wno-type-limits"
)
endif()
generate_resources(
src/main/native/resources/org/wpilib/vision/apriltag
generated/main/cpp
APRILTAG
wpi::apriltag
apriltag_resources_src
)
file(GLOB apriltag_native_src src/main/native/cpp/*.cpp)
add_library(apriltag ${apriltag_native_src} ${apriltag_resources_src} ${apriltaglib_src})
set_target_properties(apriltag PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET apriltag PROPERTY FOLDER "libraries")
target_compile_features(apriltag PUBLIC cxx_std_23)
wpilib_target_warnings(apriltag)
target_link_libraries(apriltag wpimath)
target_include_directories(
apriltag
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/apriltag>
)
install(
DIRECTORY src/main/native/include/ src/main/native/thirdparty/apriltag/include/
DESTINATION "${include_dest}/apriltag"
)
target_include_directories(
apriltag
SYSTEM
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/thirdparty/apriltag/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/thirdparty/apriltag/include/common>
)
install(TARGETS apriltag EXPORT apriltag)
export(TARGETS apriltag FILE apriltag.cmake NAMESPACE apriltag::)
configure_file(apriltag-config.cmake.in ${WPILIB_BINARY_DIR}/apriltag-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/apriltag-config.cmake DESTINATION share/apriltag)
install(EXPORT apriltag DESTINATION share/apriltag)
if(WITH_TESTS)
wpilib_add_test(apriltag src/test/native/cpp)
target_include_directories(apriltag_test PRIVATE src/test/native/include)
target_link_libraries(apriltag_test apriltag googletest)
endif()

30
apriltag/README.md Normal file
View File

@@ -0,0 +1,30 @@
# AprilTag
A C++ wrapper around the [University of Michigan's AprilTag detector](https://github.com/AprilRobotics/apriltag), alongside a vendored copy of their code with some patches (patches are located in [upstream_utils](../upstream_utils/apriltag_patches/)).
## Adding new field to AprilTagFields
### Adding field JSON
1. Add a field layout CSV file to `src/main/native/resources/org/wpilib/vision/apriltag`
1. See docstring in `convert_apriltag_layouts.py` for more
2. Run `convert_apriltag_layouts.py` in the same directory as this readme to generate the JSON
3. That script overwrites all generated JSONs, so undo undesired changes if necessary
4. Update the field dimensions at the bottom of the JSON
1. Length should be in meters from alliance wall to alliance wall
2. Width should be in meters from inside guardrail plastic to plastic
### Java updates
1. Update `src/main/java/org/wpilib/vision/apriltag/AprilTagFields.java`
1. Add enum value for new field to `AprilTagFields`
2. Update `AprilTagFields.kDefaultField` if necessary
### C++ updates
1. Update `src/main/native/include/wpi/apriltag/AprilTagFields.hpp`
1. Add enum value for new field to `AprilTagFields`
2. Update `AprilTagFields::kDefaultField` if necessary
2. Update `src/main/native/cpp/AprilTagFieldLayout.cpp`
1. Add resource getter prototype like `std::string_view GetResource_2024_crescendo_json()`
2. Add case for new field to switch in `LoadField(AprilTagField field)`

View File

@@ -0,0 +1,7 @@
include(CMakeFindDependencyMacro)
@FILENAME_DEP_REPLACE@
@WPIMATH_DEP_REPLACE@
@WPIUTIL_DEP_REPLACE@
@FILENAME_DEP_REPLACE@
include(${SELF_DIR}/apriltag.cmake)

130
apriltag/build.gradle Normal file
View File

@@ -0,0 +1,130 @@
apply from: "${rootDir}/shared/resources.gradle"
apply plugin: 'c'
ext {
nativeName = 'apriltag'
devMain = 'org.wpilib.vision.apriltag.DevMain'
useJava = true
useCpp = true
sharedCvConfigs = [
apriltagDev : [],
apriltagTest: []]
staticCvConfigs = []
def generateTask = createGenerateResourcesTask('main', 'APRILTAG', 'wpi::apriltag', project)
tasks.withType(CppCompile) {
dependsOn generateTask
}
splitSetup = {
it.sources {
resourcesCpp(CppSourceSet) {
source {
srcDirs "$buildDir/generated/main/cpp", "$rootDir/shared/singlelib"
include '*.cpp'
}
}
apriltagC(CSourceSet) {
source {
srcDirs 'src/main/native/thirdparty/apriltag/src'
include '**/*.c', '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/main/native/thirdparty/apriltag/include',
'src/main/native/thirdparty/apriltag/include/common'
}
}
}
}
}
evaluationDependsOn(':wpimath')
apply from: "${rootDir}/shared/jni/setupBuild.gradle"
apply from: "${rootDir}/shared/opencv.gradle"
dependencies {
implementation project(':wpimath')
annotationProcessor libs.avaje.jsonb.generator
}
sourceSets {
main {
resources {
srcDirs 'src/main/native/resources'
}
}
}
cppHeadersZip {
from('src/main/native/thirdparty/apriltag/include') {
into '/'
}
}
// Suppress sign-compare warnings
nativeUtils.platformConfigs.each {
if (it.name.contains('windows')) {
it.cCompiler.args.add("/wd4005")
it.cCompiler.args.add("/wd4018")
it.cCompiler.args.add("/wd4244")
it.cCompiler.args.add("/wd4267")
it.cCompiler.args.add("/wd4996")
} else if (it.name.contains('osx')) {
it.cCompiler.args.add("-Wno-format-nonliteral")
it.cCompiler.args.add("-Wno-gnu-zero-variadic-macro-arguments")
it.cCompiler.args.add("-Wno-uninitialized")
it.cCompiler.args.add("-Wno-sign-compare")
it.cCompiler.args.add("-Wno-type-limits")
} else {
it.cCompiler.args.add("-Wno-format-nonliteral")
it.cCompiler.args.add("-Wno-gnu-zero-variadic-macro-arguments")
it.cCompiler.args.add("-Wno-maybe-uninitialized")
it.cCompiler.args.add("-Wno-sign-compare")
it.cCompiler.args.add("-Wno-type-limits")
}
}
model {
components {
all {
it.sources.each {
it.exportedHeaders {
srcDirs 'src/main/native/include',
'src/main/native/thirdparty/apriltag/include',
'src/main/native/thirdparty/apriltag/include/common'
}
}
}
}
binaries {
all {
if (!it.buildable || !(it instanceof NativeBinarySpec)) {
return
}
it.cppCompiler.define 'WPILIB_EXPORTS'
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
tasks {
def c = $.components
def found = false
def systemArch = getCurrentArch()
c.each {
if (it in NativeExecutableSpec && it.name == "${nativeName}Dev") {
it.binaries.each {
if (!found) {
def arch = it.targetPlatform.name
if (arch == systemArch) {
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
found = true
}
}
}
}
}
}
}

View File

@@ -0,0 +1,90 @@
#!/usr/bin/env python3
"""
This script converts all AprilTag field layout CSV files in
src/main/native/resources/edu/wpi/first/apriltag to the JSON format
AprilTagFields expects.
The input CSV has the following format:
* Columns: ID, X, Y, Z, Z Rotation, Y Rotation
* ID is a positive integer
* X, Y, and Z are decimal inches
* Z Rotation is yaw in degrees
* Y Rotation is pitch in degrees
The values come from a table in the layout marking diagram (e.g.,
https://firstfrc.blob.core.windows.net/frc2024/FieldAssets/2024LayoutMarkingDiagram.pdf).
"""
import csv
import json
import os
from wpimath import geometry, units
def main():
# Find AprilTag field layout CSVs
filenames = [
os.path.join(dp, f)
for dp, dn, fn in os.walk("src/main/native/resources/edu/wpi/first/apriltag")
for f in fn
if f.endswith(".csv")
]
for filename in filenames:
json_data = {"tags": [], "field": {"length": 0.0, "width": 0.0}}
# Read CSV and fill in JSON data
with open(filename, newline="") as csvfile:
reader = csv.reader(csvfile, delimiter=",")
# Skip header
next(reader)
for row in reader:
# Unpack row elements
id = int(row[0])
x = float(row[1])
y = float(row[2])
z = float(row[3])
zRotation = float(row[4])
yRotation = float(row[5])
# Turn yaw into quaternion
q = geometry.Rotation3d(
units.radians(0),
units.degreesToRadians(yRotation),
units.degreesToRadians(zRotation),
).getQuaternion()
json_data["tags"].append(
{
"ID": id,
"pose": {
"translation": {
"x": units.inchesToMeters(x),
"y": units.inchesToMeters(y),
"z": units.inchesToMeters(z),
},
"rotation": {
"quaternion": {
"W": q.W(),
"X": q.X(),
"Y": q.Y(),
"Z": q.Z(),
}
},
},
}
)
# Write JSON
with open(filename.replace(".csv", ".json"), "w") as f:
json.dump(json_data, f, indent=2)
f.write("\n")
if __name__ == "__main__":
main()

66
apriltag/robotpy_native_build_info.bzl generated Normal file
View File

@@ -0,0 +1,66 @@
# THIS FILE IS AUTO GENERATED
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "copy_native_file", "generate_native_files", "robotpy_library")
def define_native_wrapper(name, pyproject_toml = None):
pyproject_toml = pyproject_toml or "src/main/python/native-pyproject.toml"
copy_to_directory(
name = "{}.copy_headers".format(name),
srcs = native.glob(["src/main/native/include/**"]) + native.glob(["src/generated/main/native/include/**"], allow_empty = True) + native.glob([
"src/main/native/thirdparty/apriltag/include/**",
]),
out = "native/apriltag/include",
root_paths = ["src/main/native/include/"],
replace_prefixes = {
"apriltag/src/generated/main/native/include": "",
"apriltag/src/main/native/include": "",
"apriltag/src/main/native/thirdparty/apriltag/include": "",
},
verbose = False,
visibility = ["//visibility:public"],
)
libinit_files = ["native/apriltag/_init_robotpy_native_apriltag.py"]
generate_native_files(
name = name,
pyproject_toml = pyproject_toml,
pc_deps = [
"//wpimath:native/wpimath/robotpy-native-wpimath.pc",
"//wpiutil:native/wpiutil/robotpy-native-wpiutil.pc",
],
libinit_files = libinit_files,
pc_files = ["native/apriltag/robotpy-native-apriltag.pc"],
)
copy_native_file(
name = "apriltag",
library = "shared/apriltag",
base_path = "native/apriltag/",
)
robotpy_library(
name = name,
distribution = "robotpy-native-apriltag",
srcs = libinit_files,
data = [
name + ".pc_wrapper",
":apriltag.copy_lib",
"{}.copy_headers".format(name),
],
deps = [
"//wpimath:robotpy-native-wpimath",
"//wpiutil:robotpy-native-wpiutil",
],
summary = "WPILib AprilTag Library",
requires = ["robotpy-native-wpiutil==0.0.0", "robotpy-native-wpimath==0.0.0"],
python_requires = ">=3.11",
strip_path_prefixes = ["apriltag"],
entry_points = {
"pkg_config": [
"apriltag = native.apriltag",
],
},
)

252
apriltag/robotpy_pybind_build_info.bzl generated Normal file
View File

@@ -0,0 +1,252 @@
# THIS FILE IS AUTO GENERATED
load("//shared/bazel/rules/gen:gen-version-file.bzl", "generate_version_file")
load("//shared/bazel/rules/robotpy:robotpy_rules.bzl", "create_pybind_library", "robotpy_library")
load("//shared/bazel/rules/robotpy:semiwrap_helpers.bzl", "gen_libinit", "gen_modinit_hpp", "gen_pkgconf", "resolve_casters", "run_header_gen")
load("//shared/bazel/rules/robotpy:semiwrap_tool_helpers.bzl", "scan_headers", "update_yaml_files")
def apriltag_extension(srcs = [], header_to_dat_deps = [], extra_hdrs = [], includes = []):
APRILTAG_HEADER_GEN = [
struct(
class_name = "AprilTag",
yml_file = "semiwrap/AprilTag.yml",
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTag.hpp",
tmpl_class_names = [],
trampolines = [
("wpi::apriltag::AprilTag", "wpi__apriltag__AprilTag.hpp"),
],
),
struct(
class_name = "AprilTagDetection",
yml_file = "semiwrap/AprilTagDetection.yml",
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagDetection.hpp",
tmpl_class_names = [],
trampolines = [
("wpi::apriltag::AprilTagDetection", "wpi__apriltag__AprilTagDetection.hpp"),
("wpi::apriltag::AprilTagDetection::Point", "wpi__apriltag__AprilTagDetection__Point.hpp"),
],
),
struct(
class_name = "AprilTagDetector",
yml_file = "semiwrap/AprilTagDetector.yml",
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagDetector.hpp",
tmpl_class_names = [],
trampolines = [
("wpi::apriltag::AprilTagDetector", "wpi__apriltag__AprilTagDetector.hpp"),
("wpi::apriltag::AprilTagDetector::Config", "wpi__apriltag__AprilTagDetector__Config.hpp"),
("wpi::apriltag::AprilTagDetector::QuadThresholdParameters", "wpi__apriltag__AprilTagDetector__QuadThresholdParameters.hpp"),
("wpi::apriltag::AprilTagDetector::Results", "wpi__apriltag__AprilTagDetector__Results.hpp"),
],
),
struct(
class_name = "AprilTagFieldLayout",
yml_file = "semiwrap/AprilTagFieldLayout.yml",
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagFieldLayout.hpp",
tmpl_class_names = [],
trampolines = [
("wpi::apriltag::AprilTagFieldLayout", "wpi__apriltag__AprilTagFieldLayout.hpp"),
],
),
struct(
class_name = "AprilTagFields",
yml_file = "semiwrap/AprilTagFields.yml",
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagFields.hpp",
tmpl_class_names = [],
trampolines = [],
),
struct(
class_name = "AprilTagPoseEstimate",
yml_file = "semiwrap/AprilTagPoseEstimate.yml",
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagPoseEstimate.hpp",
tmpl_class_names = [],
trampolines = [
("wpi::apriltag::AprilTagPoseEstimate", "wpi__apriltag__AprilTagPoseEstimate.hpp"),
],
),
struct(
class_name = "AprilTagPoseEstimator",
yml_file = "semiwrap/AprilTagPoseEstimator.yml",
header_root = "$(execpath :robotpy-native-apriltag.copy_headers)",
header_file = "$(execpath :robotpy-native-apriltag.copy_headers)/wpi/apriltag/AprilTagPoseEstimator.hpp",
tmpl_class_names = [],
trampolines = [
("wpi::apriltag::AprilTagPoseEstimator", "wpi__apriltag__AprilTagPoseEstimator.hpp"),
("wpi::apriltag::AprilTagPoseEstimator::Config", "wpi__apriltag__AprilTagPoseEstimator__Config.hpp"),
],
),
]
resolve_casters(
name = "apriltag.resolve_casters",
caster_deps = ["//wpimath:src/main/python/wpimath/wpimath-casters.pybind11.json", "//wpiutil:src/main/python/wpiutil/wpiutil-casters.pybind11.json"],
casters_pkl_file = "apriltag.casters.pkl",
dep_file = "apriltag.casters.d",
)
gen_libinit(
name = "apriltag.gen_lib_init",
output_file = "src/main/python/robotpy_apriltag/_init__apriltag.py",
modules = ["native.apriltag._init_robotpy_native_apriltag", "wpiutil._init__wpiutil", "wpimath._init__wpimath"],
)
gen_pkgconf(
name = "apriltag.gen_pkgconf",
libinit_py = "robotpy_apriltag._init__apriltag",
module_pkg_name = "robotpy_apriltag._apriltag",
output_file = "apriltag.pc",
pkg_name = "apriltag",
install_path = "src/main/python/robotpy_apriltag",
project_file = "src/main/python/pyproject.toml",
package_root = "src/main/python/robotpy_apriltag/__init__.py",
)
gen_modinit_hpp(
name = "apriltag.gen_modinit_hpp",
input_dats = [x.class_name for x in APRILTAG_HEADER_GEN],
libname = "_apriltag",
output_file = "semiwrap_init.robotpy_apriltag._apriltag.hpp",
)
run_header_gen(
name = "apriltag",
casters_pickle = "apriltag.casters.pkl",
header_gen_config = APRILTAG_HEADER_GEN,
trampoline_subpath = "src/main/python/robotpy_apriltag",
deps = header_to_dat_deps,
local_native_libraries = [
"//apriltag:robotpy-native-apriltag.copy_headers",
"//wpimath:robotpy-native-wpimath.copy_headers",
"//wpiutil:robotpy-native-wpiutil.copy_headers",
],
)
create_pybind_library(
name = "apriltag",
install_path = "src/main/python/robotpy_apriltag/",
extension_name = "_apriltag",
generated_srcs = [":apriltag.generated_srcs"],
semiwrap_header = [":apriltag.gen_modinit_hpp"],
deps = [
":apriltag.tmpl_hdrs",
":apriltag.trampoline_hdrs",
"//apriltag:apriltag",
"//wpimath:wpimath",
"//wpimath:wpimath_pybind_library",
"//wpiutil:wpiutil",
"//wpiutil:wpiutil_pybind_library",
],
dynamic_deps = [
"//apriltag:shared/apriltag",
"//wpimath:shared/wpimath",
"//wpiutil:shared/wpiutil",
],
extra_hdrs = extra_hdrs,
extra_srcs = srcs,
includes = includes,
)
native.filegroup(
name = "apriltag.generated_files",
srcs = [
"apriltag.gen_modinit_hpp.gen",
"apriltag.header_gen_files",
"apriltag.gen_pkgconf",
"apriltag.gen_lib_init",
],
tags = ["manual", "robotpy"],
)
def define_pybind_library(name, pkgcfgs = []):
# Helper used to generate all files with one target.
native.filegroup(
name = "{}.generated_files".format(name),
srcs = [
"apriltag.generated_files",
],
tags = ["manual", "robotpy"],
visibility = ["//visibility:public"],
)
# Files that will be included in the wheel as data deps
native.filegroup(
name = "{}.generated_pkgcfg_files".format(name),
srcs = [
"src/main/python/robotpy_apriltag/apriltag.pc",
],
tags = ["manual", "robotpy"],
visibility = ["//visibility:public"],
)
# Contains all of the non-python files that need to be included in the wheel
native.filegroup(
name = "{}.extra_files".format(name),
srcs = native.glob(["src/main/python/robotpy_apriltag/**"], exclude = ["src/main/python/robotpy_apriltag/**/*.py"], allow_empty = True),
tags = ["manual", "robotpy"],
)
generate_version_file(
name = "{}.generate_version".format(name),
output_file = "src/main/python/robotpy_apriltag/version.py",
template = "//shared/bazel/rules/robotpy:version_template.in",
)
robotpy_library(
name = name,
distribution = "robotpy-apriltag",
srcs = native.glob(["src/main/python/robotpy_apriltag/**/*.py"]) + [
"src/main/python/robotpy_apriltag/_init__apriltag.py",
"{}.generate_version".format(name),
],
data = [
"{}.generated_pkgcfg_files".format(name),
"{}.extra_files".format(name),
":src/main/python/robotpy_apriltag/_apriltag",
":apriltag.trampoline_hdr_files",
],
imports = ["src/main/python"],
deps = [
"//apriltag:robotpy-native-apriltag",
"//wpimath:robotpy-wpimath",
"//wpiutil:robotpy-wpiutil",
],
strip_path_prefixes = ["apriltag/src/main/python", "apriltag"],
summary = "RobotPy bindings for WPILib's AprilTag library",
project_urls = {"Source code": "https://github.com/robotpy/mostrobotpy"},
author_email = "RobotPy Development Team <robotpy@googlegroups.com>",
requires = ["robotpy-native-apriltag==0.0.0", "robotpy-wpiutil==0.0.0", "robotpy-wpimath==0.0.0"],
python_requires = ">=3.11",
entry_points = {
"pkg_config": ["apriltag = robotpy_apriltag"],
},
visibility = ["//visibility:public"],
)
update_yaml_files(
name = "{}-update-yaml".format(name),
yaml_output_directory = "src/main/python/semiwrap",
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
"//apriltag:robotpy-native-apriltag.copy_headers",
"//wpimath:robotpy-native-wpimath.copy_headers",
"//wpiutil:robotpy-native-wpiutil.copy_headers",
],
package_root_file = "src/main/python/robotpy_apriltag/__init__.py",
pkgcfgs = pkgcfgs,
pyproject_toml = "src/main/python/pyproject.toml",
yaml_files = native.glob(["src/main/python/semiwrap/**"]),
)
scan_headers(
name = "{}-scan-headers".format(name),
extra_hdrs = native.glob(["src/main/python/**/*.h"], allow_empty = True) + [
"//apriltag:robotpy-native-apriltag.copy_headers",
],
package_root_file = "src/main/python/robotpy_apriltag/__init__.py",
pkgcfgs = pkgcfgs,
pyproject_toml = "src/main/python/pyproject.toml",
)

View File

@@ -0,0 +1,20 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
public final class DevMain {
/** Main entry point. */
public static void main(String[] args) {
System.out.println("Hello World!");
AprilTagDetector detector = new AprilTagDetector();
detector.addFamily("tag16h5");
AprilTagDetector.Config config = new AprilTagDetector.Config();
config.refineEdges = false;
detector.setConfig(config);
detector.close();
}
private DevMain() {}
}

View File

@@ -0,0 +1,11 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/apriltag/AprilTagDetector.hpp"
int main() {
wpi::apriltag::AprilTagDetector detector;
detector.AddFamily("tag16h5");
detector.SetConfig({.refineEdges = false});
}

View File

@@ -0,0 +1,76 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
import io.avaje.jsonb.Json;
import java.util.Objects;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.util.RawFrame;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
/** Represents an AprilTag's metadata. */
@Json
public class AprilTag {
/** The tag's ID. */
@Json.Property("ID")
@SuppressWarnings("PMD.PublicFieldNamingConvention")
public int ID;
/** The tag's pose. */
@Json.Property("pose")
public Pose3d pose;
/**
* Constructs an AprilTag.
*
* @param ID The tag's ID.
* @param pose The tag's pose.
*/
@SuppressWarnings("ParameterName")
@Json.Creator
public AprilTag(int ID, Pose3d pose) {
this.ID = ID;
this.pose = pose;
}
@Override
public boolean equals(Object obj) {
return obj instanceof AprilTag tag && ID == tag.ID && pose.equals(tag.pose);
}
@Override
public int hashCode() {
return Objects.hash(ID, pose);
}
@Override
public String toString() {
return "AprilTag(ID: " + ID + ", pose: " + pose + ")";
}
/**
* Generates a RawFrame containing the apriltag with the id with family 16h5 passed in.
*
* @param id id
* @return A RawFrame containing the AprilTag image
*/
public static RawFrame generate16h5AprilTagImage(int id) {
RawFrame frame = new RawFrame();
AprilTagJNI.generate16h5AprilTagImage(frame, frame.getNativeObj(), id);
return frame;
}
/**
* Generates a RawFrame containing the apriltag with the id with family 36h11 passed in.
*
* @param id id
* @return A RawFrame containing the AprilTag image
*/
public static RawFrame generate36h11AprilTagImage(int id) {
RawFrame frame = new RawFrame();
AprilTagJNI.generate36h11AprilTagImage(frame, frame.getNativeObj(), id);
return frame;
}
}

View File

@@ -0,0 +1,191 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
import java.util.Arrays;
import org.wpilib.math.linalg.MatBuilder;
import org.wpilib.math.linalg.Matrix;
import org.wpilib.math.numbers.N3;
import org.wpilib.math.util.Nat;
/** A detection of an AprilTag tag. */
public class AprilTagDetection {
/**
* Gets the decoded tag's family name.
*
* @return Decoded family name
*/
public String getFamily() {
return m_family;
}
/**
* Gets the decoded ID of the tag.
*
* @return Decoded ID
*/
public int getId() {
return m_id;
}
/**
* Gets how many error bits were corrected. Note: accepting large numbers of corrected errors
* leads to greatly increased false positive rates. NOTE: As of this implementation, the detector
* cannot detect tags with a hamming distance greater than 2.
*
* @return Hamming distance (number of corrected error bits)
*/
public int getHamming() {
return m_hamming;
}
/**
* Gets a measure of the quality of the binary decoding process: the average difference between
* the intensity of a data bit versus the decision threshold. Higher numbers roughly indicate
* better decodes. This is a reasonable measure of detection accuracy only for very small tags--
* not effective for larger tags (where we could have sampled anywhere within a bit cell and still
* gotten a good detection.)
*
* @return Decision margin
*/
public float getDecisionMargin() {
return m_decisionMargin;
}
/**
* Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at
* (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.
*
* @return Homography matrix data
*/
@SuppressWarnings("PMD.MethodReturnsInternalArray")
public double[] getHomography() {
return m_homography;
}
/**
* Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at
* (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.
*
* @return Homography matrix
*/
public Matrix<N3, N3> getHomographyMatrix() {
return MatBuilder.fill(Nat.N3(), Nat.N3(), m_homography);
}
/**
* Gets the center of the detection in image pixel coordinates.
*
* @return Center point X coordinate
*/
public double getCenterX() {
return m_centerX;
}
/**
* Gets the center of the detection in image pixel coordinates.
*
* @return Center point Y coordinate
*/
public double getCenterY() {
return m_centerY;
}
/**
* Gets a corner of the tag in image pixel coordinates. These always wrap counter-clock wise
* around the tag. Index 0 is the bottom left corner.
*
* @param ndx Corner index (range is 0-3, inclusive)
* @return Corner point X coordinate
*/
public double getCornerX(int ndx) {
return m_corners[ndx * 2];
}
/**
* Gets a corner of the tag in image pixel coordinates. These always wrap counter-clock wise
* around the tag. Index 0 is the bottom left corner.
*
* @param ndx Corner index (range is 0-3, inclusive)
* @return Corner point Y coordinate
*/
public double getCornerY(int ndx) {
return m_corners[ndx * 2 + 1];
}
/**
* Gets the corners of the tag in image pixel coordinates. These always wrap counter-clock wise
* around the tag. The first set of corner coordinates are the coordinates for the bottom left
* corner.
*
* @return Corner point array (X and Y for each corner in order)
*/
@SuppressWarnings("PMD.MethodReturnsInternalArray")
public double[] getCorners() {
return m_corners;
}
private final String m_family;
private final int m_id;
private final int m_hamming;
private final float m_decisionMargin;
private final double[] m_homography;
private final double m_centerX;
private final double m_centerY;
private final double[] m_corners;
/**
* Constructs a new detection result. Used from JNI.
*
* @param family family
* @param id id
* @param hamming hamming
* @param decisionMargin dm
* @param homography homography
* @param centerX centerX
* @param centerY centerY
* @param corners corners
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public AprilTagDetection(
String family,
int id,
int hamming,
float decisionMargin,
double[] homography,
double centerX,
double centerY,
double[] corners) {
m_family = family;
m_id = id;
m_hamming = hamming;
m_decisionMargin = decisionMargin;
m_homography = homography;
m_centerX = centerX;
m_centerY = centerY;
m_corners = corners;
}
@Override
public String toString() {
return "DetectionResult [centerX="
+ m_centerX
+ ", centerY="
+ m_centerY
+ ", corners="
+ Arrays.toString(m_corners)
+ ", decisionMargin="
+ m_decisionMargin
+ ", hamming="
+ m_hamming
+ ", homography="
+ Arrays.toString(m_homography)
+ ", family="
+ m_family
+ ", id="
+ m_id
+ "]";
}
}

View File

@@ -0,0 +1,302 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
import org.opencv.core.Mat;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
/**
* An AprilTag detector engine. This is expensive to set up and tear down, so most use cases should
* only create one of these, add a family to it, set up any other configuration, and repeatedly call
* Detect().
*/
public class AprilTagDetector implements AutoCloseable {
/** Detector configuration. */
public static class Config {
/**
* How many threads should be used for computation. Default is single-threaded operation (1
* thread).
*/
public int numThreads = 1;
/**
* Quad decimation. Detection of quads can be done on a lower-resolution image, improving speed
* at a cost of pose accuracy and a slight decrease in detection rate. Decoding the binary
* payload is still done at full resolution. Default is 2.0.
*/
public float quadDecimate = 2.0f;
/**
* What Gaussian blur should be applied to the segmented image (used for quad detection). Very
* noisy images benefit from non-zero values (e.g. 0.8). Default is 0.0.
*/
public float quadSigma;
/**
* When true, the edges of the each quad are adjusted to "snap to" strong gradients nearby. This
* is useful when decimation is employed, as it can increase the quality of the initial quad
* estimate substantially. Generally recommended to be on (true). Default is true.
*
* <p>Very computationally inexpensive. Option is ignored if quad_decimate = 1.
*/
public boolean refineEdges = true;
/**
* How much sharpening should be done to decoded images. This can help decode small tags but may
* or may not help in odd lighting conditions or low light conditions. Default is 0.25.
*/
public double decodeSharpening = 0.25;
/**
* Debug mode. When true, the decoder writes a variety of debugging images to the current
* working directory at various stages through the detection process. This is slow and should
* *not* be used on space-limited systems such as the RoboRIO. Default is disabled (false).
*/
public boolean debug;
/** Default constructor. */
public Config() {}
/**
* Constructs a detector configuration.
*
* @param numThreads How many threads should be used for computation.
* @param quadDecimate Quad decimation.
* @param quadSigma What Gaussian blur should be applied to the segmented image (used for quad
* detection).
* @param refineEdges When true, the edges of the each quad are adjusted to "snap to" strong
* gradients nearby.
* @param decodeSharpening How much sharpening should be done to decoded images.
* @param debug Debug mode.
*/
Config(
int numThreads,
float quadDecimate,
float quadSigma,
boolean refineEdges,
double decodeSharpening,
boolean debug) {
this.numThreads = numThreads;
this.quadDecimate = quadDecimate;
this.quadSigma = quadSigma;
this.refineEdges = refineEdges;
this.decodeSharpening = decodeSharpening;
this.debug = debug;
}
@Override
public int hashCode() {
return numThreads
+ Float.hashCode(quadDecimate)
+ Float.hashCode(quadSigma)
+ Boolean.hashCode(refineEdges)
+ Double.hashCode(decodeSharpening)
+ Boolean.hashCode(debug);
}
@Override
public boolean equals(Object obj) {
return obj instanceof Config other
&& numThreads == other.numThreads
&& quadDecimate == other.quadDecimate
&& quadSigma == other.quadSigma
&& refineEdges == other.refineEdges
&& decodeSharpening == other.decodeSharpening
&& debug == other.debug;
}
}
/** Quad threshold parameters. */
public static class QuadThresholdParameters {
/** Threshold used to reject quads containing too few pixels. Default is 300 pixels. */
public int minClusterPixels = 300;
/**
* How many corner candidates to consider when segmenting a group of pixels into a quad. Default
* is 10.
*/
public int maxNumMaxima = 10;
/**
* Critical angle, in radians. The detector will reject quads where pairs of edges have angles
* that are close to straight or close to 180 degrees. Zero means that no quads are rejected.
* Default is 45 degrees.
*/
public double criticalAngle = 45 * Math.PI / 180.0;
/**
* When fitting lines to the contours, the maximum mean squared error allowed. This is useful in
* rejecting contours that are far from being quad shaped; rejecting these quads "early" saves
* expensive decoding processing. Default is 10.0.
*/
public float maxLineFitMSE = 10.0f;
/**
* Minimum brightness offset. When we build our model of black &amp; white pixels, we add an
* extra check that the white model must be (overall) brighter than the black model. How much
* brighter? (in pixel values, [0,255]). Default is 5.
*/
public int minWhiteBlackDiff = 5;
/**
* Whether the thresholded image be should be deglitched. Only useful for very noisy images.
* Default is disabled (false).
*/
public boolean deglitch;
/** Default constructor. */
public QuadThresholdParameters() {}
/**
* Constructs quad threshold parameters.
*
* @param minClusterPixels Threshold used to reject quads containing too few pixels.
* @param maxNumMaxima How many corner candidates to consider when segmenting a group of pixels
* into a quad.
* @param criticalAngle Critical angle, in radians.
* @param maxLineFitMSE When fitting lines to the contours, the maximum mean squared error
* allowed.
* @param minWhiteBlackDiff Minimum brightness offset.
* @param deglitch Whether the thresholded image be should be deglitched.
*/
QuadThresholdParameters(
int minClusterPixels,
int maxNumMaxima,
double criticalAngle,
float maxLineFitMSE,
int minWhiteBlackDiff,
boolean deglitch) {
this.minClusterPixels = minClusterPixels;
this.maxNumMaxima = maxNumMaxima;
this.criticalAngle = criticalAngle;
this.maxLineFitMSE = maxLineFitMSE;
this.minWhiteBlackDiff = minWhiteBlackDiff;
this.deglitch = deglitch;
}
@Override
public int hashCode() {
return minClusterPixels
+ maxNumMaxima
+ Double.hashCode(criticalAngle)
+ Float.hashCode(maxLineFitMSE)
+ minWhiteBlackDiff
+ Boolean.hashCode(deglitch);
}
@Override
public boolean equals(Object obj) {
return obj instanceof QuadThresholdParameters other
&& minClusterPixels == other.minClusterPixels
&& maxNumMaxima == other.maxNumMaxima
&& criticalAngle == other.criticalAngle
&& maxLineFitMSE == other.maxLineFitMSE
&& minWhiteBlackDiff == other.minWhiteBlackDiff
&& deglitch == other.deglitch;
}
}
/** Constructs an AprilTagDetector. */
@SuppressWarnings("this-escape")
public AprilTagDetector() {
m_native = AprilTagJNI.createDetector();
setQuadThresholdParameters(new QuadThresholdParameters());
}
@Override
public void close() {
if (m_native != 0) {
AprilTagJNI.destroyDetector(m_native);
}
m_native = 0;
}
/**
* Sets detector configuration.
*
* @param config Configuration
*/
public void setConfig(Config config) {
AprilTagJNI.setDetectorConfig(m_native, config);
}
/**
* Gets detector configuration.
*
* @return Configuration
*/
public Config getConfig() {
return AprilTagJNI.getDetectorConfig(m_native);
}
/**
* Sets quad threshold parameters.
*
* @param params Parameters
*/
public void setQuadThresholdParameters(QuadThresholdParameters params) {
AprilTagJNI.setDetectorQTP(m_native, params);
}
/**
* Gets quad threshold parameters.
*
* @return Parameters
*/
public QuadThresholdParameters getQuadThresholdParameters() {
return AprilTagJNI.getDetectorQTP(m_native);
}
/**
* Adds a family of tags to be detected.
*
* @param fam Family name, e.g. "tag16h5"
* @throws IllegalArgumentException if family name not recognized
*/
public void addFamily(String fam) {
addFamily(fam, 2);
}
/**
* Adds a family of tags to be detected.
*
* @param fam Family name, e.g. "tag16h5"
* @param bitsCorrected Maximum number of bits to correct
* @throws IllegalArgumentException if family name not recognized
*/
public void addFamily(String fam, int bitsCorrected) {
if (!AprilTagJNI.addFamily(m_native, fam, bitsCorrected)) {
throw new IllegalArgumentException("unknown family name '" + fam + "'");
}
}
/**
* Removes a family of tags from the detector.
*
* @param fam Family name, e.g. "tag16h5"
*/
public void removeFamily(String fam) {
AprilTagJNI.removeFamily(m_native, fam);
}
/** Unregister all families. */
public void clearFamilies() {
AprilTagJNI.clearFamilies(m_native);
}
/**
* Detect tags from an 8-bit image.
*
* <p>The image must be grayscale.
*
* @param img 8-bit OpenCV Mat image
* @return Results (array of AprilTagDetection)
*/
public AprilTagDetection[] detect(Mat img) {
return AprilTagJNI.detect(m_native, img.cols(), img.rows(), (int) img.step1(), img.dataAddr());
}
private long m_native;
}

View File

@@ -0,0 +1,281 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
import io.avaje.jsonb.Json;
import io.avaje.jsonb.Jsonb;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.math.geometry.Rotation3d;
import org.wpilib.math.geometry.Translation3d;
/**
* Class for representing a layout of AprilTags on a field and reading them from a JSON format.
*
* <p>The JSON format contains two top-level objects, "tags" and "field". The "tags" object is a
* list of all AprilTags contained within a layout. Each AprilTag serializes to a JSON object
* containing an ID and a Pose3d. The "field" object is a descriptor of the size of the field in
* meters with "width" and "length" values. This is to account for arbitrary field sizes when
* transforming the poses.
*
* <p>Pose3ds in the JSON are measured using the normal FRC coordinate system, NWU with the origin
* at the bottom-right corner of the blue alliance wall. {@link #setOrigin(OriginPosition)} can be
* used to change the poses returned from {@link AprilTagFieldLayout#getTagPose(int)} to be from the
* perspective of a specific alliance.
*
* <p>Tag poses represent the center of the tag, with a zero rotation representing a tag that is
* upright and facing away from the (blue) alliance wall (that is, towards the opposing alliance).
*/
@Json
public class AprilTagFieldLayout {
/** Common origin positions for the AprilTag coordinate system. */
public enum OriginPosition {
/** Blue alliance wall, right side. */
kBlueAllianceWallRightSide,
/** Red alliance wall, right side. */
kRedAllianceWallRightSide,
}
@Json.Ignore private final Map<Integer, AprilTag> m_apriltags = new HashMap<>();
@Json.Property("field")
FieldDimensions m_fieldDimensions;
@Json.Ignore private Pose3d m_origin;
/**
* Construct a new AprilTagFieldLayout with values imported from a JSON file.
*
* @param path Path of the JSON file to import from.
* @throws IOException If reading from the file fails.
*/
public AprilTagFieldLayout(String path) throws IOException {
this(Path.of(path));
}
/**
* Construct a new AprilTagFieldLayout with values imported from a JSON file.
*
* @param path Path of the JSON file to import from.
* @throws IOException If reading from the file fails.
*/
public AprilTagFieldLayout(Path path) throws IOException {
AprilTagFieldLayout layout =
Jsonb.instance().type(AprilTagFieldLayout.class).fromJson(Files.newBufferedReader(path));
m_apriltags.putAll(layout.m_apriltags);
m_fieldDimensions = layout.m_fieldDimensions;
setOrigin(OriginPosition.kBlueAllianceWallRightSide);
}
/**
* Construct a new AprilTagFieldLayout from a list of {@link AprilTag} objects.
*
* @param apriltags List of {@link AprilTag}.
* @param fieldLength Length of the field the layout is representing in meters.
* @param fieldWidth Width of the field the layout is representing in meters.
*/
public AprilTagFieldLayout(List<AprilTag> apriltags, double fieldLength, double fieldWidth) {
this(apriltags, new FieldDimensions(fieldLength, fieldWidth));
}
@Json.Creator
AprilTagFieldLayout(
@Json.Alias("tags") List<AprilTag> apriltags,
@Json.Alias("field") FieldDimensions fieldDimensions) {
// To ensure the underlying semantics don't change with what kind of list is passed in
for (AprilTag tag : apriltags) {
m_apriltags.put(tag.ID, tag);
}
m_fieldDimensions = fieldDimensions;
setOrigin(OriginPosition.kBlueAllianceWallRightSide);
}
/**
* Returns a List of the {@link AprilTag AprilTags} used in this layout.
*
* @return The {@link AprilTag AprilTags} used in this layout.
*/
@Json.Property("tags")
public List<AprilTag> getTags() {
return new ArrayList<>(m_apriltags.values());
}
/**
* Returns the length of the field the layout is representing in meters.
*
* @return length, in meters
*/
public double getFieldLength() {
return m_fieldDimensions.fieldLength;
}
/**
* Returns the length of the field the layout is representing in meters.
*
* @return width, in meters
*/
public double getFieldWidth() {
return m_fieldDimensions.fieldWidth;
}
/**
* Sets the origin based on a predefined enumeration of coordinate frame origins. The origins are
* calculated from the field dimensions.
*
* <p>This transforms the Pose3d objects returned by {@link #getTagPose(int)} to return the
* correct pose relative to a predefined coordinate frame.
*
* @param origin The predefined origin
*/
public final void setOrigin(OriginPosition origin) {
var pose =
switch (origin) {
case kBlueAllianceWallRightSide -> Pose3d.kZero;
case kRedAllianceWallRightSide ->
new Pose3d(
new Translation3d(m_fieldDimensions.fieldLength, m_fieldDimensions.fieldWidth, 0),
new Rotation3d(0, 0, Math.PI));
};
setOrigin(pose);
}
/**
* Sets the origin for tag pose transformation.
*
* <p>This transforms the Pose3d objects returned by {@link #getTagPose(int)} to return the
* correct pose relative to the provided origin.
*
* @param origin The new origin for tag transformations
*/
public final void setOrigin(Pose3d origin) {
m_origin = origin;
}
/**
* Returns the origin used for tag pose transformation.
*
* @return the origin
*/
public Pose3d getOrigin() {
return m_origin;
}
/**
* Gets an AprilTag pose by its ID.
*
* @param ID The ID of the tag.
* @return The pose corresponding to the ID passed in or an empty optional if a tag with that ID
* was not found.
*/
@SuppressWarnings("ParameterName")
public Optional<Pose3d> getTagPose(int ID) {
AprilTag tag = m_apriltags.get(ID);
if (tag == null) {
return Optional.empty();
}
return Optional.of(tag.pose.relativeTo(m_origin));
}
/**
* Serializes a AprilTagFieldLayout to a JSON file.
*
* @param path The path to write to.
* @throws IOException If writing to the file fails.
*/
public void serialize(String path) throws IOException {
serialize(Path.of(path));
}
/**
* Serializes a AprilTagFieldLayout to a JSON file.
*
* @param path The path to write to.
* @throws IOException If writing to the file fails.
*/
public void serialize(Path path) throws IOException {
Jsonb.instance().type(AprilTagFieldLayout.class).toJson(this, Files.newBufferedWriter(path));
}
/**
* Get an official {@link AprilTagFieldLayout}.
*
* @param field The loadable AprilTag field layout.
* @return AprilTagFieldLayout of the field.
* @throws UncheckedIOException If the layout does not exist.
*/
public static AprilTagFieldLayout loadField(AprilTagFields field) {
if (field.fieldLayout == null) {
try {
field.fieldLayout = loadFromResource(field.resourceFile);
} catch (IOException e) {
throw new UncheckedIOException(
"Could not load AprilTagFieldLayout from " + field.resourceFile, e);
}
}
// Copy layout because the layout's origin is mutable
return new AprilTagFieldLayout(
field.fieldLayout.getTags(),
field.fieldLayout.getFieldLength(),
field.fieldLayout.getFieldWidth());
}
/**
* Deserializes a field layout from a resource within a internal jar file.
*
* <p>Users should use {@link #loadField(AprilTagFields)} to load official layouts and {@link
* #AprilTagFieldLayout(String)} for custom layouts.
*
* @param resourcePath The absolute path of the resource
* @return The deserialized layout
* @throws IOException If the resource could not be loaded
*/
public static AprilTagFieldLayout loadFromResource(String resourcePath) throws IOException {
try (InputStream stream = AprilTagFieldLayout.class.getResourceAsStream(resourcePath)) {
if (stream == null) {
// Class.getResourceAsStream() returns null if the resource does not exist.
throw new IOException("Could not locate resource: " + resourcePath);
}
return Jsonb.instance().type(AprilTagFieldLayout.class).fromJson(stream);
}
}
@Override
public boolean equals(Object obj) {
return obj instanceof AprilTagFieldLayout layout
&& m_apriltags.equals(layout.m_apriltags)
&& m_origin.equals(layout.m_origin);
}
@Override
public int hashCode() {
return Objects.hash(m_apriltags, m_origin);
}
static class FieldDimensions {
@Json.Property(value = "length")
public final double fieldLength;
@Json.Property(value = "width")
public final double fieldWidth;
@Json.Creator()
FieldDimensions(
@Json.Alias(value = "length") double fieldLength,
@Json.Alias(value = "width") double fieldWidth) {
this.fieldLength = fieldLength;
this.fieldWidth = fieldWidth;
}
}
}

View File

@@ -0,0 +1,38 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
/** Loadable AprilTag field layouts. */
public enum AprilTagFields {
/** 2022 Rapid React. */
k2022RapidReact("2022-rapidreact.json"),
/** 2023 Charged Up. */
k2023ChargedUp("2023-chargedup.json"),
/** 2024 Crescendo. */
k2024Crescendo("2024-crescendo.json"),
/** 2025 Reefscape Welded (see TU 12). */
k2025ReefscapeWelded("2025-reefscape-welded.json"),
/** 2025 Reefscape AndyMark (see TU 12). */
k2025ReefscapeAndyMark("2025-reefscape-andymark.json"),
/** 2026 Rebuilt Welded. */
k2026RebuiltWelded("2026-rebuilt-welded.json"),
/** 2026 Rebuilt AndyMark. */
k2026RebuiltAndymark("2026-rebuilt-andymark.json");
/** Base resource directory. */
public static final String kBaseResourceDir = "/org/wpilib/vision/apriltag/";
/** Alias to the current game. */
public static final AprilTagFields kDefaultField = k2026RebuiltWelded;
/** Resource filename. */
public final String resourceFile;
AprilTagFieldLayout fieldLayout;
AprilTagFields(String resourceFile) {
this.resourceFile = kBaseResourceDir + resourceFile;
}
}

View File

@@ -0,0 +1,54 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
import org.wpilib.math.geometry.Transform3d;
/** A pair of AprilTag pose estimates. */
public class AprilTagPoseEstimate {
/**
* Constructs a pose estimate.
*
* @param pose1 first pose
* @param pose2 second pose
* @param error1 error of first pose
* @param error2 error of second pose
*/
public AprilTagPoseEstimate(Transform3d pose1, Transform3d pose2, double error1, double error2) {
this.pose1 = pose1;
this.pose2 = pose2;
this.error1 = error1;
this.error2 = error2;
}
/**
* Get the ratio of pose reprojection errors, called ambiguity. Numbers above 0.2 are likely to be
* ambiguous.
*
* @return The ratio of pose reprojection errors.
*/
public double getAmbiguity() {
double min = Math.min(error1, error2);
double max = Math.max(error1, error2);
if (max > 0) {
return min / max;
} else {
return -1;
}
}
/** Pose 1. */
public final Transform3d pose1;
/** Pose 2. */
public final Transform3d pose2;
/** Object-space error of pose 1. */
public final double error1;
/** Object-space error of pose 2. */
public final double error2;
}

View File

@@ -0,0 +1,194 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag;
import org.wpilib.math.geometry.Transform3d;
import org.wpilib.vision.apriltag.jni.AprilTagJNI;
/** Pose estimators for AprilTag tags. */
public class AprilTagPoseEstimator {
/** Configuration for the pose estimator. */
public static class Config {
/**
* Creates a pose estimator configuration.
*
* @param tagSize tag size, in meters
* @param fx camera horizontal focal length, in pixels
* @param fy camera vertical focal length, in pixels
* @param cx camera horizontal focal center, in pixels
* @param cy camera vertical focal center, in pixels
*/
public Config(double tagSize, double fx, double fy, double cx, double cy) {
this.tagSize = tagSize;
this.fx = fx;
this.fy = fy;
this.cx = cx;
this.cy = cy;
}
/** Tag size, in meters. */
public double tagSize;
/** Camera horizontal focal length, in pixels. */
public double fx;
/** Camera vertical focal length, in pixels. */
public double fy;
/** Camera horizontal focal center, in pixels. */
public double cx;
/** Camera vertical focal center, in pixels. */
public double cy;
@Override
public int hashCode() {
return Double.hashCode(tagSize)
+ Double.hashCode(fx)
+ Double.hashCode(fy)
+ Double.hashCode(cx)
+ Double.hashCode(cy);
}
@Override
public boolean equals(Object obj) {
return obj instanceof Config other
&& tagSize == other.tagSize
&& fx == other.fx
&& fy == other.fy
&& cx == other.cx
&& cy == other.cy;
}
}
/**
* Creates estimator.
*
* @param config Configuration
*/
public AprilTagPoseEstimator(Config config) {
m_config = new Config(config.tagSize, config.fx, config.fy, config.cx, config.cy);
}
/**
* Sets estimator configuration.
*
* @param config Configuration
*/
public void setConfig(Config config) {
m_config.tagSize = config.tagSize;
m_config.fx = config.fx;
m_config.fy = config.fy;
m_config.cx = config.cx;
m_config.cy = config.cy;
}
/**
* Gets estimator configuration.
*
* @return Configuration
*/
public Config getConfig() {
return new Config(m_config.tagSize, m_config.fx, m_config.fy, m_config.cx, m_config.cy);
}
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param detection Tag detection
* @return Pose estimate
*/
public Transform3d estimateHomography(AprilTagDetection detection) {
return estimateHomography(detection.getHomography());
}
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param homography Homography 3x3 matrix data
* @return Pose estimate
*/
public Transform3d estimateHomography(double[] homography) {
return AprilTagJNI.estimatePoseHomography(
homography, m_config.tagSize, m_config.fx, m_config.fy, m_config.cx, m_config.cy);
}
/**
* Estimates the pose of the tag. This returns one or two possible poses for the tag, along with
* the object-space error of each.
*
* <p>This uses the homography method described in [1] for the initial estimate. Then Orthogonal
* Iteration [2] is used to refine this estimate. Then [3] is used to find a potential second
* local minima and Orthogonal Iteration is used to refine this second estimate.
*
* <p>[1]: E. Olson, “Apriltag: A robust and flexible visual fiducial system,” in 2011 IEEE
* International Conference on Robotics and Automation, May 2011, pp. 34003407.
*
* <p>[2]: Lu, G. D. Hager and E. Mjolsness, "Fast and globally convergent pose estimation from
* video images," in IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 22, no.
* 6, pp. 610-622, June 2000. doi: 10.1109/34.862199
*
* <p>[3]: Schweighofer and A. Pinz, "Robust Pose Estimation from a Planar Target," in IEEE
* Transactions on Pattern Analysis and Machine Intelligence, vol. 28, no. 12, pp. 2024-2030, Dec.
* 2006. doi: 10.1109/TPAMI.2006.252
*
* @param detection Tag detection
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
public AprilTagPoseEstimate estimateOrthogonalIteration(AprilTagDetection detection, int nIters) {
return estimateOrthogonalIteration(detection.getHomography(), detection.getCorners(), nIters);
}
/**
* Estimates the pose of the tag. This returns one or two possible poses for the tag, along with
* the object-space error of each.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
public AprilTagPoseEstimate estimateOrthogonalIteration(
double[] homography, double[] corners, int nIters) {
return AprilTagJNI.estimatePoseOrthogonalIteration(
homography,
corners,
m_config.tagSize,
m_config.fx,
m_config.fy,
m_config.cx,
m_config.cy,
nIters);
}
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the pose with the lower
* object-space error.
*
* @param detection Tag detection
* @return Pose estimate
*/
public Transform3d estimate(AprilTagDetection detection) {
return estimate(detection.getHomography(), detection.getCorners());
}
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the pose with the lower
* object-space error.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @return Pose estimate
*/
public Transform3d estimate(double[] homography, double[] corners) {
return AprilTagJNI.estimatePose(
homography, corners, m_config.tagSize, m_config.fx, m_config.fy, m_config.cx, m_config.cy);
}
private final Config m_config;
}

View File

@@ -0,0 +1,224 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.vision.apriltag.jni;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.wpilib.math.geometry.Transform3d;
import org.wpilib.util.RawFrame;
import org.wpilib.util.runtime.RuntimeLoader;
import org.wpilib.vision.apriltag.AprilTagDetection;
import org.wpilib.vision.apriltag.AprilTagDetector;
import org.wpilib.vision.apriltag.AprilTagPoseEstimate;
/** AprilTag JNI. */
public class AprilTagJNI {
static boolean libraryLoaded = false;
/** Sets whether JNI should be loaded in the static block. */
public static class Helper {
private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true);
/**
* Returns true if the JNI should be loaded in the static block.
*
* @return True if the JNI should be loaded in the static block.
*/
public static boolean getExtractOnStaticLoad() {
return extractOnStaticLoad.get();
}
/**
* Sets whether the JNI should be loaded in the static block.
*
* @param load Whether the JNI should be loaded in the static block.
*/
public static void setExtractOnStaticLoad(boolean load) {
extractOnStaticLoad.set(load);
}
/** Utility class. */
private Helper() {}
}
static {
if (Helper.getExtractOnStaticLoad()) {
try {
RuntimeLoader.loadLibrary("apriltagjni");
} catch (IOException ex) {
ex.printStackTrace();
System.exit(1);
}
libraryLoaded = true;
}
}
/**
* Constructs an AprilTag detector engine.
*
* @return The detector engine handle
*/
public static native long createDetector();
/**
* Destroys an AprilTag detector engine.
*
* @param det The detector engine handle
*/
public static native void destroyDetector(long det);
/**
* Sets the detector engine configuration.
*
* @param det The detector engine handle
* @param config A configuration
*/
public static native void setDetectorConfig(long det, AprilTagDetector.Config config);
/**
* Gets the detector engine configuration.
*
* @param det The detector engine handle
* @return The configuration
*/
public static native AprilTagDetector.Config getDetectorConfig(long det);
/**
* Sets the detector engine quad threshold parameters.
*
* @param det The detector engine handle
* @param params Quad threshold parameters
*/
public static native void setDetectorQTP(
long det, AprilTagDetector.QuadThresholdParameters params);
/**
* Gets the detector engine quad threshold parameters.
*
* @param det The detector engine handle
* @return Quad threshold parameters
*/
public static native AprilTagDetector.QuadThresholdParameters getDetectorQTP(long det);
/**
* Adds a family of tags to be detected by the detector engine.
*
* @param det The detector engine handle
* @param fam Family name, e.g. "tag16h5"
* @param bitsCorrected Maximum number of bits to correct
* @return False if family can't be found
*/
public static native boolean addFamily(long det, String fam, int bitsCorrected);
/**
* Removes a family of tags from the detector.
*
* @param det The detector engine handle
* @param fam Family name, e.g. "tag16h5"
*/
public static native void removeFamily(long det, String fam);
/**
* Unregister all families.
*
* @param det The detector engine handle
*/
public static native void clearFamilies(long det);
/**
* Detect tags from an 8-bit image.
*
* @param det The detector engine handle
* @param width The width of the image
* @param height The height of the image
* @param stride The number of bytes between image rows (often the same as width)
* @param bufAddr The address of the image buffer
* @return The results (array of AprilTagDetection)
*/
public static native AprilTagDetection[] detect(
long det, int width, int height, int stride, long bufAddr);
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param homography Homography 3x3 matrix data
* @param tagSize The tag size, in meters
* @param fx The camera horizontal focal length, in pixels
* @param fy The camera vertical focal length, in pixels
* @param cx The camera horizontal focal center, in pixels
* @param cy The camera vertical focal center, in pixels
* @return Pose estimate
*/
public static native Transform3d estimatePoseHomography(
double[] homography, double tagSize, double fx, double fy, double cx, double cy);
/**
* Estimates the pose of the tag. This returns one or two possible poses for the tag, along with
* the object-space error of each.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @param tagSize The tag size, in meters
* @param fx The camera horizontal focal length, in pixels
* @param fy The camera vertical focal length, in pixels
* @param cx The camera horizontal focal center, in pixels
* @param cy The camera vertical focal center, in pixels
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
public static native AprilTagPoseEstimate estimatePoseOrthogonalIteration(
double[] homography,
double[] corners,
double tagSize,
double fx,
double fy,
double cx,
double cy,
int nIters);
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the pose with the lower
* object-space error.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @param tagSize The tag size, in meters
* @param fx The camera horizontal focal length, in pixels
* @param fy The camera vertical focal length, in pixels
* @param cx The camera horizontal focal center, in pixels
* @param cy The camera vertical focal center, in pixels
* @return Pose estimate
*/
public static native Transform3d estimatePose(
double[] homography,
double[] corners,
double tagSize,
double fx,
double fy,
double cx,
double cy);
/**
* Generates a RawFrame containing the apriltag with the id with family 16h5 passed in.
*
* @param frameObj generated frame (output parameter).
* @param frame raw frame handle
* @param id id
*/
public static native void generate16h5AprilTagImage(RawFrame frameObj, long frame, int id);
/**
* Generates a RawFrame containing the apriltag with the id with family 36h11 passed in.
*
* @param frameObj generated frame (output parameter).
* @param frame raw frame handle
* @param id id
*/
public static native void generate36h11AprilTagImage(RawFrame frameObj, long frame, int id);
/** Utility class. */
private AprilTagJNI() {}
}

View File

@@ -0,0 +1,61 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/apriltag/AprilTag.hpp"
#include <cstring>
#include "wpi/util/json.hpp"
#ifdef _WIN32
#pragma warning(disable : 4200)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wc99-extensions"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "apriltag.h"
#include "tag16h5.h"
#include "tag36h11.h"
using namespace wpi::apriltag;
static bool FamilyToImage(wpi::util::RawFrame* frame, apriltag_family_t* family,
int id) {
image_u8_t* image = apriltag_to_image(family, id);
size_t totalDataSize = image->height * image->stride;
bool rv = frame->Reserve(totalDataSize);
std::memcpy(frame->data, image->buf, totalDataSize);
frame->size = totalDataSize;
frame->width = image->width;
frame->height = image->height;
frame->stride = image->stride;
frame->pixelFormat = WPI_PIXFMT_GRAY;
image_u8_destroy(image);
return rv;
}
bool AprilTag::Generate36h11AprilTagImage(wpi::util::RawFrame* frame, int id) {
apriltag_family_t* tagFamily = tag36h11_create();
bool rv = FamilyToImage(frame, tagFamily, id);
tag36h11_destroy(tagFamily);
return rv;
}
bool AprilTag::Generate16h5AprilTagImage(wpi::util::RawFrame* frame, int id) {
apriltag_family_t* tagFamily = tag16h5_create();
bool rv = FamilyToImage(frame, tagFamily, id);
tag16h5_destroy(tagFamily);
return rv;
}
void wpi::apriltag::to_json(wpi::util::json& json, const AprilTag& apriltag) {
json = wpi::util::json::object("ID", apriltag.ID, "pose", apriltag.pose);
}
void wpi::apriltag::from_json(const wpi::util::json& json, AprilTag& apriltag) {
apriltag.ID = json.at("ID").get_int();
apriltag.pose = json.at("pose").get<wpi::math::Pose3d>();
}

View File

@@ -0,0 +1,37 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/apriltag/AprilTagDetection.hpp"
#include <type_traits>
#ifdef _WIN32
#pragma warning(disable : 4200)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wc99-extensions"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "apriltag.h"
using namespace wpi::apriltag;
static_assert(sizeof(AprilTagDetection) == sizeof(apriltag_detection_t),
"structure sizes don't match");
static_assert(std::is_standard_layout_v<AprilTagDetection>,
"AprilTagDetection is not standard layout?");
std::string_view AprilTagDetection::GetFamily() const {
return static_cast<const apriltag_family_t*>(family)->name;
}
std::span<const double, 9> AprilTagDetection::GetHomography() const {
return std::span<const double, 9>{static_cast<matd_t*>(H)->data, 9};
}
Eigen::Matrix3d AprilTagDetection::GetHomographyMatrix() const {
return Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor>>{
static_cast<matd_t*>(H)->data};
}

View File

@@ -0,0 +1,172 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/apriltag/AprilTagDetector.hpp"
#include <cmath>
#include <utility>
#ifdef _WIN32
#pragma warning(disable : 4200)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wc99-extensions"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "apriltag.h"
#include "tag16h5.h"
#include "tag36h11.h"
using namespace wpi::apriltag;
AprilTagDetector::Results::Results(void* impl, const private_init&)
: span{reinterpret_cast<AprilTagDetection**>(
static_cast<zarray_t*>(impl)->data),
static_cast<size_t>(static_cast<zarray_t*>(impl)->size)},
m_impl{impl} {}
AprilTagDetector::Results& AprilTagDetector::Results::operator=(Results&& rhs) {
Destroy();
m_impl = rhs.m_impl;
rhs.m_impl = nullptr;
return *this;
}
void AprilTagDetector::Results::Destroy() {
if (m_impl) {
apriltag_detections_destroy(static_cast<zarray_t*>(m_impl));
}
}
AprilTagDetector::AprilTagDetector() : m_impl{apriltag_detector_create()} {
SetQuadThresholdParameters({});
}
AprilTagDetector& AprilTagDetector::operator=(AprilTagDetector&& rhs) {
Destroy();
m_impl = rhs.m_impl;
rhs.m_impl = nullptr;
m_families = std::move(rhs.m_families);
rhs.m_families.clear();
m_qtpCriticalAngle = rhs.m_qtpCriticalAngle;
return *this;
}
void AprilTagDetector::SetConfig(const Config& config) {
auto& impl = *static_cast<apriltag_detector_t*>(m_impl);
impl.nthreads = config.numThreads;
impl.quad_decimate = config.quadDecimate;
impl.quad_sigma = config.quadSigma;
impl.refine_edges = config.refineEdges;
impl.decode_sharpening = config.decodeSharpening;
impl.debug = config.debug;
}
AprilTagDetector::Config AprilTagDetector::GetConfig() const {
auto& impl = *static_cast<apriltag_detector_t*>(m_impl);
return {
.numThreads = impl.nthreads,
.quadDecimate = impl.quad_decimate,
.quadSigma = impl.quad_sigma,
.refineEdges = impl.refine_edges,
.decodeSharpening = impl.decode_sharpening,
.debug = impl.debug,
};
}
void AprilTagDetector::SetQuadThresholdParameters(
const QuadThresholdParameters& params) {
auto& qtp = static_cast<apriltag_detector_t*>(m_impl)->qtp;
qtp.min_cluster_pixels = params.minClusterPixels;
qtp.max_nmaxima = params.maxNumMaxima;
qtp.critical_rad = params.criticalAngle.value();
qtp.cos_critical_rad = std::cos(params.criticalAngle.value());
qtp.max_line_fit_mse = params.maxLineFitMSE;
qtp.min_white_black_diff = params.minWhiteBlackDiff;
qtp.deglitch = params.deglitch;
m_qtpCriticalAngle = params.criticalAngle;
}
AprilTagDetector::QuadThresholdParameters
AprilTagDetector::GetQuadThresholdParameters() const {
auto& qtp = static_cast<apriltag_detector_t*>(m_impl)->qtp;
return {
.minClusterPixels = qtp.min_cluster_pixels,
.maxNumMaxima = qtp.max_nmaxima,
.criticalAngle = m_qtpCriticalAngle,
.maxLineFitMSE = qtp.max_line_fit_mse,
.minWhiteBlackDiff = qtp.min_white_black_diff,
.deglitch = qtp.deglitch != 0,
};
}
bool AprilTagDetector::AddFamily(std::string_view fam, int bitsCorrected) {
auto& data = m_families[fam];
if (data) {
return true; // already detecting
}
// create the family
if (fam == "tag16h5") {
data = tag16h5_create();
} else if (fam == "tag36h11") {
data = tag36h11_create();
}
if (!data) {
m_families.erase(fam); // don't keep null value
return false; // can't add
}
apriltag_detector_add_family_bits(static_cast<apriltag_detector_t*>(m_impl),
static_cast<apriltag_family_t*>(data),
bitsCorrected);
return true;
}
void AprilTagDetector::RemoveFamily(std::string_view fam) {
auto it = m_families.find(fam);
if (it != m_families.end()) {
apriltag_detector_remove_family(
static_cast<apriltag_detector_t*>(m_impl),
static_cast<apriltag_family_t*>(it->second));
DestroyFamily(it->first, it->second);
m_families.erase(it);
}
}
void AprilTagDetector::ClearFamilies() {
apriltag_detector_clear_families(static_cast<apriltag_detector_t*>(m_impl));
DestroyFamilies();
m_families.clear();
}
AprilTagDetector::Results AprilTagDetector::Detect(int width, int height,
int stride, uint8_t* buf) {
image_u8_t img{width, height, stride, buf};
return {
apriltag_detector_detect(static_cast<apriltag_detector_t*>(m_impl), &img),
Results::private_init{}};
}
void AprilTagDetector::Destroy() {
if (m_impl) {
apriltag_detector_destroy(static_cast<apriltag_detector_t*>(m_impl));
}
DestroyFamilies();
}
void AprilTagDetector::DestroyFamilies() {
for (auto&& entry : m_families) {
DestroyFamily(entry.first, entry.second);
}
}
void AprilTagDetector::DestroyFamily(std::string_view name, void* data) {
auto fam = static_cast<apriltag_family_t*>(data);
if (name == "tag16h5") {
tag16h5_destroy(fam);
} else if (name == "tag36h11") {
tag36h11_destroy(fam);
}
}

View File

@@ -0,0 +1,180 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/apriltag/AprilTagFieldLayout.hpp"
#include <system_error>
#include <utility>
#include <vector>
#include "wpi/units/angle.hpp"
#include "wpi/units/length.hpp"
#include "wpi/util/MemoryBuffer.hpp"
#include "wpi/util/json.hpp"
#include "wpi/util/raw_ostream.hpp"
using namespace wpi::apriltag;
AprilTagFieldLayout::AprilTagFieldLayout(std::string_view path) {
auto fileBuffer = wpi::util::MemoryBuffer::GetFile(path);
if (!fileBuffer) {
throw std::runtime_error(fmt::format("Cannot open file: {}", path));
}
auto buf = fileBuffer.value()->GetCharBuffer();
auto json = wpi::util::json::parse_or_throw({buf.data(), buf.size()});
for (auto&& jtag : json.at("tags").get_array()) {
auto tag = jtag.get<AprilTag>();
m_apriltags[tag.ID] = tag;
}
m_fieldWidth = wpi::units::meter_t{json.at("field").at("width").get_number()};
m_fieldLength =
wpi::units::meter_t{json.at("field").at("length").get_number()};
}
AprilTagFieldLayout::AprilTagFieldLayout(std::vector<AprilTag> apriltags,
wpi::units::meter_t fieldLength,
wpi::units::meter_t fieldWidth)
: m_fieldLength(std::move(fieldLength)),
m_fieldWidth(std::move(fieldWidth)) {
for (const auto& tag : apriltags) {
m_apriltags[tag.ID] = tag;
}
}
wpi::units::meter_t AprilTagFieldLayout::GetFieldLength() const {
return m_fieldLength;
}
wpi::units::meter_t AprilTagFieldLayout::GetFieldWidth() const {
return m_fieldWidth;
}
std::vector<AprilTag> AprilTagFieldLayout::GetTags() const {
std::vector<AprilTag> tags;
tags.reserve(m_apriltags.size());
for (const auto& tag : m_apriltags) {
tags.emplace_back(tag.second);
}
return tags;
}
void AprilTagFieldLayout::SetOrigin(OriginPosition origin) {
switch (origin) {
case OriginPosition::kBlueAllianceWallRightSide:
SetOrigin(wpi::math::Pose3d{});
break;
case OriginPosition::kRedAllianceWallRightSide:
SetOrigin(wpi::math::Pose3d{
wpi::math::Translation3d{m_fieldLength, m_fieldWidth, 0_m},
wpi::math::Rotation3d{0_deg, 0_deg, 180_deg}});
break;
default:
throw std::invalid_argument("Invalid origin");
}
}
void AprilTagFieldLayout::SetOrigin(const wpi::math::Pose3d& origin) {
m_origin = origin;
}
wpi::math::Pose3d AprilTagFieldLayout::GetOrigin() const {
return m_origin;
}
std::optional<wpi::math::Pose3d> AprilTagFieldLayout::GetTagPose(int ID) const {
const auto& it = m_apriltags.find(ID);
if (it == m_apriltags.end()) {
return std::nullopt;
}
return it->second.pose.RelativeTo(m_origin);
}
void AprilTagFieldLayout::Serialize(std::string_view path) {
std::error_code error_code;
wpi::util::raw_fd_ostream output{path, error_code};
if (error_code) {
throw std::runtime_error(fmt::format("Cannot open file: {}", path));
}
wpi::util::json json = *this;
output << json;
output.flush();
}
void wpi::apriltag::to_json(wpi::util::json& json,
const AprilTagFieldLayout& layout) {
std::vector<AprilTag> tagVector;
tagVector.reserve(layout.m_apriltags.size());
for (const auto& pair : layout.m_apriltags) {
tagVector.push_back(pair.second);
}
auto field = wpi::util::json::object("length", layout.m_fieldLength.value(),
"width", layout.m_fieldWidth.value());
json = wpi::util::json::object("field", std::move(field), "tags",
std::move(tagVector));
}
void wpi::apriltag::from_json(const wpi::util::json& json,
AprilTagFieldLayout& layout) {
layout.m_apriltags.clear();
for (auto&& jtag : json.at("tags").get_array()) {
auto tag = jtag.get<AprilTag>();
layout.m_apriltags[tag.ID] = tag;
}
layout.m_fieldLength =
wpi::units::meter_t{json.at("field").at("length").get_number()};
layout.m_fieldWidth =
wpi::units::meter_t{json.at("field").at("width").get_number()};
}
// Use namespace declaration for forward declaration
namespace wpi::apriltag {
// C++ generated from resource files
std::string_view GetResource_2022_rapidreact_json();
std::string_view GetResource_2023_chargedup_json();
std::string_view GetResource_2024_crescendo_json();
std::string_view GetResource_2025_reefscape_welded_json();
std::string_view GetResource_2025_reefscape_andymark_json();
std::string_view GetResource_2026_rebuilt_welded_json();
std::string_view GetResource_2026_rebuilt_andymark_json();
} // namespace wpi::apriltag
AprilTagFieldLayout AprilTagFieldLayout::LoadField(AprilTagField field) {
std::string_view fieldString;
switch (field) {
case AprilTagField::k2022RapidReact:
fieldString = GetResource_2022_rapidreact_json();
break;
case AprilTagField::k2023ChargedUp:
fieldString = GetResource_2023_chargedup_json();
break;
case AprilTagField::k2024Crescendo:
fieldString = GetResource_2024_crescendo_json();
break;
case AprilTagField::k2025ReefscapeWelded:
fieldString = GetResource_2025_reefscape_welded_json();
break;
case AprilTagField::k2025ReefscapeAndyMark:
fieldString = GetResource_2025_reefscape_andymark_json();
break;
case AprilTagField::k2026RebuiltWelded:
fieldString = GetResource_2026_rebuilt_welded_json();
break;
case AprilTagField::k2026RebuiltAndyMark:
fieldString = GetResource_2026_rebuilt_andymark_json();
break;
case AprilTagField::kNumFields:
throw std::invalid_argument("Invalid Field");
}
wpi::util::json json = wpi::util::json::parse_or_throw(fieldString);
return json.get<AprilTagFieldLayout>();
}

View File

@@ -0,0 +1,20 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/apriltag/AprilTagPoseEstimate.hpp"
#include <algorithm>
using namespace wpi::apriltag;
double AprilTagPoseEstimate::GetAmbiguity() const {
auto min = (std::min)(error1, error2);
auto max = (std::max)(error1, error2);
if (max > 0) {
return min / max;
} else {
return -1;
}
}

View File

@@ -0,0 +1,155 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "wpi/apriltag/AprilTagPoseEstimator.hpp"
#include <Eigen/QR>
#include "wpi/apriltag/AprilTagDetection.hpp"
#ifdef _WIN32
#pragma warning(disable : 4200)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wc99-extensions"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "apriltag.h"
#include "apriltag_pose.h"
using namespace wpi::apriltag;
static Eigen::Matrix3d OrthogonalizeRotationMatrix(
const Eigen::Matrix3d& input) {
Eigen::HouseholderQR<Eigen::Matrix3d> qr{input};
Eigen::Matrix3d Q = qr.householderQ();
Eigen::Matrix3d R = qr.matrixQR().triangularView<Eigen::Upper>();
// Fix signs in R if they're < 0 so it's close to an identity matrix
// (our QR decomposition implementation sometimes flips the signs of
// columns)
for (int colR = 0; colR < 3; ++colR) {
if (R(colR, colR) < 0) {
for (int rowQ = 0; rowQ < 3; ++rowQ) {
Q(rowQ, colR) = -Q(rowQ, colR);
}
}
}
return Q;
}
static wpi::math::Transform3d MakePose(const apriltag_pose_t& pose) {
if (!pose.R || !pose.t) {
return {};
}
return {wpi::math::Translation3d{wpi::units::meter_t{pose.t->data[0]},
wpi::units::meter_t{pose.t->data[1]},
wpi::units::meter_t{pose.t->data[2]}},
wpi::math::Rotation3d{OrthogonalizeRotationMatrix(
Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor>>{
pose.R->data})}};
}
static apriltag_detection_info_t MakeDetectionInfo(
const apriltag_detection_t* det,
const AprilTagPoseEstimator::Config& config) {
return {const_cast<apriltag_detection_t*>(det),
config.tagSize.value(),
config.fx,
config.fy,
config.cx,
config.cy};
}
static apriltag_detection_t MakeBasicDet(
std::span<const double, 9> homography,
const std::span<const double, 8>* corners) {
apriltag_detection_t detection;
detection.H = matd_create(3, 3);
std::memcpy(detection.H->data, homography.data(), 9 * sizeof(double));
if (corners) {
for (int i = 0; i < 4; i++) {
detection.p[i][0] = (*corners)[i * 2];
detection.p[i][1] = (*corners)[i * 2 + 1];
}
}
return detection;
}
static wpi::math::Transform3d DoEstimateHomography(
const apriltag_detection_t* detection,
const AprilTagPoseEstimator::Config& config) {
auto info = MakeDetectionInfo(detection, config);
apriltag_pose_t pose;
estimate_pose_for_tag_homography(&info, &pose);
return MakePose(pose);
}
wpi::math::Transform3d AprilTagPoseEstimator::EstimateHomography(
const AprilTagDetection& detection) const {
return DoEstimateHomography(
reinterpret_cast<const apriltag_detection_t*>(&detection), m_config);
}
wpi::math::Transform3d AprilTagPoseEstimator::EstimateHomography(
std::span<const double, 9> homography) const {
auto detection = MakeBasicDet(homography, nullptr);
auto rv = DoEstimateHomography(&detection, m_config);
matd_destroy(detection.H);
return rv;
}
static AprilTagPoseEstimate DoEstimateOrthogonalIteration(
const apriltag_detection_t* detection,
const AprilTagPoseEstimator::Config& config, int nIters) {
auto info = MakeDetectionInfo(detection, config);
apriltag_pose_t pose1, pose2;
double err1, err2;
estimate_tag_pose_orthogonal_iteration(&info, &err1, &pose1, &err2, &pose2,
nIters, 1e-7);
return {MakePose(pose1), MakePose(pose2), err1, err2};
}
AprilTagPoseEstimate AprilTagPoseEstimator::EstimateOrthogonalIteration(
const AprilTagDetection& detection, int nIters) const {
return DoEstimateOrthogonalIteration(
reinterpret_cast<const apriltag_detection_t*>(&detection), m_config,
nIters);
}
AprilTagPoseEstimate AprilTagPoseEstimator::EstimateOrthogonalIteration(
std::span<const double, 9> homography, std::span<const double, 8> corners,
int nIters) const {
auto detection = MakeBasicDet(homography, &corners);
auto rv = DoEstimateOrthogonalIteration(&detection, m_config, nIters);
matd_destroy(detection.H);
return rv;
}
static wpi::math::Transform3d DoEstimate(
const apriltag_detection_t* detection,
const AprilTagPoseEstimator::Config& config) {
auto info = MakeDetectionInfo(detection, config);
apriltag_pose_t pose;
estimate_tag_pose(&info, &pose);
return MakePose(pose);
}
wpi::math::Transform3d AprilTagPoseEstimator::Estimate(
const AprilTagDetection& detection) const {
return DoEstimate(reinterpret_cast<const apriltag_detection_t*>(&detection),
m_config);
}
wpi::math::Transform3d AprilTagPoseEstimator::Estimate(
std::span<const double, 9> homography,
std::span<const double, 8> corners) const {
auto detection = MakeBasicDet(homography, &corners);
auto rv = DoEstimate(&detection, m_config);
matd_destroy(detection.H);
return rv;
}

View File

@@ -0,0 +1,636 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include <jni.h>
#include <cstdio>
#include <cstring>
#define WPI_RAWFRAME_JNI
#include "org_wpilib_vision_apriltag_jni_AprilTagJNI.h"
#include "wpi/apriltag/AprilTag.hpp"
#include "wpi/apriltag/AprilTagDetector.hpp"
#include "wpi/apriltag/AprilTagPoseEstimator.hpp"
#include "wpi/util/RawFrame.h"
#include "wpi/util/jni_util.hpp"
using namespace wpi::apriltag;
using namespace wpi::util::java;
static JavaVM* jvm = nullptr;
static JClass detectionCls;
static JClass detectorConfigCls;
static JClass detectorQTPCls;
static JClass poseEstimateCls;
static JClass quaternionCls;
static JClass rotation3dCls;
static JClass transform3dCls;
static JClass translation3dCls;
static JClass rawFrameCls;
static JException illegalArgEx;
static JException nullPointerEx;
static const JClassInit classes[] = {
{"org/wpilib/vision/apriltag/AprilTagDetection", &detectionCls},
{"org/wpilib/vision/apriltag/AprilTagDetector$Config", &detectorConfigCls},
{"org/wpilib/vision/apriltag/AprilTagDetector$QuadThresholdParameters",
&detectorQTPCls},
{"org/wpilib/vision/apriltag/AprilTagPoseEstimate", &poseEstimateCls},
{"org/wpilib/math/geometry/Quaternion", &quaternionCls},
{"org/wpilib/math/geometry/Rotation3d", &rotation3dCls},
{"org/wpilib/math/geometry/Transform3d", &transform3dCls},
{"org/wpilib/math/geometry/Translation3d", &translation3dCls},
{"org/wpilib/util/RawFrame", &rawFrameCls}};
static const JExceptionInit exceptions[] = {
{"java/lang/IllegalArgumentException", &illegalArgEx},
{"java/lang/NullPointerException", &nullPointerEx}};
extern "C" {
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
jvm = vm;
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
return JNI_ERR;
}
// Cache references to classes
for (auto& c : classes) {
*c.cls = JClass(env, c.name);
if (!*c.cls) {
std::fprintf(stderr, "could not load class %s\n", c.name);
return JNI_ERR;
}
}
for (auto& c : exceptions) {
*c.cls = JException(env, c.name);
if (!*c.cls) {
std::fprintf(stderr, "could not load exception %s\n", c.name);
return JNI_ERR;
}
}
return JNI_VERSION_1_6;
}
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) {
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
return;
}
// Delete global references
for (auto& c : classes) {
c.cls->free(env);
}
for (auto& c : exceptions) {
c.cls->free(env);
}
jvm = nullptr;
}
} // extern "C"
//
// Conversions from Java to C++ objects
//
static AprilTagDetector::Config FromJavaDetectorConfig(JNIEnv* env,
jobject jconfig) {
if (!jconfig) {
return {};
}
#define FIELD(name, sig) \
static jfieldID name##Field = nullptr; \
if (!name##Field) { \
name##Field = env->GetFieldID(detectorConfigCls, #name, sig); \
}
FIELD(numThreads, "I");
FIELD(quadDecimate, "F");
FIELD(quadSigma, "F");
FIELD(refineEdges, "Z");
FIELD(decodeSharpening, "D");
FIELD(debug, "Z");
#undef FIELD
#define FIELD(ctype, jtype, name) \
.name = static_cast<ctype>(env->Get##jtype##Field(jconfig, name##Field))
return {
FIELD(int, Int, numThreads),
FIELD(float, Float, quadDecimate),
FIELD(float, Float, quadSigma),
FIELD(bool, Boolean, refineEdges),
FIELD(double, Double, decodeSharpening),
FIELD(bool, Boolean, debug),
};
#undef GET
#undef FIELD
}
static AprilTagDetector::QuadThresholdParameters FromJavaDetectorQTP(
JNIEnv* env, jobject jparams) {
if (!jparams) {
return {};
}
#define FIELD(name, sig) \
static jfieldID name##Field = nullptr; \
if (!name##Field) { \
name##Field = env->GetFieldID(detectorQTPCls, #name, sig); \
}
FIELD(minClusterPixels, "I");
FIELD(maxNumMaxima, "I");
FIELD(criticalAngle, "D");
FIELD(maxLineFitMSE, "F");
FIELD(minWhiteBlackDiff, "I");
FIELD(deglitch, "Z");
#undef FIELD
#define FIELD(ctype, jtype, name) \
.name = static_cast<ctype>(env->Get##jtype##Field(jparams, name##Field))
return {
FIELD(int, Int, minClusterPixels),
FIELD(int, Int, maxNumMaxima),
.criticalAngle = wpi::units::radian_t{static_cast<double>(
env->GetDoubleField(jparams, criticalAngleField))},
FIELD(float, Float, maxLineFitMSE),
FIELD(int, Int, minWhiteBlackDiff),
FIELD(bool, Boolean, deglitch),
};
#undef GET
#undef FIELD
}
//
// Conversions from C++ to Java objects
//
static jobject MakeJObject(JNIEnv* env, const AprilTagDetection& detect) {
static jmethodID constructor = env->GetMethodID(
detectionCls, "<init>", "(Ljava/lang/String;IIF[DDD[D)V");
if (!constructor) {
return nullptr;
}
JLocal<jstring> fam{env, MakeJString(env, detect.GetFamily())};
auto homography = detect.GetHomography();
JLocal<jdoubleArray> harr{
env, MakeJDoubleArray(
env, {reinterpret_cast<const jdouble*>(homography.data()),
homography.size()})};
double cornersBuf[8];
auto corners = detect.GetCorners(cornersBuf);
JLocal<jdoubleArray> carr{
env,
MakeJDoubleArray(env, {reinterpret_cast<const jdouble*>(corners.data()),
corners.size()})};
auto center = detect.GetCenter();
return env->NewObject(detectionCls, constructor, fam.obj(),
static_cast<jint>(detect.GetId()),
static_cast<jint>(detect.GetHamming()),
static_cast<jfloat>(detect.GetDecisionMargin()),
harr.obj(), static_cast<jdouble>(center.x),
static_cast<jdouble>(center.y), carr.obj());
}
static jobjectArray MakeJObject(JNIEnv* env,
std::span<const AprilTagDetection* const> arr) {
jobjectArray jarr = env->NewObjectArray(arr.size(), detectionCls, nullptr);
if (!jarr) {
return nullptr;
}
for (size_t i = 0; i < arr.size(); ++i) {
JLocal<jobject> elem{env, MakeJObject(env, *arr[i])};
env->SetObjectArrayElement(jarr, i, elem.obj());
}
return jarr;
}
static jobject MakeJObject(JNIEnv* env,
const AprilTagDetector::Config& config) {
static jmethodID constructor =
env->GetMethodID(detectorConfigCls, "<init>", "(IFFZDZ)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(detectorConfigCls, constructor,
static_cast<jint>(config.numThreads),
static_cast<jfloat>(config.quadDecimate),
static_cast<jfloat>(config.quadSigma),
static_cast<jboolean>(config.refineEdges),
static_cast<jdouble>(config.decodeSharpening),
static_cast<jboolean>(config.debug));
}
static jobject MakeJObject(
JNIEnv* env, const AprilTagDetector::QuadThresholdParameters& params) {
static jmethodID constructor =
env->GetMethodID(detectorQTPCls, "<init>", "(IIDFIZ)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(detectorQTPCls, constructor,
static_cast<jint>(params.minClusterPixels),
static_cast<jint>(params.maxNumMaxima),
static_cast<jdouble>(params.criticalAngle),
static_cast<jfloat>(params.maxLineFitMSE),
static_cast<jint>(params.minWhiteBlackDiff),
static_cast<jboolean>(params.deglitch));
}
static jobject MakeJObject(JNIEnv* env, const wpi::math::Translation3d& xlate) {
static jmethodID constructor =
env->GetMethodID(translation3dCls, "<init>", "(DDD)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(
translation3dCls, constructor, static_cast<jdouble>(xlate.X()),
static_cast<jdouble>(xlate.Y()), static_cast<jdouble>(xlate.Z()));
}
static jobject MakeJObject(JNIEnv* env, const wpi::math::Quaternion& q) {
static jmethodID constructor =
env->GetMethodID(quaternionCls, "<init>", "(DDDD)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(quaternionCls, constructor, static_cast<jdouble>(q.W()),
static_cast<jdouble>(q.X()),
static_cast<jdouble>(q.Y()),
static_cast<jdouble>(q.Z()));
}
static jobject MakeJObject(JNIEnv* env, const wpi::math::Rotation3d& rot) {
static jmethodID constructor = env->GetMethodID(
rotation3dCls, "<init>", "(Lorg/wpilib/math/geometry/Quaternion;)V");
if (!constructor) {
return nullptr;
}
JLocal<jobject> q{env, MakeJObject(env, rot.GetQuaternion())};
return env->NewObject(rotation3dCls, constructor, q.obj());
}
static jobject MakeJObject(JNIEnv* env, const wpi::math::Transform3d& xform) {
static jmethodID constructor =
env->GetMethodID(transform3dCls, "<init>",
"(Lorg/wpilib/math/geometry/Translation3d;"
"Lorg/wpilib/math/geometry/Rotation3d;)V");
if (!constructor) {
return nullptr;
}
JLocal<jobject> xlate{env, MakeJObject(env, xform.Translation())};
JLocal<jobject> rot{env, MakeJObject(env, xform.Rotation())};
return env->NewObject(transform3dCls, constructor, xlate.obj(), rot.obj());
}
static jobject MakeJObject(JNIEnv* env, const AprilTagPoseEstimate& est) {
static jmethodID constructor =
env->GetMethodID(poseEstimateCls, "<init>",
"(Lorg/wpilib/math/geometry/Transform3d;"
"Lorg/wpilib/math/geometry/Transform3d;DD)V");
if (!constructor) {
return nullptr;
}
JLocal<jobject> pose1{env, MakeJObject(env, est.pose1)};
JLocal<jobject> pose2{env, MakeJObject(env, est.pose2)};
return env->NewObject(poseEstimateCls, constructor, pose1.obj(), pose2.obj(),
static_cast<jdouble>(est.error1),
static_cast<jdouble>(est.error2));
}
extern "C" {
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: createDetector
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_createDetector
(JNIEnv* env, jclass)
{
return reinterpret_cast<jlong>(new AprilTagDetector);
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: destroyDetector
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_destroyDetector
(JNIEnv* env, jclass, jlong det)
{
delete reinterpret_cast<AprilTagDetector*>(det);
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: setDetectorConfig
* Signature: (JLjava/lang/Object;)V
*/
JNIEXPORT void JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_setDetectorConfig
(JNIEnv* env, jclass, jlong det, jobject config)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->SetConfig(
FromJavaDetectorConfig(env, config));
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: getDetectorConfig
* Signature: (J)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_getDetectorConfig
(JNIEnv* env, jclass, jlong det)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return nullptr;
}
return MakeJObject(env,
reinterpret_cast<AprilTagDetector*>(det)->GetConfig());
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: setDetectorQTP
* Signature: (JLjava/lang/Object;)V
*/
JNIEXPORT void JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_setDetectorQTP
(JNIEnv* env, jclass, jlong det, jobject params)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->SetQuadThresholdParameters(
FromJavaDetectorQTP(env, params));
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: getDetectorQTP
* Signature: (J)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_getDetectorQTP
(JNIEnv* env, jclass, jlong det)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return nullptr;
}
return MakeJObject(
env,
reinterpret_cast<AprilTagDetector*>(det)->GetQuadThresholdParameters());
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: addFamily
* Signature: (JLjava/lang/String;I)Z
*/
JNIEXPORT jboolean JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_addFamily
(JNIEnv* env, jclass, jlong det, jstring fam, jint bitsCorrected)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return false;
}
if (!fam) {
nullPointerEx.Throw(env, "fam cannot be null");
return false;
}
return reinterpret_cast<AprilTagDetector*>(det)->AddFamily(
JStringRef{env, fam}, bitsCorrected);
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: removeFamily
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_removeFamily
(JNIEnv* env, jclass, jlong det, jstring fam)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
if (!fam) {
nullPointerEx.Throw(env, "fam cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->RemoveFamily(JStringRef{env, fam});
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: clearFamilies
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_clearFamilies
(JNIEnv* env, jclass, jlong det)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->ClearFamilies();
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: detect
* Signature: (JIIIJ)[Ljava/lang/Object;
*/
JNIEXPORT jobjectArray JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_detect
(JNIEnv* env, jclass, jlong det, jint width, jint height, jint stride,
jlong bufAddr)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return nullptr;
}
if (bufAddr == 0) {
nullPointerEx.Throw(env, "bufAddr cannot be null");
return nullptr;
}
return MakeJObject(
env, reinterpret_cast<AprilTagDetector*>(det)->Detect(
width, height, stride, reinterpret_cast<uint8_t*>(bufAddr)));
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: estimatePoseHomography
* Signature: ([DDDDDD)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_estimatePoseHomography
(JNIEnv* env, jclass, jdoubleArray homography, jdouble tagSize, jdouble fx,
jdouble fy, jdouble cx, jdouble cy)
{
if (!homography) {
nullPointerEx.Throw(env, "homography cannot be null");
return nullptr;
}
JSpan<const jdouble, 9> harr{env, homography};
if (harr.size() != 9) {
illegalArgEx.Throw(env, "homography array must be size 9");
return nullptr;
}
AprilTagPoseEstimator estimator(
{wpi::units::meter_t{tagSize}, fx, fy, cx, cy});
return MakeJObject(env, estimator.EstimateHomography(harr));
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: estimatePoseOrthogonalIteration
* Signature: ([D[DDDDDDI)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_estimatePoseOrthogonalIteration
(JNIEnv* env, jclass, jdoubleArray homography, jdoubleArray corners,
jdouble tagSize, jdouble fx, jdouble fy, jdouble cx, jdouble cy, jint nIters)
{
// homography
if (!homography) {
nullPointerEx.Throw(env, "homography cannot be null");
return nullptr;
}
JSpan<const jdouble, 9> harr{env, homography};
if (harr.size() != 9) {
illegalArgEx.Throw(env, "homography array must be size 9");
return nullptr;
}
// corners
if (!corners) {
nullPointerEx.Throw(env, "corners cannot be null");
return nullptr;
}
JSpan<const jdouble, 8> carr{env, corners};
if (carr.size() != 8) {
illegalArgEx.Throw(env, "corners array must be size 8");
return nullptr;
}
AprilTagPoseEstimator estimator(
{wpi::units::meter_t{tagSize}, fx, fy, cx, cy});
return MakeJObject(env,
estimator.EstimateOrthogonalIteration(harr, carr, nIters));
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: estimatePose
* Signature: ([D[DDDDDD)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_estimatePose
(JNIEnv* env, jclass, jdoubleArray homography, jdoubleArray corners,
jdouble tagSize, jdouble fx, jdouble fy, jdouble cx, jdouble cy)
{
// homography
if (!homography) {
nullPointerEx.Throw(env, "homography cannot be null");
return nullptr;
}
JSpan<const jdouble, 9> harr{env, homography};
if (harr.size() != 9) {
illegalArgEx.Throw(env, "homography array must be size 9");
return nullptr;
}
// corners
if (!corners) {
nullPointerEx.Throw(env, "corners cannot be null");
return nullptr;
}
JSpan<const jdouble, 8> carr{env, corners};
if (carr.size() != 8) {
illegalArgEx.Throw(env, "corners array must be size 8");
return nullptr;
}
AprilTagPoseEstimator estimator(
{wpi::units::meter_t{tagSize}, fx, fy, cx, cy});
return MakeJObject(env, estimator.Estimate(harr, carr));
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: generate16h5AprilTagImage
* Signature: (Ljava/lang/Object;JI)V
*/
JNIEXPORT void JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_generate16h5AprilTagImage
(JNIEnv* env, jclass, jobject frameObj, jlong framePtr, jint id)
{
auto* frame = reinterpret_cast<wpi::util::RawFrame*>(framePtr);
if (!frame) {
nullPointerEx.Throw(env, "frame is null");
return;
}
bool newData = AprilTag::Generate16h5AprilTagImage(frame, id);
wpi::util::SetFrameData(env, rawFrameCls, frameObj, *frame, newData);
}
/*
* Class: org_wpilib_vision_apriltag_jni_AprilTagJNI
* Method: generate36h11AprilTagImage
* Signature: (Ljava/lang/Object;JI)V
*/
JNIEXPORT void JNICALL
Java_org_wpilib_vision_apriltag_jni_AprilTagJNI_generate36h11AprilTagImage
(JNIEnv* env, jclass, jobject frameObj, jlong framePtr, jint id)
{
auto* frame = reinterpret_cast<wpi::util::RawFrame*>(framePtr);
if (!frame) {
nullPointerEx.Throw(env, "frame is null");
return;
}
// function might reallocate
bool newData = AprilTag::Generate36h11AprilTagImage(frame, id);
wpi::util::SetFrameData(env, rawFrameCls, frameObj, *frame, newData);
}
} // extern "C"

View File

@@ -0,0 +1,39 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include "wpi/math/geometry/Pose3d.hpp"
#include "wpi/util/RawFrame.hpp"
#include "wpi/util/SymbolExports.hpp"
namespace wpi::util {
class json;
} // namespace wpi::util
namespace wpi::apriltag {
/**
* Represents an AprilTag's metadata.
*/
struct WPILIB_DLLEXPORT AprilTag {
/// The tag's ID.
int ID;
/// The tag's pose.
wpi::math::Pose3d pose;
bool operator==(const AprilTag&) const = default;
static bool Generate36h11AprilTagImage(wpi::util::RawFrame* frame, int id);
static bool Generate16h5AprilTagImage(wpi::util::RawFrame* frame, int id);
};
WPILIB_DLLEXPORT
void to_json(wpi::util::json& json, const AprilTag& apriltag);
WPILIB_DLLEXPORT
void from_json(const wpi::util::json& json, AprilTag& apriltag);
} // namespace wpi::apriltag

View File

@@ -0,0 +1,161 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <stdint.h>
#include <span>
#include <string_view>
#include <Eigen/Core>
#include "wpi/util/SymbolExports.hpp"
namespace wpi::apriltag {
/**
* A detection of an AprilTag tag.
*/
class WPILIB_DLLEXPORT AprilTagDetection final {
public:
AprilTagDetection() = delete;
AprilTagDetection(const AprilTagDetection&) = delete;
AprilTagDetection& operator=(const AprilTagDetection&) = delete;
/** A point. Used for center and corner points. */
struct Point {
double x;
double y;
};
/**
* Gets the decoded tag's family name.
*
* @return Decoded family name
*/
std::string_view GetFamily() const;
/**
* Gets the decoded ID of the tag.
*
* @return Decoded ID
*/
int GetId() const { return id; }
/**
* Gets how many error bits were corrected. Note: accepting large numbers of
* corrected errors leads to greatly increased false positive rates.
* NOTE: As of this implementation, the detector cannot detect tags with
* a hamming distance greater than 2.
*
* @return Hamming distance (number of corrected error bits)
*/
int GetHamming() const { return hamming; }
/**
* Gets a measure of the quality of the binary decoding process: the
* average difference between the intensity of a data bit versus
* the decision threshold. Higher numbers roughly indicate better
* decodes. This is a reasonable measure of detection accuracy
* only for very small tags-- not effective for larger tags (where
* we could have sampled anywhere within a bit cell and still
* gotten a good detection.)
*
* @return Decision margin
*/
float GetDecisionMargin() const { return decision_margin; }
/**
* Gets the 3x3 homography matrix describing the projection from an
* "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,
* -1)) to pixels in the image.
*
* @return Homography matrix data
*/
std::span<const double, 9> GetHomography() const;
/**
* Gets the 3x3 homography matrix describing the projection from an
* "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,
* -1)) to pixels in the image.
*
* @return Homography matrix
*/
Eigen::Matrix3d GetHomographyMatrix() const;
/**
* Gets the center of the detection in image pixel coordinates.
*
* @return Center point
*/
const Point& GetCenter() const { return *reinterpret_cast<const Point*>(c); }
/**
* Gets a corner of the tag in image pixel coordinates. These always
* wrap counter-clock wise around the tag. Index 0 is the bottom left corner.
*
* @param ndx Corner index (range is 0-3, inclusive)
* @return Corner point
*/
const Point& GetCorner(int ndx) const {
return *reinterpret_cast<const Point*>(p[ndx]);
}
/**
* Gets the corners of the tag in image pixel coordinates. These always
* wrap counter-clock wise around the tag. The first set of corner coordinates
* are the coordinates for the bottom left corner.
*
* @param cornersBuf Corner point array (X and Y for each corner in order)
* @return Corner point array (copy of cornersBuf span)
*/
std::span<double, 8> GetCorners(std::span<double, 8> cornersBuf) const {
for (int i = 0; i < 4; i++) {
cornersBuf[i * 2] = p[i][0];
cornersBuf[i * 2 + 1] = p[i][1];
}
return cornersBuf;
}
private:
// This class *must* be standard-layout-compatible with apriltag_detection
// as we use reinterpret_cast from that structure. This means the below
// members must exactly match the contents of the apriltag_detection struct.
// The tag family.
void* family;
// The decoded ID of the tag.
int id;
// How many error bits were corrected? Note: accepting large numbers of
// corrected errors leads to greatly increased false positive rates.
// NOTE: As of this implementation, the detector cannot detect tags with
// a hamming distance greater than 2.
int hamming;
// A measure of the quality of the binary decoding process: the
// average difference between the intensity of a data bit versus
// the decision threshold. Higher numbers roughly indicate better
// decodes. This is a reasonable measure of detection accuracy
// only for very small tags-- not effective for larger tags (where
// we could have sampled anywhere within a bit cell and still
// gotten a good detection.)
float decision_margin;
// The 3x3 homography matrix describing the projection from an
// "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,
// -1)) to pixels in the image.
void* H;
// The center of the detection in image pixel coordinates.
double c[2];
// The corners of the tag in image pixel coordinates. These always
// wrap counter-clock wise around the tag.
double p[4][2];
};
} // namespace wpi::apriltag

View File

@@ -0,0 +1,261 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <stdint.h>
#include <memory>
#include <span>
#include <string_view>
#include <utility>
#include "wpi/apriltag/AprilTagDetection.hpp"
#include "wpi/units/angle.hpp"
#include "wpi/util/StringMap.hpp"
#include "wpi/util/SymbolExports.hpp"
namespace wpi::apriltag {
/**
* An AprilTag detector engine. This is expensive to set up and tear down, so
* most use cases should only create one of these, add a family to it, set up
* any other configuration, and repeatedly call Detect().
*/
class WPILIB_DLLEXPORT AprilTagDetector {
public:
/** Detector configuration. */
struct Config {
bool operator==(const Config&) const = default;
/**
* How many threads should be used for computation. Default is
* single-threaded operation (1 thread).
*/
int numThreads = 1;
/**
* Quad decimation. Detection of quads can be done on a lower-resolution
* image, improving speed at a cost of pose accuracy and a slight decrease
* in detection rate. Decoding the binary payload is still done at full
* resolution. Default is 2.0.
*/
float quadDecimate = 2.0f;
/**
* What Gaussian blur should be applied to the segmented image (used for
* quad detection). Very noisy images benefit from non-zero values (e.g.
* 0.8). Default is 0.0.
*/
float quadSigma = 0.0f;
/**
* When true, the edges of the each quad are adjusted to "snap to" strong
* gradients nearby. This is useful when decimation is employed, as it can
* increase the quality of the initial quad estimate substantially.
* Generally recommended to be on (true). Default is true.
*
* Very computationally inexpensive. Option is ignored if
* quad_decimate = 1.
*/
bool refineEdges = true;
/**
* How much sharpening should be done to decoded images. This can help
* decode small tags but may or may not help in odd lighting conditions or
* low light conditions. Default is 0.25.
*/
double decodeSharpening = 0.25;
/**
* Debug mode. When true, the decoder writes a variety of debugging images
* to the current working directory at various stages through the detection
* process. This is slow and should *not* be used on space-limited systems
* such as the RoboRIO. Default is disabled (false).
*/
bool debug = false;
};
/** Quad threshold parameters. */
struct QuadThresholdParameters {
bool operator==(const QuadThresholdParameters&) const = default;
/**
* Threshold used to reject quads containing too few pixels. Default is 300
* pixels.
*/
int minClusterPixels = 300;
/**
* How many corner candidates to consider when segmenting a group of pixels
* into a quad. Default is 10.
*/
int maxNumMaxima = 10;
/**
* Critical angle. The detector will reject quads where pairs of edges have
* angles that are close to straight or close to 180 degrees. Zero means
* that no quads are rejected. Default is 45 degrees.
*/
wpi::units::radian_t criticalAngle = 45_deg;
/**
* When fitting lines to the contours, the maximum mean squared error
* allowed. This is useful in rejecting contours that are far from being
* quad shaped; rejecting these quads "early" saves expensive decoding
* processing. Default is 10.0.
*/
float maxLineFitMSE = 10.0f;
/**
* Minimum brightness offset. When we build our model of black & white
* pixels, we add an extra check that the white model must be (overall)
* brighter than the black model. How much brighter? (in pixel values,
* [0,255]). Default is 5.
*/
int minWhiteBlackDiff = 5;
/**
* Whether the thresholded image be should be deglitched. Only useful for
* very noisy images. Default is disabled (false).
*/
bool deglitch = false;
};
/**
* Array of detection results. Each array element is a pointer to an
* AprilTagDetection.
*/
class WPILIB_DLLEXPORT Results
: public std::span<AprilTagDetection const* const> {
struct private_init {};
friend class AprilTagDetector;
public:
Results() = default;
Results(void* impl, const private_init&);
~Results() { Destroy(); }
Results(const Results&) = delete;
Results& operator=(const Results&) = delete;
Results(Results&& rhs) : span{std::move(rhs)}, m_impl{rhs.m_impl} {
rhs.m_impl = nullptr;
}
Results& operator=(Results&& rhs);
private:
void Destroy();
void* m_impl = nullptr;
};
AprilTagDetector();
~AprilTagDetector() { Destroy(); }
AprilTagDetector(const AprilTagDetector&) = delete;
AprilTagDetector& operator=(const AprilTagDetector&) = delete;
AprilTagDetector(AprilTagDetector&& rhs)
: m_impl{rhs.m_impl},
m_families{std::move(rhs.m_families)},
m_qtpCriticalAngle{rhs.m_qtpCriticalAngle} {
rhs.m_impl = nullptr;
}
AprilTagDetector& operator=(AprilTagDetector&& rhs);
/**
* @{
* @name Configuration functions
*/
/**
* Sets detector configuration.
*
* @param config Configuration
*/
void SetConfig(const Config& config);
/**
* Gets detector configuration.
*
* @return Configuration
*/
Config GetConfig() const;
/**
* Sets quad threshold parameters.
*
* @param params Parameters
*/
void SetQuadThresholdParameters(const QuadThresholdParameters& params);
/**
* Gets quad threshold parameters.
*
* @return Parameters
*/
QuadThresholdParameters GetQuadThresholdParameters() const;
/** @} */
/**
* @{
* @name Tag family functions
*/
/**
* Adds a family of tags to be detected.
*
* @param fam Family name, e.g. "tag16h5"
* @param bitsCorrected Maximum number of bits to correct
* @return False if family can't be found
*/
bool AddFamily(std::string_view fam, int bitsCorrected = 2);
/**
* Removes a family of tags from the detector.
*
* @param fam Family name, e.g. "tag16h5"
*/
void RemoveFamily(std::string_view fam);
/**
* Unregister all families.
*/
void ClearFamilies();
/** @} */
/**
* Detect tags from an 8-bit image.
* The image must be grayscale.
*
* @param width width of the image
* @param height height of the image
* @param stride number of bytes between image rows (often the same as width)
* @param buf image buffer
* @return Results (array of AprilTagDetection pointers)
*/
Results Detect(int width, int height, int stride, uint8_t* buf);
/**
* Detect tags from an 8-bit image.
* The image must be grayscale.
*
* @param width width of the image
* @param height height of the image
* @param buf image buffer
* @return Results (array of AprilTagDetection pointers)
*/
Results Detect(int width, int height, uint8_t* buf) {
return Detect(width, height, width, buf);
}
private:
void Destroy();
void DestroyFamilies();
void DestroyFamily(std::string_view name, void* data);
void* m_impl;
wpi::util::StringMap<void*> m_families;
wpi::units::radian_t m_qtpCriticalAngle = 10_deg;
};
} // namespace wpi::apriltag

View File

@@ -0,0 +1,18 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <opencv2/core/mat.hpp>
#include "wpi/apriltag/AprilTagDetector.hpp"
namespace wpi::apriltag {
inline AprilTagDetector::Results AprilTagDetect(AprilTagDetector& detector,
cv::Mat& image) {
return detector.Detect(image.cols, image.rows, image.data);
}
} // namespace wpi::apriltag

View File

@@ -0,0 +1,167 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <optional>
#include <string_view>
#include <unordered_map>
#include <vector>
#include "wpi/apriltag/AprilTag.hpp"
#include "wpi/apriltag/AprilTagFields.hpp"
#include "wpi/math/geometry/Pose3d.hpp"
#include "wpi/units/length.hpp"
#include "wpi/util/SymbolExports.hpp"
namespace wpi::util {
class json;
} // namespace wpi::util
namespace wpi::apriltag {
/**
* Class for representing a layout of AprilTags on a field and reading them from
* a JSON format.
*
* The JSON format contains two top-level objects, "tags" and "field".
* The "tags" object is a list of all AprilTags contained within a layout. Each
* AprilTag serializes to a JSON object containing an ID and a
* wpi::math::Pose3d. The "field" object is a descriptor of the size of the
* field in meters with "width" and "length" values. This is to account for
* arbitrary field sizes when transforming the poses.
*
* Pose3ds in the JSON are measured using the normal FRC coordinate system, NWU
* with the origin at the bottom-right corner of the blue alliance wall.
* SetOrigin(OriginPosition) can be used to change the poses returned from
* GetTagPose(int) to be from the perspective of a specific alliance.
*
* Tag poses represent the center of the tag, with a zero rotation representing
* a tag that is upright and facing away from the (blue) alliance wall (that is,
* towards the opposing alliance). */
class WPILIB_DLLEXPORT AprilTagFieldLayout {
public:
/**
* Common origin positions for the AprilTag coordinate system.
*/
enum class OriginPosition {
/// Blue alliance wall, right side.
kBlueAllianceWallRightSide,
/// Red alliance wall, right side.
kRedAllianceWallRightSide,
};
/**
* Loads an AprilTagFieldLayout from a predefined field
*
* @param field The predefined field
* @return AprilTagFieldLayout of the field
*/
static AprilTagFieldLayout LoadField(AprilTagField field);
AprilTagFieldLayout() = default;
/**
* Construct a new AprilTagFieldLayout with values imported from a JSON file.
*
* @param path Path of the JSON file to import from.
*/
explicit AprilTagFieldLayout(std::string_view path);
/**
* Construct a new AprilTagFieldLayout from a vector of AprilTag objects.
*
* @param apriltags Vector of AprilTags.
* @param fieldLength Length of field the layout is representing.
* @param fieldWidth Width of field the layout is representing.
*/
AprilTagFieldLayout(std::vector<AprilTag> apriltags,
wpi::units::meter_t fieldLength,
wpi::units::meter_t fieldWidth);
/**
* Returns the length of the field the layout is representing.
* @return length
*/
wpi::units::meter_t GetFieldLength() const;
/**
* Returns the length of the field the layout is representing.
* @return width
*/
wpi::units::meter_t GetFieldWidth() const;
/**
* Returns a vector of all the april tags used in this layout.
* @return list of tags
*/
std::vector<AprilTag> GetTags() const;
/**
* Sets the origin based on a predefined enumeration of coordinate frame
* origins. The origins are calculated from the field dimensions.
*
* This transforms the Pose3ds returned by GetTagPose(int) to return the
* correct pose relative to a predefined coordinate frame.
*
* @param origin The predefined origin
*/
void SetOrigin(OriginPosition origin);
/**
* Sets the origin for tag pose transformation.
*
* This transforms the Pose3ds returned by GetTagPose(int) to return the
* correct pose relative to the provided origin.
*
* @param origin The new origin for tag transformations
*/
void SetOrigin(const wpi::math::Pose3d& origin);
/**
* Returns the origin used for tag pose transformation.
* @return the origin
*/
wpi::math::Pose3d GetOrigin() const;
/**
* Gets an AprilTag pose by its ID.
*
* @param ID The ID of the tag.
* @return The pose corresponding to the ID that was passed in or an empty
* optional if a tag with that ID is not found.
*/
std::optional<wpi::math::Pose3d> GetTagPose(int ID) const;
/**
* Serializes an AprilTagFieldLayout to a JSON file.
*
* @param path The path to write the JSON file to.
*/
void Serialize(std::string_view path);
/*
* Checks equality between this AprilTagFieldLayout and another object.
*/
bool operator==(const AprilTagFieldLayout&) const = default;
private:
std::unordered_map<int, AprilTag> m_apriltags;
wpi::units::meter_t m_fieldLength;
wpi::units::meter_t m_fieldWidth;
wpi::math::Pose3d m_origin;
friend WPILIB_DLLEXPORT void to_json(wpi::util::json& json,
const AprilTagFieldLayout& layout);
friend WPILIB_DLLEXPORT void from_json(const wpi::util::json& json,
AprilTagFieldLayout& layout);
};
WPILIB_DLLEXPORT
void to_json(wpi::util::json& json, const AprilTagFieldLayout& layout);
WPILIB_DLLEXPORT
void from_json(const wpi::util::json& json, AprilTagFieldLayout& layout);
} // namespace wpi::apriltag

View File

@@ -0,0 +1,35 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
namespace wpi::apriltag {
/**
* Loadable AprilTag field layouts.
*/
enum class AprilTagField {
/// 2022 Rapid React.
k2022RapidReact,
/// 2023 Charged Up.
k2023ChargedUp,
/// 2024 Crescendo.
k2024Crescendo,
/// 2025 Reefscape AndyMark (see TU12).
k2025ReefscapeAndyMark,
/// 2025 Reefscape Welded (see TU12).
k2025ReefscapeWelded,
/// 2026 Rebuilt Andymark.
k2026RebuiltAndyMark,
/// 2026 Rebuilt Welded.
k2026RebuiltWelded,
/// Alias to the current game.
kDefaultField = k2026RebuiltWelded,
// This is a placeholder for denoting the last supported field. This should
// always be the last entry in the enum and should not be used by users
kNumFields,
};
} // namespace wpi::apriltag

View File

@@ -0,0 +1,35 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include "wpi/math/geometry/Transform3d.hpp"
#include "wpi/util/SymbolExports.hpp"
namespace wpi::apriltag {
/** A pair of AprilTag pose estimates. */
struct WPILIB_DLLEXPORT AprilTagPoseEstimate {
/** Pose 1. */
wpi::math::Transform3d pose1;
/** Pose 2. */
wpi::math::Transform3d pose2;
/** Object-space error of pose 1. */
double error1;
/** Object-space error of pose 2. */
double error2;
/**
* Gets the ratio of pose reprojection errors, called ambiguity. Numbers
* above 0.2 are likely to be ambiguous.
*
* @return The ratio of pose reprojection errors.
*/
double GetAmbiguity() const;
};
} // namespace wpi::apriltag

View File

@@ -0,0 +1,146 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <span>
#include "wpi/apriltag/AprilTagPoseEstimate.hpp"
#include "wpi/math/geometry/Transform3d.hpp"
#include "wpi/units/length.hpp"
#include "wpi/util/SymbolExports.hpp"
namespace wpi::apriltag {
class AprilTagDetection;
/** Pose estimators for AprilTag tags. */
class WPILIB_DLLEXPORT AprilTagPoseEstimator {
public:
/** Configuration for the pose estimator. */
struct Config {
bool operator==(const Config&) const = default;
/** The tag size. */
wpi::units::meter_t tagSize;
/** Camera horizontal focal length, in pixels. */
double fx;
/** Camera vertical focal length, in pixels. */
double fy;
/** Camera horizontal focal center, in pixels. */
double cx;
/** Camera vertical focal center, in pixels. */
double cy;
};
/**
* Creates estimator.
*
* @param config Configuration
*/
explicit AprilTagPoseEstimator(const Config& config) : m_config{config} {}
/**
* Sets estimator configuration.
*
* @param config Configuration
*/
void SetConfig(const Config& config) { m_config = config; }
/**
* Gets estimator configuration.
*
* @return Configuration
*/
const Config& GetConfig() const { return m_config; }
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param detection Tag detection
* @return Pose estimate
*/
wpi::math::Transform3d EstimateHomography(
const AprilTagDetection& detection) const;
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param homography Homography 3x3 matrix data
* @return Pose estimate
*/
wpi::math::Transform3d EstimateHomography(
std::span<const double, 9> homography) const;
/**
* Estimates the pose of the tag. This returns one or two possible poses for
* the tag, along with the object-space error of each.
*
* This uses the homography method described in [1] for the initial estimate.
* Then Orthogonal Iteration [2] is used to refine this estimate. Then [3] is
* used to find a potential second local minima and Orthogonal Iteration is
* used to refine this second estimate.
*
* [1]: E. Olson, “Apriltag: A robust and flexible visual fiducial system,” in
* 2011 IEEE International Conference on Robotics and Automation,
* May 2011, pp. 34003407.
* [2]: Lu, G. D. Hager and E. Mjolsness, "Fast and globally convergent pose
* estimation from video images," in IEEE Transactions on Pattern
* Analysis and Machine Intelligence, vol. 22, no. 6, pp. 610-622, June 2000.
* doi: 10.1109/34.862199
* [3]: Schweighofer and A. Pinz, "Robust Pose Estimation from a Planar
* Target," in IEEE Transactions on Pattern Analysis and Machine Intelligence,
* vol. 28, no. 12, pp. 2024-2030, Dec. 2006. doi: 10.1109/TPAMI.2006.252
*
* @param detection Tag detection
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
AprilTagPoseEstimate EstimateOrthogonalIteration(
const AprilTagDetection& detection, int nIters) const;
/**
* Estimates the pose of the tag. This returns one or two possible poses for
* the tag, along with the object-space error of each.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
AprilTagPoseEstimate EstimateOrthogonalIteration(
std::span<const double, 9> homography, std::span<const double, 8> corners,
int nIters) const;
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the
* pose with the lower object-space error.
*
* @param detection Tag detection
* @return Pose estimate
*/
wpi::math::Transform3d Estimate(const AprilTagDetection& detection) const;
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the
* pose with the lower object-space error.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @return Pose estimate
*/
wpi::math::Transform3d Estimate(std::span<const double, 9> homography,
std::span<const double, 8> corners) const;
private:
Config m_config;
};
} // namespace wpi::apriltag

View File

@@ -0,0 +1,440 @@
{
"tags": [
{
"ID": 0,
"pose": {
"translation": {
"x": -0.0035306,
"y": 7.578928199999999,
"z": 0.8858503999999999
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 1,
"pose": {
"translation": {
"x": 3.2327088,
"y": 5.486654,
"z": 1.7254728
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 3.067812,
"y": 5.3305202,
"z": 1.3762228
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": -0.7071067811865475
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 0.0039878,
"y": 5.058536999999999,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 0.0039878,
"y": 3.5124898,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 0.12110719999999998,
"y": 1.7178274,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": 0.9196502204050923,
"X": 0.0,
"Y": 0.0,
"Z": 0.39273842708457407
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 0.8733027999999999,
"y": 0.9412985999999999,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": 0.9196502204050923,
"X": 0.0,
"Y": 0.0,
"Z": 0.39273842708457407
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 1.6150844,
"y": 0.15725139999999999,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": 0.9196502204050923,
"X": 0.0,
"Y": 0.0,
"Z": 0.39273842708457407
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 16.4627306,
"y": 0.6506718,
"z": 0.8858503999999999
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 13.2350002,
"y": 2.743454,
"z": 1.7254728
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 13.391388000000001,
"y": 2.8998418,
"z": 1.3762228
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865475
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 16.4552122,
"y": 3.1755079999999998,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 16.4552122,
"y": 4.7171356,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 16.3350194,
"y": 6.5149729999999995,
"z": 0.8937752
},
"rotation": {
"quaternion": {
"W": -0.37298778257580906,
"X": -0.0,
"Y": 0.0,
"Z": 0.9278362538989199
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 15.5904946,
"y": 7.292695599999999,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": -0.37298778257580906,
"X": -0.0,
"Y": 0.0,
"Z": 0.9278362538989199
}
}
}
},
{
"ID": 17,
"pose": {
"translation": {
"x": 14.847188999999998,
"y": 8.0691228,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": -0.37298778257580906,
"X": -0.0,
"Y": 0.0,
"Z": 0.9278362538989199
}
}
}
},
{
"ID": 40,
"pose": {
"translation": {
"x": 7.874127,
"y": 4.9131728,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": 0.5446390350150271,
"X": 0.0,
"Y": 0.0,
"Z": 0.838670567945424
}
}
}
},
{
"ID": 41,
"pose": {
"translation": {
"x": 7.4312271999999995,
"y": 3.759327,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": -0.20791169081775934,
"X": -0.0,
"Y": 0.0,
"Z": 0.9781476007338057
}
}
}
},
{
"ID": 42,
"pose": {
"translation": {
"x": 8.585073,
"y": 3.3164272,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": 0.838670567945424,
"X": 0.0,
"Y": 0.0,
"Z": -0.5446390350150271
}
}
}
},
{
"ID": 43,
"pose": {
"translation": {
"x": 9.0279728,
"y": 4.470273,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": 0.9781476007338057,
"X": 0.0,
"Y": 0.0,
"Z": 0.20791169081775934
}
}
}
},
{
"ID": 50,
"pose": {
"translation": {
"x": 7.6790296,
"y": 4.3261534,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": 0.17729273396782605,
"X": -0.22744989571511945,
"Y": 0.04215534644161733,
"Z": 0.9565859910053995
}
}
}
},
{
"ID": 51,
"pose": {
"translation": {
"x": 8.0182466,
"y": 3.5642296,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": -0.5510435465842192,
"X": -0.19063969497246985,
"Y": -0.13102303230819815,
"Z": 0.8017733354717242
}
}
}
},
{
"ID": 52,
"pose": {
"translation": {
"x": 8.7801704,
"y": 3.9034466,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": -0.9565859910053994,
"X": -0.04215534644161739,
"Y": -0.22744989571511942,
"Z": 0.17729273396782633
}
}
}
},
{
"ID": 53,
"pose": {
"translation": {
"x": 8.4409534,
"y": 4.6653704,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": 0.8017733354717241,
"X": -0.1310230323081982,
"Y": 0.19063969497246983,
"Z": 0.5510435465842194
}
}
}
}
],
"field": {
"length": 16.4592,
"width": 8.2296
}
}

View File

@@ -0,0 +1,152 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 15.513558,
"y": 1.071626,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 15.513558,
"y": 2.748026,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 15.513558,
"y": 4.424426,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 16.178784,
"y": 6.749796,
"z": 0.695452
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 0.36195,
"y": 6.749796,
"z": 0.695452
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 1.02743,
"y": 4.424426,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 1.02743,
"y": 2.748026,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 1.02743,
"y": 1.071626,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
}
],
"field": {
"length": 16.54175,
"width": 8.0137
}
}

View File

@@ -0,0 +1,296 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 15.079471999999997,
"y": 0.24587199999999998,
"z": 1.355852
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 16.185134,
"y": 0.883666,
"z": 1.355852
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 16.579342,
"y": 4.982717999999999,
"z": 1.4511020000000001
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 16.579342,
"y": 5.547867999999999,
"z": 1.4511020000000001
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 14.700757999999999,
"y": 8.2042,
"z": 1.355852
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 1.8415,
"y": 8.2042,
"z": 1.355852
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": -0.038099999999999995,
"y": 5.547867999999999,
"z": 1.4511020000000001
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": -0.038099999999999995,
"y": 4.982717999999999,
"z": 1.4511020000000001
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 9,
"pose": {
"translation": {
"x": 0.356108,
"y": 0.883666,
"z": 1.355852
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 1.4615159999999998,
"y": 0.24587199999999998,
"z": 1.355852
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 11.904726,
"y": 3.7132259999999997,
"z": 1.3208
},
"rotation": {
"quaternion": {
"W": -0.8660254037844387,
"X": -0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 11.904726,
"y": 4.49834,
"z": 1.3208
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 11.220196,
"y": 4.105148,
"z": 1.3208
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 5.320792,
"y": 4.105148,
"z": 1.3208
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 4.641342,
"y": 4.49834,
"z": 1.3208
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 4.641342,
"y": 3.7132259999999997,
"z": 1.3208
},
"rotation": {
"quaternion": {
"W": -0.4999999999999998,
"X": -0.0,
"Y": 0.0,
"Z": 0.8660254037844387
}
}
}
}
],
"field": {
"length": 16.541,
"width": 8.211
}
}

View File

@@ -0,0 +1,23 @@
ID,X,Y,Z,Z-Rotation,X-Rotation
1,656.98,24.73,58.5,126,0
2,656.98,291.9,58.5,234,0
3,452.4,316.21,51.25,270,0
4,365.2,241.44,73.54,0,30
5,365.2,75.19,73.54,0,30
6,530.49,129.97,12.13,300,0
7,546.87,158.3,12.13,0,0
8,530.49,186.63,12.13,60,0
9,497.77,186.63,12.13,120,0
10,481.39,158.3,12.13,180,0
11,497.77,129.97,12.13,240,0
12,33.91,24.73,58.5,54,0
13,33.91,291.9,58.5,306,0
14,325.68,241.44,73.54,180,30
15,325.68,75.19,73.54,180,30
16,238.49,0.42,51.25,90,0
17,160.39,129.97,12.13,240,0
18,144,158.3,12.13,180,0
19,160.39,186.63,12.13,120,0
20,193.1,186.63,12.13,60,0
21,209.49,158.3,12.13,0,0
22,193.1,129.97,12.13,300,0
1 ID X Y Z Z-Rotation X-Rotation
2 1 656.98 24.73 58.5 126 0
3 2 656.98 291.9 58.5 234 0
4 3 452.4 316.21 51.25 270 0
5 4 365.2 241.44 73.54 0 30
6 5 365.2 75.19 73.54 0 30
7 6 530.49 129.97 12.13 300 0
8 7 546.87 158.3 12.13 0 0
9 8 530.49 186.63 12.13 60 0
10 9 497.77 186.63 12.13 120 0
11 10 481.39 158.3 12.13 180 0
12 11 497.77 129.97 12.13 240 0
13 12 33.91 24.73 58.5 54 0
14 13 33.91 291.9 58.5 306 0
15 14 325.68 241.44 73.54 180 30
16 15 325.68 75.19 73.54 180 30
17 16 238.49 0.42 51.25 90 0
18 17 160.39 129.97 12.13 240 0
19 18 144 158.3 12.13 180 0
20 19 160.39 186.63 12.13 120 0
21 20 193.1 186.63 12.13 60 0
22 21 209.49 158.3 12.13 0 0
23 22 193.1 129.97 12.13 300 0

View File

@@ -0,0 +1,404 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 16.687292,
"y": 0.628142,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": 0.4539904997395468,
"X": 0.0,
"Y": 0.0,
"Z": 0.8910065241883678
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 16.687292,
"y": 7.414259999999999,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": -0.45399049973954675,
"X": -0.0,
"Y": 0.0,
"Z": 0.8910065241883679
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 11.49096,
"y": 8.031733999999998,
"z": 1.30175
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 9.276079999999999,
"y": 6.132575999999999,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 0.9659258262890683,
"X": 0.0,
"Y": 0.25881904510252074,
"Z": 0.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 9.276079999999999,
"y": 1.9098259999999998,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 0.9659258262890683,
"X": 0.0,
"Y": 0.25881904510252074,
"Z": 0.0
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 13.474446,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.8660254037844387,
"X": -0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 13.890498,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 13.474446,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 9,
"pose": {
"translation": {
"x": 12.643358,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 12.227305999999999,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 12.643358,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.4999999999999998,
"X": -0.0,
"Y": 0.0,
"Z": 0.8660254037844387
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 0.8613139999999999,
"y": 0.628142,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": 0.8910065241883679,
"X": 0.0,
"Y": 0.0,
"Z": 0.45399049973954675
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 0.8613139999999999,
"y": 7.414259999999999,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": -0.8910065241883678,
"X": -0.0,
"Y": 0.0,
"Z": 0.45399049973954686
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 8.272272,
"y": 6.132575999999999,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 5.914589856893349e-17,
"X": -0.25881904510252074,
"Y": 1.5848095757158825e-17,
"Z": 0.9659258262890683
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 8.272272,
"y": 1.9098259999999998,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 5.914589856893349e-17,
"X": -0.25881904510252074,
"Y": 1.5848095757158825e-17,
"Z": 0.9659258262890683
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 6.057646,
"y": 0.010667999999999999,
"z": 1.30175
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 17,
"pose": {
"translation": {
"x": 4.073905999999999,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.4999999999999998,
"X": -0.0,
"Y": 0.0,
"Z": 0.8660254037844387
}
}
}
},
{
"ID": 18,
"pose": {
"translation": {
"x": 3.6576,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 19,
"pose": {
"translation": {
"x": 4.073905999999999,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 20,
"pose": {
"translation": {
"x": 4.904739999999999,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 21,
"pose": {
"translation": {
"x": 5.321046,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 22,
"pose": {
"translation": {
"x": 4.904739999999999,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.8660254037844387,
"X": -0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
}
],
"field": {
"length": 17.548,
"width": 8.042
}
}

View File

@@ -0,0 +1,23 @@
ID,X,Y,Z,Z-Rotation,X-Rotation
1,657.37,25.8,58.5,126,0
2,657.37,291.2,58.5,234,0
3,455.15,317.15,51.25,270,0
4,365.2,241.64,73.54,0,30
5,365.2,75.39,73.54,0,30
6,530.49,130.17,12.13,300,0
7,546.87,158.5,12.13,0,0
8,530.49,186.83,12.13,60,0
9,497.77,186.83,12.13,120,0
10,481.39,158.5,12.13,180,0
11,497.77,130.17,12.13,240,0
12,33.51,25.8,58.5,54,0
13,33.51,291.2,58.5,306,0
14,325.68,241.64,73.54,180,30
15,325.68,75.39,73.54,180,30
16,235.73,-0.15,51.25,90,0
17,160.39,130.17,12.13,240,0
18,144,158.5,12.13,180,0
19,160.39,186.83,12.13,120,0
20,193.1,186.83,12.13,60,0
21,209.49,158.5,12.13,0,0
22,193.1,130.17,12.13,300,0
1 ID X Y Z Z-Rotation X-Rotation
2 1 657.37 25.8 58.5 126 0
3 2 657.37 291.2 58.5 234 0
4 3 455.15 317.15 51.25 270 0
5 4 365.2 241.64 73.54 0 30
6 5 365.2 75.39 73.54 0 30
7 6 530.49 130.17 12.13 300 0
8 7 546.87 158.5 12.13 0 0
9 8 530.49 186.83 12.13 60 0
10 9 497.77 186.83 12.13 120 0
11 10 481.39 158.5 12.13 180 0
12 11 497.77 130.17 12.13 240 0
13 12 33.51 25.8 58.5 54 0
14 13 33.51 291.2 58.5 306 0
15 14 325.68 241.64 73.54 180 30
16 15 325.68 75.39 73.54 180 30
17 16 235.73 -0.15 51.25 90 0
18 17 160.39 130.17 12.13 240 0
19 18 144 158.5 12.13 180 0
20 19 160.39 186.83 12.13 120 0
21 20 193.1 186.83 12.13 60 0
22 21 209.49 158.5 12.13 0 0
23 22 193.1 130.17 12.13 300 0

View File

@@ -0,0 +1,404 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 16.697198,
"y": 0.65532,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": 0.4539904997395468,
"X": 0.0,
"Y": 0.0,
"Z": 0.8910065241883678
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 16.697198,
"y": 7.3964799999999995,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": -0.45399049973954675,
"X": -0.0,
"Y": 0.0,
"Z": 0.8910065241883679
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 11.560809999999998,
"y": 8.05561,
"z": 1.30175
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 9.276079999999999,
"y": 6.137656,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 0.9659258262890683,
"X": 0.0,
"Y": 0.25881904510252074,
"Z": 0.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 9.276079999999999,
"y": 1.914906,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 0.9659258262890683,
"X": 0.0,
"Y": 0.25881904510252074,
"Z": 0.0
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 13.474446,
"y": 3.3063179999999996,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.8660254037844387,
"X": -0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 13.890498,
"y": 4.0259,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 13.474446,
"y": 4.745482,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 9,
"pose": {
"translation": {
"x": 12.643358,
"y": 4.745482,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 12.227305999999999,
"y": 4.0259,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 12.643358,
"y": 3.3063179999999996,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.4999999999999998,
"X": -0.0,
"Y": 0.0,
"Z": 0.8660254037844387
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 0.851154,
"y": 0.65532,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": 0.8910065241883679,
"X": 0.0,
"Y": 0.0,
"Z": 0.45399049973954675
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 0.851154,
"y": 7.3964799999999995,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": -0.8910065241883678,
"X": -0.0,
"Y": 0.0,
"Z": 0.45399049973954686
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 8.272272,
"y": 6.137656,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 5.914589856893349e-17,
"X": -0.25881904510252074,
"Y": 1.5848095757158825e-17,
"Z": 0.9659258262890683
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 8.272272,
"y": 1.914906,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 5.914589856893349e-17,
"X": -0.25881904510252074,
"Y": 1.5848095757158825e-17,
"Z": 0.9659258262890683
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 5.9875419999999995,
"y": -0.0038099999999999996,
"z": 1.30175
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 17,
"pose": {
"translation": {
"x": 4.073905999999999,
"y": 3.3063179999999996,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.4999999999999998,
"X": -0.0,
"Y": 0.0,
"Z": 0.8660254037844387
}
}
}
},
{
"ID": 18,
"pose": {
"translation": {
"x": 3.6576,
"y": 4.0259,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 19,
"pose": {
"translation": {
"x": 4.073905999999999,
"y": 4.745482,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 20,
"pose": {
"translation": {
"x": 4.904739999999999,
"y": 4.745482,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 21,
"pose": {
"translation": {
"x": 5.321046,
"y": 4.0259,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 22,
"pose": {
"translation": {
"x": 4.904739999999999,
"y": 3.3063179999999996,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.8660254037844387,
"X": -0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
}
],
"field": {
"length": 17.548,
"width": 8.052
}
}

View File

@@ -0,0 +1,33 @@
ID,X,Y,Z,Z-Rotation,X-Rotation
1,467.085,291.791,35,180,0
2,468.559,182.077,44.25,90,0
3,444.797,172.321,44.25,180,0
4,444.797,158.321,44.25,180,0
5,468.559,134.565,44.25,270,0
6,467.085,24.851,35,180,0
7,470.034,24.851,35,0,0
8,482.559,134.565,44.25,270,0
9,492.329,144.321,44.25,0,0
10,492.329,158.321,44.25,0,0
11,482.559,182.077,44.25,90,0
12,470.034,291.791,35,0,0
13,649.58,291.02,21.75,180,0
14,649.58,274.02,21.75,180,0
15,649.566,169.783,21.75,180,0
16,649.566,152.783,21.75,180,0
17,183.034,24.851,35,0,0
18,181.559,134.565,44.25,270,0
19,205.321,144.321,44.25,0,0
20,205.321,158.321,44.25,0,0
21,181.559,182.077,44.25,90,0
22,183.034,291.791,35,0,0
23,180.085,291.791,35,180,0
24,167.559,182.077,44.25,90,0
25,157.79,172.321,44.25,180,0
26,157.79,158.321,44.25,180,0
27,167.559,134.565,44.25,270,0
28,180.085,24.851,35,180,0
29,0.539,25.621,21.75,0,0
30,0.539,42.621,21.75,0,0
31,0.553,146.858,21.75,0,0
32,0.553,163.858,21.75,0,0
1 ID X Y Z Z-Rotation X-Rotation
2 1 467.085 291.791 35 180 0
3 2 468.559 182.077 44.25 90 0
4 3 444.797 172.321 44.25 180 0
5 4 444.797 158.321 44.25 180 0
6 5 468.559 134.565 44.25 270 0
7 6 467.085 24.851 35 180 0
8 7 470.034 24.851 35 0 0
9 8 482.559 134.565 44.25 270 0
10 9 492.329 144.321 44.25 0 0
11 10 492.329 158.321 44.25 0 0
12 11 482.559 182.077 44.25 90 0
13 12 470.034 291.791 35 0 0
14 13 649.58 291.02 21.75 180 0
15 14 649.58 274.02 21.75 180 0
16 15 649.566 169.783 21.75 180 0
17 16 649.566 152.783 21.75 180 0
18 17 183.034 24.851 35 0 0
19 18 181.559 134.565 44.25 270 0
20 19 205.321 144.321 44.25 0 0
21 20 205.321 158.321 44.25 0 0
22 21 181.559 182.077 44.25 90 0
23 22 183.034 291.791 35 0 0
24 23 180.085 291.791 35 180 0
25 24 167.559 182.077 44.25 90 0
26 25 157.79 172.321 44.25 180 0
27 26 157.79 158.321 44.25 180 0
28 27 167.559 134.565 44.25 270 0
29 28 180.085 24.851 35 180 0
30 29 0.539 25.621 21.75 0 0
31 30 0.539 42.621 21.75 0 0
32 31 0.553 146.858 21.75 0 0
33 32 0.553 163.858 21.75 0 0

View File

@@ -0,0 +1,584 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 11.863959,
"y": 7.411491399999999,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 11.9013986,
"y": 4.6247558,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 11.2978438,
"y": 4.3769534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 11.2978438,
"y": 4.0213534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 11.9013986,
"y": 3.417951,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 11.863959,
"y": 0.6312154,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 11.9388636,
"y": 0.6312154,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 12.2569986,
"y": 3.417951,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 9,
"pose": {
"translation": {
"x": 12.5051566,
"y": 3.6657534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 12.5051566,
"y": 4.0213534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 12.2569986,
"y": 4.6247558,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 11.9388636,
"y": 7.411491399999999,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 16.499332,
"y": 7.391907999999999,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 16.499332,
"y": 6.960107999999999,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 16.4989764,
"y": 4.3124882,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 16.4989764,
"y": 3.8806881999999994,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 17,
"pose": {
"translation": {
"x": 4.6490636,
"y": 0.6312154,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 18,
"pose": {
"translation": {
"x": 4.6115986,
"y": 3.417951,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 19,
"pose": {
"translation": {
"x": 5.2151534,
"y": 3.6657534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 20,
"pose": {
"translation": {
"x": 5.2151534,
"y": 4.0213534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 21,
"pose": {
"translation": {
"x": 4.6115986,
"y": 4.6247558,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 22,
"pose": {
"translation": {
"x": 4.6490636,
"y": 7.411491399999999,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 23,
"pose": {
"translation": {
"x": 4.574159,
"y": 7.411491399999999,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 24,
"pose": {
"translation": {
"x": 4.2559986,
"y": 4.6247558,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 25,
"pose": {
"translation": {
"x": 4.007866,
"y": 4.3769534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 26,
"pose": {
"translation": {
"x": 4.007866,
"y": 4.0213534,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 27,
"pose": {
"translation": {
"x": 4.2559986,
"y": 3.417951,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 28,
"pose": {
"translation": {
"x": 4.574159,
"y": 0.6312154,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 29,
"pose": {
"translation": {
"x": 0.0136906,
"y": 0.6507734,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 30,
"pose": {
"translation": {
"x": 0.0136906,
"y": 1.0825734,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 31,
"pose": {
"translation": {
"x": 0.0140462,
"y": 3.7301932,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 32,
"pose": {
"translation": {
"x": 0.0140462,
"y": 4.1619931999999995,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
}
],
"field": {
"length": 16.518,
"width": 8.043
}
}

View File

@@ -0,0 +1,33 @@
ID,X,Y,Z,Z-Rotation,X-Rotation
1,467.637,292.314,35,180,0
2,469.111,182.6,44.25,90,0
3,445.349,172.844,44.25,180,0
4,445.349,158.844,44.25,180,0
5,469.111,135.088,44.25,270,0
6,467.637,25.374,35,180,0
7,470.586,25.374,35,0,0
8,483.111,135.088,44.25,270,0
9,492.881,144.844,44.25,0,0
10,492.881,158.844,44.25,0,0
11,483.111,182.6,44.25,90,0
12,470.586,292.314,35,0,0
13,650.918,291.469,21.75,180,0
14,650.918,274.469,21.75,180,0
15,650.904,170.219,21.75,180,0
16,650.904,153.219,21.75,180,0
17,183.586,25.374,35,0,0
18,182.111,135.088,44.25,270,0
19,205.873,144.844,44.25,0,0
20,205.873,158.844,44.25,0,0
21,182.111,182.6,44.25,90,0
22,183.586,292.314,35,0,0
23,180.637,292.314,35,180,0
24,168.111,182.6,44.25,90,0
25,158.341,172.844,44.25,180,0
26,158.341,158.844,44.25,180,0
27,168.111,135.088,44.25,270,0
28,180.637,25.374,35,180,0
29,0.305,26.219,21.75,0,0
30,0.305,43.219,21.75,0,0
31,0.318,147.469,21.75,0,0
32,0.318,164.469,21.75,0,0
1 ID X Y Z Z-Rotation X-Rotation
2 1 467.637 292.314 35 180 0
3 2 469.111 182.6 44.25 90 0
4 3 445.349 172.844 44.25 180 0
5 4 445.349 158.844 44.25 180 0
6 5 469.111 135.088 44.25 270 0
7 6 467.637 25.374 35 180 0
8 7 470.586 25.374 35 0 0
9 8 483.111 135.088 44.25 270 0
10 9 492.881 144.844 44.25 0 0
11 10 492.881 158.844 44.25 0 0
12 11 483.111 182.6 44.25 90 0
13 12 470.586 292.314 35 0 0
14 13 650.918 291.469 21.75 180 0
15 14 650.918 274.469 21.75 180 0
16 15 650.904 170.219 21.75 180 0
17 16 650.904 153.219 21.75 180 0
18 17 183.586 25.374 35 0 0
19 18 182.111 135.088 44.25 270 0
20 19 205.873 144.844 44.25 0 0
21 20 205.873 158.844 44.25 0 0
22 21 182.111 182.6 44.25 90 0
23 22 183.586 292.314 35 0 0
24 23 180.637 292.314 35 180 0
25 24 168.111 182.6 44.25 90 0
26 25 158.341 172.844 44.25 180 0
27 26 158.341 158.844 44.25 180 0
28 27 168.111 135.088 44.25 270 0
29 28 180.637 25.374 35 180 0
30 29 0.305 26.219 21.75 0 0
31 30 0.305 43.219 21.75 0 0
32 31 0.318 147.469 21.75 0 0
33 32 0.318 164.469 21.75 0 0

View File

@@ -0,0 +1,584 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 11.8779798,
"y": 7.4247756,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 11.9154194,
"y": 4.638039999999999,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 11.3118646,
"y": 4.3902376,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 11.3118646,
"y": 4.0346376,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 11.9154194,
"y": 3.4312351999999997,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 11.8779798,
"y": 0.6444996,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 11.9528844,
"y": 0.6444996,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 12.2710194,
"y": 3.4312351999999997,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 9,
"pose": {
"translation": {
"x": 12.519177399999998,
"y": 3.6790375999999996,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 12.519177399999998,
"y": 4.0346376,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 12.2710194,
"y": 4.638039999999999,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 11.9528844,
"y": 7.4247756,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 16.5333172,
"y": 7.4033126,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 16.5333172,
"y": 6.9715126,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 16.5329616,
"y": 4.3235626,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 16.5329616,
"y": 3.8917626,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 17,
"pose": {
"translation": {
"x": 4.6630844,
"y": 0.6444996,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 18,
"pose": {
"translation": {
"x": 4.6256194,
"y": 3.4312351999999997,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 19,
"pose": {
"translation": {
"x": 5.229174199999999,
"y": 3.6790375999999996,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 20,
"pose": {
"translation": {
"x": 5.229174199999999,
"y": 4.0346376,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 21,
"pose": {
"translation": {
"x": 4.6256194,
"y": 4.638039999999999,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 22,
"pose": {
"translation": {
"x": 4.6630844,
"y": 7.4247756,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 23,
"pose": {
"translation": {
"x": 4.5881798,
"y": 7.4247756,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 24,
"pose": {
"translation": {
"x": 4.2700194,
"y": 4.638039999999999,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 25,
"pose": {
"translation": {
"x": 4.0218614,
"y": 4.3902376,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 26,
"pose": {
"translation": {
"x": 4.0218614,
"y": 4.0346376,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 27,
"pose": {
"translation": {
"x": 4.2700194,
"y": 3.4312351999999997,
"z": 1.12395
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 28,
"pose": {
"translation": {
"x": 4.5881798,
"y": 0.6444996,
"z": 0.889
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 29,
"pose": {
"translation": {
"x": 0.0077469999999999995,
"y": 0.6659626,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 30,
"pose": {
"translation": {
"x": 0.0077469999999999995,
"y": 1.0977626,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 31,
"pose": {
"translation": {
"x": 0.0080772,
"y": 3.7457125999999996,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 32,
"pose": {
"translation": {
"x": 0.0080772,
"y": 4.1775126,
"z": 0.55245
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
}
],
"field": {
"length": 16.541,
"width": 8.069
}
}

View File

@@ -0,0 +1,276 @@
/* Copyright (C) 2013-2016, The Regents of The University of Michigan.
All rights reserved.
This software was developed in the APRIL Robotics Lab under the
direction of Edwin Olson, ebolson@umich.edu. This software may be
available under alternative licensing terms; contact the address above.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the Regents of The University of Michigan.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include "common/matd.h"
#include "common/image_u8.h"
#include "common/zarray.h"
#include "common/workerpool.h"
#include "common/timeprofile.h"
#include "common/pthreads_cross.h"
#define APRILTAG_TASKS_PER_THREAD_TARGET 10
struct quad
{
float p[4][2]; // corners
bool reversed_border;
// H: tag coordinates ([-1,1] at the black corners) to pixels
// Hinv: pixels to tag
matd_t *H, *Hinv;
};
// Represents a tag family. Every tag belongs to a tag family. Tag
// families are generated by the Java tool
// april.tag.TagFamilyGenerator and can be converted to C using
// april.tag.TagToC.
typedef struct apriltag_family apriltag_family_t;
struct apriltag_family
{
// How many codes are there in this tag family?
uint32_t ncodes;
// The codes in the family.
uint64_t *codes;
int width_at_border;
int total_width;
bool reversed_border;
// The bit locations.
uint32_t nbits;
uint32_t *bit_x;
uint32_t *bit_y;
// minimum hamming distance between any two codes. (e.g. 36h11 => 11)
uint32_t h;
// a human-readable name, e.g., "tag36h11"
char *name;
// some detector implementations may preprocess codes in order to
// accelerate decoding. They put their data here. (Do not use the
// same apriltag_family instance in more than one implementation)
void *impl;
};
struct apriltag_quad_thresh_params
{
// reject quads containing too few pixels
int min_cluster_pixels;
// how many corner candidates to consider when segmenting a group
// of pixels into a quad.
int max_nmaxima;
// Reject quads where pairs of edges have angles that are close to
// straight or close to 180 degrees. Zero means that no quads are
// rejected. (In radians).
float critical_rad;
float cos_critical_rad;
// When fitting lines to the contours, what is the maximum mean
// squared error allowed? This is useful in rejecting contours
// that are far from being quad shaped; rejecting these quads "early"
// saves expensive decoding processing.
float max_line_fit_mse;
// When we build our model of black & white pixels, we add an
// extra check that the white model must be (overall) brighter
// than the black model. How much brighter? (in pixel values,
// [0,255]). .
int min_white_black_diff;
// should the thresholded image be deglitched? Only useful for
// very noisy images
int deglitch;
};
// Represents a detector object. Upon creating a detector, all fields
// are set to reasonable values, but can be overridden by accessing
// these fields.
typedef struct apriltag_detector apriltag_detector_t;
struct apriltag_detector
{
///////////////////////////////////////////////////////////////
// User-configurable parameters.
// How many threads should be used?
int nthreads;
// detection of quads can be done on a lower-resolution image,
// improving speed at a cost of pose accuracy and a slight
// decrease in detection rate. Decoding the binary payload is
// still done at full resolution. .
float quad_decimate;
// What Gaussian blur should be applied to the segmented image
// (used for quad detection?) Parameter is the standard deviation
// in pixels. Very noisy images benefit from non-zero values
// (e.g. 0.8).
float quad_sigma;
// When true, the edges of the each quad are adjusted to "snap
// to" strong gradients nearby. This is useful when decimation is
// employed, as it can increase the quality of the initial quad
// estimate substantially. Generally recommended to be on (true).
//
// Very computationally inexpensive. Option is ignored if
// quad_decimate = 1.
bool refine_edges;
// How much sharpening should be done to decoded images? This
// can help decode small tags but may or may not help in odd
// lighting conditions or low light conditions.
//
// The default value is 0.25.
double decode_sharpening;
// When true, write a variety of debugging images to the
// current working directory at various stages through the
// detection process. (Somewhat slow).
bool debug;
struct apriltag_quad_thresh_params qtp;
///////////////////////////////////////////////////////////////
// Statistics relating to last processed frame
timeprofile_t *tp;
uint32_t nedges;
uint32_t nsegments;
uint32_t nquads;
///////////////////////////////////////////////////////////////
// Internal variables below
// Not freed on apriltag_destroy; a tag family can be shared
// between multiple users. The user should ultimately destroy the
// tag family passed into the constructor.
zarray_t *tag_families;
// Used to manage multi-threading.
workerpool_t *wp;
// Used for thread safety.
pthread_mutex_t mutex;
};
// Represents the detection of a tag. These are returned to the user
// and must be individually destroyed by the user.
typedef struct apriltag_detection apriltag_detection_t;
struct apriltag_detection
{
// a pointer for convenience. not freed by apriltag_detection_destroy.
apriltag_family_t *family;
// The decoded ID of the tag
int id;
// How many error bits were corrected? Note: accepting large numbers of
// corrected errors leads to greatly increased false positive rates.
// NOTE: As of this implementation, the detector cannot detect tags with
// a hamming distance greater than 2.
int hamming;
// A measure of the quality of the binary decoding process: the
// average difference between the intensity of a data bit versus
// the decision threshold. Higher numbers roughly indicate better
// decodes. This is a reasonable measure of detection accuracy
// only for very small tags-- not effective for larger tags (where
// we could have sampled anywhere within a bit cell and still
// gotten a good detection.)
float decision_margin;
// The 3x3 homography matrix describing the projection from an
// "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,
// -1)) to pixels in the image. This matrix will be freed by
// apriltag_detection_destroy.
matd_t *H;
// The center of the detection in image pixel coordinates.
double c[2];
// The corners of the tag in image pixel coordinates. These always
// wrap counter-clock wise around the tag.
double p[4][2];
};
// don't forget to add a family!
apriltag_detector_t *apriltag_detector_create(void);
// add a family to the apriltag detector. caller still "owns" the family.
// a single instance should only be provided to one apriltag detector instance.
void apriltag_detector_add_family_bits(apriltag_detector_t *td, apriltag_family_t *fam, int bits_corrected);
// Tunable, but really, 2 is a good choice. Values of >=3
// consume prohibitively large amounts of memory, and otherwise
// you want the largest value possible.
static inline void apriltag_detector_add_family(apriltag_detector_t *td, apriltag_family_t *fam)
{
apriltag_detector_add_family_bits(td, fam, 2);
}
// does not deallocate the family.
void apriltag_detector_remove_family(apriltag_detector_t *td, apriltag_family_t *fam);
// unregister all families, but does not deallocate the underlying tag family objects.
void apriltag_detector_clear_families(apriltag_detector_t *td);
// Destroy the april tag detector (but not the underlying
// apriltag_family_t used to initialize it.)
void apriltag_detector_destroy(apriltag_detector_t *td);
// Detect tags from an image and return an array of
// apriltag_detection_t*. You can use apriltag_detections_destroy to
// free the array and the detections it contains, or call
// _detection_destroy and zarray_destroy yourself.
zarray_t *apriltag_detector_detect(apriltag_detector_t *td, image_u8_t *im_orig);
// Call this method on each of the tags returned by apriltag_detector_detect
void apriltag_detection_destroy(apriltag_detection_t *det);
// destroys the array AND the detections within it.
void apriltag_detections_destroy(zarray_t *detections);
// Renders the apriltag.
// Caller is responsible for calling image_u8_destroy on the image
image_u8_t *apriltag_to_image(apriltag_family_t *fam, uint32_t idx);
#ifdef __cplusplus
}
#endif

Some files were not shown because too many files have changed in this diff Show More