Class SmartMotorControllerConfig<T extends SmartMotorControllerConfig<T>>

java.lang.Object
yams.core.motorcontrollers.SmartMotorControllerConfig<T>
Type Parameters:
T - Concrete config type, so chained with calls keep the subclass type.
Direct Known Subclasses:
SmartMotorControllerConfig, SmartMotorControllerConfig

public abstract class SmartMotorControllerConfig<T extends SmartMotorControllerConfig<T>> extends Object
Smart motor controller config.

Example

SmartMotorControllerConfig config = new SmartMotorControllerConfig()
    .withMotorInverted(false)
    .withStatorCurrentLimit(Amps.of(40))
    .withSupplyCurrentLimit(Amps.of(60))
    .withFeedforward(new SimpleMotorFeedforward(0.001, 0.002))
    .withMechanismUpperLimit(Degrees.of(90))
    .withMechanismLowerLimit(Degrees.of(-90))
    .withGearing(new GearBox(12.0, 60.0));
  • Constructor Details

  • Method Details

    • self

      protected abstract T self()
      Get this config as its concrete type, so chained with calls keep the subclass type.
      Returns:
      this SmartMotorControllerConfig.
    • clone

      public abstract T clone()
      Overrides:
      clone in class Object
    • withVendorConfig

      public T withVendorConfig(Object vendorConfig)
      Set the vendor specific config for the SmartMotorController which will be used as a base. Vendor configs will be overridden by the SmartMotorControllerConfig options.
      Parameters:
      vendorConfig - Vendor specific config object. Must be of the correct type for the SmartMotorController. Only the root configuration class is accepted.
      Returns:
      SmartMotorControllerConfig for chaining.
      Implementation Requirements:
      SmartMotorControllerConfig options will always take precedence and overwrite the vendor config. Apply any changes after the SmartMotorController is created to ensure accuracy.
    • attachController

      protected void attachController(SmartMotorController controller)
      Attach the SmartMotorController this config was applied to, so command-layer helpers (e.g. live tuning) can reach back into it without core depending on any command framework types.
      Parameters:
      controller - SmartMotorController this config configured.
    • getAttachedController

      protected Optional<SmartMotorController> getAttachedController()
      Get the SmartMotorController this config was attached to via attachController(SmartMotorController), if any.
      Returns:
      Optional of the attached SmartMotorController.
    • withExternalEncoderInverted

      public T withExternalEncoderInverted(boolean externalEncoderInverted)
      Set the external encoder inversion state.
      Parameters:
      externalEncoderInverted - External encoder inversion state.
      Returns:
      SmartMotorControllerConfig for chaining.
      Implementation Note:
      This may mean the zero offset you gather should be negated.
    • withControlMode

      public T withControlMode(ControlMode controlMode)
      Set the control mode for the SmartMotorController
      Parameters:
      controlMode - ControlMode to apply.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFeedbackSynchronizationThreshold

      public T withFeedbackSynchronizationThreshold(org.wpilib.units.measure.Angle angle)
      Set the feedback synchronization threshold so the relative encoder synchronizes with the absolute encoder at this point.
      Parameters:
      angle - Angle to exceed.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if a mechanism circumference is configured, since auto-synchronization is unavailable for distance based mechanisms.
    • withClosedLoopControllerMaximumVoltage

      public T withClosedLoopControllerMaximumVoltage(org.wpilib.units.measure.Voltage volts)
      Set the closed loop maximum voltage output.
      Parameters:
      volts - Maximum voltage.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withStartingPosition

      public T withStartingPosition(org.wpilib.units.measure.Angle startingAngle)
      Set the starting angle of the SmartMotorController
      Parameters:
      startingAngle - Starting Mechanism Angle.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withStartingPosition

      public T withStartingPosition(org.wpilib.units.measure.Distance startingAngle)
      Set the starting angle of the SmartMotorController
      Parameters:
      startingAngle - Starting Mechanism Distance.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • withSimStartingPosition

      public T withSimStartingPosition(org.wpilib.units.measure.Angle simStartingAngle)
      Set the starting angle of the SmartMotorController to be used only in simulation
      Parameters:
      simStartingAngle - Starting Mechanism Angle.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimStartingPosition

      public T withSimStartingPosition(org.wpilib.units.measure.Distance simStartingAngle)
      Set the starting angle of the SmartMotorController to be used only in simulation
      Parameters:
      simStartingAngle - Starting Mechanism Distance.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • withUseExternalFeedbackEncoder

      public T withUseExternalFeedbackEncoder(boolean useExternalEncoder)
      Set the external encoder to be the primary feedback device for the PID controller.
      Parameters:
      useExternalEncoder - External encoder as primary feedback device for the PID controller.
      Returns:
      SmartMotorControllerConfig for chaining
    • withEncoderInverted

      public T withEncoderInverted(boolean inverted)
      Set the encoder inversion state.
      Parameters:
      inverted - Encoder inversion state.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withMotorInverted

      public T withMotorInverted(boolean motorInverted)
      Set the motor inversion state.
      Parameters:
      motorInverted - Motor inversion state.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withResetPreviousConfig

      public T withResetPreviousConfig(boolean resetPreviousConfig)
      Set the SmartMotorController to reset the old configurations and only apply what is given to SmartMotorControllerConfig
      Parameters:
      resetPreviousConfig - Reset the old config?
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTemperatureCutoff

      public T withTemperatureCutoff(org.wpilib.units.measure.Temperature cutoff)
      Set the Temperature cut off for the SmartMotorController/
      Parameters:
      cutoff - maximum Temperature
      Returns:
      SmartMotorControllerConfig for chaining.
    • withExternalEncoderZeroOffset

      public T withExternalEncoderZeroOffset(org.wpilib.units.measure.Distance distance)
      Set the zero offset of the SmartMotorController's external Encoder.
      Parameters:
      distance - Zero offset in distance.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • withExternalEncoderDiscontinuityPoint

      public T withExternalEncoderDiscontinuityPoint(org.wpilib.units.measure.Angle discontinuityPoint)
      Set the external encoder absolute position to wrap around a defined discontinuity point.
      Parameters:
      discontinuityPoint - Discontinuity point of the external encoder, when provided 0.5rot the external encoder will read between [-0.5, 0.5]; when provided 1rot the external encoder will read between [0, 1].
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if the discontinuity point is not equivalent to 0.5 or 1 rotations.
      Implementation Note:
      Only works for External Absolute Encoders.
    • withExternalEncoderZeroOffset

      public T withExternalEncoderZeroOffset(org.wpilib.units.measure.Angle angle)
      Set the zero offset of the SmartMotorController's external Encoder.
      Parameters:
      angle - Angle to 0.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withContinuousWrapping

      public T withContinuousWrapping(org.wpilib.units.measure.Angle bottom, org.wpilib.units.measure.Angle top)
      Set continuous wrapping for the SmartMotorController
      Parameters:
      bottom - Bottom value to wrap to.
      top - Top value to wrap to.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if soft limits are already configured.
      SmartMotorControllerConfigurationException - if a linear (distance based) closed loop controller is in use.
      SmartMotorControllerConfigurationException - if no closed loop controller is configured.
    • withClosedLoopTolerance

      public T withClosedLoopTolerance(org.wpilib.units.measure.Angle tolerance)
      Set the closed loop tolerance of the mechanism controller.
      Parameters:
      tolerance - Closed loop controller tolerance
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if the tolerance is not null and no closed loop controller is configured.
    • withClosedLoopTolerance

      public T withClosedLoopTolerance(org.wpilib.units.measure.Distance tolerance)
      Set the SmartMotorController closed loop controller tolerance via distance.
      Parameters:
      tolerance - Distance tolerance.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if a linear closed loop controller is not in use.
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
      SmartMotorControllerConfigurationException - if the tolerance is not null and no closed loop controller is configured.
    • getClosedLoopTolerance

      public Optional<org.wpilib.units.measure.Angle> getClosedLoopTolerance()
      Get the SmartMotorController closed loop controller tolerance.
      Returns:
      Angle tolerance.
    • withTelemetry

      public T withTelemetry(String telemetryName, TelemetryVerbosity verbosity)
      Set the telemetry for the SmartMotorController
      Parameters:
      telemetryName - Name for the SmartMotorController
      verbosity - Verbosity of the Telemetry for the SmartMotorController
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTelemetry

      public T withTelemetry(TelemetryVerbosity verbosity)
      Set the telemetry for the SmartMotorController
      Parameters:
      verbosity - Verbosity of the Telemetry for the SmartMotorController
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTelemetry

      public T withTelemetry(String telemetryName, SmartMotorControllerTelemetryConfig telemetryConfig)
      Parameters:
      telemetryName - Name for the SmartMotorController
      telemetryConfig - Config that specifies what to log.
      Returns:
      SmartMotorControllerConfig for chaining.
    • getSmartControllerTelemetryConfig

      public Optional<SmartMotorControllerTelemetryConfig> getSmartControllerTelemetryConfig()
      Get the telemetry configuration
      Returns:
      Telemetry configuration.
    • getStatorStallCurrentLimit

      public OptionalInt getStatorStallCurrentLimit()
      Get the stator stall current limit.
      Returns:
      Stator current limit.
    • withSoftLimits

      public T withSoftLimits(org.wpilib.units.measure.Distance low, org.wpilib.units.measure.Distance high)
      Set the distance soft limits.
      Parameters:
      low - Low distance soft limit.
      high - High distance soft limit.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
      SmartMotorControllerConfigurationException - if the converted lower limit is greater than or equal to the upper limit.
    • withMomentOfInertia

      public T withMomentOfInertia(org.wpilib.units.measure.Distance length, org.wpilib.units.measure.Mass weight)
      Add the mechanism moment of inertia to the SmartMotorControllers simulation when not run under a formal mechanism.
      Parameters:
      length - Length of the mechanism for MOI.
      weight - Weight of the mechanism for MOI.
      Returns:
      SmartMotorControllerConfig for chaining
      Throws:
      SmartMotorControllerConfigurationException - if the length or weight is null.
    • withMomentOfInertia

      public T withMomentOfInertia(org.wpilib.units.measure.MomentOfInertia MOI)
      Add the mechanism moment of inertia to the SmartMotorControllers simulation when not run under a formal mechanism.
      Parameters:
      MOI - Known moment of inertia.
      Returns:
      SmartMotorControllerConfig for chaining
    • withSoftLimits

      public T withSoftLimits(org.wpilib.units.measure.Angle low, org.wpilib.units.measure.Angle high)
      Set the angle soft limits.
      Parameters:
      low - Low angle soft limit.
      high - High angle soft limit.
      Returns:
      SmartMotorControllerConfig for chaining.
      Throws:
      SmartMotorControllerConfigurationException - if both limits are non-null and the lower limit is greater than or equal to the upper limit.
    • getSupplyStallCurrentLimit

      public OptionalInt getSupplyStallCurrentLimit()
      Get the supply stall current limit.
      Returns:
      Supply stall current limit.
    • getVoltageCompensation

      public Optional<org.wpilib.units.measure.Voltage> getVoltageCompensation()
      Get the voltage compensation for the SmartMotorController
      Returns:
      Ideal voltage
    • getZeroPower

      public Optional<MotorMode> getZeroPower()
      Get the zero power mode for the SmartMotorController
      Returns:
      MotorMode
    • getMOI

      public double getMOI()
      Get the Moment of Inertia of the SmartMotorController's mechanism for the DCMotorSim.
      Returns:
      Moment of Inertia in JKgMetersSquared.
    • getMechanismLowerLimit

      public Optional<org.wpilib.units.measure.Angle> getMechanismLowerLimit()
      Lower limit of the mechanism.
      Returns:
      Lower angle soft limit.
    • getMechanismUpperLimit

      public Optional<org.wpilib.units.measure.Angle> getMechanismUpperLimit()
      Upper limit of the mechanism.
      Returns:
      Higher angle soft limit.
    • withZeroPower

      public T withZeroPower(MotorMode zeroPower)
      Set the SmartMotorController to brake or coast mode.
      Parameters:
      zeroPower - MotorMode zero power mode
      Returns:
      SmartMotorControllerConfig for chaining.
    • withVoltageCompensation

      public T withVoltageCompensation(org.wpilib.units.measure.Voltage voltageCompensation)
      Set the voltage compensation for the SmartMotorController
      Parameters:
      voltageCompensation - Ideal voltage value.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFollowers

      @SafeVarargs public final T withFollowers(org.wpilib.util.Pair<Object,Boolean>... followers)
      Set the follower motors of the SmartMotorController
      Parameters:
      followers - Base motor types (NOT SmartMotorController!) to configure as followers, must be same brand as the SmartMotorController with inversion from the base motor.
      Returns:
      SmartMotorControllerConfig for chaining
    • withLooselyCoupledFollowers

      public final T withLooselyCoupledFollowers(SmartMotorController... followers)
      Applies loosely coupled follower motors to the SmartMotorController.
      Parameters:
      followers - SmartMotorControllers to configure as followers.
      Returns:
      SmartMotorControllerConfig for chaining
      Implementation Requirements:
      Configurations are not transferred!
      Implementation Note:
      ONLY the position and velocity requests will be forwarded.
    • clearFollowers

      public void clearFollowers()
      Clear the follower motors so they are not reapplied
    • withStatorCurrentLimit

      public T withStatorCurrentLimit(org.wpilib.units.measure.Current stallCurrent)
      Set the stall stator current limit for the SmartMotorController
      Parameters:
      stallCurrent - Stall stator current limit for the SmartMotorController.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withOutputCurrentLimit

      public T withOutputCurrentLimit(org.wpilib.units.measure.Current stallCurrent)
      Set the stall stator current limit for the SmartMotorController
      Parameters:
      stallCurrent - Stall stator current limit for the SmartMotorController.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSupplyCurrentLimit

      public T withSupplyCurrentLimit(org.wpilib.units.measure.Current supplyCurrent)
      Set the stall supply current limit for the SmartMotorController
      Parameters:
      supplyCurrent - Supply current limit.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withInputCurrentLimit

      public T withInputCurrentLimit(org.wpilib.units.measure.Current supplyCurrent)
      Set the stall supply current limit for the SmartMotorController
      Parameters:
      supplyCurrent - Supply current limit.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withClosedLoopRampRate

      public T withClosedLoopRampRate(org.wpilib.units.measure.Time rate)
      Set the closed loop ramp rate. The ramp rate is the minimum time it should take to go from 0 power to full power in the motor controller while using PID.
      Parameters:
      rate - time to go from 0 to full throttle.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withOpenLoopRampRate

      public T withOpenLoopRampRate(org.wpilib.units.measure.Time rate)
      Set the open loop ramp rate. The ramp rate is the minimum time it should take to go from 0 power to full power in the motor controller while not using PID.
      Parameters:
      rate - time to go from 0 to full throttle.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withExternalEncoder

      public T withExternalEncoder(Object externalEncoder)
      Set the external encoder which is attached to the motor type sent used by SmartMotorController

      Supported external encoders:

      • SPARK MAX and SPARK Flex: the SPARK's absolute encoder, the SPARK MAX's alternate encoder or the SPARK Flex's external encoder (quadrature, whose counts per revolution come from the vendor config), or an encoder the SPARK reads over CAN (a REVLib DetachedEncoder).
      • TalonFX and TalonFXS: a CANcoder, or a CANdi whose PWM input is selected by the feedback sensor source of the vendor config.
      Parameters:
      externalEncoder - External encoder attached to the SmartMotorController
      Returns:
      SmartMotorControllerConfig for chaining.
    • getFollowers

      public Optional<org.wpilib.util.Pair<Object,Boolean>[]> getFollowers()
      Get the follower motors to the SmartMotorControllerConfig
      Returns:
      Follower motor list.
    • withGearing

      public T withGearing(MechanismGearing gear)
      Parameters:
      gear - MechanismGearing representing the gearbox and sprockets to the final axis.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withGearing

      public T withGearing(double reductionRatio)
      Parameters:
      reductionRatio - Reduction ratio, for example, a ratio of "3:1" is 3; a ratio of "1:2" is 0.5.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withMechanismCircumference

      public T withMechanismCircumference(org.wpilib.units.measure.Distance circumference)
      Set the mechanism circumference to allow distance calculations on the SmartMotorController.
      Parameters:
      circumference - Circumference of the actuating spool or sprocket+chain attached the mechanism actuator.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withWheelRadius

      public T withWheelRadius(org.wpilib.units.measure.Distance radius)
      Set the wheel radius for the mechanism.
      Parameters:
      radius - Radius of the wheels as Distance
      Returns:
      SmartMotorControllerConfig for chaining.
    • withDrumRadius

      public T withDrumRadius(org.wpilib.units.measure.Distance radius)
      Set the Elevator drum radius
      Parameters:
      radius - Drum radius of elevator spool.
      Returns:
      SmartMotorControllerConfig for chaining
      Implementation Note:
      Overload for withWheelRadius(Distance)
    • withDrumRadius

      public T withDrumRadius(org.wpilib.units.measure.Distance chainPitch, int teeth)
      Set the Elevator drum radius via the chain pitch (.25in or .35in) and teeth count.
      Parameters:
      chainPitch - Chain pitch.
      teeth - Sprocket teeth count.
      Returns:
      SmartMotorControllerConfig for chaining.
      Implementation Note:
      Overload for withWheelRadius(Distance)
    • withCascadingElevatorStages

      public T withCascadingElevatorStages(int stages)
      Change the SmartMotorControllerConfig gear ratio to be divided by the number of stages given, will reapply it if already done manually.
      Parameters:
      stages - Stages given
      Returns:
      SmartMotorControllerConfig for chaining.
      Implementation Note:
      Alias for withGearing(MechanismGearing) where MechanismGearing.div(double) is applied via the stages.
    • withWheelDiameter

      public T withWheelDiameter(org.wpilib.units.measure.Distance diameter)
      Set the wheel diameter for the mechanism.
      Parameters:
      diameter - Diameter of the wheels as Distance
      Returns:
      SmartMotorControllerConfig for chaining.
    • getMechanismCircumference

      public Optional<org.wpilib.units.measure.Distance> getMechanismCircumference()
      Get the mechanism to distance ratio for the SmartMotorController
      Returns:
      Rotations/Distance ratio to convert mechanism rotations to distance.
    • getLinearClosedLoopControllerUse

      public boolean getLinearClosedLoopControllerUse()
      If the closed loop controller is linear or Distance based.
      Returns:
      Linear closed loop controller.
    • withClosedLoopControlPeriod

      public T withClosedLoopControlPeriod(org.wpilib.units.measure.Time time)
      Modify the period of the PID controller for the motor controller.
      Parameters:
      time - Period of the motor controller PID.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withClosedLoopControlPeriod

      public T withClosedLoopControlPeriod(org.wpilib.units.measure.Frequency time)
      Modify the period of the PID controller for the motor controller.
      Parameters:
      time - Period of the motor controller PID.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimulationPeriod

      public T withSimulationPeriod(org.wpilib.units.measure.Time time)
      Set the simulation loop period the rate at which SmartMotorController.simIterate() steps the simulated physics forward. Independent of withClosedLoopControlPeriod(Time); a robot can run its periodic loop at 20ms while stepping simulation physics at 5ms, for example. Defaults to 20ms if not set.
      Parameters:
      time - Simulation loop period.
      Returns:
      SmartMotorControllerConfig for chaining.
    • getSimulationPeriod

      public org.wpilib.units.measure.Time getSimulationPeriod()
      Get the simulation loop period the rate at which SmartMotorController.simIterate() steps the simulated physics forward. Defaults to 20ms if not set via withSimulationPeriod(Time).
      Returns:
      Simulation loop period.
    • getArmFeedforward

      public Optional<org.wpilib.math.controller.ArmFeedforward> getArmFeedforward(SmartMotorController.ClosedLoopControllerSlot slot)
      Get the ArmFeedforward if it is set.
      Parameters:
      slot - SmartMotorController.ClosedLoopControllerSlot for the ArmFeedforward.
      Returns:
      Optional of the ArmFeedforward.
    • withSimFeedforward

      public T withSimFeedforward(org.wpilib.math.controller.ArmFeedforward armFeedforward, SmartMotorController.ClosedLoopControllerSlot slot)
      Configure the ArmFeedforward for the SmartMotorController, units are in Rotations: kS and kG in volts, kV in volts per rotation per second and kA in volts per rotation per second squared.
      Parameters:
      armFeedforward - Arm feedforward for the SmartMotorController
      slot - SmartMotorController.ClosedLoopControllerSlot for the ArmFeedforward.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimFeedforward

      public T withSimFeedforward(org.wpilib.math.controller.ArmFeedforward armFeedforward)
      Configure the ArmFeedforward for the SmartMotorController, units are in Rotations: kS and kG in volts, kV in volts per rotation per second and kA in volts per rotation per second squared.
      Parameters:
      armFeedforward - Arm feedforward for the SmartMotorController
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFeedforward

      public T withFeedforward(org.wpilib.math.controller.ArmFeedforward armFeedforward, SmartMotorController.ClosedLoopControllerSlot slot)
      Configure the ArmFeedforward for the SmartMotorController, units are in Rotations: kS and kG in volts, kV in volts per rotation per second and kA in volts per rotation per second squared.
      Parameters:
      armFeedforward - Arm feedforward for the SmartMotorController
      slot - SmartMotorController.ClosedLoopControllerSlot for the ArmFeedforward.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFeedforward

      public T withFeedforward(org.wpilib.math.controller.ArmFeedforward armFeedforward)
      Configure the ArmFeedforward for the SmartMotorController, units are in Rotations: kS and kG in volts, kV in volts per rotation per second and kA in volts per rotation per second squared.
      Parameters:
      armFeedforward - Arm feedforward for the SmartMotorController
      Returns:
      SmartMotorControllerConfig for chaining.
    • getElevatorFeedforward

      public Optional<org.wpilib.math.controller.ElevatorFeedforward> getElevatorFeedforward(SmartMotorController.ClosedLoopControllerSlot slot)
      Get the ElevatorFeedforward Optional
      Parameters:
      slot - SmartMotorController.ClosedLoopControllerSlot for the ElevatorFeedforward.
      Returns:
      ElevatorFeedforward Optional
    • withSimFeedforward

      public T withSimFeedforward(org.wpilib.math.controller.ElevatorFeedforward elevatorFeedforward, SmartMotorController.ClosedLoopControllerSlot slot)
      Configure ElevatorFeedforward for the SmartMotorController
      Parameters:
      elevatorFeedforward - ElevatorFeedforward to set.
      slot - SmartMotorController.ClosedLoopControllerSlot for the ElevatorFeedforward.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimFeedforward

      public T withSimFeedforward(org.wpilib.math.controller.ElevatorFeedforward elevatorFeedforward)
      Configure ElevatorFeedforward for the SmartMotorController
      Parameters:
      elevatorFeedforward - ElevatorFeedforward to set.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFeedforward

      public T withFeedforward(org.wpilib.math.controller.ElevatorFeedforward elevatorFeedforward, SmartMotorController.ClosedLoopControllerSlot slot)
      Configure ElevatorFeedforward for the SmartMotorController
      Parameters:
      elevatorFeedforward - ElevatorFeedforward to set.
      slot - SmartMotorController.ClosedLoopControllerSlot for the ElevatorFeedforward.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFeedforward

      public T withFeedforward(org.wpilib.math.controller.ElevatorFeedforward elevatorFeedforward)
      Configure ElevatorFeedforward for the SmartMotorController
      Parameters:
      elevatorFeedforward - ElevatorFeedforward to set.
      Returns:
      SmartMotorControllerConfig for chaining.
    • getSimpleFeedforward

      public Optional<org.wpilib.math.controller.SimpleMotorFeedforward> getSimpleFeedforward(SmartMotorController.ClosedLoopControllerSlot slot)
      Get the SimpleMotorFeedforward Optional.
      Parameters:
      slot - SmartMotorController.ClosedLoopControllerSlot for the SimpleMotorFeedforward.
      Returns:
      SimpleMotorFeedforward Optional
    • withSimClosedLoopController

      public T withSimClosedLoopController(LQRController controller)
      Set the closed loop controller for the SmartMotorController. The units passed in are in Rotations (or Meters if Mechanism Circumference is configured), and outputs are in Volts.
      Parameters:
      controller - LQRController to use, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), and output is Voltage.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimClosedLoopController

      public T withSimClosedLoopController(double kP, double kI, double kD, SmartMotorController.ClosedLoopControllerSlot slot)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured).
      Parameters:
      kP - KP scalar for the PID Controller.
      kI - KI scalar for the PID Controller.
      kD - KD scalar for the PID Controller.
      slot - Closed loop controller slot.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimClosedLoopController

      public T withSimClosedLoopController(double kP, double kI, double kD)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured).
      Parameters:
      kP - KP scalar for the PID Controller.
      kI - KI scalar for the PID Controller.
      kD - KD scalar for the PID Controller.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimClosedLoopController

      public T withSimClosedLoopController(org.wpilib.math.controller.PIDController controller, SmartMotorController.ClosedLoopControllerSlot slot)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured).
      Parameters:
      controller - PIDController to use.
      slot - Closed loop controller slot.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimClosedLoopController

      public T withSimClosedLoopController(org.wpilib.math.controller.PIDController controller)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured).
      Parameters:
      controller - PIDController to use.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withProfile

      public T withProfile(org.wpilib.math.trajectory.TrapezoidProfile.Constraints profile)
      Set the trapezoidal motion profile for the SmartMotorController.
      Parameters:
      profile - TrapezoidProfile; if linear use meters/s, meters/s^2; if rotational use rotations/s, rotations/s^2.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTrapezoidalProfile

      public T withTrapezoidalProfile(org.wpilib.units.measure.LinearVelocity maxVel, org.wpilib.units.measure.LinearAcceleration maxAccel)
      Set the linear trapezoidal motion profile for the SmartMotorController.
      Parameters:
      maxVel - Max velocity for the profile.
      maxAccel - Max acceleration for the profile.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTrapezoidalProfile

      public T withTrapezoidalProfile(org.wpilib.units.measure.AngularVelocity maxVel, org.wpilib.units.measure.AngularAcceleration maxAccel)
      Set the angular trapezoidal motion profile for the SmartMotorController.
      Parameters:
      maxVel - Max velocity for the profile.
      maxAccel - Max acceleration for the profile.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTrapezoidalProfile

      public T withTrapezoidalProfile(org.wpilib.units.measure.AngularAcceleration maxAccel, org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> maxJerk)
      Set the angular velocity trapezoidal profile for the SmartMotorController.
      Parameters:
      maxAccel - Max acceleration for the profile.
      maxJerk - Max velocity for the profile.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTrapezoidalProfile

      public T withTrapezoidalProfile(org.wpilib.units.measure.LinearAcceleration maxAccel, org.wpilib.units.measure.Velocity<org.wpilib.units.LinearAccelerationUnit> maxJerk)
      Set the linear velocity trapezoidal profile for the SmartMotorController.
      Parameters:
      maxAccel - Max acceleration for the profile.
      maxJerk - Max velocity for the profile.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withProfile

      public T withProfile(org.wpilib.math.trajectory.ExponentialProfile.Constraints profile)
      Set the exponential profile
      Parameters:
      profile - Exponential profile; meters/s, meters/s^2 for linear controllers; rotations/s, and rotations/s^2 for rotational controllers..
      Returns:
      SmartMotorControllerConfig for chaining.
    • withExponentialProfile

      public T withExponentialProfile(org.wpilib.units.measure.Voltage maxVolts, org.wpilib.math.system.DCMotor motor, org.wpilib.units.measure.MomentOfInertia moi)
      Get the ExponentialProfile.Constraints for an arm or flywheel.
      Parameters:
      maxVolts - Maximum input voltage for profile generation.
      motor - DCMotor of the arm.
      moi - MomentOfInertia of the arm.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withExponentialProfile

      public T withExponentialProfile(org.wpilib.units.measure.Voltage maxVolts, org.wpilib.math.system.DCMotor motor, org.wpilib.units.measure.Mass mass, org.wpilib.units.measure.Distance drumRadius)
      Get the ExponentialProfile.Constraints for an elevator.
      Parameters:
      maxVolts - Maximum input voltage for profile generation.
      motor - DCMotor of the elevator.
      mass - Mass of the elevator carriage.
      drumRadius - Distance of the elevator drum radius.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withExponentialProfile

      public T withExponentialProfile(org.wpilib.units.measure.Voltage maxVolts, org.wpilib.units.measure.AngularVelocity maxVelocity, org.wpilib.units.measure.AngularAcceleration maxAcceleration)
      Create a generic constraints object.
      Parameters:
      maxVolts - Maximum input voltage for profile generation.
      maxVelocity - Maximum velocity.
      maxAcceleration - Maximum acceleration.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withTrapezoidalProfileConstraints

      public T withTrapezoidalProfileConstraints(org.wpilib.math.trajectory.TrapezoidProfile.Constraints constraints)
      Replace the trapezoidal profile's constraints, keeping how the profile is used (position or velocity, rotational or linear). Used by live tuning, so that tuning one constraint keeps the others that were tuned before.
      Parameters:
      constraints - Constraints in the profile's units: rotations or meters, per second, or per second squared for a velocity profile.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withExponentialProfile

      public T withExponentialProfile(org.wpilib.math.trajectory.ExponentialProfile.Constraints constraints)
      Set the exponential profile for the SmartMotorController.
      Parameters:
      constraints - ExponentialProfile.Constraints for the profile.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withClosedLoopController

      public T withClosedLoopController(LQRController controller)
      Set the closed loop controller for the SmartMotorController with an exponential profile, the units passed in are in Rotations (or Meters if linear closed loop controller configured), outputs are in Volts.
      Parameters:
      controller - LQRController to use, the units passed in are in Rotations and output is Voltage.
      Returns:
      SmartMotorControllerConfig for chaining.
      Implementation Note:
      This clears all PIDs.
    • withClosedLoopController

      public T withClosedLoopController(double kP, double kI, double kD, SmartMotorController.ClosedLoopControllerSlot slot)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if linear closed loop controller is configured), the outputs are in Volts.
      Parameters:
      kP - KP scalar for the PID Controller, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      kI - KI scalar for the PID Controller, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      kD - KD scalar for the PID Controller, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      slot - Closed loop controller slot.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withClosedLoopController

      public T withClosedLoopController(double kP, double kI, double kD)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if linear closed loop controller is configured), the outputs are in Volts.
      Parameters:
      kP - KP scalar for the PID Controller, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      kI - KI scalar for the PID Controller, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      kD - KD scalar for the PID Controller, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withClosedLoopController

      public T withClosedLoopController(org.wpilib.math.controller.PIDController controller, SmartMotorController.ClosedLoopControllerSlot slot)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if linear closed loop controller is configured), the outputs are in Volts.
      Parameters:
      controller - PIDController to use, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      slot - Closed loop controller slot.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withClosedLoopController

      public T withClosedLoopController(org.wpilib.math.controller.PIDController controller)
      Set the closed loop controller for the SmartMotorController, the units passed in are in Rotations (or Meters if linear closed loop controller is configured), the outputs are in Volts.
      Parameters:
      controller - PIDController to use, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      Returns:
      SmartMotorControllerConfig for chaining.
    • getLQRClosedLoopController

      public Optional<LQRController> getLQRClosedLoopController()
      Get the controller for the SmartMotorController, the units passed in are in Rotations (or Meters if Mechanism Circumference is configured), the outputs are in Volts.
      Returns:
      LQRController
    • getPID

      public Optional<org.wpilib.math.controller.PIDController> getPID(SmartMotorController.ClosedLoopControllerSlot slot)
      Get the simple closed loop controller without motion profiling.
      Parameters:
      slot - Closed loop controller slot.
      Returns:
      PIDController if it exists.
    • getExponentialProfile

      public Optional<org.wpilib.math.trajectory.ExponentialProfile.Constraints> getExponentialProfile()
      Get the exponential profile for the closed loop controller on SmartMotorController.
      Returns:
      ExponentialProfile if it exists.
    • getTrapezoidProfile

      public Optional<org.wpilib.math.trajectory.TrapezoidProfile.Constraints> getTrapezoidProfile()
      Get the trapezoidal motion profile for the SmartMotorController.
      Returns:
      TrapezoidProfile if it exists.
    • withSimFeedforward

      public T withSimFeedforward(org.wpilib.math.controller.SimpleMotorFeedforward simpleFeedforward, SmartMotorController.ClosedLoopControllerSlot slot)
      Set the SimpleMotorFeedforward for SmartMotorController, units are in Rotations.
      Parameters:
      simpleFeedforward - SimpleMotorFeedforward
      slot - Closed loop controller slot.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withSimFeedforward

      public T withSimFeedforward(org.wpilib.math.controller.SimpleMotorFeedforward simpleFeedforward)
      Set the SimpleMotorFeedforward for SmartMotorController, units are in Rotations.
      Parameters:
      simpleFeedforward - SimpleMotorFeedforward
      Returns:
      SmartMotorControllerConfig for chaining.
    • withLinearClosedLoopController

      public T withLinearClosedLoopController(boolean linearClosedLoopController)
      Set the closed loop controller to be Linear or Distance based.
      Parameters:
      linearClosedLoopController - Closed loop controller is distance based when true, angle based when false.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withVelocityTrapezoidalProfile

      public T withVelocityTrapezoidalProfile(boolean velocityTrapezoidalProfile)
      Set the trapezoidal profile to be read explicitly as a velocity profile.
      Parameters:
      velocityTrapezoidalProfile - The trapezoidal profile is read explicitly as a velocity profile.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFeedforward

      public T withFeedforward(org.wpilib.math.controller.SimpleMotorFeedforward simpleFeedforward, SmartMotorController.ClosedLoopControllerSlot slot)
      Set the SimpleMotorFeedforward for SmartMotorController, units are in Rotations
      Parameters:
      simpleFeedforward - SimpleMotorFeedforward
      slot - Closed loop controller slot.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withFeedforward

      public T withFeedforward(org.wpilib.math.controller.SimpleMotorFeedforward simpleFeedforward)
      Set the SimpleMotorFeedforward for SmartMotorController, units are in Rotations
      Parameters:
      simpleFeedforward - SimpleMotorFeedforward
      Returns:
      SmartMotorControllerConfig for chaining.
    • getClosedLoopControlPeriod

      public Optional<org.wpilib.units.measure.Time> getClosedLoopControlPeriod()
      Get the period of the SmartMotorController closed loop period.
      Returns:
      SmartMotorController closed loop controller period.
    • getGearing

      public MechanismGearing getGearing()
      Get the gearing to convert rotor rotations to mechanisms rotations connected to the SmartMotorController
      Returns:
      MechanismGearing representing the gearbox and sprockets attached to the SmartMotorController.
    • getExternalEncoder

      public Optional<Object> getExternalEncoder()
      Get the external encoder.
      Returns:
      Attached external encoder.
    • getOpenLoopRampRate

      public Optional<org.wpilib.units.measure.Time> getOpenLoopRampRate()
      Get the open loop ramp rate.
      Returns:
      Open loop ramp rate.
    • getClosedLoopRampRate

      public Optional<org.wpilib.units.measure.Time> getClosedLoopRampRate()
      Get the closed loop ramp rate.
      Returns:
      Closed loop ramp.
    • getVerbosity

      public Optional<TelemetryVerbosity> getVerbosity()
      Get Telemetry verbosity.
      Returns:
      Verbosity for telemetry.
    • getTelemetryName

      public Optional<String> getTelemetryName()
      Telemetry name.
      Returns:
      Telemetry name for NetworkTables.
    • convertToMechanism

      public org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> convertToMechanism(org.wpilib.units.measure.Velocity<org.wpilib.units.LinearAccelerationUnit> jerk)
      Convert org.wpilib.units.measure.Velocity<org.wpilib.units.LinearAccelerationUnit> to org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> using the mechanismCircumference
      Parameters:
      jerk - Linear jerk to convert.
      Returns:
      Equivalent angular jerk.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertFromMechanism

      public org.wpilib.units.measure.Velocity<org.wpilib.units.LinearAccelerationUnit> convertFromMechanism(org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> jerk)
      Convert org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> to org.wpilib.units.measure.Velocity<org.wpilib.units.LinearAccelerationUnit> using the mechanismCircumference
      Parameters:
      jerk - Angular jerk to convert.
      Returns:
      Equivalent angular jerk.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertToMechanism

      public org.wpilib.units.measure.AngularVelocity convertToMechanism(org.wpilib.units.measure.LinearVelocity velocity)
      Convert LinearVelocity to AngularVelocity using the mechanismCircumference
      Parameters:
      velocity - Linear velocity to convert.
      Returns:
      Equivalent angular velocity.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertToMechanism

      public org.wpilib.units.measure.AngularAcceleration convertToMechanism(org.wpilib.units.measure.LinearAcceleration acceleration)
      Convert LinearAcceleration to AngularAcceleration using the mechanismCircumference
      Parameters:
      acceleration - Linear acceleration to convert.
      Returns:
      Equivalent angular acceleration.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertToMechanism

      public org.wpilib.units.measure.Angle convertToMechanism(org.wpilib.units.measure.Distance distance)
      Convert Distance to Angle using mechanismCircumference
      Parameters:
      distance - Distance to convert to Angle
      Returns:
      Angle of distance.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertFromMechanism

      public org.wpilib.units.measure.Distance convertFromMechanism(org.wpilib.units.measure.Angle rotations)
      Convert Angle to Distance using mechanismCircumference
      Parameters:
      rotations - Rotations to convert.
      Returns:
      Distance of the mechanism.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertFromMechanism

      public org.wpilib.units.measure.LinearVelocity convertFromMechanism(org.wpilib.units.measure.AngularVelocity velocity)
      Convert Angle to LinearVelocity using mechanismCircumference
      Parameters:
      velocity - Velocity to convert.
      Returns:
      Velocity of the mechanism.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertFromMechanism

      public org.wpilib.units.measure.LinearAcceleration convertFromMechanism(org.wpilib.units.measure.AngularAcceleration acceleration)
      Convert Angle to LinearAcceleration using mechanismCircumference
      Parameters:
      acceleration - Rotations to convert.
      Returns:
      Acceleration of the mechanism.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertToVoltage

      public org.wpilib.units.measure.Voltage convertToVoltage(org.wpilib.math.system.DCMotor motor, org.wpilib.units.measure.Force feedforwardForce)
      Convert a feedforward Force applied at the mechanism into the equivalent motor feedforward Voltage, using gearing and mechanismCircumference. This is only the voltage that produces the force (the resistive drop of the matching current), not the back-EMF of the commanded speed, since it is added on top of a velocity feedforward that already covers that.
      Parameters:
      motor - DCMotor of the mechanism.
      feedforwardForce - Feedforward Force applied to the mechanism.
      Returns:
      Equivalent feedforward Voltage at the motor.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • convertToCurrent

      public org.wpilib.units.measure.Current convertToCurrent(org.wpilib.math.system.DCMotor motor, org.wpilib.units.measure.Force feedforwardForce)
      Convert a feedforward Force applied at the mechanism into the equivalent motor feedforward Current, using gearing and mechanismCircumference. This is the feedforward to use for torque-current based closed-loop control (e.g. TorqueCurrentFOC).
      Parameters:
      motor - DCMotor of the mechanism.
      feedforwardForce - Feedforward Force applied to the mechanism.
      Returns:
      Equivalent feedforward Current at the motor.
      Throws:
      SmartMotorControllerConfigurationException - if the mechanism circumference is not configured.
    • getExternalEncoderZeroOffset

      public Optional<org.wpilib.units.measure.Angle> getExternalEncoderZeroOffset()
      Get the zero offset for the SmartMotorController
      Returns:
      Angle offset.
    • getTemperatureCutoff

      public Optional<org.wpilib.units.measure.Temperature> getTemperatureCutoff()
      Get the temperature cut off for the SmartMotorController
      Returns:
      Maximum Temperature
    • getEncoderInverted

      public Optional<Boolean> getEncoderInverted()
      Get the encoder inversion state
      Returns:
      encoder inversion state
    • getMotorInverted

      public Optional<Boolean> getMotorInverted()
      Get the motor inversion state
      Returns:
      moto inversion state.
    • getUseExternalFeedback

      public boolean getUseExternalFeedback()
      Use the external feedback sensor.
      Returns:
      Use the attached absolute encoder.
    • getStartingPosition

      public Optional<org.wpilib.units.measure.Angle> getStartingPosition()
      Get the starting mechanism position of the SmartMotorController
      Returns:
      Starting Mechanism position.
    • getClosedLoopControllerMaximumVoltage

      public Optional<org.wpilib.units.measure.Voltage> getClosedLoopControllerMaximumVoltage()
      Get the closed loop maximum voltage.
      Returns:
      Maximum voltage in Volts.
    • getFeedbackSynchronizationThreshold

      public Optional<org.wpilib.units.measure.Angle> getFeedbackSynchronizationThreshold()
      Get the feedback synchronization threshold.
      Returns:
      Feedback synchronization threshold.
    • getMotorControllerMode

      public ControlMode getMotorControllerMode()
      Get the motor controller mode to use.
      Returns:
      ControlMode to use.
    • getExternalEncoderGearing

      public Optional<MechanismGearing> getExternalEncoderGearing()
      Get the external encoder gearing, default is 1:1 on a MAXPlanetary.
      Returns:
      External encoder gearing.
    • withExternalEncoderGearing

      public T withExternalEncoderGearing(MechanismGearing externalEncoderGearing)
      Set the external encoder gearing.
      Parameters:
      externalEncoderGearing - External encoder gearing.
      Returns:
      SmartMotorControllerConfig for chaining.
    • withExternalEncoderGearing

      public T withExternalEncoderGearing(double reductionRatio)
      Set the external encoder gearing.
      Parameters:
      reductionRatio - External encoder gearing. For example, a ratio of "3:1" is 3; "1:2" is 0.5
      Returns:
      SmartMotorControllerConfig for chaining.
    • getContinuousWrapping

      public Optional<org.wpilib.units.measure.Angle> getContinuousWrapping()
      Get the continuous wrapping point for the SmartMotorController encoder.
      Returns:
      Angle where the encoder wraps around.
      Throws:
      SmartMotorControllerConfigurationException - if continuous wrapping is configured with bounds that do not span exactly one rotation (minimum is not maximum minus 1 rotation).
    • getContinuousWrappingMin

      public Optional<org.wpilib.units.measure.Angle> getContinuousWrappingMin()
      Get the continuous wrapping point for the SmartMotorController encoder.
      Returns:
      Angle where the encoder wraps around.
      Throws:
      SmartMotorControllerConfigurationException - if continuous wrapping is configured with bounds that do not span exactly one rotation (minimum is not maximum minus 1 rotation).
    • getContinuousWrappingSetpoint

      public org.wpilib.units.measure.Angle getContinuousWrappingSetpoint(org.wpilib.units.measure.Angle setpoint, org.wpilib.units.measure.Angle current)
      Get the position setpoint to command with continuous wrapping: the angle equivalent to setpoint, a whole number of wrapping ranges away, that is nearest current. For motor controllers whose onboard wrapping cannot be given the mechanism's wrapping range.
      Parameters:
      setpoint - Mechanism angle to go to.
      current - Current mechanism angle.
      Returns:
      The equivalent setpoint nearest current, or setpoint unchanged when continuous wrapping is not configured.
      Throws:
      SmartMotorControllerConfigurationException - if continuous wrapping is configured with bounds that do not span exactly one rotation (minimum is not maximum minus 1 rotation).
    • getLooselyCoupledFollowers

      public Optional<SmartMotorController[]> getLooselyCoupledFollowers()
      Get the loosely coupled follower motors.
      Returns:
      SmartMotorController list of loosely coupled followers.
    • getVelocityTrapezoidalProfileInUse

      public boolean getVelocityTrapezoidalProfileInUse()
      Velocity trapezoidal profile configured.
      Returns:
      true, if trapezoidal profile is configured as a velocity profile. false otherwise.
    • getVendorConfig

      public Optional<Object> getVendorConfig()
      Get the vendor specific configuration object to mutate with SmartMotorControllerConfig options.
      Returns:
      SmartMotorController vendor-specific configuration object.
    • withVendorControlRequest

      public T withVendorControlRequest(Object vendorControlRequest)
      Set the vendor specific control request for the SmartMotorController which will be used in place of default or calculated ones.
      Parameters:
      vendorControlRequest - Vendor specific control request for velocity or position.
      Returns:
      SmartMotorControllerConfig for chaining
    • getResetPreviousConfig

      public boolean getResetPreviousConfig()
      Reset the old config?
      Returns:
      Should reset old config
    • resetValidationCheck

      public void resetValidationCheck()
      Reset the validation checks for all required options to be applied to SmartMotorController from SmartMotorController.applyConfig(SmartMotorControllerConfig).
    • validateBasicOptions

      public void validateBasicOptions()
      Validate all required options are at least fetched and handled in each SmartMotorController wrapper.
      Throws:
      SmartMotorControllerConfigurationException - if any required basic option was not fetched (applied) by the SmartMotorController wrapper.
    • validateExternalEncoderOptions

      public void validateExternalEncoderOptions()
      Validate external encoder config options for the config.
      Throws:
      SmartMotorControllerConfigurationException - if any external encoder option was not fetched (applied) by the SmartMotorController wrapper.
    • getExternalEncoderInverted

      public Optional<Boolean> getExternalEncoderInverted()
      Get whether or not the external encoder is inverted.
      Returns:
      External encoder inversion state
    • getVendorControlRequest

      public Optional<Object> getVendorControlRequest()
      Get the vendor specific control request.
      Returns:
      Vendor specific control request for velocity or position.
    • getExternalEncoderDiscontinuityPoint

      public Optional<org.wpilib.units.measure.Angle> getExternalEncoderDiscontinuityPoint()
      Get the external encoder discontinuity point.
      Returns:
      External encoder discontinuity point.
    • setupLiveTuning

      public void setupLiveTuning()
      Setup live tuning for the SmartMotorController