Class SmartMotorControllerConfig
java.lang.Object
yams.core.motorcontrollers.SmartMotorControllerConfig<SmartMotorControllerConfig>
yams.commands2.config.SmartMotorControllerConfig
public class SmartMotorControllerConfig
extends SmartMotorControllerConfig<SmartMotorControllerConfig>
Command-based extension of
SmartMotorControllerConfig that
adds the Subsystem binding and command-layer helpers (e.g. live tuning) that core must
not depend on.
Example
SmartMotorControllerConfig config = new SmartMotorControllerConfig(this)
.withMotorInverted(false)
.withStatorCurrentLimit(Amps.of(40));
-
Nested Class Summary
Nested classes/interfaces inherited from class SmartMotorControllerConfig
SmartMotorControllerConfig.SmartMotorControllerOptions -
Constructor Summary
ConstructorsConstructorDescriptionConstruct theSmartMotorControllerConfigwith aSubsystemadded later.SmartMotorControllerConfig(org.wpilib.command2.Subsystem subsystem) Construct theSmartMotorControllerConfigfor theSubsystem -
Method Summary
Modifier and TypeMethodDescriptionclone()org.wpilib.command2.SubsystemGet the subsystem controlled by theSmartMotorControllerprotected SmartMotorControllerConfigself()Get this config as its concrete type, so chainedwithcalls keep the subclass type.voidSet up live tuning for theSmartMotorControllerthis config is attached to: registers a shared "Live Tuning"CommandongetSubsystem()viaSmartMotorControllerCommandRegistrythat pulls tuned values from NetworkTables each loop, and registers cleanup so the registration is removed when the controller is closed.withSubsystem(org.wpilib.command2.Subsystem subsystem) Sets theSubsystemfor theSmartMotorControllerConfigto pass along toSmartMotorControllerand the mechanisms built on it.Methods inherited from class SmartMotorControllerConfig
attachController, clearFollowers, convertFromMechanism, convertFromMechanism, convertFromMechanism, convertFromMechanism, convertToCurrent, convertToMechanism, convertToMechanism, convertToMechanism, convertToMechanism, convertToVoltage, getArmFeedforward, getAttachedController, getClosedLoopControllerMaximumVoltage, getClosedLoopControlPeriod, getClosedLoopRampRate, getClosedLoopTolerance, getContinuousWrapping, getContinuousWrappingMin, getContinuousWrappingSetpoint, getElevatorFeedforward, getEncoderInverted, getExponentialProfile, getExternalEncoder, getExternalEncoderDiscontinuityPoint, getExternalEncoderGearing, getExternalEncoderInverted, getExternalEncoderZeroOffset, getFeedbackSynchronizationThreshold, getFollowers, getGearing, getLinearClosedLoopControllerUse, getLooselyCoupledFollowers, getLQRClosedLoopController, getMechanismCircumference, getMechanismLowerLimit, getMechanismUpperLimit, getMOI, getMotorControllerMode, getMotorInverted, getOpenLoopRampRate, getPID, getResetPreviousConfig, getSimpleFeedforward, getSimulationPeriod, getSmartControllerTelemetryConfig, getStartingPosition, getStatorStallCurrentLimit, getSupplyStallCurrentLimit, getTelemetryName, getTemperatureCutoff, getTrapezoidProfile, getUseExternalFeedback, getVelocityTrapezoidalProfileInUse, getVendorConfig, getVendorControlRequest, getVerbosity, getVoltageCompensation, getZeroPower, resetValidationCheck, validateBasicOptions, validateExternalEncoderOptions, withCascadingElevatorStages, withClosedLoopController, withClosedLoopController, withClosedLoopController, withClosedLoopController, withClosedLoopController, withClosedLoopControllerMaximumVoltage, withClosedLoopControlPeriod, withClosedLoopControlPeriod, withClosedLoopRampRate, withClosedLoopTolerance, withClosedLoopTolerance, withContinuousWrapping, withControlMode, withDrumRadius, withDrumRadius, withEncoderInverted, withExponentialProfile, withExponentialProfile, withExponentialProfile, withExponentialProfile, withExternalEncoder, withExternalEncoderDiscontinuityPoint, withExternalEncoderGearing, withExternalEncoderGearing, withExternalEncoderInverted, withExternalEncoderZeroOffset, withExternalEncoderZeroOffset, withFeedbackSynchronizationThreshold, withFeedforward, withFeedforward, withFeedforward, withFeedforward, withFeedforward, withFeedforward, withFollowers, withGearing, withGearing, withInputCurrentLimit, withLinearClosedLoopController, withLooselyCoupledFollowers, withMechanismCircumference, withMomentOfInertia, withMomentOfInertia, withMotorInverted, withOpenLoopRampRate, withOutputCurrentLimit, withProfile, withProfile, withResetPreviousConfig, withSimClosedLoopController, withSimClosedLoopController, withSimClosedLoopController, withSimClosedLoopController, withSimClosedLoopController, withSimFeedforward, withSimFeedforward, withSimFeedforward, withSimFeedforward, withSimFeedforward, withSimFeedforward, withSimStartingPosition, withSimStartingPosition, withSimulationPeriod, withSoftLimits, withSoftLimits, withStartingPosition, withStartingPosition, withStatorCurrentLimit, withSupplyCurrentLimit, withTelemetry, withTelemetry, withTelemetry, withTemperatureCutoff, withTrapezoidalProfile, withTrapezoidalProfile, withTrapezoidalProfile, withTrapezoidalProfile, withTrapezoidalProfileConstraints, withUseExternalFeedbackEncoder, withVelocityTrapezoidalProfile, withVendorConfig, withVendorControlRequest, withVoltageCompensation, withWheelDiameter, withWheelRadius, withZeroPower
-
Constructor Details
-
SmartMotorControllerConfig
public SmartMotorControllerConfig(org.wpilib.command2.Subsystem subsystem) Construct theSmartMotorControllerConfigfor theSubsystem- Parameters:
subsystem-Subsystemto use.
-
SmartMotorControllerConfig
public SmartMotorControllerConfig()Construct theSmartMotorControllerConfigwith aSubsystemadded later.- Implementation Note:
- You must use
withSubsystem(Subsystem)before passing off toSmartMotorController
-
-
Method Details
-
self
Description copied from class:SmartMotorControllerConfigGet this config as its concrete type, so chainedwithcalls keep the subclass type.- Specified by:
selfin classSmartMotorControllerConfig<SmartMotorControllerConfig>- Returns:
- this
SmartMotorControllerConfig.
-
clone
- Specified by:
clonein classSmartMotorControllerConfig<SmartMotorControllerConfig>
-
withSubsystem
Sets theSubsystemfor theSmartMotorControllerConfigto pass along toSmartMotorControllerand the mechanisms built on it. Must be set if aSubsystemwas not defined previously.- Parameters:
subsystem-Subsystemto use.- Returns:
SmartMotorControllerConfigfor chaining.- Throws:
SmartMotorControllerConfigurationException- if aSubsystemhas already been set, either through the constructor or a previous call to this method.- Implementation Note:
- Does not copy the entire config, should NEVER be reused.
-
getSubsystem
public org.wpilib.command2.Subsystem getSubsystem()Get the subsystem controlled by theSmartMotorController- Returns:
Subsystemcontrolled.- Throws:
SmartMotorControllerConfigurationException- if noSubsystemwas set, i.e. the no-arg constructor (or a null subsystem) was used andwithSubsystem(Subsystem)was never called.
-
setupLiveTuning
public void setupLiveTuning()Set up live tuning for theSmartMotorControllerthis config is attached to: registers a shared "Live Tuning"CommandongetSubsystem()viaSmartMotorControllerCommandRegistrythat pulls tuned values from NetworkTables each loop, and registers cleanup so the registration is removed when the controller is closed.- Overrides:
setupLiveTuningin classSmartMotorControllerConfig<SmartMotorControllerConfig>- Throws:
IllegalStateException- if a differentSubsysteminstance with the same name has already registered a "Live Tuning" command.
-