Package yams.mechanisms.config
Class DifferentialMechanismConfig
java.lang.Object
yams.mechanisms.config.DifferentialMechanismConfig
Differential Mechanism config.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDifferential Mechanism configuration class.Differential Mechanism configuration class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanApply config changes from this class to theSmartMotorControllerclone()getLeftMechanismPosition(Angle tilt, Angle twist) The leftSmartMotorControllermechanism position.Get the leftSmartMotorControllerof theDifferentialMechanismGet the length of theDifferentialMechanismGet theMechanismPositionConfigassociated with thisDifferentialMechanismConfig.doublegetMOI()Get the moment of inertia for theDifferentialMechanismsimulation.Deprecated.getRightMechanismPosition(Angle tilt, Angle twist) The rightSmartMotorControllermechanism position.Get the rightSmartMotorControllerof theDifferentialMechanismSim color valueGet starting tiltAngle.Get starting twistAngle.Network Tables name for thePivotGet the telemetry verbosity of thePivotgetTiltAngle(Angle leftMechPos, Angle rightMechPos) Get the tilt angle of theDifferentialMechanism.Get the angle supplier for the attached absolute encoder, if it exists.Get the starting angle of theDifferentialMechanismtilt.getTwistAngle(Angle leftMechPos, Angle rightMechPos) Get the twist angle of theDifferentialMechanismwith any additional twist gearing.Get the angle supplier for the attached absolute encoder, if it exists.The gearing for the twist in theDifferentialMechanismGet the starting angle of theDifferentialMechanismtwist.withAngleSuppliers(Supplier<Angle> twistSupplier, Supplier<Angle> tiltSupplier) Setup suppliers for absolute encoders on theDifferentialMechanismwithGearing(MechanismGearing gearing) Aet the gearing for the differential mechanism if it isnt 1:1.withLength(Distance length) Set the length of theDifferentialMechanism.withMechanismPositionConfig(MechanismPositionConfig mechanismPositionConfig) Set the differential mechanism position configuration.withMOI(double MOI) Configure the MOI directly instead of estimating it with the length and mass of theDifferentialMechanismfor simulation.Configure the MOI directly instead of estimating it with the length and mass of theDifferentialMechanismfor simulation.withSimColor(Color8Bit simColor) Publish the color in sim as this.Add the smart motor controllers to the configuration.withStartingPosition(Angle tilt, Angle twist) Set theDifferentialMechanismstarting positions.withTelemetry(String telemetryName, SmartMotorControllerConfig.TelemetryVerbosity telemetryVerbosity) Configure telemetry for thePivotmechanism.withTiltStartingPosition(Angle startingPosition) Set theDifferentialMechanismtilt starting position.withTwistStartingPosition(Angle startingPosition) Set theDifferentialMechanismtwist starting position.
-
Field Details
-
networkRoot
Deprecated.The network root of the mechanism (Optional).
-
-
Constructor Details
-
DifferentialMechanismConfig
Differential Mechanism configuration class.- Parameters:
left- LeftSmartMotorControllerconfigured with the gearing up to the tilt movement if synchronized.right- RightSmartMotorControllerconfigured with the gearing up to the tilt movement if syncrhonized.
-
DifferentialMechanismConfig
public DifferentialMechanismConfig()Differential Mechanism configuration class. Required call towithSmartMotorControllers(SmartMotorController, SmartMotorController)before usage.
-
-
Method Details
-
clone
-
withSmartMotorControllers
public DifferentialMechanismConfig withSmartMotorControllers(SmartMotorController left, SmartMotorController right) Add the smart motor controllers to the configuration.- Parameters:
left- LeftSmartMotorControllerright- RightSmartMotorController- Returns:
DifferentialMechanismConfigfor chaining.
-
getTwistAngle
Get the twist angle of theDifferentialMechanismwith any additional twist gearing.- Parameters:
leftMechPos- LeftSmartMotorControllerMechanism PositionrightMechPos- RightSmartMotorControllerMechanism Position- Returns:
- Twist
Angle
-
getTiltAngle
Get the tilt angle of theDifferentialMechanism.- Parameters:
leftMechPos- LeftSmartMotorControllerMechanism PositionrightMechPos- RightSmartMotorControllerMechanism Position- Returns:
- Tilt
Angle
-
getLeftMechanismPosition
The leftSmartMotorControllermechanism position. -
getRightMechanismPosition
The rightSmartMotorControllermechanism position. -
withSimColor
Publish the color in sim as this.- Parameters:
simColor-Color8Bitto show.- Returns:
DifferentialMechanismConfigfor chaining.
-
withMOI
Configure the MOI directly instead of estimating it with the length and mass of theDifferentialMechanismfor simulation.- Parameters:
MOI- Moment of Inertia of theDifferentialMechanism- Returns:
DifferentialMechanismConfigfor chaining.
-
withLength
Set the length of theDifferentialMechanism.- Parameters:
length- Length of theDifferentialMechanism- Returns:
DifferentialMechanismConfigfor chaining.
-
withMOI
Configure the MOI directly instead of estimating it with the length and mass of theDifferentialMechanismfor simulation.- Parameters:
length- Length of theDifferentialMechanism.weight- Weight of theDifferentialMechanism- Returns:
DifferentialMechanismConfigfor chaining.
-
withTelemetry
public DifferentialMechanismConfig withTelemetry(String telemetryName, SmartMotorControllerConfig.TelemetryVerbosity telemetryVerbosity) Configure telemetry for thePivotmechanism.- Parameters:
telemetryName- Telemetry NetworkTable name to appear under "SmartDashboard/"telemetryVerbosity- Telemetry verbosity to apply.- Returns:
DifferentialMechanismConfigfor chaining.
-
withMechanismPositionConfig
public DifferentialMechanismConfig withMechanismPositionConfig(MechanismPositionConfig mechanismPositionConfig) Set the differential mechanism position configuration.- Parameters:
mechanismPositionConfig-MechanismPositionConfigfor theDifferentialMechanism- Returns:
DifferentialMechanismConfigfor chaining
-
withGearing
Aet the gearing for the differential mechanism if it isnt 1:1. Separate from gearing to the bevel gears.- Parameters:
gearing- Gearing for the bevel gears.- Returns:
DifferentialMechanismConfigfor chaining
-
withTwistStartingPosition
Set theDifferentialMechanismtwist starting position.- Parameters:
startingPosition- Starting position of theDifferentialMechanismtwist.- Returns:
DifferentialMechanismConfigfor chaining
-
withAngleSuppliers
public DifferentialMechanismConfig withAngleSuppliers(Supplier<Angle> twistSupplier, Supplier<Angle> tiltSupplier) Setup suppliers for absolute encoders on theDifferentialMechanism- Parameters:
twistSupplier-Supplier<Angle>for the twist.tiltSupplier-Supplier<Angle>for the tilt.- Returns:
DifferentialMechanismConfigfor chaining.
-
withStartingPosition
Set theDifferentialMechanismstarting positions.- Parameters:
tilt-Angleof the tilt.twist-Angleof the twist.- Returns:
DifferentialMechanismConfigfor chaining.
-
withTiltStartingPosition
Set theDifferentialMechanismtilt starting position.- Parameters:
startingPosition- Starting position of theDifferentialMechanismtilt.- Returns:
DifferentialMechanismConfigfor chaining
-
applyConfig
public boolean applyConfig()Apply config changes from this class to theSmartMotorController- Returns:
SmartMotorController.applyConfig(SmartMotorControllerConfig)result.
-
getMOI
public double getMOI()Get the moment of inertia for theDifferentialMechanismsimulation.- Returns:
- Moment of Inertia.
-
getTelemetryVerbosity
Get the telemetry verbosity of thePivot- Returns:
SmartMotorControllerConfig.TelemetryVerbosityof thePivot
-
getTelemetryName
Network Tables name for thePivot- Returns:
- Network Tables name.
-
getTiltStartingAngle
Get the starting angle of theDifferentialMechanismtilt.- Returns:
Angleof theDifferentialMechanismtilt.
-
getStartingTiltAngle
Get starting tiltAngle.- Returns:
- Tilt
Angle.
-
getStartingTwistAngle
Get starting twistAngle.- Returns:
- Twist
Angle.
-
getTwistStartingAngle
Get the starting angle of theDifferentialMechanismtwist.- Returns:
Angleof theDifferentialMechanismtwist.
-
getTwistAngleSupplier
Get the angle supplier for the attached absolute encoder, if it exists.- Returns:
Anglesupplier for the given absolute encoder attached to the twist.
-
getLength
Get the length of theDifferentialMechanism- Returns:
DistanceofDifferentialMechanism
-
getTwistGearing
The gearing for the twist in theDifferentialMechanism- Returns:
MechanismGearingof the twist.
-
getTiltAngleSupplier
Get the angle supplier for the attached absolute encoder, if it exists.- Returns:
Anglesupplier for the given absolute encoder attached to the tilt.
-
getLeftMotorController
Get the leftSmartMotorControllerof theDifferentialMechanism- Returns:
- left
SmartMotorController
-
getRightMotorController
Get the rightSmartMotorControllerof theDifferentialMechanism- Returns:
- right
SmartMotorController
-
getSimColor
Sim color value- Returns:
- Sim color value
-
getMechanismPositionConfig
Get theMechanismPositionConfigassociated with thisDifferentialMechanismConfig.- Returns:
- An
Optionalcontaining theMechanismPositionConfigif present, otherwise an emptyOptional.
-
getNetworkRoot
Deprecated.Get the network root of the mechanism.- Returns:
- Optional containing the network root if set, otherwise an empty Optional.
-