|
YAMS
Yet Another Mechanism System
|
#include <Pivot.hpp>


Public Member Functions | |
| Pivot (config::PivotConfig *config, motorcontrollers::SmartMotorController *smc) | |
| void | SimIterate () override |
| void | UpdateTelemetry () override |
| void | VisualizationUpdate () override |
| std::string | GetName () const override |
| wpi::cmd::Trigger | Max () override |
| wpi::cmd::Trigger | Min () override |
| wpi::cmd::CommandPtr | Run (wpi::units::degree_t angle) |
| wpi::cmd::CommandPtr | Run (std::function< wpi::units::degree_t()> angle) |
| wpi::cmd::CommandPtr | RunTo (wpi::units::degree_t angle, wpi::units::degree_t tolerance=wpi::units::degree_t{1.0}) |
| wpi::cmd::CommandPtr | RunTo (std::function< wpi::units::degree_t()> angle, wpi::units::degree_t tolerance=wpi::units::degree_t{1.0}) |
| wpi::units::degree_t | GetAngle () const |
| wpi::cmd::Trigger | Gte (wpi::units::degree_t angle) |
| wpi::cmd::Trigger | Lte (wpi::units::degree_t angle) |
| wpi::cmd::Trigger | Between (wpi::units::degree_t start, wpi::units::degree_t end) |
| wpi::cmd::Trigger | IsNear (wpi::units::degree_t angle, wpi::units::degree_t within=wpi::units::degree_t{1.0}) |
| const config::PivotConfig & | GetConfig () const |
| wpi::math::Pose3d | GetPose3d () const override |
| void | SetAngle (wpi::units::degree_t angle) |
Public Member Functions inherited from yams::mechanisms::positional::SmartPositionalMechanism | |
| SmartPositionalMechanism () | |
| virtual | ~SmartPositionalMechanism ()=default |
| wpi::MechanismLigament2d * | GetMechanismLigament () |
| wpi::MechanismRoot2d * | GetMechanismRoot () |
| motorcontrollers::SmartMotorController * | GetMotor () |
Public Member Functions inherited from yams::mechanisms::SmartMechanism | |
| SmartMechanism () | |
| virtual | ~SmartMechanism ()=default |
| wpi::cmd::CommandPtr | Set (double dutycycle) |
| wpi::cmd::CommandPtr | Set (std::function< double()> dutycycle) |
| wpi::cmd::CommandPtr | SetVoltage (wpi::units::volt_t volts) |
| wpi::cmd::CommandPtr | SetVoltage (std::function< wpi::units::volt_t()> volts) |
| void | SetMechanismVelocitySetpoint (wpi::units::turns_per_second_t velocity) |
| void | SetMeasurementVelocitySetpoint (wpi::units::meters_per_second_t velocity) |
| void | SetMechanismPositionSetpoint (wpi::units::turn_t angle) |
| void | SetMeasurementPositionSetpoint (wpi::units::meter_t distance) |
| void | SetVoltageSetpoint (wpi::units::volt_t voltage) |
| void | SetDutyCycleSetpoint (double dutycycle) |
| motorcontrollers::SmartMotorController * | GetMotorController () |
| std::optional< wpi::units::turn_t > | GetMechanismSetpoint () |
| std::optional< wpi::units::meter_t > | GetMeasurementSetpoint () |
| wpi::Mechanism2d * | GetMechanismWindow () |
Additional Inherited Members | |
Protected Attributes inherited from yams::mechanisms::positional::SmartPositionalMechanism | |
| wpi::MechanismRoot2d * | m_mechanismRoot {nullptr} |
| wpi::MechanismLigament2d * | m_mechanismLigament {nullptr} |
Protected Attributes inherited from yams::mechanisms::SmartMechanism | |
| wpi::cmd::SubsystemBase * | m_subsystem {nullptr} |
| motorcontrollers::SmartMotorController * | m_smc {nullptr} |
| std::optional< wpi::Mechanism2d > | m_mechanismWindow |
Smart mechanism implementation for a pivot joint.
Similar to an Arm but intended for mechanisms that rotate a fixed-length assembly (e.g. a shooter hood or wrist) rather than a cantilevered arm with a meaningful length. Uses mechanism-space (degree) closed-loop control.
| yams::mechanisms::positional::Pivot::Pivot | ( | config::PivotConfig * | config, |
| motorcontrollers::SmartMotorController * | smc | ||
| ) |
| wpi::cmd::Trigger yams::mechanisms::positional::Pivot::Between | ( | wpi::units::degree_t | start, |
| wpi::units::degree_t | end | ||
| ) |
Trigger that fires while the pivot angle is between start and end (inclusive).
| start | Lower bound. |
| end | Upper bound. |
| wpi::units::degree_t yams::mechanisms::positional::Pivot::GetAngle | ( | ) | const |
Get the current pivot angle from the motor encoder.
| const config::PivotConfig & yams::mechanisms::positional::Pivot::GetConfig | ( | ) | const |
Get the configuration used to construct this pivot.
|
overridevirtual |
Get the human-readable name of this pivot.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Get the pivot's pose, for publishing to AdvantageScope as a component of a robot model: where it is mounted, as set in its MechanismPositionConfig, turned to the pivot's angle about the axis normal to its movement plane. A turret turns in the XY plane.
Implements yams::mechanisms::SmartMechanism.
| wpi::cmd::Trigger yams::mechanisms::positional::Pivot::Gte | ( | wpi::units::degree_t | angle | ) |
Trigger that fires while the pivot angle is >= the given angle.
| angle | Reference angle. |
| wpi::cmd::Trigger yams::mechanisms::positional::Pivot::IsNear | ( | wpi::units::degree_t | angle, |
| wpi::units::degree_t | within = wpi::units::degree_t{1.0} |
||
| ) |
Trigger that fires while the pivot is within tolerance of an angle.
| angle | Reference angle. |
| within | Tolerance. |
| wpi::cmd::Trigger yams::mechanisms::positional::Pivot::Lte | ( | wpi::units::degree_t | angle | ) |
Trigger that fires while the pivot angle is <= the given angle.
| angle | Reference angle. |
|
overridevirtual |
Trigger that becomes true when the pivot is at or past its maximum configured angle.
Implements yams::mechanisms::positional::SmartPositionalMechanism.
|
overridevirtual |
Trigger that becomes true when the pivot is at or past its minimum configured angle.
Implements yams::mechanisms::positional::SmartPositionalMechanism.
| wpi::cmd::CommandPtr yams::mechanisms::positional::Pivot::Run | ( | std::function< wpi::units::degree_t()> | angle | ) |
Set the pivot to the given angle via a supplier.
| angle | Supplier returning the desired pivot angle each loop. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Pivot::Run | ( | wpi::units::degree_t | angle | ) |
Set the pivot to the given angle.
| angle | Pivot angle to go to. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Pivot::RunTo | ( | std::function< wpi::units::degree_t()> | angle, |
| wpi::units::degree_t | tolerance = wpi::units::degree_t{1.0} |
||
| ) |
Command the pivot to an angle from a supplier, then end when within tolerance.
The supplier is evaluated once when the command is created.
| angle | Supplier for the target angle. |
| tolerance | Acceptable error. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Pivot::RunTo | ( | wpi::units::degree_t | angle, |
| wpi::units::degree_t | tolerance = wpi::units::degree_t{1.0} |
||
| ) |
Command the pivot to a fixed angle, then end when within tolerance.
| angle | Target pivot angle. |
| tolerance | Acceptable error. |
| void yams::mechanisms::positional::Pivot::SetAngle | ( | wpi::units::degree_t | angle | ) |
Directly command the pivot to an angle setpoint (non-command, for use in periodic).
| angle | Desired pivot angle. |
|
overridevirtual |
Advance the pivot's simulation by one loop iteration.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Publish pivot telemetry to NetworkTables / SmartDashboard.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Update the Mechanism2d ligament to reflect the current angle.
Implements yams::mechanisms::SmartMechanism.