Class ElevatorConfig
java.lang.Object
yams.core.mechanisms.config.ElevatorConfig
Elevator configuration class.
Configuration Example
SmartMotorControllerConfig motorConfig = new SmartMotorControllerConfig()
.withClosedLoopController(0.5,0,0)
.withFeedforward(new ElevatorFeedforward(0.1,0.4,0.12)
.withStatorCurrentLimit(Amps.of(40));
SmartMotorController motor = new TalonFXWrapper(
new TalonFX(4), DCMotor.getKrakenX60(1), motorConfig);
ElevatorConfig config = new ElevatorConfig()
.withCarriageWeight(Kilograms.of(4.0))
.withTelemetry("Elevator", TelemetryVerbosity.HIGH)
.withHardLimits(Meters.of(0), Meters.of(2));
Elevator elevator = new Elevator(config, motor);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()org.wpilib.units.measure.AnglegetAngle()Get the Angle of theElevatorOptional<org.wpilib.units.measure.Mass> Get theMassof theElevatorcarriage.booleanGet if the elevator is horizontalOptional<org.wpilib.units.measure.Distance> Get the Upper hard limit of theElevator: the maximum height fromwithHardLimits(Distance, Distance), or the stage heights' total without hard limits, as the stages carry the carriage to the top.Get the mechanism position configuration of the elevator.Optional<org.wpilib.units.measure.Distance> Get the lower hard limit of theElevator: the minimum height fromwithHardLimits(Distance, Distance), or 0 without hard limits when the stages are set, as the stages start at the bottom.org.wpilib.util.Color8BitGet sim colorList<org.wpilib.units.measure.Distance> Get how far each moving stage travels relative to the stage below it.Optional<org.wpilib.units.measure.Distance> Get how far the stages travel together, the sum of the stage heights.Get the number of stages that move, counting the carriage as the last.Network Tables name for theElevatorGet the telemetry verbosity of theElevatorwithAngle(org.wpilib.units.measure.Angle angle) Configure theElevators angle for simulation.withCarriageWeight(org.wpilib.units.measure.Mass mass) Configure theElevatorsMassfor simulation.withHardLimits(org.wpilib.units.measure.Distance min, org.wpilib.units.measure.Distance max) Set the Hard Limits for simulationSet elevator as horizontal to avoid gravity simulationwithMechanismPositionConfig(MechanismPositionConfig mechanismPositionConfig) Set the elevator mechanism position configuration.withSimColor(org.wpilib.util.Color8Bit simColor) Publish the color in sim as this.withStages(org.wpilib.units.measure.Distance... stageHeights) Set the elevator's moving stages, for the pose of each stage fromElevator.getCascadePose3d()orElevator.getContinuousPose3d(boolean).withTelemetry(String telemetryName, TelemetryVerbosity telemetryVerbosity) Configure telemetry for theElevatormechanism.
-
Constructor Details
-
ElevatorConfig
public ElevatorConfig()Elevator Configuration class
-
-
Method Details
-
clone
-
withSimColor
Publish the color in sim as this.- Parameters:
simColor-Color8Bitto show.- Returns:
ElevatorConfigfor chaining.
-
withAngle
Configure theElevators angle for simulation.- Parameters:
angle- Angle of theElevator.- Returns:
ElevatorConfigfor chaining.
-
withCarriageWeight
Configure theElevatorsMassfor simulation.- Parameters:
mass-Massof theElevator- Returns:
ElevatorConfigfor chaining.
-
withTelemetry
Configure telemetry for theElevatormechanism.- Parameters:
telemetryName- Telemetry NetworkTable name to appear under "SmartDashboard/"telemetryVerbosity- Telemetry verbosity to apply.- Returns:
ElevatorConfigfor chaining.
-
withMechanismPositionConfig
Set the elevator mechanism position configuration.- Parameters:
mechanismPositionConfig-MechanismPositionConfigfor theElevator- Returns:
ElevatorConfigfor chaining
-
withHardLimits
public ElevatorConfig withHardLimits(org.wpilib.units.measure.Distance min, org.wpilib.units.measure.Distance max) Set the Hard Limits for simulation- Parameters:
min- Height where the physical stop appears.max- Height where the physical stop appears- Returns:
ElevatorConfigfor chaining.
-
withHorizontalElevator
Set elevator as horizontal to avoid gravity simulation- Returns:
ElevatorConfigfor chaining.
-
getAngle
public org.wpilib.units.measure.Angle getAngle()Get the Angle of theElevator- Returns:
Angleof the Elevator.
-
withStages
Set the elevator's moving stages, for the pose of each stage fromElevator.getCascadePose3d()orElevator.getContinuousPose3d(boolean).The stage heights must add up to the elevator's maximum height, from
withHardLimits(Distance, Distance): theElevatorthrows if they do not. Without hard limits, the elevator's height is from 0 to the stage heights' total.- Parameters:
stageHeights- How far each moving stage travels relative to the stage below it, from the stage nearest the fixed stage to the carriage, which is the last. One for each stage that moves.- Returns:
ElevatorConfigfor chaining.- Throws:
IllegalArgumentException- if no height is given, or a height is not positive.
-
getStages
Get the number of stages that move, counting the carriage as the last.- Returns:
- The number of moving stages, or empty if
withStages(Distance...)was not called.
-
getStageHeights
Get how far each moving stage travels relative to the stage below it.- Returns:
- Each moving stage's height, from the stage nearest the fixed stage to the carriage, or an
empty list if
withStages(Distance...)was not called.
-
getStageHeightTotal
Get how far the stages travel together, the sum of the stage heights.- Returns:
- The total of the stage heights, or empty if
withStages(Distance...)was not called.
-
getMaximumHeight
Get the Upper hard limit of theElevator: the maximum height fromwithHardLimits(Distance, Distance), or the stage heights' total without hard limits, as the stages carry the carriage to the top.- Returns:
Distancehard limit.
-
getMinimumHeight
Get the lower hard limit of theElevator: the minimum height fromwithHardLimits(Distance, Distance), or 0 without hard limits when the stages are set, as the stages start at the bottom.- Returns:
Distancehard limit.
-
getTelemetryVerbosity
Get the telemetry verbosity of theElevator- Returns:
TelemetryVerbosityof theElevator
-
getTelemetryName
-
getSimColor
public org.wpilib.util.Color8Bit getSimColor()Get sim color- Returns:
- sim color
-
getCarriageMass
-
getIsElevatorHorizontal
public boolean getIsElevatorHorizontal()Get if the elevator is horizontal- Returns:
- if elevator is horizontal.
-
getMechanismPositionConfig
Get the mechanism position configuration of the elevator.- Returns:
- Optional containing the mechanism position configuration if set, otherwise an empty Optional.
-