Package yams.mechanisms.positional
Class DoubleJointedArm
java.lang.Object
yams.mechanisms.SmartMechanism
yams.mechanisms.positional.SmartPositionalMechanism
yams.mechanisms.positional.DoubleJointedArm
Arm mechanism.
-
Field Summary
Fields inherited from class yams.mechanisms.positional.SmartPositionalMechanism
m_mechanismLigament, m_mechanismRootFields inherited from class yams.mechanisms.SmartMechanism
m_mechanismWindow, m_smc, m_subsystem, m_telemetry -
Constructor Summary
ConstructorsConstructorDescriptionDoubleJointedArm(ArmConfig lowerConfig, ArmConfig upperConfig) Constructor for the Arm mechanism. -
Method Summary
Modifier and TypeMethodDescriptiongetAnglesForPosition(Translation2d translation, boolean invert) Inverse Kinematics for a DoubleJointedArmGet the shoulder angle of the DoubleJointedArm.getName()Get the name of the mechanism.Get theTranslation2dof the double jointed arm.Get the relative position of the mechanism, taking into account the relative position defined in theMechanismPositionConfig.Get the elbow angle of the DoubleJointedArmbooleanisNear(Translation2d target, Distance tolerance) Is near the target within tolerancemax()Deprecated.min()Deprecated.run(Translation2d translation2d, boolean invert) Set the position of the DoubleJointedArm to be at pose in meters.run(Supplier<Translation2d> translation, Supplier<Boolean> invert) Set the position of the DoubleJointedArm to be at pose in meters.runTo(Translation2d translation2d, boolean invert, Distance tolerance) Runs to the given target and stops the command.Runs to the given target and stops the command.set(double dutycycle) Deprecated.Simple duty cycle command.Deprecated.Set the shoulder and elbow angle of the DoubleJointedArm.voidsetDutyCycleSetpoint(double dutycycle) Deprecated.voidsetMeasurementPositionSetpoint(Distance distance) Deprecated.voidsetMeasurementVelocitySetpoint(LinearVelocity velocity) Deprecated.voidDeprecated.voidsetMechanismVelocitySetpoint(AngularVelocity velocity) Deprecated.setPosition(Translation2d translation, boolean invert) Set the position of the DoubleJointedArm to be at pose in meters.setVoltage(Voltage volts) Deprecated.setVoltage(Supplier<Voltage> volts) Deprecated.voidsetVoltageSetpoint(Voltage voltage) Deprecated.voidIterate simsysId(Voltage maximumVoltage, Velocity<VoltageUnit> step, Time duration) Deprecated.voidUpdate the mechanism's telemetry.voidUpdates the mechanism ligament with the current angle of the arm.Methods inherited from class yams.mechanisms.positional.SmartPositionalMechanism
getMechanismLigament, getMechanismRoot, getMotorMethods inherited from class yams.mechanisms.SmartMechanism
gearbox, gearbox, gearing, gearing, getMechanismSetpoint, getMechanismWindow, getMotorController, sprocket, sprocket
-
Constructor Details
-
Method Details
-
getPosition
Get theTranslation2dof the double jointed arm.- Returns:
Translation2dof the double jointed arm.
-
getAnglesForPosition
Inverse Kinematics for a DoubleJointedArm- Parameters:
translation- Translations from root in Meters.invert- Invert the elbow.- Returns:
Pairwith the shoulder angle then elbow angle.
-
setPosition
Set the position of the DoubleJointedArm to be at pose in meters.- Parameters:
translation-Translation2dwhere X is away from root, and Y is up.invert- Invert the eblow.- Returns:
Commandthat will reach the specified goal.
-
run
Set the position of the DoubleJointedArm to be at pose in meters.- Parameters:
translation2d-Translation2dwhere X is away from root, and Y is up.invert- Invert the eblow.- Returns:
Commandthat will reach the specified goal.
-
run
Set the position of the DoubleJointedArm to be at pose in meters.- Parameters:
translation-Supplier<Translation2d>where X is away from root, and Y is up.invert-Supplier<Boolean>Invert the eblow.- Returns:
Commandthat will reach the specified goal.
-
runTo
Runs to the given target and stops the command. Note, if you have a default command it will take over.- Parameters:
translation2d- Target positioninvert- Invert the elbow direction.tolerance- Tolerance- Returns:
Commandthat will reach the specified goal.
-
runTo
public Command runTo(Supplier<Translation2d> translation, Supplier<Boolean> invert, Distance tolerance) Runs to the given target and stops the command. Note, if you have a default command it will take over.- Parameters:
translation- Target positioninvert- Invert the elbow direction.tolerance- Tolerance- Returns:
Commandthat will reach the specified goal.
-
isNear
Is near the target within tolerance- Parameters:
target- Target to checktolerance- Tolerance- Returns:
- Boolean
-
updateTelemetry
public void updateTelemetry()Description copied from class:SmartMechanismUpdate the mechanism's telemetry.- Specified by:
updateTelemetryin classSmartMechanism
-
simIterate
public void simIterate()Description copied from class:SmartMechanismIterate sim- Specified by:
simIteratein classSmartMechanism
-
visualizationUpdate
public void visualizationUpdate()Updates the mechanism ligament with the current angle of the arm.- Specified by:
visualizationUpdatein classSmartMechanism- See Also:
-
getRelativeMechanismPosition
Get the relative position of the mechanism, taking into account the relative position defined in theMechanismPositionConfig.- Specified by:
getRelativeMechanismPositionin classSmartMechanism- Returns:
- The relative position of the mechanism as a
Translation3d.
-
getName
Description copied from class:SmartMechanismGet the name of the mechanism.- Specified by:
getNamein classSmartMechanism- Returns:
Stringname.
-
max
Deprecated.Description copied from class:SmartPositionalMechanismSmartPositionalMechanismis at max, defined by the soft limit or hard limit on theSmartPositionalMechanism.- Specified by:
maxin classSmartPositionalMechanism- Returns:
- Maximum angle for the
SmartPositionalMechanism.
-
getLowerAngle
Get the shoulder angle of the DoubleJointedArm.- Returns:
Angleof the shoulder.
-
getUpperAngle
Get the elbow angle of the DoubleJointedArm- Returns:
Angleof the elbow.
-
setAngle
Set the shoulder and elbow angle of the DoubleJointedArm. -
set
Simple duty cycle command.- Parameters:
lowerDutycycle- Dutycycle of the shoulder.upperDutycycle- DutyCycle of the elbow.- Returns:
Commandto set the DutyCycle.
-
set
Deprecated.Description copied from class:SmartMechanismSet the DutyCycle of theSmartMotorController.- Overrides:
setin classSmartMechanism- Parameters:
dutycycle- [-1,1] to set.- Returns:
Command
-
set
Deprecated.Description copied from class:SmartMechanismSet the DutyCycle of theSmartMotorController.- Overrides:
setin classSmartMechanism- Parameters:
dutycyle- [-1,1] to set via anSupplier.- Returns:
Command
-
setVoltage
Deprecated.Description copied from class:SmartMechanismSet the voltage of theSmartMotorController.- Overrides:
setVoltagein classSmartMechanism- Parameters:
volts-Voltageof theSmartMotorControllerto set.- Returns:
Command
-
setVoltage
Deprecated.Description copied from class:SmartMechanismSet the voltage of theSmartMotorController.- Overrides:
setVoltagein classSmartMechanism- Parameters:
volts-Voltageof theSmartMotorControllerto set, via aSupplier.- Returns:
Command
-
min
Deprecated.Description copied from class:SmartPositionalMechanismMinimum angle of theSmartPositionalMechanismgiven by the soft limit or hard limit of theSmartPositionalMechanism.- Specified by:
minin classSmartPositionalMechanism- Returns:
Triggeron minimum of theSmartPositionalMechanism.
-
sysId
Deprecated.Description copied from class:SmartPositionalMechanismCreate the SysId routine and commands to run the SysId tests. The SysId test will run the mechanism up then down at a constant speed, then run the mechanism up at an increasing speed and down at an increasing speed. Requires the maximum and minimum limit to be set. Runs the mechanism within 1 degree of the maximum and minimum.- Specified by:
sysIdin classSmartPositionalMechanism- Parameters:
maximumVoltage- MaximumVoltageto give to theSmartPositionalMechanism, is the voltage given to run theSmartPositionalMechanismup at a static speed.step- StepVoltageto give to theSmartPositionalMechanism.duration- SysId test duration.- Returns:
SequentialCommandGrouprunning the SysId commands.
-
setMeasurementVelocitySetpoint
Deprecated.Description copied from class:SmartMechanismSet theSmartMotorControllerto the given speed.- Overrides:
setMeasurementVelocitySetpointin classSmartMechanism- Parameters:
velocity-LinearVelocityto go to.
-
setMechanismVelocitySetpoint
Deprecated.Description copied from class:SmartMechanismSet theSmartMotorControllerto the given speed.- Overrides:
setMechanismVelocitySetpointin classSmartMechanism- Parameters:
velocity-AngularVelocityto go to.
-
setMeasurementPositionSetpoint
Deprecated.Description copied from class:SmartMechanismSets theSmartMotorControllerto the given distance.- Overrides:
setMeasurementPositionSetpointin classSmartMechanism- Parameters:
distance-Distanceto go to.
-
setMechanismPositionSetpoint
Deprecated.Description copied from class:SmartMechanismSets theSmartMotorControllerto the given angle.- Overrides:
setMechanismPositionSetpointin classSmartMechanism- Parameters:
angle-Angleto go to.
-
setVoltageSetpoint
Deprecated.Description copied from class:SmartMechanismSet the voltage of theSmartMotorController.- Overrides:
setVoltageSetpointin classSmartMechanism- Parameters:
voltage-Voltageto go to.
-
setDutyCycleSetpoint
Deprecated.Description copied from class:SmartMechanismSet the dutycycle of theSmartMotorController.- Overrides:
setDutyCycleSetpointin classSmartMechanism- Parameters:
dutycycle- [-1,1] to set.
-