Class PivotConfig

java.lang.Object
yams.core.mechanisms.config.PivotConfig

public class PivotConfig extends Object
Pivot configuration class.

Configuration Example

// Create the motor controller configuration with PID and feedforward gains
SmartMotorControllerConfig motorConfig = new SmartMotorControllerConfig()
    .withClosedLoopController(0.15,0,0)
    .withFeedforward(new SimpleMotorFeedforward(0.004, 0.05, 0.2)
    .withStatorCurrentLimit(Amps.of(40))
    .withMechanismUpperLimit(Degrees.of(60))
    .withMechanismLowerLimit(Degrees.of(0))
    .withStartingPosition(Degrees.of(0));

SmartMotorController motor = new TalonFXWrapper(
    new TalonFX(3),
    DCMotor.getKrakenX60(1),
    motorConfig);

// Build the pivot config and mechanism
PivotConfig config = new PivotConfig()
    .withHardLimits(Degrees.of(0), Degrees.of(60))
    .withTelemetry("ShooterHood", TelemetryVerbosity.HIGH);

Pivot pivot = new Pivot(config, motor);
  • Constructor Details

    • PivotConfig

      public PivotConfig()
      Pivot Configuration class
      Implementation Note:
      Defaults to XY plane.
    • PivotConfig

      public PivotConfig(PivotConfig cfg)
      Copy constructor.
      Parameters:
      cfg - Config to copy.
  • Method Details

    • clone

      public PivotConfig clone()
      Overrides:
      clone in class Object
    • withSimColor

      public PivotConfig withSimColor(org.wpilib.util.Color8Bit simColor)
      Publish the color in sim as this.
      Parameters:
      simColor - Color8Bit to show.
      Returns:
      PivotConfig for chaining.
    • withTelemetry

      public PivotConfig withTelemetry(String telemetryName, TelemetryVerbosity telemetryVerbosity)
      Configure telemetry for the Pivot mechanism.
      Parameters:
      telemetryName - Telemetry NetworkTable name to appear under "SmartDashboard/"
      telemetryVerbosity - Telemetry verbosity to apply.
      Returns:
      PivotConfig for chaining.
    • withMechanismPositionConfig

      public PivotConfig withMechanismPositionConfig(MechanismPositionConfig mechanismPositionConfig)
      Set the elevator mechanism position configuration.
      Parameters:
      mechanismPositionConfig - MechanismPositionConfig for the Elevator
      Returns:
      PivotConfig for chaining
    • withHardLimits

      public PivotConfig withHardLimits(org.wpilib.units.measure.Angle min, org.wpilib.units.measure.Angle max)
      Set the Hard Limits for simulation
      Parameters:
      min - Angle where the physical stop appears.
      max - Angle where the physical stop appears
      Returns:
      PivotConfig for chaining.
    • getUpperHardLimit

      public Optional<org.wpilib.units.measure.Angle> getUpperHardLimit()
      Get the Upper hard limit of the Pivot.
      Returns:
      Angle hard limit.
    • getLowerHardLimit

      public Optional<org.wpilib.units.measure.Angle> getLowerHardLimit()
      Get the lower hard limit of the Pivot
      Returns:
      Angle hard limit.
    • getTelemetryVerbosity

      public Optional<TelemetryVerbosity> getTelemetryVerbosity()
      Get the telemetry verbosity of the Pivot
      Returns:
      TelemetryVerbosity of the Pivot
    • getTelemetryName

      public Optional<String> getTelemetryName()
      Network Tables name for the Pivot
      Returns:
      Network Tables name.
    • getSimColor

      public org.wpilib.util.Color8Bit getSimColor()
      Sim color value
      Returns:
      Sim color value
    • getMechanismPositionConfig

      public MechanismPositionConfig getMechanismPositionConfig()
      Get the MechanismPositionConfig associated with this PivotConfig.
      Returns:
      An Optional containing the MechanismPositionConfig if present, otherwise an empty Optional.