Package yams.mechanisms.config
Class ArmConfig
java.lang.Object
yams.mechanisms.config.ArmConfig
Arm configuration class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe network root of the mechanism (Optional). -
Constructor Summary
ConstructorsConstructorDescriptionArm configuration class.ArmConfig(SmartMotorController motorController) Arm Configuration class -
Method Summary
Modifier and TypeMethodDescriptionbooleanApply config changes from this class to theSmartMotorControllerclone()Get the Length of theArmGet the lower hard limit of theArmGet theMechanismPositionConfigassociated with thisArmConfig.doublegetMOI()Get the moment of inertia for theArmsimulation.getMotor()Get theSmartMotorControllerof theArmGet sim colorGet the starting angle of theArmNetwork Tables name for theArmDeprecated.Get the telemetry verbosity of theArmGet the Upper hard limit of theArm.withHardLimit(Angle min, Angle max) Set the Hard Limits for simulationwithHorizontalZero(Angle horizontalZero) Set the horizontal zero of the arms absolute encoder.withLength(Distance distance) Configure theArms length for simulation.withMechanismPositionConfig(MechanismPositionConfig mechanismPositionConfig) Set the elevator mechanism position configuration.withMOI(double MOI) Configure the MOI directly instead of estimating it with the length and mass of theArmfor simulation.withSimColor(Color8Bit simColor) Publish the color in sim as this.withSmartMotorController(SmartMotorController motorController) Configure theSmartMotorControllerfor theArmwithSoftLimits(Angle lowerLimit, Angle upperLimit) Set the arm soft limits.withStartingPosition(Angle startingPosition) Set the arm starting angle of the motor controller encoder.withTelemetry(String networkRoot, String telemetryName, SmartMotorControllerConfig.TelemetryVerbosity telemetryVerbosity) Deprecated.withTelemetry(String telemetryName, SmartMotorControllerConfig.TelemetryVerbosity telemetryVerbosity) Configure telemetry for theArmmechanism.withWrapping(Angle min, Angle max) Wrap the arm around these angles.
-
Field Details
-
networkTableName
The network root of the mechanism (Optional).
-
-
Constructor Details
-
ArmConfig
Arm Configuration class- Parameters:
motorController- PrimarySmartMotorControllerfor theArm
-
ArmConfig
public ArmConfig()Arm configuration class. Required
-
-
Method Details
-
clone
-
withSmartMotorController
Configure theSmartMotorControllerfor theArm- Parameters:
motorController- PrimarySmartMotorControllerfor theArm- Returns:
ArmConfigfor chaining.
-
withSimColor
Publish the color in sim as this. -
withMOI
Configure the MOI directly instead of estimating it with the length and mass of theArmfor simulation. -
withLength
Configure theArms length for simulation. -
withMass
-
withTelemetry
public ArmConfig withTelemetry(String telemetryName, SmartMotorControllerConfig.TelemetryVerbosity telemetryVerbosity) Configure telemetry for theArmmechanism.- Parameters:
telemetryName- Telemetry NetworkTable name to appear under "SmartDashboard/"telemetryVerbosity- Telemetry verbosity to apply.- Returns:
ArmConfigfor chaining.
-
withTelemetry
@Deprecated public ArmConfig withTelemetry(String networkRoot, String telemetryName, SmartMotorControllerConfig.TelemetryVerbosity telemetryVerbosity) Deprecated.Configure telemetry for theArmmechanism.- Parameters:
networkRoot- Telemetry NetworkTabletelemetryName- Telemetry NetworkTable name to appear under _networkTableName_telemetryVerbosity- Telemetry verbosity to apply.- Returns:
ArmConfigfor chaining.
-
withMechanismPositionConfig
Set the elevator mechanism position configuration.- Parameters:
mechanismPositionConfig-MechanismPositionConfigfor theElevator- Returns:
PivotConfigfor chaining
-
withHorizontalZero
Set the horizontal zero of the arms absolute encoder.- Parameters:
horizontalZero- Offset of the arm that will make the arm read 0 when horizontal.- Returns:
ArmConfigfor chaining.
-
withStartingPosition
Set the arm starting angle of the motor controller encoder.- Parameters:
startingPosition- Starting position of the arm.- Returns:
ArmConfigfor chaining
-
withSoftLimits
Set the arm soft limits. When exceeded the power will be set to 0.- Parameters:
lowerLimit- Minimum rotation of the arm.upperLimit- Maximum rotation of the arm.- Returns:
ArmConfigfor chaining.
-
withWrapping
Wrap the arm around these angles. When the arm exceeds the maximum angle it will read as if it is the minimum angle.- Parameters:
min- Minimum angle for wrappingmax- Maximum angle for wrapping.- Returns:
ArmConfigfor chaining.
-
withHardLimit
Set the Hard Limits for simulation- Parameters:
min- Angle where the physical stop appears.max- Angle where the physical stop appears- Returns:
ArmConfigfor chaining.
-
applyConfig
public boolean applyConfig()Apply config changes from this class to theSmartMotorController- Returns:
SmartMotorController.applyConfig(SmartMotorControllerConfig)result.
-
getLength
Get the Length of theArm- Returns:
Distanceof the Arm.
-
getMOI
public double getMOI()Get the moment of inertia for theArmsimulation.- Returns:
- Moment of Inertia.
-
getUpperHardLimit
Get the Upper hard limit of theArm.- Returns:
Anglehard limit.
-
getLowerHardLimit
Get the lower hard limit of theArm- Returns:
Anglehard limit.
-
getTelemetryVerbosity
Get the telemetry verbosity of theArm- Returns:
SmartMotorControllerConfig.TelemetryVerbosityof theArm
-
getTelemetryName
Network Tables name for theArm- Returns:
- Network Tables name.
-
getStartingAngle
Get the starting angle of theArm -
getMotor
Get theSmartMotorControllerof theArm- Returns:
SmartMotorControllerfor theArm
-
getSimColor
Get sim color- Returns:
- sim color.
-
getMechanismPositionConfig
Get theMechanismPositionConfigassociated with thisArmConfig.- Returns:
- An
Optionalcontaining theMechanismPositionConfigif present, otherwise an emptyOptional.
-
getTelemetryNetworkTableName
Deprecated.Get the telemetry network subtable of the mechanism.- Returns:
- Optional containing the telemetry network subtable if set, otherwise an empty Optional.
-