mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Bump to WPILib 2025 Beta 1 & remove C++ protobuf (#1484)
Remove C++ protobuf support until https://github.com/wpilibsuite/allwpilib/issues/7250 is addressed. Developers should upgrade to wpilib vscode 2025 beta 1. --------- Co-authored-by: Matt <matthew.morley.ca@gmail.com>
This commit is contained in:
@@ -44,20 +44,22 @@ SwerveDriveSim::SwerveDriveSim(
|
||||
: SwerveDriveSim(
|
||||
frc::LinearSystem<2, 1, 2>{
|
||||
(Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0,
|
||||
-driveFF.kV.to<double>() / driveFF.kA.to<double>())
|
||||
-driveFF.GetKv().to<double>() / driveFF.GetKa().to<double>())
|
||||
.finished(),
|
||||
Eigen::Matrix<double, 2, 1>{0.0, 1.0 / driveFF.kA.to<double>()},
|
||||
Eigen::Matrix<double, 2, 1>{0.0,
|
||||
1.0 / driveFF.GetKa().to<double>()},
|
||||
(Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(),
|
||||
Eigen::Matrix<double, 2, 1>{0.0, 0.0}},
|
||||
driveFF.kS, driveMotor, driveGearing, driveWheelRadius,
|
||||
driveFF.GetKs(), driveMotor, driveGearing, driveWheelRadius,
|
||||
frc::LinearSystem<2, 1, 2>{
|
||||
(Eigen::MatrixXd(2, 2) << 0.0, 1.0, 0.0,
|
||||
-steerFF.kV.to<double>() / steerFF.kA.to<double>())
|
||||
-steerFF.GetKv().to<double>() / steerFF.GetKa().to<double>())
|
||||
.finished(),
|
||||
Eigen::Matrix<double, 2, 1>{0.0, 1.0 / steerFF.kA.to<double>()},
|
||||
Eigen::Matrix<double, 2, 1>{0.0,
|
||||
1.0 / steerFF.GetKa().to<double>()},
|
||||
(Eigen::MatrixXd(2, 2) << 1.0, 0.0, 0.0, 1.0).finished(),
|
||||
Eigen::Matrix<double, 2, 1>{0.0, 0.0}},
|
||||
steerFF.kS, steerMotor, steerGearing, kinematics) {}
|
||||
steerFF.GetKs(), steerMotor, steerGearing, kinematics) {}
|
||||
|
||||
SwerveDriveSim::SwerveDriveSim(
|
||||
const frc::LinearSystem<2, 1, 2>& drivePlant, units::volt_t driveKs,
|
||||
|
||||
@@ -64,12 +64,11 @@ void SwerveModule::Periodic() {
|
||||
driveMotor.SetVoltage(driveFF + drivePID);
|
||||
}
|
||||
|
||||
void SwerveModule::SetDesiredState(const frc::SwerveModuleState& newState,
|
||||
void SwerveModule::SetDesiredState(frc::SwerveModuleState newState,
|
||||
bool shouldBeOpenLoop, bool steerInPlace) {
|
||||
frc::Rotation2d currentRotation = GetAbsoluteHeading();
|
||||
frc::SwerveModuleState optimizedState =
|
||||
frc::SwerveModuleState::Optimize(newState, currentRotation);
|
||||
desiredState = optimizedState;
|
||||
newState.Optimize(currentRotation);
|
||||
desiredState = newState;
|
||||
}
|
||||
|
||||
frc::Rotation2d SwerveModule::GetAbsoluteHeading() const {
|
||||
|
||||
@@ -31,7 +31,11 @@
|
||||
#include <frc/controller/SimpleMotorFeedforward.h>
|
||||
#include <frc/geometry/Transform3d.h>
|
||||
#include <frc/geometry/Translation2d.h>
|
||||
#include <units/acceleration.h>
|
||||
#include <units/angular_acceleration.h>
|
||||
#include <units/angular_velocity.h>
|
||||
#include <units/length.h>
|
||||
#include <units/velocity.h>
|
||||
|
||||
namespace constants {
|
||||
namespace Vision {
|
||||
@@ -40,12 +44,13 @@ inline const frc::Transform3d kRobotToCam{
|
||||
frc::Translation3d{0.5_m, 0.0_m, 0.5_m},
|
||||
frc::Rotation3d{0_rad, -30_deg, 0_rad}};
|
||||
inline const frc::AprilTagFieldLayout kTagLayout{
|
||||
frc::LoadAprilTagLayoutField(frc::AprilTagField::k2024Crescendo)};
|
||||
frc::AprilTagFieldLayout::LoadField(frc::AprilTagField::k2024Crescendo)};
|
||||
|
||||
inline const Eigen::Matrix<double, 3, 1> kSingleTagStdDevs{4, 4, 8};
|
||||
inline const Eigen::Matrix<double, 3, 1> kMultiTagStdDevs{0.5, 0.5, 1};
|
||||
} // namespace Vision
|
||||
namespace Swerve {
|
||||
using namespace units;
|
||||
|
||||
inline constexpr units::meter_t kTrackWidth{18.5_in};
|
||||
inline constexpr units::meter_t kTrackLength{18.5_in};
|
||||
@@ -73,6 +78,8 @@ inline constexpr double kSteerKP = 20.0;
|
||||
inline constexpr double kSteerKI = 0.0;
|
||||
inline constexpr double kSteerKD = 0.25;
|
||||
|
||||
using namespace units;
|
||||
|
||||
inline const frc::SimpleMotorFeedforward<units::meters> kDriveFF{
|
||||
0.25_V, 2.5_V / 1_mps, 0.3_V / 1_mps_sq};
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ class SwerveModule {
|
||||
public:
|
||||
explicit SwerveModule(const constants::Swerve::ModuleConstants& consts);
|
||||
void Periodic();
|
||||
void SetDesiredState(const frc::SwerveModuleState& newState,
|
||||
bool shouldBeOpenLoop, bool steerInPlace);
|
||||
void SetDesiredState(frc::SwerveModuleState newState, bool shouldBeOpenLoop,
|
||||
bool steerInPlace);
|
||||
frc::Rotation2d GetAbsoluteHeading() const;
|
||||
frc::SwerveModuleState GetState() const;
|
||||
frc::SwerveModulePosition GetPosition() const;
|
||||
|
||||
Reference in New Issue
Block a user