Class SwerveSteeringSubsystem

java.lang.Object
org.wpilib.command2.SubsystemBase
All Implemented Interfaces:
org.wpilib.command2.Subsystem, org.wpilib.telemetry.TelemetryLoggable, DataFrameRefreshable, SupportsSetpointLock, TunablePrefixProvider

public class SwerveSteeringSubsystem extends BaseSimpleSetpointSubsystem implements DataFrameRefreshable
  • Constructor Details

  • Method Details

    • getLabel

      public String getLabel()
    • getPrefix

      public String getPrefix()
      Specified by:
      getPrefix in interface TunablePrefixProvider
      Overrides:
      getPrefix in class BaseSubsystem
    • getCurrentValue

      public Double getCurrentValue()
      Gets current angle in degrees
      Specified by:
      getCurrentValue in class BaseSetpointSubsystem<Double,Double>
    • getCurrentRotation

      public org.wpilib.math.geometry.Rotation2d getCurrentRotation()
      Gets current angle as a Rotation2d
    • getTargetValue

      public Double getTargetValue()
      Gets target angle in degrees
      Specified by:
      getTargetValue in class BaseSetpointSubsystem<Double,Double>
    • setTargetValue

      public void setTargetValue(Double value)
      Sets target angle in degrees
      Specified by:
      setTargetValue in class BaseSetpointSubsystem<Double,Double>
    • setPower

      public void setPower(Double power)
      Sets the output power of the motor.
      Specified by:
      setPower in class BaseSetpointSubsystem<Double,Double>
      Parameters:
      power - The power value, between -1 and 1.
    • isCalibrated

      public boolean isCalibrated()
      Specified by:
      isCalibrated in class BaseSetpointSubsystem<Double,Double>
    • sysIdQuasistatic

      public org.wpilib.command2.Command sysIdQuasistatic(org.wpilib.command2.sysid.SysIdRoutine.Direction direction)
      Gets a command to run the SysId routine in the quasistatic mode.
      Parameters:
      direction - The direction to run the SysId routine.
      Returns:
      The command to run the SysId routine.
    • sysIdDynamic

      public org.wpilib.command2.Command sysIdDynamic(org.wpilib.command2.sysid.SysIdRoutine.Direction direction)
      Gets a command to run the SysId routine in the dynamic mode.
      Parameters:
      direction - The direction to run the SysId routine.
      Returns:
      The command to run the SysId routine.
    • getVelocity

      public org.wpilib.units.measure.AngularVelocity getVelocity()
    • getMotorController

      public Optional<XCANMotorController> getMotorController()
      Gets the motor controller for this steering module.
      Returns:
      The motor controller for this steering module.
    • getEncoder

      public Optional<XCANCoder> getEncoder()
      Gets the CANCoder for this steering module.
      Returns:
      The CANCoder for this steering module.
    • getBestEncoderPosition

      public org.wpilib.units.measure.Angle getBestEncoderPosition()
      Gets the current position of the mechanism using the best available encoder.
      Returns:
      The position in degrees.
    • getAbsoluteEncoderPosition

      public org.wpilib.units.measure.Angle getAbsoluteEncoderPosition()
      Gets the reported position of the CANCoder.
      Returns:
      The position of the CANCoder.
    • setMotorControllerPidTarget

      public void setMotorControllerPidTarget()
      Calculates the nearest position on the motor encoder to targetDegrees and sets the controller's PID target.
    • periodic

      public void periodic()
      Description copied from class: BaseSubsystem
      This method is called on each CommandScheduler loop.
      Specified by:
      periodic in interface org.wpilib.command2.Subsystem
      Overrides:
      periodic in class BaseSubsystem
    • refreshDataFrame

      public void refreshDataFrame()
      Description copied from interface: DataFrameRefreshable
      Consumes and processes inputs from the device or subsystem.
      Specified by:
      refreshDataFrame in interface DataFrameRefreshable