Package yams.mechanisms
Class SmartMechanism
java.lang.Object
yams.mechanisms.SmartMechanism
- Direct Known Subclasses:
SmartPositionalMechanism,SmartVelocityMechanism
Generic implementation of a mechanism with advanced telemetry.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Mechanism2dMechanism Window.protected SmartMotorControllerMotor for the subsystem.protected SubsystemSubsystem for the Mechanism.protected MechanismTelemetryMechanism telemetry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GearBoxgearbox(double... reductionStages) Deprecated, for removal: This API element is subject to removal in a future version.static GearBoxDeprecated, for removal: This API element is subject to removal in a future version.UseGearBox.fromStages(String...)instead.static MechanismGearingDeprecated, for removal: This API element is subject to removal in a future version.UseMechanismGearinginstead.static MechanismGearingDeprecated, for removal: This API element is subject to removal in a future version.UseMechanismGearing(GearBox, Sprocket)instead.Get theSmartMechanism's setpoint as anAngleif it exists.Get theMechanism2dfor the mechanism.Get theSmartMotorControllerabstract StringgetName()Get the name of the mechanism.abstract Translation3dGet theTranslation3dof the mechanism usingMechanism2dcoordinates.set(double dutycycle) Set the DutyCycle of theSmartMotorController.Set the DutyCycle of theSmartMotorController.setVoltage(Voltage volts) Set the voltage of theSmartMotorController.setVoltage(Supplier<Voltage> volts) Set the voltage of theSmartMotorController.abstract voidIterate simstatic Sprocketsprocket(double... sprocketReductionStages) Deprecated, for removal: This API element is subject to removal in a future version.UseSprocket.fromStages(String...)instead.static SprocketDeprecated, for removal: This API element is subject to removal in a future version.UseSprocket.fromStages(String...)instead.abstract voidUpdate the mechanism's telemetry.abstract voidUpdate the mechanism's visualization state.
-
Field Details
-
m_subsystem
Subsystem for the Mechanism. -
m_smc
Motor for the subsystem. -
m_telemetry
Mechanism telemetry. -
m_mechanismWindow
Mechanism Window.
-
-
Constructor Details
-
SmartMechanism
public SmartMechanism()
-
-
Method Details
-
sprocket
Deprecated, for removal: This API element is subject to removal in a future version.UseSprocket.fromStages(String...)instead.Create theSprocketclass easily for use within the mechanism.- Parameters:
sprocketReductionStages- Teeth of each sprocket in the chain, in the format of "IN:OUT" => IN/OUT.- Returns:
Sprocketrepresenting the sprocketReductionStages given.
-
sprocket
Deprecated, for removal: This API element is subject to removal in a future version.UseSprocket.fromStages(String...)instead.Create theSprocketclass easily for use within the mechanism.- Parameters:
sprocketReductionStages- Teeth of each sprocket in the chain in the format of "IN:OUT".- Returns:
Sprocketrepresenting the sprocketReductionStages given.
-
gearbox
Deprecated, for removal: This API element is subject to removal in a future version.UseGearBox.fromStages(String...)instead.Create theGearBoxforMechanismGearing- Parameters:
reductionStages- Reduction stages in the gear box in the format of "IN:OUT"- Returns:
GearBoxfor use inMechanismGearing;
-
gearbox
Deprecated, for removal: This API element is subject to removal in a future version.UseGearBox.fromReductionStages(double...)instead.Create theGearBoxforMechanismGearing.- Parameters:
reductionStages- Reduction stages in the gear box, where "IN:OUT" => IN/OUT.- Returns:
GearBoxfor use inMechanismGearing;
-
gearing
@Deprecated(forRemoval=true) public static MechanismGearing gearing(GearBox gearBox, Sprocket sprocket) Deprecated, for removal: This API element is subject to removal in a future version.UseMechanismGearing(GearBox, Sprocket)instead.- Parameters:
gearBox-GearBoxcreated usinggearbox(double...).sprocket-Sprocketcreated usingsprocket(double...).- Returns:
MechanismGearingwith theGearBoxandSprocket.
-
gearing
Deprecated, for removal: This API element is subject to removal in a future version.UseMechanismGearinginstead.CreateMechanismGearingwith the givenGearBox.- Parameters:
gearBox-GearBoxcreated usinggearbox(double...).- Returns:
MechanismGearingwith theGearBox.
-
set
Set the DutyCycle of theSmartMotorController.- Parameters:
dutycycle- [-1,1] to set.- Returns:
Command
-
set
Set the DutyCycle of theSmartMotorController. -
setVoltage
Set the voltage of theSmartMotorController.- Parameters:
volts-Voltageof theSmartMotorControllerto set.- Returns:
Command
-
setVoltage
Set the voltage of theSmartMotorController.- Parameters:
volts-Voltageof theSmartMotorControllerto set, via aSupplier.- Returns:
Command
-
getMotorController
Get theSmartMotorController- Returns:
SmartMotorControllerfor the mechanism.
-
getMechanismSetpoint
Get theSmartMechanism's setpoint as anAngleif it exists. -
simIterate
public abstract void simIterate()Iterate sim -
updateTelemetry
public abstract void updateTelemetry()Update the mechanism's telemetry. -
getMechanismWindow
Get theMechanism2dfor the mechanism.- Returns:
Mechanism2dfor the mechanism.
-
visualizationUpdate
public abstract void visualizationUpdate()Update the mechanism's visualization state. -
getRelativeMechanismPosition
Get theTranslation3dof the mechanism usingMechanism2dcoordinates.- Returns:
Translation3dof the mechanism.
-
getName
Get the name of the mechanism.- Returns:
Stringname.
-
GearBox.fromReductionStages(double...)instead.