Commit Graph

215 Commits

Author SHA1 Message Date
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
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
Peter Johnson
ef676aca70 Merge branch 'main' into 2027 2025-09-25 22:17:00 -07:00
Tyler Veness
ab53d51c6f Fix or suppress clang-tidy warnings (#8254) 2025-09-25 21:28:04 -07:00
Peter Johnson
3e4e9c9b01 Merge branch 'main' into 2027 2025-08-09 00:55:26 -07:00
Tyler Veness
9ac7e286f5 [build] Upgrade Gradle plugins (#8166)
I upgraded all plugins I could see except org.ysb33r.doxygen. 2.0 made
breaking changes, and I couldn't figure out how to migrate.

Most of the changes are for suppressing new linter purification rites.
2025-08-08 23:04:02 -07:00
Peter Johnson
ed7982563b Merge branch 'main' into 2027 2025-08-03 11:51:25 -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
Peter Johnson
6c16e846fa Merge branch 'main' into 2027 2025-05-29 21:41:50 -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
Yuhao
8fe3cfb325 [cscore] Add UVC Protocol Support for USB Camera Controls on macOS (#7926) 2025-04-30 08:02:59 -06:00
Peter Johnson
36811211be Merge branch 'main' into 2027 2025-04-25 23:45:43 -07: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
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
Matt
2de03c9601 [cscore] Use frame time in Linux UsbCameraImpl (#7609) 2025-01-07 09:33:20 -07: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
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
a04c40f589 Replace std::make_pair with std::pair CTAD (#7405) 2024-11-17 20:29:23 -08:00
Joseph Eng
9a5f73d787 [cscore] Add back VideoProperty handle member initializer (#7283) 2024-10-23 21:46:20 -07: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
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
fad06ae1e7 Merge .inc files into headers (#7215) 2024-10-15 23:42:57 -07:00
Gold856
12885015ed [cscore,hal] Remove VS 2019 16.4.0 workaround (#7201) 2024-10-11 22:18:12 -07:00
Gold856
84075997c6 [cscore] Fix Java VideoSink class doc (NFC) (#7120) 2024-09-22 22:12:36 -07:00
Tyler Veness
554024767e Fix errors from new cpplint.py (#7105) 2024-09-20 17:43:39 -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
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
Jade
a9ce3290b5 Fix Doxygen warnings for C++ code (#6608) 2024-08-21 07:55:03 -07:00
Gold856
b12b83aa89 Fix typos with cspell (#6972) 2024-08-17 07:44:34 -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
Gold856
b0cc84a9c7 [build] Upgrade to PMD 7.2.0 (#6718) 2024-06-08 22:08:23 -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
Jade
6220c6be4d [wpiutil] Remove RuntimeDetector and simplify RuntimeLoader (#6600) 2024-05-24 10:48:59 -07: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
Gold856
305a0657e2 [cscore] Deprecate AxisCamera (#6579) 2024-05-12 10:28:51 -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
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
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
Tyler Veness
3b2a2381b6 [ci] Upgrade to new macOS runner (#6328) 2024-02-04 10:38:23 -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
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
Tyler Veness
ad0859a8c9 [docs] Add missing JavaDocs (#6125) 2024-01-01 22:56:23 -08:00
Peter Johnson
5659038443 [wpiutil,cscore,apriltag] Fix RawFrame (#6098) 2023-12-26 22:05:02 -06: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