mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Make 2027 build (#2422)
This PR updates everything for 2027. This includes removing GradleRIO, simplifying our wpilib version defintion, updating APIs, updating to Java 21, and more. Note that photonlibpy is failing because robotpy has not been fully updated yet. Examples are omitted because they need to be updated for our new PhotonPoseEstimator API and still need some changes from WPILIB. photonlib windows build is failing because we're waiting for some upstream changes. Finally, images are failing since they don't have Java 21 yet.
This commit is contained in:
@@ -11,7 +11,7 @@ repositories {
|
||||
|
||||
wpi.maven.useLocal = false
|
||||
wpi.maven.useDevelopment = false
|
||||
wpi.versions.wpilibVersion = "2027.0.+"
|
||||
wpi.versions.wpilibVersion = "2027.0.0-alpha-4"
|
||||
|
||||
// Define my targets (SystemCore) and artifacts (deployable files)
|
||||
// This is added by GradleRIO's backing project DeployUtils.
|
||||
|
||||
@@ -4,7 +4,7 @@ pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
String frcYear = '2027_alpha1'
|
||||
String frcYear = '2027_alpha4'
|
||||
File frcHome
|
||||
if (OperatingSystem.current().isWindows()) {
|
||||
String publicFolder = System.getenv('PUBLIC')
|
||||
|
||||
@@ -124,7 +124,8 @@ void Robot::SimulationPeriodic() {
|
||||
wpi::sim::BatterySim::Calculate({totalCurrent});
|
||||
// Using max(0.1, voltage) here isn't a *physically correct* solution,
|
||||
// but it avoids problems with battery voltage measuring 0.
|
||||
wpi::sim::RoboRioSim::SetVInVoltage(wpi::units::math::max(0.1_V, loadedBattVolts));
|
||||
wpi::sim::RoboRioSim::SetVInVoltage(
|
||||
wpi::units::math::max(0.1_V, loadedBattVolts));
|
||||
}
|
||||
|
||||
#ifndef RUNNING_FRC_TESTS
|
||||
|
||||
@@ -151,7 +151,8 @@ void SwerveDrive::Log() {
|
||||
wpi::SmartDashboard::PutNumber(table + "VY", chassisSpeeds.vy.to<double>());
|
||||
wpi::SmartDashboard::PutNumber(
|
||||
table + "Omega Degrees",
|
||||
chassisSpeeds.omega.convert<wpi::units::degrees_per_second>().to<double>());
|
||||
chassisSpeeds.omega.convert<wpi::units::degrees_per_second>()
|
||||
.to<double>());
|
||||
wpi::SmartDashboard::PutNumber(table + "Target VX",
|
||||
targetChassisSpeeds.vx.to<double>());
|
||||
wpi::SmartDashboard::PutNumber(table + "Target VY",
|
||||
@@ -207,4 +208,6 @@ wpi::math::Pose2d SwerveDrive::GetSimPose() const {
|
||||
return swerveDriveSim.GetPose();
|
||||
}
|
||||
|
||||
wpi::units::ampere_t SwerveDrive::GetCurrentDraw() const { return totalCurrentDraw; }
|
||||
wpi::units::ampere_t SwerveDrive::GetCurrentDraw() const {
|
||||
return totalCurrentDraw;
|
||||
}
|
||||
|
||||
@@ -60,11 +60,12 @@ SwerveDriveSim::SwerveDriveSim(
|
||||
steerFF.GetKs(), steerMotor, steerGearing, kinematics) {}
|
||||
|
||||
SwerveDriveSim::SwerveDriveSim(
|
||||
const wpi::math::LinearSystem<2, 1, 2>& drivePlant, wpi::units::volt_t driveKs,
|
||||
const wpi::math::DCMotor& driveMotor, double driveGearing,
|
||||
wpi::units::meter_t driveWheelRadius,
|
||||
const wpi::math::LinearSystem<2, 1, 2>& steerPlant, wpi::units::volt_t steerKs,
|
||||
const wpi::math::DCMotor& steerMotor, double steerGearing,
|
||||
const wpi::math::LinearSystem<2, 1, 2>& drivePlant,
|
||||
wpi::units::volt_t driveKs, const wpi::math::DCMotor& driveMotor,
|
||||
double driveGearing, wpi::units::meter_t driveWheelRadius,
|
||||
const wpi::math::LinearSystem<2, 1, 2>& steerPlant,
|
||||
wpi::units::volt_t steerKs, const wpi::math::DCMotor& steerMotor,
|
||||
double steerGearing,
|
||||
const wpi::math::SwerveDriveKinematics<numModules>& kinematics)
|
||||
: drivePlant(drivePlant),
|
||||
driveKs(driveKs),
|
||||
@@ -230,7 +231,9 @@ SwerveDriveSim::GetSteerStates() const {
|
||||
return steerStates;
|
||||
}
|
||||
|
||||
wpi::units::radians_per_second_t SwerveDriveSim::GetOmega() const { return omega; }
|
||||
wpi::units::radians_per_second_t SwerveDriveSim::GetOmega() const {
|
||||
return omega;
|
||||
}
|
||||
|
||||
wpi::units::ampere_t SwerveDriveSim::GetCurrentDraw(
|
||||
const wpi::math::DCMotor& motor, wpi::units::radians_per_second_t velocity,
|
||||
@@ -245,8 +248,8 @@ wpi::units::ampere_t SwerveDriveSim::GetCurrentDraw(
|
||||
return retVal;
|
||||
}
|
||||
|
||||
std::array<wpi::units::ampere_t, numModules> SwerveDriveSim::GetDriveCurrentDraw()
|
||||
const {
|
||||
std::array<wpi::units::ampere_t, numModules>
|
||||
SwerveDriveSim::GetDriveCurrentDraw() const {
|
||||
std::array<wpi::units::ampere_t, numModules> currents;
|
||||
for (int i = 0; i < numModules; i++) {
|
||||
wpi::units::radians_per_second_t speed =
|
||||
@@ -258,8 +261,8 @@ std::array<wpi::units::ampere_t, numModules> SwerveDriveSim::GetDriveCurrentDraw
|
||||
return currents;
|
||||
}
|
||||
|
||||
std::array<wpi::units::ampere_t, numModules> SwerveDriveSim::GetSteerCurrentDraw()
|
||||
const {
|
||||
std::array<wpi::units::ampere_t, numModules>
|
||||
SwerveDriveSim::GetSteerCurrentDraw() const {
|
||||
std::array<wpi::units::ampere_t, numModules> currents;
|
||||
for (int i = 0; i < numModules; i++) {
|
||||
wpi::units::radians_per_second_t speed =
|
||||
|
||||
@@ -71,7 +71,8 @@ void SwerveModule::SetDesiredState(wpi::math::SwerveModuleState newState,
|
||||
}
|
||||
|
||||
wpi::math::Rotation2d SwerveModule::GetAbsoluteHeading() const {
|
||||
return wpi::math::Rotation2d{wpi::units::radian_t{steerEncoder.GetDistance()}};
|
||||
return wpi::math::Rotation2d{
|
||||
wpi::units::radian_t{steerEncoder.GetDistance()}};
|
||||
}
|
||||
|
||||
wpi::math::SwerveModuleState SwerveModule::GetState() const {
|
||||
@@ -132,8 +133,8 @@ void SwerveModule::Log() {
|
||||
|
||||
void SwerveModule::SimulationUpdate(
|
||||
wpi::units::meter_t driveEncoderDist,
|
||||
wpi::units::meters_per_second_t driveEncoderRate, wpi::units::ampere_t driveCurrent,
|
||||
wpi::units::radian_t steerEncoderDist,
|
||||
wpi::units::meters_per_second_t driveEncoderRate,
|
||||
wpi::units::ampere_t driveCurrent, wpi::units::radian_t steerEncoderDist,
|
||||
wpi::units::radians_per_second_t steerEncoderRate,
|
||||
wpi::units::ampere_t steerCurrent) {
|
||||
driveEncoderSim.SetDistance(driveEncoderDist.to<double>());
|
||||
|
||||
@@ -58,10 +58,11 @@ inline constexpr wpi::units::meter_t kTrackLength{18.5_in};
|
||||
inline constexpr wpi::units::meter_t kRobotWidth{25_in + 3.25_in * 2};
|
||||
inline constexpr wpi::units::meter_t kRobotLength{25_in + 3.25_in * 2};
|
||||
inline constexpr wpi::units::meters_per_second_t kMaxLinearSpeed{15.5_fps};
|
||||
inline constexpr wpi::units::radians_per_second_t kMaxAngularSpeed{720_deg_per_s};
|
||||
inline constexpr wpi::units::radians_per_second_t kMaxAngularSpeed{
|
||||
720_deg_per_s};
|
||||
inline constexpr wpi::units::meter_t kWheelDiameter{4_in};
|
||||
inline constexpr wpi::units::meter_t kWheelCircumference{kWheelDiameter *
|
||||
std::numbers::pi};
|
||||
std::numbers::pi};
|
||||
|
||||
inline constexpr double kDriveGearRatio = 6.75;
|
||||
inline constexpr double kSteerGearRatio = 12.8;
|
||||
@@ -101,8 +102,8 @@ struct ModuleConstants {
|
||||
|
||||
ModuleConstants(int moduleNum, int driveMotorId, int driveEncoderA,
|
||||
int driveEncoderB, int steerMotorId, int steerEncoderA,
|
||||
int steerEncoderB, double angleOffset, wpi::units::meter_t xOffset,
|
||||
wpi::units::meter_t yOffset)
|
||||
int steerEncoderB, double angleOffset,
|
||||
wpi::units::meter_t xOffset, wpi::units::meter_t yOffset)
|
||||
: moduleNum(moduleNum),
|
||||
driveMotorId(driveMotorId),
|
||||
driveEncoderA(driveEncoderA),
|
||||
|
||||
@@ -35,7 +35,8 @@ class SwerveDrive {
|
||||
public:
|
||||
SwerveDrive();
|
||||
void Periodic();
|
||||
void Drive(wpi::units::meters_per_second_t vx, wpi::units::meters_per_second_t vy,
|
||||
void Drive(wpi::units::meters_per_second_t vx,
|
||||
wpi::units::meters_per_second_t vy,
|
||||
wpi::units::radians_per_second_t omega);
|
||||
void SetChassisSpeeds(const wpi::math::ChassisSpeeds& targetChassisSpeeds,
|
||||
bool openLoop, bool steerInPlace);
|
||||
|
||||
@@ -44,11 +44,12 @@ class SwerveDriveSim {
|
||||
const wpi::math::DCMotor& steerMotor, double steerGearing,
|
||||
const wpi::math::SwerveDriveKinematics<numModules>& kinematics);
|
||||
SwerveDriveSim(
|
||||
const wpi::math::LinearSystem<2, 1, 2>& drivePlant, wpi::units::volt_t driveKs,
|
||||
const wpi::math::DCMotor& driveMotor, double driveGearing,
|
||||
wpi::units::meter_t driveWheelRadius,
|
||||
const wpi::math::LinearSystem<2, 1, 2>& steerPlant, wpi::units::volt_t steerKs,
|
||||
const wpi::math::DCMotor& steerMotor, double steerGearing,
|
||||
const wpi::math::LinearSystem<2, 1, 2>& drivePlant,
|
||||
wpi::units::volt_t driveKs, const wpi::math::DCMotor& driveMotor,
|
||||
double driveGearing, wpi::units::meter_t driveWheelRadius,
|
||||
const wpi::math::LinearSystem<2, 1, 2>& steerPlant,
|
||||
wpi::units::volt_t steerKs, const wpi::math::DCMotor& steerMotor,
|
||||
double steerGearing,
|
||||
const wpi::math::SwerveDriveKinematics<numModules>& kinematics);
|
||||
void SetDriveInputs(const std::array<wpi::units::volt_t, numModules>& inputs);
|
||||
void SetSteerInputs(const std::array<wpi::units::volt_t, numModules>& inputs);
|
||||
@@ -75,9 +76,9 @@ class SwerveDriveSim {
|
||||
std::array<Eigen::Matrix<double, 2, 1>, numModules> GetSteerStates() const;
|
||||
wpi::units::radians_per_second_t GetOmega() const;
|
||||
wpi::units::ampere_t GetCurrentDraw(const wpi::math::DCMotor& motor,
|
||||
wpi::units::radians_per_second_t velocity,
|
||||
wpi::units::volt_t inputVolts,
|
||||
wpi::units::volt_t batteryVolts) const;
|
||||
wpi::units::radians_per_second_t velocity,
|
||||
wpi::units::volt_t inputVolts,
|
||||
wpi::units::volt_t batteryVolts) const;
|
||||
std::array<wpi::units::ampere_t, numModules> GetDriveCurrentDraw() const;
|
||||
std::array<wpi::units::ampere_t, numModules> GetSteerCurrentDraw() const;
|
||||
wpi::units::ampere_t GetTotalCurrentDraw() const;
|
||||
|
||||
Reference in New Issue
Block a user