14#include <wpi/commands2/SubsystemBase.hpp>
15#include <wpi/math/controller/ArmFeedforward.hpp>
16#include <wpi/math/controller/ElevatorFeedforward.hpp>
17#include <wpi/math/controller/SimpleMotorFeedforward.hpp>
18#include <wpi/math/system/DCMotor.hpp>
19#include <wpi/math/trajectory/ExponentialProfile.hpp>
20#include <wpi/math/trajectory/TrapezoidProfile.hpp>
21#include <wpi/units/acceleration.hpp>
22#include <wpi/units/angle.hpp>
23#include <wpi/units/angular_acceleration.hpp>
24#include <wpi/units/angular_jerk.hpp>
25#include <wpi/units/angular_velocity.hpp>
26#include <wpi/units/current.hpp>
27#include <wpi/units/force.hpp>
28#include <wpi/units/length.hpp>
29#include <wpi/units/mass.hpp>
30#include <wpi/units/moment_of_inertia.hpp>
31#include <wpi/units/temperature.hpp>
32#include <wpi/units/time.hpp>
33#include <wpi/units/velocity.hpp>
34#include <wpi/units/voltage.hpp>
57 wpi::units::meters, wpi::units::inverse<wpi::units::cubed<wpi::units::seconds>>>>;
92 double kP,
double kI,
double kD,
105 const wpi::math::ArmFeedforward& ff,
116 const wpi::math::ElevatorFeedforward& ff,
127 const wpi::math::SimpleMotorFeedforward<wpi::units::turns>& ff,
140 wpi::units::turns_per_second_t maxVelocity,
141 wpi::units::turns_per_second_squared_t maxAcceleration);
151 wpi::units::meters_per_second_t maxVelocity,
152 wpi::units::meters_per_second_squared_t maxAcceleration);
165 wpi::units::turns_per_second_squared_t maxAcceleration,
166 wpi::units::angular_jerk::turns_per_second_cubed_t maxJerk);
189 wpi::units::volt_t maxInput);
204 wpi::math::DCMotor motor,
205 wpi::units::kilogram_square_meter_t moi);
221 wpi::math::DCMotor motor,
222 wpi::units::kilogram_t mass,
223 wpi::units::meter_t drumRadius);
234 wpi::units::volt_t maxVolts, wpi::units::turns_per_second_t maxVelocity,
235 wpi::units::turns_per_second_squared_t maxAcceleration);
244 wpi::math::ExponentialProfile<wpi::units::turns, wpi::units::volts>::Constraints constraints);
258 wpi::units::volt_t maxInput);
416 wpi::units::turn_t upper);
431 wpi::units::meter_t upper);
677 wpi::units::turn_t max);
777 const wpi::math::ArmFeedforward& ff,
788 const wpi::math::ElevatorFeedforward& ff,
799 const wpi::math::SimpleMotorFeedforward<wpi::units::turns>& ff,
812 double kP,
double kI,
double kD,
836 wpi::units::turns_per_second_t maxVelocity,
837 wpi::units::turns_per_second_squared_t maxAcceleration);
847 wpi::units::meters_per_second_t maxVelocity,
848 wpi::units::meters_per_second_squared_t maxAcceleration);
857 wpi::math::ExponentialProfile<wpi::units::turns, wpi::units::volts>::Constraints constraints);
958 std::vector<SmartMotorController*> followers);
1023 std::optional<wpi::math::ArmFeedforward>
armFF;
1025 std::optional<wpi::math::SimpleMotorFeedforward<wpi::units::turns>>
simpleFF;
1026 std::optional<math::LQRConfig>
lqr;
1145 wpi::units::turn_t current)
const;
1204 std::shared_ptr<telemetry::SmartMotorControllerTelemetryConfig>
1211 wpi::units::kilogram_square_meter_t
GetMOI()
const;
1257 std::optional<wpi::math::ExponentialProfile<wpi::units::turns, wpi::units::volts>>
1260 std::optional<wpi::math::ExponentialProfile<wpi::units::meters, wpi::units::volts>>
1297 wpi::units::turns_per_second_t mechanismVelocity)
const;
1306 wpi::units::turns_per_second_squared_t mechanismAcceleration)
const;
1315 wpi::units::angular_jerk::turns_per_second_cubed_t mechanismJerk)
const;
1340 wpi::units::meters_per_second_squared_t acceleration)
const;
1361 wpi::units::newton_t feedforwardForce)
const;
1372 wpi::units::newton_t feedforwardForce)
const;
1375 static constexpr int kNumSlots = 4;
1379 bool m_slotHasFeedback[kNumSlots]{
false,
false,
false,
false};
1383 enum class BasicOptions {
1384 VendorControlRequest,
1386 ClosedLoopMaxVoltage,
1405 LooselyCoupledFollowers,
1406 VoltageCompensation,
1407 FeedbackSynchronizationThreshold,
1408 ClosedLoopTolerance,
1409 ClosedLoopControlPeriod,
1410 ResetPreviousConfig,
1412 enum class ExternalEncoderOptions {
1414 UseExternalFeedback,
1416 ExternalEncoderInverted,
1418 static std::string_view ToString(BasicOptions opt);
1419 static std::string_view ToString(ExternalEncoderOptions opt);
1420 mutable std::set<BasicOptions> m_basicOptions;
1421 mutable std::set<ExternalEncoderOptions> m_externalEncoderOptions;
1424 double ForceToRotorTorque(wpi::units::newton_t feedforwardForce)
const;
1426 void RequireCircumference(
const std::string& action)
const;
1428 bool HasClosedLoopController()
const;
1435 std::shared_ptr<math::ADRCConfig> config;
1436 ADRCSlot() =
default;
1438 ADRCSlot(
const ADRCSlot& other)
1439 : config{other.config ? std::make_shared<math::ADRCConfig>(*other.config) : nullptr} {}
1441 ADRCSlot& operator=(
const ADRCSlot& other) {
1442 if (
this != &other) config = other.config ? std::make_shared<math::ADRCConfig>(*other.config) : nullptr;
1445 ADRCSlot(ADRCSlot&&) =
default;
1446 ADRCSlot& operator=(ADRCSlot&&) =
default;
1448 ADRCSlot m_adrc[kNumSlots];
1450 bool m_momentOfInertiaConfigured{
false};
1453 struct SimGainsOverride {
1454 std::optional<double> kP, kI, kD;
1455 std::optional<math::LQRConfig> lqr;
1456 std::optional<wpi::math::ArmFeedforward> armFF;
1457 std::optional<wpi::math::ElevatorFeedforward> elevatorFF;
1458 std::optional<wpi::math::SimpleMotorFeedforward<wpi::units::turns>> simpleFF;
1460 SimGainsOverride m_simGains[kNumSlots];
1463 std::optional<wpi::math::TrapezoidProfile<wpi::units::turns>> m_trapProfile;
1464 std::optional<wpi::math::TrapezoidProfile<wpi::units::meters>> m_linearTrapProfile;
1465 std::optional<wpi::math::ExponentialProfile<wpi::units::turns, wpi::units::volts>> m_expoProfile;
1466 std::optional<wpi::math::ExponentialProfile<wpi::units::meters, wpi::units::volts>>
1467 m_linearExpoProfile;
1468 bool m_velocityTrapProfile{
false};
1470 std::optional<wpi::units::turns_per_second_t> m_trapMaxVelTurns;
1471 std::optional<wpi::units::turns_per_second_squared_t> m_trapMaxAccTurns;
1472 std::optional<wpi::units::meters_per_second_t> m_trapMaxVelLinear;
1473 std::optional<wpi::units::meters_per_second_squared_t> m_trapMaxAccLinear;
1475 std::optional<double> m_expoMotionMagicKV;
1476 std::optional<double> m_expoMotionMagicKA;
1477 std::optional<wpi::units::volt_t> m_expoMaxInput;
1480 std::optional<wpi::units::turn_t> m_mechLowerLimit;
1481 std::optional<wpi::units::turn_t> m_mechUpperLimit;
1482 std::optional<wpi::units::ampere_t> m_statorCurrentLimit;
1483 std::optional<wpi::units::ampere_t> m_supplyCurrentLimit;
1484 std::optional<wpi::units::celsius_t> m_temperatureCutoff;
1485 std::optional<wpi::units::volt_t> m_closedLoopMaxVoltage;
1486 std::optional<wpi::units::volt_t> m_voltageCompensation;
1487 std::optional<wpi::units::turn_t> m_feedbackSynchronizationThreshold;
1488 std::optional<wpi::units::turn_t> m_closedLoopTolerance;
1489 bool m_resetPreviousConfig{
true};
1490 std::optional<wpi::units::turn_t> m_wrappingMin;
1491 std::optional<wpi::units::turn_t> m_wrappingMax;
1493 bool m_wrappingContinuous{
false};
1497 std::optional<MotorMode> m_zeroPower;
1498 std::optional<wpi::units::second_t> m_closedLoopPeriod;
1499 std::optional<wpi::units::second_t> m_openLoopRampRate;
1500 std::optional<wpi::units::second_t> m_closedLoopRampRate;
1503 std::optional<bool> m_motorInverted;
1504 std::optional<bool> m_encoderInverted;
1507 std::optional<gearing::MechanismGearing> m_motorGearing;
1508 std::optional<wpi::units::meter_t> m_mechanismCircumference;
1509 bool m_linearClosedLoopController{
false};
1512 std::optional<std::any> m_externalEncoder;
1513 bool m_useExternalFeedback{
true};
1514 std::optional<bool> m_externalEncoderInverted;
1515 std::optional<double> m_externalEncoderConversionFactor;
1516 std::optional<wpi::units::turn_t> m_externalEncoderZeroOffset;
1517 std::optional<gearing::MechanismGearing> m_externalEncoderGearing;
1520 std::optional<std::string> m_telemetryName;
1521 std::optional<TelemetryVerbosity> m_verbosity;
1523 std::shared_ptr<telemetry::SmartMotorControllerTelemetryConfig> m_telemetryConfig;
1525 wpi::cmd::SubsystemBase* m_subsystem{
nullptr};
1526 std::optional<wpi::math::DCMotor> m_simMotor;
1527 wpi::units::kilogram_square_meter_t m_moi{0.02_kg_sq_m};
1528 std::optional<wpi::units::second_t> m_simulationPeriod;
1529 std::optional<wpi::units::turn_t> m_startingPosition;
1530 std::optional<wpi::units::meter_t> m_startingPositionDistance;
1533 std::optional<wpi::units::turn_t> m_simStartingPosition;
1534 std::optional<wpi::math::TrapezoidProfile<wpi::units::turns>> m_simTrapProfile;
1535 std::optional<wpi::math::TrapezoidProfile<wpi::units::meters>> m_simLinearTrapProfile;
1536 std::optional<wpi::math::ExponentialProfile<wpi::units::turns, wpi::units::volts>>
1539 std::optional<std::any> m_vendorConfig;
1540 std::optional<std::any> m_vendorControlRequest;
1543 std::vector<std::pair<std::any, bool>> m_followers;
1544 std::vector<SmartMotorController*> m_looseFollowers;
Definition MechanismGearing.hpp:19
Definition ADRCConfig.hpp:82
Definition LQRConfig.hpp:28
std::optional< wpi::units::turn_t > GetWrappingMin() const
std::optional< bool > GetExternalEncoderInverted() const
SmartMotorControllerConfig & WithStartingPosition(wpi::units::meter_t startingDistance)
SmartMotorControllerConfig & WithTelemetry(const std::string &name, TelemetryVerbosity verbosity=TelemetryVerbosity::HIGH)
SmartMotorControllerConfig & WithSupplyCurrentLimit(wpi::units::ampere_t limit)
wpi::units::turn_t ConvertToMechanism(wpi::units::meter_t distance) const
std::optional< wpi::units::volt_t > GetExponentialProfileMaxInput() const
SmartMotorControllerConfig & WithTemperatureCutoff(wpi::units::celsius_t temperature)
wpi::units::turn_t GetContinuousWrappingSetpoint(wpi::units::turn_t setpoint, wpi::units::turn_t current) const
SmartMotorControllerConfig & WithTrapezoidProfile(wpi::units::turns_per_second_t maxVelocity, wpi::units::turns_per_second_squared_t maxAcceleration)
SmartMotorControllerConfig & WithMotorInverted(bool inverted)
std::optional< wpi::units::volt_t > GetVoltageCompensation() const
SmartMotorControllerConfig & WithZeroPower(MotorMode mode)
bool GetLinearClosedLoopControllerUse() const
std::optional< std::any > GetExternalEncoder() const
std::optional< wpi::units::turn_t > GetMechanismLowerLimit() const
SmartMotorControllerConfig & WithExternalEncoderGearing(double reductionRatio)
SmartMotorControllerConfig & WithExternalEncoderInverted(bool inverted)
std::optional< wpi::math::SimpleMotorFeedforward< wpi::units::turns > > GetSimpleFeedforward(ClosedLoopControllerSlot slot) const
bool GetUseExternalFeedback() const
const std::vector< std::pair< std::any, bool > > & GetFollowers() const
SmartMotorControllerConfig & WithContinuousWrapping(wpi::units::turn_t min, wpi::units::turn_t max)
wpi::units::turns_per_second_t ConvertToMechanism(wpi::units::meters_per_second_t velocity) const
std::optional< wpi::units::turn_t > GetStartingPosition() const
SmartMotorControllerConfig & WithMOI(wpi::units::meter_t length, wpi::units::kilogram_t mass)
wpi::units::kilogram_square_meter_t GetMOI() const
SmartMotorControllerConfig & WithWheelMOI(wpi::units::meter_t diameter, wpi::units::kilogram_t mass)
wpi::units::ampere_t ConvertToCurrent(const wpi::math::DCMotor &motor, wpi::units::newton_t feedforwardForce) const
SmartMotorControllerConfig & WithClosedLoopControlPeriod(wpi::units::second_t period)
std::optional< wpi::units::meter_t > GetMeasurementLowerLimit() const
SmartMotorControllerConfig & WithClosedLoopRampRate(wpi::units::second_t rampRate)
double GetKi(ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0) const
std::optional< wpi::units::turns_per_second_squared_t > GetTrapMaxAccelTurns() const
SmartMotorControllerConfig & WithClosedLoopMode()
SmartMotorControllerConfig & WithExponentialProfile(wpi::units::volt_t maxVolts, wpi::math::DCMotor motor, wpi::units::kilogram_t mass, wpi::units::meter_t drumRadius)
SmartMotorControllerConfig & WithStartingPosition(wpi::units::degree_t startingAngle)
std::optional< int > GetStatorStallCurrentLimit() const
TelemetryVerbosity
Definition SmartMotorControllerConfig.hpp:73
@ LOW
Definition SmartMotorControllerConfig.hpp:73
@ NONE
Definition SmartMotorControllerConfig.hpp:73
@ HIGH
Definition SmartMotorControllerConfig.hpp:73
@ MEDIUM
Definition SmartMotorControllerConfig.hpp:73
SmartMotorControllerConfig & WithWrapping(wpi::units::turn_t min, wpi::units::turn_t max)
wpi::units::meters_per_second_squared_t ConvertFromMechanism(wpi::units::turns_per_second_squared_t mechanismAcceleration) const
wpi::units::meters_per_second_t ConvertFromMechanism(wpi::units::turns_per_second_t mechanismVelocity) const
SmartMotorControllerConfig & WithSimFeedforward(const wpi::math::ArmFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
SmartMotorControllerConfig & WithMotorGearing(const gearing::MechanismGearing &gearing)
double GetKp(ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0) const
std::optional< wpi::math::ArmFeedforward > GetArmFeedforward(ClosedLoopControllerSlot slot) const
SmartMotorControllerConfig & WithMechanismLimits(wpi::units::turn_t lower, wpi::units::turn_t upper)
bool HasExponentialProfile() const
PIDGains GetSlotGains(ClosedLoopControllerSlot slot) const
SmartMotorControllerConfig & WithSimStartingPosition(wpi::units::degree_t startingAngle)
std::optional< wpi::units::ampere_t > GetStatorCurrentLimit() const
wpi::units::meter_t ConvertFromMechanism(wpi::units::turn_t mechanismPosition) const
std::optional< wpi::units::turn_t > GetMechanismUpperLimit() const
SmartMotorControllerConfig & WithSubsystem(wpi::cmd::SubsystemBase *subsystem)
SmartMotorControllerConfig & WithCascadingElevatorStages(int stages)
SmartMotorControllerConfig & WithSimulationPeriod(wpi::units::second_t period)
SmartMotorControllerConfig & WithExternalEncoderGearing(const gearing::MechanismGearing &gearing)
void ResetValidationCheck() const
SmartMotorControllerConfig & WithSimTrapezoidProfile(wpi::units::turns_per_second_t maxVelocity, wpi::units::turns_per_second_squared_t maxAcceleration)
SmartMotorControllerConfig Clone() const
SmartMotorControllerConfig & WithFeedforward(const wpi::math::ArmFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
std::optional< wpi::units::ampere_t > GetSupplyCurrentLimit() const
bool HasSubsystem() const
std::optional< bool > GetMotorInverted() const
wpi::units::volt_t ConvertToVoltage(const wpi::math::DCMotor &motor, wpi::units::newton_t feedforwardForce) const
SmartMotorControllerConfig & WithFollowers(std::vector< std::pair< std::any, bool > > followers)
SmartMotorControllerConfig & WithExponentialProfile(double kV, double kA, wpi::units::volt_t maxInput)
std::optional< TelemetryVerbosity > GetVerbosity() const
ControlMode
Definition SmartMotorControllerConfig.hpp:69
@ OPEN_LOOP
Definition SmartMotorControllerConfig.hpp:69
@ CLOSED_LOOP
Definition SmartMotorControllerConfig.hpp:69
SmartMotorControllerConfig & WithSimStartingPosition(wpi::units::meter_t startingDistance)
SmartMotorControllerConfig & WithSimFeedforward(const wpi::math::SimpleMotorFeedforward< wpi::units::turns > &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
std::optional< MotorMode > GetZeroPower() const
std::optional< wpi::units::turn_t > GetWrappingMax() const
SmartMotorControllerConfig & WithLinearExponentialProfile(double kV, double kA, wpi::units::volt_t maxInput)
SmartMotorControllerConfig & WithVelocityTrapezoidProfile(wpi::units::meters_per_second_squared_t maxAcceleration, meters_per_second_cubed_t maxJerk)
std::optional< wpi::units::second_t > GetClosedLoopControlPeriod() const
std::optional< wpi::units::second_t > GetClosedLoopRampRate() const
SmartMotorControllerConfig & WithVendorControlRequest(std::any req)
SmartMotorControllerConfig & WithVoltageCompensation(wpi::units::volt_t voltage)
std::optional< wpi::units::meters_per_second_t > GetTrapMaxVelocityLinear() const
SmartMotorControllerConfig & WithFeedback(double kP, double kI, double kD, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
SmartMotorControllerConfig & WithClosedLoopTolerance(wpi::units::meter_t tolerance)
SmartMotorControllerConfig & WithExternalEncoderZeroOffset(wpi::units::turn_t zeroOffset)
SmartMotorControllerConfig & WithSimClosedLoopController(double kP, double kI, double kD, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
SmartMotorControllerConfig & WithFeedbackSynchronizationThreshold(wpi::units::turn_t threshold)
bool HasTrapezoidProfile() const
SmartMotorControllerConfig & WithVendorConfig(std::any cfg)
SmartMotorControllerConfig & WithFeedforward(const wpi::math::ElevatorFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
std::shared_ptr< telemetry::SmartMotorControllerTelemetryConfig > GetSmartControllerTelemetryConfig() const
const std::optional< gearing::MechanismGearing > & GetMotorGearing() const
SmartMotorControllerConfig & WithStatorCurrentLimit(wpi::units::ampere_t limit)
std::optional< double > GetExternalEncoderConversionFactor() const
std::optional< wpi::math::DCMotor > GetSimMotor() const
bool GetResetPreviousConfig() const
ControlMode GetMotorControllerMode() const
std::optional< wpi::math::TrapezoidProfile< wpi::units::meters > > GetLinearTrapezoidProfile() const
SmartMotorControllerConfig & WithOpenLoopRampRate(wpi::units::second_t rampRate)
std::optional< std::any > GetVendorConfig() const
SmartMotorControllerConfig & WithMOI(wpi::units::kilogram_square_meter_t moi)
SmartMotorControllerConfig & WithExponentialProfile(wpi::units::volt_t maxVolts, wpi::math::DCMotor motor, wpi::units::kilogram_square_meter_t moi)
wpi::cmd::SubsystemBase * GetSubsystem() const
std::optional< wpi::units::volt_t > GetClosedLoopControllerMaximumVoltage() const
SmartMotorControllerConfig()
SmartMotorControllerConfig & WithMotorGearing(double reductionRatio)
std::optional< wpi::units::meters_per_second_squared_t > GetTrapMaxAccelLinear() const
SmartMotorControllerConfig & WithMechanismCircumference(wpi::units::meter_t gearPitch, int teeth)
SmartMotorControllerConfig & WithResetPreviousConfig(bool reset)
SmartMotorControllerConfig & WithTelemetry(TelemetryVerbosity verbosity)
SmartMotorControllerConfig & WithMechanismRadius(wpi::units::meter_t radius)
std::optional< std::string > GetTelemetryName() const
std::optional< wpi::math::TrapezoidProfile< wpi::units::turns > > GetTrapezoidProfile() const
SmartMotorControllerConfig & WithMechanismCircumference(wpi::units::meter_t circumference)
meters_per_second_cubed_t ConvertFromMechanism(wpi::units::angular_jerk::turns_per_second_cubed_t mechanismJerk) const
std::optional< wpi::units::turns_per_second_t > GetTrapMaxVelocityTurns() const
SmartMotorControllerConfig & WithMechanismDiameter(wpi::units::meter_t diameter)
SmartMotorControllerConfig & WithExponentialProfile(wpi::units::volt_t maxVolts, wpi::units::turns_per_second_t maxVelocity, wpi::units::turns_per_second_squared_t maxAcceleration)
wpi::units::angular_jerk::turns_per_second_cubed_t ConvertToMechanism(meters_per_second_cubed_t jerk) const
SmartMotorControllerConfig & WithSimExponentialProfile(wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::Constraints constraints)
SmartMotorControllerConfig & WithExternalEncoder(std::any encoder)
SmartMotorControllerConfig & WithExponentialProfile(wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts >::Constraints constraints)
SmartMotorControllerConfig & WithLinearTrapezoidProfile(wpi::units::meters_per_second_t maxVelocity, wpi::units::meters_per_second_squared_t maxAcceleration)
std::optional< std::any > GetVendorControlRequest() const
bool GetVelocityTrapezoidalProfileInUse() const
std::optional< wpi::units::meter_t > GetMeasurementUpperLimit() const
std::optional< math::LQRConfig > GetLQR(ClosedLoopControllerSlot slot) const
std::optional< wpi::units::turn_t > GetClosedLoopTolerance() const
SmartMotorControllerConfig & WithLooselyCoupledFollowers(std::vector< SmartMotorController * > followers)
std::optional< int > GetSupplyStallCurrentLimit() const
std::optional< wpi::units::celsius_t > GetTemperatureCutoff() const
SmartMotorControllerConfig & WithSimClosedLoopController(const math::LQRConfig &lqrConfig, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
ClosedLoopControllerSlot
Definition SmartMotorControllerConfig.hpp:75
@ SLOT_3
Definition SmartMotorControllerConfig.hpp:75
@ SLOT_2
Definition SmartMotorControllerConfig.hpp:75
@ SLOT_0
Definition SmartMotorControllerConfig.hpp:75
@ SLOT_1
Definition SmartMotorControllerConfig.hpp:75
SmartMotorControllerConfig & WithClosedLoopTolerance(wpi::units::turn_t tolerance)
SmartMotorControllerConfig & WithLQR(const math::LQRConfig &lqrConfig, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
std::optional< wpi::math::ElevatorFeedforward > GetElevatorFeedforward(ClosedLoopControllerSlot slot) const
void ValidateBasicOptions() const
std::shared_ptr< math::ADRCConfig > GetADRCController(ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0) const
std::optional< wpi::math::ExponentialProfile< wpi::units::turns, wpi::units::volts > > GetExponentialProfile() const
SmartMotorControllerConfig & WithOpenLoopMode()
SmartMotorControllerConfig & WithSimMotor(wpi::math::DCMotor motor)
const std::vector< SmartMotorController * > & GetLooselyCoupledFollowers() const
SmartMotorControllerConfig & WithLinearClosedLoopController(bool linear)
wpi::units::turns_per_second_squared_t ConvertToMechanism(wpi::units::meters_per_second_squared_t acceleration) const
SmartMotorControllerConfig & WithEncoderInverted(bool inverted)
SmartMotorControllerConfig & WithoutADRCController(ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
bool IsMomentOfInertiaConfigured() const
SmartMotorControllerConfig & WithVelocityTrapezoidProfile(wpi::units::turns_per_second_squared_t maxAcceleration, wpi::units::angular_jerk::turns_per_second_cubed_t maxJerk)
SmartMotorControllerConfig & WithMeasurementLimits(wpi::units::meter_t lower, wpi::units::meter_t upper)
SmartMotorControllerConfig & WithUseExternalFeedbackEncoder(bool use)
SmartMotorControllerConfig & WithSimTrapezoidProfile(wpi::units::meters_per_second_t maxVelocity, wpi::units::meters_per_second_squared_t maxAcceleration)
std::optional< wpi::math::ExponentialProfile< wpi::units::meters, wpi::units::volts > > GetLinearExponentialProfile() const
const std::optional< gearing::MechanismGearing > & GetExternalEncoderGearing() const
void ValidateExternalEncoderOptions() const
std::optional< wpi::units::turn_t > GetFeedbackSynchronizationThreshold() const
std::optional< wpi::units::meter_t > GetMechanismCircumference() const
wpi::units::second_t GetSimulationPeriod() const
std::optional< wpi::units::turn_t > GetExternalEncoderZeroOffset() const
std::optional< bool > GetEncoderInverted() const
bool HasLinearExponentialProfile() const
SmartMotorControllerConfig & WithExternalEncoderConversionFactor(double factor)
MotorMode
Definition SmartMotorControllerConfig.hpp:71
@ BRAKE
Definition SmartMotorControllerConfig.hpp:71
@ COAST
Definition SmartMotorControllerConfig.hpp:71
std::optional< double > GetExponentialProfileKA() const
std::optional< double > GetExponentialProfileKV() const
SmartMotorControllerConfig & WithExternalEncoderZeroOffset(wpi::units::meter_t zeroOffset)
SmartMotorControllerConfig & WithADRCController(const math::ADRCConfig &adrcConfig, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
SmartMotorControllerConfig & WithSimFeedforward(const wpi::math::ElevatorFeedforward &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
bool IsWrappingContinuous() const
SmartMotorControllerConfig & WithClosedLoopMaxVoltage(wpi::units::volt_t maxVoltage)
SmartMotorControllerConfig & WithFeedforward(const wpi::math::SimpleMotorFeedforward< wpi::units::turns > &ff, ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0)
double GetKd(ClosedLoopControllerSlot slot=ClosedLoopControllerSlot::SLOT_0) const
std::optional< wpi::units::second_t > GetOpenLoopRampRate() const
SmartMotorControllerConfig & WithTelemetry(const std::string &name, telemetry::SmartMotorControllerTelemetryConfig telemetryConfig)
Definition SmartMotorController.hpp:49
Definition SmartMotorControllerTelemetryConfig.hpp:63
Definition GearBox.hpp:11
Definition ADRCConfig.hpp:20
wpi::units::unit_t< wpi::units::compound_unit< wpi::units::meters, wpi::units::inverse< wpi::units::cubed< wpi::units::seconds > > > > meters_per_second_cubed_t
Definition SmartMotorControllerConfig.hpp:56
Definition SwerveDrive.hpp:872
Definition SmartMotorControllerConfig.hpp:1020
double kP
Definition SmartMotorControllerConfig.hpp:1021
double kD
Definition SmartMotorControllerConfig.hpp:1021
double kS
Definition SmartMotorControllerConfig.hpp:1022
std::optional< wpi::math::ElevatorFeedforward > elevatorFF
Definition SmartMotorControllerConfig.hpp:1024
double kV
Definition SmartMotorControllerConfig.hpp:1022
std::optional< math::LQRConfig > lqr
Definition SmartMotorControllerConfig.hpp:1026
std::optional< wpi::math::ArmFeedforward > armFF
Definition SmartMotorControllerConfig.hpp:1023
double kI
Definition SmartMotorControllerConfig.hpp:1021
std::optional< wpi::math::SimpleMotorFeedforward< wpi::units::turns > > simpleFF
Definition SmartMotorControllerConfig.hpp:1025
double kG
Definition SmartMotorControllerConfig.hpp:1022
double kA
Definition SmartMotorControllerConfig.hpp:1022