diff --git a/cpp/BasicLatencyCompensation/build.gradle b/cpp/BasicLatencyCompensation/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/BasicLatencyCompensation/build.gradle +++ b/cpp/BasicLatencyCompensation/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/CANcoder/build.gradle b/cpp/CANcoder/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/CANcoder/build.gradle +++ b/cpp/CANcoder/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/CommandBasedDrive/build.gradle b/cpp/CommandBasedDrive/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/CommandBasedDrive/build.gradle +++ b/cpp/CommandBasedDrive/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/CommandBasedDrive/src/main/include/subsystems/DriveSubsystem.h b/cpp/CommandBasedDrive/src/main/include/subsystems/DriveSubsystem.h index 944b3eb3..9ac4f963 100644 --- a/cpp/CommandBasedDrive/src/main/include/subsystems/DriveSubsystem.h +++ b/cpp/CommandBasedDrive/src/main/include/subsystems/DriveSubsystem.h @@ -43,7 +43,7 @@ class DriveSubsystem : public frc2::SubsystemBase static constexpr units::inch_t kWheelRadiusInches = 3_in; frc::sim::DifferentialDrivetrainSim m_driveSim{ - frc::DCMotor::Falcon500(2), + frc::DCMotor::Falcon500FOC(2), kGearRatio, 2.1_kg_sq_m, // MOI of 2.1 kg m^2 (from CAD model) 26.5_kg, // Mass of robot is 26.5 kg diff --git a/cpp/CurrentLimits/build.gradle b/cpp/CurrentLimits/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/CurrentLimits/build.gradle +++ b/cpp/CurrentLimits/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/Falcon500ArcadeDrive/build.gradle b/cpp/Falcon500ArcadeDrive/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/Falcon500ArcadeDrive/build.gradle +++ b/cpp/Falcon500ArcadeDrive/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/FusedCANcoder/build.gradle b/cpp/FusedCANcoder/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/FusedCANcoder/build.gradle +++ b/cpp/FusedCANcoder/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/MotionMagic/build.gradle b/cpp/MotionMagic/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/MotionMagic/build.gradle +++ b/cpp/MotionMagic/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/MotionMagic/src/main/cpp/sim/TalonFXSimProfile.cpp b/cpp/MotionMagic/src/main/cpp/sim/TalonFXSimProfile.cpp index c2e80b4c..c172843e 100644 --- a/cpp/MotionMagic/src/main/cpp/sim/TalonFXSimProfile.cpp +++ b/cpp/MotionMagic/src/main/cpp/sim/TalonFXSimProfile.cpp @@ -3,7 +3,7 @@ using namespace ctre::phoenix6; TalonFXSimProfile::TalonFXSimProfile(hardware::TalonFX& falcon, units::kilogram_square_meter_t rotorInertia) : - _motorSim{frc::DCMotor::Falcon500(1), 1, rotorInertia}, + _motorSim{frc::DCMotor::Falcon500FOC(1), 1, rotorInertia}, _falcon{falcon} { } @@ -15,9 +15,10 @@ void TalonFXSimProfile::Run() { _motorSim.Update(GetPeriod()); /// SET SIM PHYSICS INPUTS - auto velocity = _motorSim.GetAngularVelocity(); + auto const position = _motorSim.GetAngularPosition(); + auto const velocity = _motorSim.GetAngularVelocity(); - _falcon.GetSimState().SetRawRotorPosition(_motorSim.GetAngularPosition()); + _falcon.GetSimState().SetRawRotorPosition(position); _falcon.GetSimState().SetRotorVelocity(velocity); _falcon.GetSimState().SetSupplyVoltage(12_V - _falcon.GetSimState().GetSupplyCurrent() * kMotorResistance); diff --git a/cpp/Pigeon2/build.gradle b/cpp/Pigeon2/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/Pigeon2/build.gradle +++ b/cpp/Pigeon2/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/PositionClosedLoop/build.gradle b/cpp/PositionClosedLoop/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/PositionClosedLoop/build.gradle +++ b/cpp/PositionClosedLoop/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/Simulation/build.gradle b/cpp/Simulation/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/Simulation/build.gradle +++ b/cpp/Simulation/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/Simulation/src/main/include/Robot.h b/cpp/Simulation/src/main/include/Robot.h index fa8fd899..7fc0cc03 100644 --- a/cpp/Simulation/src/main/include/Robot.h +++ b/cpp/Simulation/src/main/include/Robot.h @@ -44,7 +44,7 @@ class Robot : public frc::TimedRobot { static constexpr units::inch_t kWheelRadiusInches = 3_in; frc::sim::DifferentialDrivetrainSim m_driveSim{ - frc::DCMotor::Falcon500(2), + frc::DCMotor::Falcon500FOC(2), kGearRatio, 2.1_kg_sq_m, // MOI of 2.1 kg m^2 (from CAD model) 26.5_kg, // Mass of robot is 26.5 kg diff --git a/cpp/VelocityClosedLoop/build.gradle b/cpp/VelocityClosedLoop/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/VelocityClosedLoop/build.gradle +++ b/cpp/VelocityClosedLoop/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/cpp/WaitForAll/build.gradle b/cpp/WaitForAll/build.gradle index 07f7fc67..b4a566f2 100644 --- a/cpp/WaitForAll/build.gradle +++ b/cpp/WaitForAll/build.gradle @@ -1,7 +1,7 @@ plugins { id "cpp" id "google-test-test-suite" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } // Define my targets (RoboRIO) and artifacts (deployable files) diff --git a/java/BasicLatencyCompensation/build.gradle b/java/BasicLatencyCompensation/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/BasicLatencyCompensation/build.gradle +++ b/java/BasicLatencyCompensation/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/CANcoder/build.gradle b/java/CANcoder/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/CANcoder/build.gradle +++ b/java/CANcoder/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/CANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java b/java/CANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java index 8f58c88f..9ffd20c0 100644 --- a/java/CANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java +++ b/java/CANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java @@ -2,7 +2,6 @@ import com.ctre.phoenix6.hardware.CANcoder; import com.ctre.phoenix6.hardware.TalonFX; -import com.ctre.phoenix6.sim.CANcoderSimState; import edu.wpi.first.math.system.plant.DCMotor; import edu.wpi.first.math.util.Units; @@ -19,7 +18,6 @@ class TalonFXSimProfile extends SimProfile { private final double _gearRatio; private final DCMotorSim _motorSim; - private final CANcoderSimState _cancoderSim; // We need a sim state in order to change the values of CANcoder /** * Creates a new simulation profile for a TalonFX device. @@ -38,8 +36,7 @@ public TalonFXSimProfile(final TalonFX falcon, final CANcoder canCoder, final do this._falcon = falcon; this._canCoder = canCoder; this._gearRatio = gearRatio; - this._motorSim = new DCMotorSim(DCMotor.getFalcon500(1), 100, .001); - this._cancoderSim = _canCoder.getSimState(); + this._motorSim = new DCMotorSim(DCMotor.getFalcon500Foc(1), gearRatio, .001); } /** @@ -56,18 +53,15 @@ public void run() { _motorSim.update(getPeriod()); // SET SIM PHYSICS INPUTS - double position = _motorSim.getAngularPositionRotations(); - double velocity = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); + final double position_rot = _motorSim.getAngularPositionRotations() * _gearRatio; + final double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()) * _gearRatio; - _falcon.getSimState().setRawRotorPosition(position); - _falcon.getSimState().setRotorVelocity(velocity); + _falcon.getSimState().setRawRotorPosition(position_rot); + _falcon.getSimState().setRotorVelocity(velocity_rps); _falcon.getSimState().setSupplyVoltage(12 - _falcon.getSimState().getSupplyCurrent() * kMotorResistance); - _canCoder.getSimState().setRawPosition(_motorSim.getAngularPositionRotations() / _gearRatio); - _canCoder.getSimState().setVelocity(velocity / _gearRatio); - - _cancoderSim.setRawPosition(position); - _cancoderSim.setVelocity(velocity); + _canCoder.getSimState().setRawPosition(position_rot / _gearRatio); + _canCoder.getSimState().setVelocity(velocity_rps / _gearRatio); } } \ No newline at end of file diff --git a/java/CommandBasedDrive/build.gradle b/java/CommandBasedDrive/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/CommandBasedDrive/build.gradle +++ b/java/CommandBasedDrive/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/CommandBasedDrive/src/main/java/frc/robot/subsystems/DriveSubsystem.java b/java/CommandBasedDrive/src/main/java/frc/robot/subsystems/DriveSubsystem.java index 80019a3d..09fc3d0a 100644 --- a/java/CommandBasedDrive/src/main/java/frc/robot/subsystems/DriveSubsystem.java +++ b/java/CommandBasedDrive/src/main/java/frc/robot/subsystems/DriveSubsystem.java @@ -56,7 +56,7 @@ public class DriveSubsystem extends SubsystemBase { /* Simulation model of the drivetrain */ private final DifferentialDrivetrainSim m_driveSim = new DifferentialDrivetrainSim( - DCMotor.getFalcon500(2), // 2 CIMS on each side of the drivetrain. + DCMotor.getFalcon500Foc(2), // 2 CIMS on each side of the drivetrain. kGearRatio, // Standard AndyMark Gearing reduction. 2.1, // MOI of 2.1 kg m^2 (from CAD model). 26.5, // Mass of the robot is 26.5 kg. diff --git a/java/ControlRequestLimits/build.gradle b/java/ControlRequestLimits/build.gradle index 3b9dc0de..e2b78281 100644 --- a/java/ControlRequestLimits/build.gradle +++ b/java/ControlRequestLimits/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/CurrentLimits/build.gradle b/java/CurrentLimits/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/CurrentLimits/build.gradle +++ b/java/CurrentLimits/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/Falcon500ArcadeDrive/build.gradle b/java/Falcon500ArcadeDrive/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/Falcon500ArcadeDrive/build.gradle +++ b/java/Falcon500ArcadeDrive/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/FusedCANcoder/build.gradle b/java/FusedCANcoder/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/FusedCANcoder/build.gradle +++ b/java/FusedCANcoder/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/FusedCANcoder/src/main/java/frc/robot/Robot.java b/java/FusedCANcoder/src/main/java/frc/robot/Robot.java index 48abb170..e987040b 100644 --- a/java/FusedCANcoder/src/main/java/frc/robot/Robot.java +++ b/java/FusedCANcoder/src/main/java/frc/robot/Robot.java @@ -94,7 +94,7 @@ public void robotPeriodic() { } } - if(m_joystick.getAButton()) { + if (m_joystick.getAButton()) { /* Clear sticky faults */ m_fx.clearStickyFaults(); } @@ -137,7 +137,7 @@ public void testPeriodic() {} @Override public void simulationInit() { - PhysicsSim.getInstance().addTalonFX(m_fx, m_cc, 25, 0.001); + PhysicsSim.getInstance().addTalonFX(m_fx, m_cc, 12.8, 0.001); } @Override diff --git a/java/FusedCANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java b/java/FusedCANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java index fb08c177..a4981b17 100644 --- a/java/FusedCANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java +++ b/java/FusedCANcoder/src/main/java/frc/robot/sim/TalonFXSimProfile.java @@ -36,7 +36,7 @@ public TalonFXSimProfile(final TalonFX falcon, final CANcoder canCoder, final do this._falcon = falcon; this._canCoder = canCoder; this._gearRatio = gearRatio; - this._motorSim = new DCMotorSim(DCMotor.getFalcon500(1), gearRatio, rotorInertia); + this._motorSim = new DCMotorSim(DCMotor.getFalcon500Foc(1), gearRatio, rotorInertia); } /** @@ -54,15 +54,16 @@ public void run() { _motorSim.update(getPeriod()); /// SET SIM PHYSICS INPUTS - double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); + final double position_rot = _motorSim.getAngularPositionRotations() * _gearRatio; + final double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()) * _gearRatio; - _falcon.getSimState().setRawRotorPosition(_motorSim.getAngularPositionRotations()); + _falcon.getSimState().setRawRotorPosition(position_rot); _falcon.getSimState().setRotorVelocity(velocity_rps); _falcon.getSimState().setSupplyVoltage(12 - _falcon.getSimState().getSupplyCurrent() * kMotorResistance); - _canCoder.getSimState().setRawPosition(_motorSim.getAngularPositionRotations()/_gearRatio); - _canCoder.getSimState().setVelocity(velocity_rps/_gearRatio); + _canCoder.getSimState().setRawPosition(position_rot / _gearRatio); + _canCoder.getSimState().setVelocity(velocity_rps / _gearRatio); } } \ No newline at end of file diff --git a/java/MotionMagic/build.gradle b/java/MotionMagic/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/MotionMagic/build.gradle +++ b/java/MotionMagic/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/MotionMagic/src/main/java/frc/robot/sim/TalonFXSimProfile.java b/java/MotionMagic/src/main/java/frc/robot/sim/TalonFXSimProfile.java index 9ec300b0..b654859f 100644 --- a/java/MotionMagic/src/main/java/frc/robot/sim/TalonFXSimProfile.java +++ b/java/MotionMagic/src/main/java/frc/robot/sim/TalonFXSimProfile.java @@ -31,7 +31,7 @@ class TalonFXSimProfile extends SimProfile { */ public TalonFXSimProfile(final TalonFX falcon, final double rotorInertia) { this._falcon = falcon; - this._motorSim = new DCMotorSim(DCMotor.getFalcon500(1), 1.0, rotorInertia); + this._motorSim = new DCMotorSim(DCMotor.getFalcon500Foc(1), 1.0, rotorInertia); } /** @@ -49,9 +49,10 @@ public void run() { _motorSim.update(getPeriod()); /// SET SIM PHYSICS INPUTS - double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); + final double position_rot = _motorSim.getAngularPositionRotations(); + final double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); - _falcon.getSimState().setRawRotorPosition(_motorSim.getAngularPositionRotations()); + _falcon.getSimState().setRawRotorPosition(position_rot); _falcon.getSimState().setRotorVelocity(velocity_rps); _falcon.getSimState().setSupplyVoltage(12 - _falcon.getSimState().getSupplyCurrent() * kMotorResistance); diff --git a/java/Pigeon2/build.gradle b/java/Pigeon2/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/Pigeon2/build.gradle +++ b/java/Pigeon2/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/Pigeon2/src/main/java/frc/robot/sim/TalonFXSimProfile.java b/java/Pigeon2/src/main/java/frc/robot/sim/TalonFXSimProfile.java index 452e5a83..0d005b44 100644 --- a/java/Pigeon2/src/main/java/frc/robot/sim/TalonFXSimProfile.java +++ b/java/Pigeon2/src/main/java/frc/robot/sim/TalonFXSimProfile.java @@ -34,7 +34,7 @@ class TalonFXSimProfile extends SimProfile { public TalonFXSimProfile(final TalonFX falcon, final Pigeon2 pigeon, final double rotorInertia) { this._falcon = falcon; this._pigeon = pigeon; - this._motorSim = new DCMotorSim(DCMotor.getFalcon500(1), 1.0, rotorInertia); + this._motorSim = new DCMotorSim(DCMotor.getFalcon500Foc(1), 1.0, rotorInertia); } /** @@ -52,14 +52,15 @@ public void run() { _motorSim.update(getPeriod()); /// SET SIM PHYSICS INPUTS - double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); + final double position_rot = _motorSim.getAngularPositionRotations(); + final double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); - _falcon.getSimState().setRawRotorPosition(_motorSim.getAngularPositionRotations()); + _falcon.getSimState().setRawRotorPosition(position_rot); _falcon.getSimState().setRotorVelocity(velocity_rps); _falcon.getSimState().setSupplyVoltage(12 - _falcon.getSimState().getSupplyCurrent() * kMotorResistance); - _pigeon.getSimState().setRawYaw(_motorSim.getAngularPositionRotations()); + _pigeon.getSimState().setRawYaw(position_rot); } } \ No newline at end of file diff --git a/java/PositionClosedLoop/build.gradle b/java/PositionClosedLoop/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/PositionClosedLoop/build.gradle +++ b/java/PositionClosedLoop/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/PositionClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java b/java/PositionClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java index b53a05d9..1fd2ed84 100644 --- a/java/PositionClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java +++ b/java/PositionClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java @@ -31,7 +31,7 @@ class TalonFXSimProfile extends SimProfile { * The phase of the TalonFX sensors */ public TalonFXSimProfile(final TalonFX falcon, final double rotorInertia) { - this._motorSim = new DCMotorSim(DCMotor.getFalcon500(1), 1.0, rotorInertia); + this._motorSim = new DCMotorSim(DCMotor.getFalcon500Foc(1), 1.0, rotorInertia); this._falconSim = falcon.getSimState(); } @@ -50,9 +50,10 @@ public void run() { _motorSim.update(getPeriod()); /// SET SIM PHYSICS INPUTS - double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); + final double position_rot = _motorSim.getAngularPositionRotations(); + final double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); - _falconSim.setRawRotorPosition(_motorSim.getAngularPositionRotations()); + _falconSim.setRawRotorPosition(position_rot); _falconSim.setRotorVelocity(velocity_rps); _falconSim.setSupplyVoltage(12 - _falconSim.getSupplyCurrent() * kMotorResistance); diff --git a/java/Simulation/build.gradle b/java/Simulation/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/Simulation/build.gradle +++ b/java/Simulation/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/Simulation/src/main/java/frc/robot/Robot.java b/java/Simulation/src/main/java/frc/robot/Robot.java index 0a2a4c55..ecc62fc8 100644 --- a/java/Simulation/src/main/java/frc/robot/Robot.java +++ b/java/Simulation/src/main/java/frc/robot/Robot.java @@ -68,7 +68,7 @@ public class Robot extends TimedRobot { /* Simulation model of the drivetrain */ private final DifferentialDrivetrainSim m_driveSim = new DifferentialDrivetrainSim( - DCMotor.getFalcon500(2), // 2 CIMS on each side of the drivetrain. + DCMotor.getFalcon500Foc(2), // 2 CIMS on each side of the drivetrain. kGearRatio, // Standard AndyMark Gearing reduction. 2.1, // MOI of 2.1 kg m^2 (from CAD model). 26.5, // Mass of the robot is 26.5 kg. diff --git a/java/SwerveWithPathPlanner/build.gradle b/java/SwerveWithPathPlanner/build.gradle index 94b78617..a581ae74 100644 --- a/java/SwerveWithPathPlanner/build.gradle +++ b/java/SwerveWithPathPlanner/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/VelocityClosedLoop/build.gradle b/java/VelocityClosedLoop/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/VelocityClosedLoop/build.gradle +++ b/java/VelocityClosedLoop/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java { diff --git a/java/VelocityClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java b/java/VelocityClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java index 9c73a39d..8e11b340 100644 --- a/java/VelocityClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java +++ b/java/VelocityClosedLoop/src/main/java/frc/robot/sim/TalonFXSimProfile.java @@ -30,7 +30,7 @@ class TalonFXSimProfile extends SimProfile { * The phase of the TalonFX sensors */ public TalonFXSimProfile(final TalonFX falcon, final double rotorInertia) { - this._motorSim = new DCMotorSim(DCMotor.getFalcon500(1), 1.0, rotorInertia); + this._motorSim = new DCMotorSim(DCMotor.getFalcon500Foc(1), 1.0, rotorInertia); this._falconSim = falcon.getSimState(); } @@ -49,9 +49,10 @@ public void run() { _motorSim.update(getPeriod()); /// SET SIM PHYSICS INPUTS - double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); + final double position_rot = _motorSim.getAngularPositionRotations(); + final double velocity_rps = Units.radiansToRotations(_motorSim.getAngularVelocityRadPerSec()); - _falconSim.setRawRotorPosition(_motorSim.getAngularPositionRotations()); + _falconSim.setRawRotorPosition(position_rot); _falconSim.setRotorVelocity(velocity_rps); _falconSim.setSupplyVoltage(12 - _falconSim.getSupplyCurrent() * kMotorResistance); diff --git a/java/WaitForAll/build.gradle b/java/WaitForAll/build.gradle index 359cf8ac..8a03f481 100644 --- a/java/WaitForAll/build.gradle +++ b/java/WaitForAll/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-1" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" } java {