Repository navigation
Experimental alpha-7 CUDA and PhotonVision migration - #2
Project516 wants to merge 2 commits into
Conversation
f935fb7 to
0ee2903
Compare
|
@allengregoryiv @SpectrumFRC3847 ready for a review. This one is still a draft, because the hardware gate in the body is not met. Rebased onto
What I would like checked:
The known gap, now written into Still unproven, and the reason this stays a draft: the native detector has never been compiled. Alpha-7 needs G++ 14 and C++23, JetPack 6 ships GCC 11, and the hosted Java build says nothing about CUDA, NVJPEG, TensorRT, the JVM, or the robot network. |
|
@Project516 merge conflicts |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved critical build and clock-synchronization defects, plus moderate Jetson setup and compatibility issues, remain.
Review effort: Lite
Findings: 4
Open (6)
Field calibration build omits required ALLWPILIB_DIR · New Clock sync uses incorrect microsecond conversions for nanosecond timestamps · New Prerequisite script fails when the build parent directory is absent · New Detector CMake invocation omits required ALLWPILIB_DIR · New Existing Java environment block is not updated for Java 17 · New Legacy fallback lacks the required WPILib JNI compatibility API · New
What changed in this PR
Ports the Jetson/PhotonVision CUDA stack to WPILib 2027 alpha-7 and documents the experimental migration requirements.
Changes:
- Updates Java, NetworkTables, JNI, and native build tooling for alpha-7.
- Adds the PhotonVision migration patch and CUDA 13 validation guidance.
- Updates Jetson scripts, tests, documentation, and detector integration.
| File | Summary |
|---|---|
tests/robot-clock/run.sh |
Configurable Java 25 runtime. |
tests/robot-clock/FakeRobotClock.java |
Alpha-7 NetworkTables migration. |
tests/jvm-check.sh |
Configurable Java diagnostics. |
tests/jetson-telemetry/run.sh |
Java 25 runtime setup. |
tests/jetson-telemetry/NtTelemetryDump.java |
Alpha-7 NetworkTables APIs. |
tests/gpudetector-handles/run.sh |
Alpha-7 detector and AprilTag testing. |
tests/detector-frame-sizes/run.sh |
Alpha-7 detector runtime setup. |
tests/detector-frame-sizes/FrameSizeTest.java |
PhotonVision native loading test. |
tests/cpu-profile.sh |
Configurable Java tooling. |
scripts/jetson/13-build-fieldcal-detect.sh |
Field-calibration detector build. |
scripts/jetson/07-build-bos-detector.sh |
Alpha-7 CUDA detector build. |
scripts/jetson/06-install-fork-jar.sh |
Alpha-7 jar installation. |
scripts/jetson/05-build-gpudetector.sh |
Legacy detector compatibility path. |
scripts/jetson/04-build-allwpilib.sh |
Pinned alpha-7 headers. |
scripts/jetson/02-jetpack.sh |
Jetson Java environment updates. |
scripts/host/03-build-photonvision-fork.sh |
Alpha-7 PhotonVision build. |
README.md |
Experimental migration workflow. |
docs/UPSTREAM-PORT.md |
Migration history and upstream notes. |
docs/TECHNICAL.md |
Alpha-7 technical baseline. |
docs/CUDA13-MIGRATION.md |
Migration contract and validation checklist. |
detector/GpuDetectorJNI.cc |
Alpha-7 JNI and raw-frame handling. |
detector/CMakeLists.txt |
Alpha-7 header validation and linkage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
c1fc7d3 to
d6801a8
Compare
d6801a8 to
5385532
Compare
FileFrameProvider wraps the stop interrupt in a RuntimeException, which the photonvision-63 catch-all logged and looped on, so stopProcess joined forever and VisionModuleManagerTest hung.
|
@allengregoryiv rebased on main and ready for a review. The alpha-7 port now covers photonvision-62 to 73, and the jar builds and PhotonVision's unit tests pass on Actions. It stays a draft until it has run on a Jetson (see Hardware gate). Details are in the description. |
|
@Project516 merge conflicts |
|
we dont plan to update to alpha 7 |


Summary
2027.0.0-alpha-7.photonvision-00throughphotonvision-73, onto PhotonVision source1f419c9d(alpha-7) as one patch,patches/photonvision-2027-alpha7-migration.patch.org.wpilibAprilTag class and C-compatibleWPI_RawFrameheaders, without the C++23-onlywpi/util/jni_util.hpp. The bridge links no WPILib library, so 04 only fetches the pinned alpha-7 headers.docs/CUDA13-MIGRATION.md.This is PR 2 of 2 for alpha-7. #1 holds the robot-facing version policy.
Rebased onto
mainatab6e086on 2026-10-12, as one commit. Main's new work since8765deais ported too.What changed in this update (2026-10-12)
Rebase conflicts. Main reworked eight files this PR also changes. Each keeps main's new structure with the alpha-7 edits on top:
03-build-photonvision-fork.sh: main now pins Node, Temurin and pnpm with SHA-256s. The alpha-7 build pins Nodev24.21.0, Temurin25.0.4.1+1and pnpm11.28.2the same way, instead of taking the latest Node 24, JDK 25 and pnpm 11.tests/robot-clock,tests/jetson-telemetry: main's unattended versions (bench helpers, deadlines, PASS/FAIL checks) on Java 25.tests/detector-frame-sizes: main's 2560x1600 case andFAR_SEARCH=offswitch, with natives from PhotonVision's jar.tests/fake-robot/FakeRobot.java: main's clock-offset options,org.wpilibimports.README.md,05-build-gpudetector.sh: the alpha-7 text and the refusal, as before.Patches 62 to 73 ported, cherry-picked in order onto the alpha-7 tree:
ControlWordstruct, under/DriverStation(not/FMSInfo), and publishes noFMSControlData(DriverStationBackend.MatchDataSenderatv2027.0.0-alpha-7). The struct layout is the one 62 decodes. Without this, idle and quiet mode never saw the robot's state on alpha-7. The test publishes to/DriverStationtoo.configureFrameProviderForPipeline).VisionModule.stop()stays private as alpha-7 has it, and the pipeline copy uses Avaje instead ofJacksonUtils. Snapshot restore keeps the Avaje meta read. The catch-all also exits when the error was caused by an interrupt: alpha-7'sFileFrameProviderwraps the stop interrupt in aRuntimeException, and looping on it hungVisionModuleManagerTestforever.spectrumGpufield is on the already@JsonUIGeneralSettings.Earlier port notes
Patches 35 to 61 ported. Each was cherry-picked in order onto the alpha-7 tree and resolved against the new base. The main differences:
ObjectMapper, so they now use Avaje Jsonb (@Jsonrecords,Jsonb.instance(),ctx.json). Patch 45 applied cleanly but referenced classes that no longer exist.AprilTagFieldLayoutis gone from PhotonVision's config.TagQualityTest(61) usesorg.wpilib.fields.Field,AprilTagImageGeneratorandRotation3d.inverse().SEND_ALL,KEEP_DUPLICATES,TOPICS_ONLY), andstartClient4isstartClient.?.resolutionguards.Times are nanoseconds in alpha-7. This fixes Copilot's clock-sync finding and the same bug in two more files.
WPI_Now,NetworkTablesJNI.now(), NT value timestamps and cscoregrabFrameare all steady-clock nanoseconds (timestamp.cpp,UsbCameraImpl.cpp:583).RobotClockSync: the staleness and rate limits are 5 s and 30 s in ns, and the age converts with/ 1_000_000.RewindManagerandRewindRecorderconvert to microseconds at the source.frames.csvandsession.jsonstay in microseconds, sodetector/rewind_reader.h,tools/fieldcalandrewind-export.pyare unchanged.toMidExposureNswas already right.Jar. Shadow 9.0.0 kept dependencies' duplicate
LICENSEandMETA-INF/NOTICE*entries, sounzip -tcalled the jar a zip bomb, andmake-prebuilt-bundle.shwould have refused it.photon-servernow excludes those duplicates. Service files still merge.Main's new scripts and tests on alpha-7:
tests/regression,tests/tag-quality,tests/fake-robotandtests/jetson-telemetryuseorg.wpilibpackages, the alpha-7 NT API and Java 25.make-prebuilt-bundle.shno longer packslibwpiutil,libwpimathandlibapriltag, since the alpha-7 detector doesn't link them.install.sh --prebuiltrefuses a bundle whose MANIFEST lacks the migration patch, so it won't install a WPILib 2026 release onto this checkout. It installsopenjdk-25-jdk.release/NOTICES.mddescribes the alpha-7 jar and the allwpilib headers.upstream_watch.pywatches PhotonVisionmainagainstUPSTREAM_SHAand tries the migration patch, instead of the 4143 fork. allwpilib tags compare as alpha, beta, rc and release, so it would have exited onTAG=v2027.0.0-alpha-7.Earlier Copilot findings, all fixed in this commit:
-DALLWPILIB_DIR.$HOME/buildfirst.JAVA_HOMEis replaced.08 bos, since the 4143 detector can't load in the alpha-7 jar.Validation
GitHub Actions on a temporary fork branch (workflow not in this PR). Run: https://github.com/Project516/SpectrumJetson/actions/runs/38484200349
scripts/host/03-build-photonvision-fork.sh, applies the patch to1f419c9dwith the pinned tools and produces the linuxarm64 jar.unzip -tpasses../gradlew test: 332 tests, 0 failures, 2 skipped (photon-core, photon-targeting, photon-lib).tests/**/*.javaprograms compile against the jar.tests/robot-vision-live/LiveCheck.javadoesn't: it is compiled against the robot-side jars, not PhotonVision's (see Noticed).git apply --checkof the patch on a clean1f419c9d, andscripts/ci/lint.shclean.Hardware gate
This is still an experimental port. The hosted Java build is not proof for Jetson, CUDA, NVJPEG, TensorRT, JVM, or the robot network. The native detector has not been compiled: alpha-7 needs G++ 14 and C++23, and JetPack 6 ships GCC 11.
Before this is treated as working, test it on the target Jetson with real cameras, native libraries, the robot process, and a joint robot-network run, following
docs/CUDA13-MIGRATION.md. Keep this PR as a draft until those results are recorded.Noticed, not fixed
photonvision-NNpatch on main must also be ported into the migration patch. The doc says so, but nothing checks it. A CI job that applies each stack to its base would catch drift./api/spectrum/uiStatepipeline entries now come fromSerializationUtils.objectToHashMap, so enum fields may serialize differently than under Jackson. The UI tests compare entries with each other and find pipelines by nickname, so they don't depend on it, but anything reading enum names there would.robot_usin Rewind'sframes.csvstays in microseconds, while alpha-7 PhotonLib result timestamps are nanoseconds.docs/REWIND.mdnow says to divide by 1000. Whether the robot's AdvantageKit log on alpha-7 is in µs or ns hasn't been checked.v2026.7once Upstream watch: skip prereleases and record reviewed tags #12 merges and this is rebased.robot-visionbuilds against both WPILib 2026 and 2027 on its own, andtests/robot-vision-livestill runs the robot-side jars on Java 17. Neither is part of this port.