mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpimath] Make SimpleMotorFeedforward only support discrete feedforward (#6647)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
committed by
GitHub
parent
5f261a88af
commit
30c7632ab8
@@ -40,8 +40,7 @@ class Robot : public frc::TimedRobot {
|
||||
m_motor.SetSetpoint(
|
||||
ExampleSmartMotorController::PIDMode::kPosition,
|
||||
m_setpoint.position.value(),
|
||||
m_feedforward.Calculate(m_setpoint.velocity, next.velocity, kDt) /
|
||||
12_V);
|
||||
m_feedforward.Calculate(m_setpoint.velocity, next.velocity) / 12_V);
|
||||
|
||||
m_setpoint = next;
|
||||
}
|
||||
|
||||
@@ -54,9 +54,10 @@ class Robot : public frc::TimedRobot {
|
||||
// accelerate the shooter wheel
|
||||
.IfHigh([&shooter = m_shooter, &controller = m_controller, &ff = m_ff,
|
||||
&encoder = m_shooterEncoder] {
|
||||
shooter.SetVoltage(units::volt_t{controller.Calculate(
|
||||
encoder.GetRate(), SHOT_VELOCITY.value())} +
|
||||
ff.Calculate(SHOT_VELOCITY));
|
||||
shooter.SetVoltage(
|
||||
units::volt_t{controller.Calculate(encoder.GetRate(),
|
||||
SHOT_VELOCITY.value())} +
|
||||
ff.Calculate(units::radians_per_second_t{SHOT_VELOCITY}));
|
||||
});
|
||||
// if not, stop
|
||||
(!shootTrigger).IfHigh([&shooter = m_shooter] { shooter.Set(0.0); });
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <frc/simulation/EncoderSim.h>
|
||||
#include <frc/simulation/FlywheelSim.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
#include <frc/system/plant/LinearSystemId.h>
|
||||
#include <units/moment_of_inertia.h>
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "subsystems/ShooterSubsystem.h"
|
||||
|
||||
#include <frc/controller/PIDController.h>
|
||||
#include <units/angular_velocity.h>
|
||||
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user