Class ArmConfig

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

public class ArmConfig extends Object
Arm configuration class.

Configuration Example

// Create a motor first
SmartMotorControllerConfig motorConfig = new SmartMotorControllerConfig()
    .withClosedLoopController(0.12,0,0)
    .withFeedforward(new ArmFeedforward(0.005,0.05,0.3))
    .withStatorCurrentLimit(Amps.of(40))
    .withMechanismUpperLimit(Degrees.of(90))
    .withMechanismLowerLimit(Degrees.of(-10));
SmartMotorController motor = new SparkWrapper(
    new SparkMax(1, MotorType.kBrushless), DCMotor.getNEO(1), motorConfig);

// Build the arm config and mechanism
ArmConfig config = new ArmConfig()
    .withLength(Meters.of(0.5))
    .withTelemetry("Arm", TelemetryVerbosity.HIGH)
    .withHardLimits(Degrees.of(-10), Degrees.of(90));

Arm arm = new Arm(config, motor);
  • Constructor Details

    • ArmConfig

      public ArmConfig()
      Arm configuration class. Required
  • Method Details

    • clone

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

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

      public ArmConfig withLength(org.wpilib.units.measure.Distance distance)
      Configure the Arms length for simulation.
      Parameters:
      distance - Length of the Arm.
      Returns:
      ArmConfig for chaining.
      Implementation Note:
      This is not used to forward the MOI to SmartMotorControllerConfig
    • withTelemetry

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

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

      public ArmConfig 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:
      ArmConfig for chaining.
    • getLength

      public Optional<org.wpilib.units.measure.Distance> getLength()
      Get the Length of the Arm
      Returns:
      Distance of the Arm.
    • getUpperHardLimit

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

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

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

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

      public org.wpilib.util.Color8Bit getSimColor()
      Get sim color
      Returns:
      sim color.
    • getMechanismPositionConfig

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