Class SmartMotorControllerConfig
java.lang.Object
yams.core.motorcontrollers.SmartMotorControllerConfig<SmartMotorControllerConfig>
yams.commands3.config.SmartMotorControllerConfig
public class SmartMotorControllerConfig
extends SmartMotorControllerConfig<SmartMotorControllerConfig>
Command-based extension of
SmartMotorControllerConfig that
adds the Mechanism 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 aMechanismadded later.SmartMotorControllerConfig(org.wpilib.command3.Mechanism mechanism) Construct theSmartMotorControllerConfigfor theMechanism -
Method Summary
Modifier and TypeMethodDescriptionclone()org.wpilib.command3.MechanismGet the mechanism 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"CommandongetMechanism()viaSmartMotorControllerCommandRegistrythat pulls tuned values from NetworkTables each loop, and registers cleanup so the registration is removed when the controller is closed.withMechanism(org.wpilib.command3.Mechanism mechanism) Sets theMechanismfor 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.command3.Mechanism mechanism) Construct theSmartMotorControllerConfigfor theMechanism- Parameters:
mechanism-Mechanismto use.
-
SmartMotorControllerConfig
public SmartMotorControllerConfig()Construct theSmartMotorControllerConfigwith aMechanismadded later.- Implementation Note:
- You must use
withMechanism(Mechanism)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>
-
withMechanism
Sets theMechanismfor theSmartMotorControllerConfigto pass along toSmartMotorControllerand the mechanisms built on it. Must be set if aMechanismwas not defined previously.- Parameters:
mechanism-Mechanismto use.- Returns:
SmartMotorControllerConfigfor chaining.- Throws:
SmartMotorControllerConfigurationException- if aMechanismhas 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.
-
getMechanism
public org.wpilib.command3.Mechanism getMechanism()Get the mechanism controlled by theSmartMotorController- Returns:
Mechanismcontrolled.- Throws:
SmartMotorControllerConfigurationException- if noMechanismwas set, i.e. the no-arg constructor (or a null mechanism) was used andwithMechanism(Mechanism)was never called.
-
setupLiveTuning
public void setupLiveTuning()Set up live tuning for theSmartMotorControllerthis config is attached to: registers a shared "Live Tuning"CommandongetMechanism()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 differentMechanisminstance with the same name has already registered a "Live Tuning" command.
-