Skip to content

[SPIKE, do not merge] Migrate XbotEdu to WPILib 2027 alpha 7 - #50

Draft
aschokking wants to merge 6 commits into
mainfrom
spike-wpilib-2027
Draft

aschokking wants to merge 6 commits into
mainfrom
spike-wpilib-2027

Conversation

@aschokking

Copy link
Copy Markdown
Contributor

Warning

Spike, do not merge. This is an exploratory migration to measure what moving XbotEdu to WPILib 2027 would take. It targets an alpha toolchain and includes a spike-only test filter. Kept as a draft for reference when 2027 is released.

Built on top of #49 (data frame cleanup), and modelled on FRCRobotTemplate main, which was migrated to 2027 in Team488/FRCRobotTemplate#88.

Result

  • Main and test code compile on 2027.0.0-alpha-7 with Java 25 and SCL 20261003.9.
  • All 16 tests that can run give the same result as on 2026. The same 4 pass, and the same 12 student-exercise tests fail with the same assertion messages.
  • DriveToPositionCommandTest lands at 5.002332505667951 on both 2026 and 2027, identical to every digit across 300 loops.
  • The 4 SwerveDriveWithJoysticksCommandTest cases are excluded: Windows Smart App Control on the dev machine blocks the unsigned alpha wpimathjni.dll, which FlywheelSim needs. See "Blockers" below.

Build changes

2026 2027
Gradle 8.11 9.4.1
GradleRIO edu.wpi.first.GradleRIO 2026.2.1 org.wpilib.GradleRIO 2027.0.0-alpha-7
Java 17 25 (toolchain)
SCL 20261003.3 20261003.9
Deploy target RoboRIO SystemCore
AspectJ weaving yes removed (as in the template)
frcYear 2025 2027_alpha7

Vendordeps are replaced with the template's 2027 set (AdvantageKit 27 alpha, REVLib 2027 alpha, Phoenix 6 26.50 alpha, photonlib dev build, PathPlanner, Commands V2). LaserCAN and Studica are dropped.

API changes hit

Each replacement was checked against the 2027 jars or WPILib sources, not guessed:

2026 2027
edu.wpi.first.* org.wpilib.* (package moves)
ChassisSpeeds / .omegaRadiansPerSecond ChassisVelocities / .omega
SwerveModuleState SwerveModuleVelocity
toSwerveModuleStates / toChassisSpeeds toSwerveModuleVelocities / toChassisVelocities
PropertyFactory / DoubleProperty / createPersistentProperty TunableFactory / TunableDouble / createDouble
SmartDashboard.putData(name, cmd) Tunables.publish(name, cmd) (same run/stop toggle)
LinearSystemId.createFlywheelSystem Models.flywheelFromPhysicalConstants (same arg order)
FlywheelSim.getAngularVelocityRadPerSec() getAngularVelocity() (still rad/s)
DriverStation.isEnabled() RobotState.isEnabled()
MathUtil.clamp removed; Math.clamp
getifAvailable(XboxButton.Start) getXboxButtonIfAvailable(Button.MENU)
cmd.schedule() CommandScheduler.getInstance().schedule(cmd)
requires(subsystem) addRequirements(subsystem)

Also adds UnsupportedHardwareModule (copied from the template), because 2027 SCL's RealDevicesModule no longer binds XLaserCANFactory.

Blockers before this could ship

  1. No roboRIO deploy. 2027 GradleRIO only deploys to SystemCore; there's no roboRIO target. The "Running on a Real Robot" challenge couldn't deploy to any robot the team has today.
  2. Smart App Control blocks alpha natives. Unsigned alpha DLLs have no reputation, so Windows 11 machines with SAC enforcing (likely including student laptops) can't load wpimathjni. 2026 release DLLs pass the same check.

Curriculum docs that would need updating

  • Moving to a Target Position: the Property system section (PropertyFactory/DoubleProperty) becomes Tunables, and the Elastic "SmartDashboard → DriveToPosition" steps change. How 2027 Elastic shows a published Tunable is untested.
  • Altering Tank Drive, Mapping Buttons to Commands, Robot Architecture: the button binding API, and Start → MENU.
  • Basic Robot Principles: the observation tests now use CommandScheduler.getInstance().schedule(cmd).
  • Tank Drive: the DriveSubsystem snippet shows PropertyFactory pf.
  • Advanced Swerve: SwerveModuleState / speedMetersPerSecond become SwerveModuleVelocity / velocity.
  • Onboarding / Environment Setup: WPILib 2027 install, temurin-17 becomes Java 25.
  • AdvantageScope layout: probably needs a 2027 re-export (untested).

Not tested

The interactive simulator, AdvantageScope or Elastic on 2027, deploying to hardware, and the 4 excluded swerve tests.

🤖 Generated with Claude Code

aschokking and others added 2 commits October 10, 2026 11:48
SeriouslyCommonLib #636 (2026-07-13) made devices register themselves with a
DataFrameRegistry when they are created, and BaseRobot refreshes them all
each loop. Subsystems no longer need to implement DataFrameRefreshable and
forward refreshDataFrame() to their motors, and Robot no longer needs to add
them to a list.

XbotEdu was pinned to SCL 20260405.5, which predates #636 - no registry, and
BaseRobot still had the manual dataFrameRefreshables list. So removing the
plumbing requires the SCL bump; on the old version it was the only thing
refreshing the drive motors.

SCL version: 20261003.3 is the newest published build that both includes the
registry and targets Java 17. From 20261003.6 the artifacts are compiled for
Java 25 (class file version 69) for the WPILib 2027 line, which XbotEdu's
2026 toolchain cannot load.

Changes:
- DriveSubsystem, SwerveDriveSubsystem: drop DataFrameRefreshable and
  refreshDataFrame(). The CurrentSwerveState log that lived inside
  SwerveDriveSubsystem.refreshDataFrame() moves to periodic().
- Robot: drop the dataFrameRefreshables.add(...) calls. Both subsystems are
  still created, since EduSimulator and SubsystemDefaultCommandMap inject them.
- Tests: subsystem.refreshDataFrame() becomes
  getInjectorComponent().dataFrameRegistry().refreshAll().
- Tests: MockXboxControllerAdapter and MockTimer moved from
  edu.wpi.first.wpilibj to xbot.common.controls.sensors.mock_adapters in the
  newer SCL; imports updated.

Verified: compiles, checkstyle passes, and the full test suite gives the
identical per-test result as main (same 4 pass, same 16 student-exercise
tests fail with the same messages). DriveToPositionCommandTest reports the
same final distance (5.002332505667951) over 300 loops on both, which only
matches if the registry refreshes motor positions the way the manual calls
did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exploratory migration to measure the cost of moving XbotEdu to WPILib 2027,
modelled on FRCRobotTemplate main (migrated in #88). Built on top of the
data-frame cleanup branch (PR #49).

Result: main and test code compile on 2027.0.0-alpha-7 / Java 25 / SCL
20261003.9, and all 16 tests that can run here give identical results to
2026 (DriveToPositionCommandTest final distance 5.002332505667951 on both).
The 4 SwerveDriveWithJoysticksCommandTest cases are excluded: Smart App
Control on this machine blocks the unsigned alpha wpimathjni.dll.

Build: Gradle 9.4.1, org.wpilib.GradleRIO 2027.0.0-alpha-7, Java 25
toolchain, SystemCore deploy target (2027 has no roboRIO target), AspectJ
weaving removed, frcYear 2027_alpha7, vendordeps from the template.

API changes hit:
- edu.wpi.first.* -> org.wpilib.* package moves
- ChassisSpeeds -> ChassisVelocities (.omega), SwerveModuleState ->
  SwerveModuleVelocity, toSwerveModuleStates/toChassisSpeeds -> *Velocities
- PropertyFactory/DoubleProperty -> TunableFactory/TunableDouble
  (createPersistentProperty -> createDouble)
- SmartDashboard.putData -> Tunables.publish
- LinearSystemId.createFlywheelSystem -> Models.flywheelFromPhysicalConstants
- FlywheelSim.getAngularVelocityRadPerSec -> getAngularVelocity (still rad/s)
- DriverStation.isEnabled -> RobotState.isEnabled
- MathUtil.clamp removed -> Math.clamp
- getifAvailable(XboxButton.Start) -> getXboxButtonIfAvailable(Button.MENU)
- Command.schedule() removed -> CommandScheduler.getInstance().schedule(cmd)
- requires(subsystem) -> addRequirements(subsystem)
- UnsupportedHardwareModule stub for XLaserCANFactory, copied from the
  template (2027 SCL's RealDevicesModule no longer binds it)

The test filter at the end of build.gradle is spike-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from remove-manual-dataframe-refresh to main October 10, 2026 19:40
aschokking and others added 2 commits November 14, 2026 09:55
Resolve conflicts in build.gradle and SwerveDriveSubsystem.java by keeping
the 2027 migration side (SCL 20261003.9, org.wpilib.* imports). Main's only
new commit (#49) is the squash of this branch's base commit, so no content
from main is lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI agents (JavaToolInstaller pinned to JDK 17) have no Java 25 install,
so :compileJava failed resolving the toolchain. The foojay resolver lets
Gradle download a matching JDK when none is found locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant