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


Public Member Functions | |
| Elevator (config::ElevatorConfig *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::meter_t height) |
| wpi::cmd::CommandPtr | Run (std::function< wpi::units::meter_t()> height) |
| wpi::cmd::CommandPtr | RunTo (wpi::units::meter_t height, wpi::units::meter_t tolerance=wpi::units::meter_t{0.01}) |
| wpi::cmd::CommandPtr | RunTo (std::function< wpi::units::meter_t()> height, wpi::units::meter_t tolerance=wpi::units::meter_t{0.01}) |
| wpi::units::meter_t | GetHeight () const |
| wpi::cmd::Trigger | Gte (wpi::units::meter_t height) |
| wpi::cmd::Trigger | Lte (wpi::units::meter_t height) |
| wpi::cmd::Trigger | Between (wpi::units::meter_t start, wpi::units::meter_t end) |
| wpi::cmd::Trigger | IsNear (wpi::units::meter_t height, wpi::units::meter_t within=wpi::units::meter_t{0.01}) |
| const config::ElevatorConfig & | GetConfig () const |
| wpi::math::Pose3d | GetPose3d () const override |
| std::vector< wpi::math::Pose3d > | GetCascadePose3d () const |
| std::vector< wpi::math::Pose3d > | GetContinuousPose3d (bool carriageFirst) const |
| void | SetHeight (wpi::units::meter_t height) |
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 linear elevator.
Drives a carriage along a linear axis using a SmartMotorController configured for measurement-space (meter) closed-loop control.
| yams::mechanisms::positional::Elevator::Elevator | ( | config::ElevatorConfig * | config, |
| motorcontrollers::SmartMotorController * | smc | ||
| ) |
| wpi::cmd::Trigger yams::mechanisms::positional::Elevator::Between | ( | wpi::units::meter_t | start, |
| wpi::units::meter_t | end | ||
| ) |
Trigger that fires while the elevator height is between start and end (inclusive).
| start | Lower bound. |
| end | Upper bound. |
| std::vector< wpi::math::Pose3d > yams::mechanisms::positional::Elevator::GetCascadePose3d | ( | ) | const |
Get the pose of each moving stage of a cascade elevator, for publishing to AdvantageScope as components of a robot model. A cascade elevator's stages all move at once, each by its share of the carriage's height: a stage that travels a third of the elevator's total travel moves a third of the carriage's height relative to the stage below it.
The stages are set with ElevatorConfig::WithStages().
| ElevatorConfigurationException | if the stages are not set, or there are fewer than 2. |
| const config::ElevatorConfig & yams::mechanisms::positional::Elevator::GetConfig | ( | ) | const |
Get the configuration used to construct this elevator.
| std::vector< wpi::math::Pose3d > yams::mechanisms::positional::Elevator::GetContinuousPose3d | ( | bool | carriageFirst | ) | const |
Get the pose of each moving stage of a continuous elevator, for publishing to AdvantageScope as components of a robot model. A continuous elevator's stages move one at a time. Which moves first depends on how it is rigged: watch it move to see which it is.
The stages are set with ElevatorConfig::WithStages().
| carriageFirst | True if the carriage moves first, false if it moves last. |
| ElevatorConfigurationException | if the stages are not set, or there are fewer than 2. |
| wpi::units::meter_t yams::mechanisms::positional::Elevator::GetHeight | ( | ) | const |
Get the current carriage height from the motor encoder.
|
overridevirtual |
Get the human-readable name of this elevator.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Get the carriage's pose, for publishing to AdvantageScope as a component of a robot model: where the elevator is mounted, as set in its MechanismPositionConfig, moved up the elevator by its height, at the elevator's angle in its movement plane.
Implements yams::mechanisms::SmartMechanism.
| wpi::cmd::Trigger yams::mechanisms::positional::Elevator::Gte | ( | wpi::units::meter_t | height | ) |
Trigger that fires while the elevator height is >= the given height.
| height | Reference height. |
| wpi::cmd::Trigger yams::mechanisms::positional::Elevator::IsNear | ( | wpi::units::meter_t | height, |
| wpi::units::meter_t | within = wpi::units::meter_t{0.01} |
||
| ) |
Trigger that fires while the elevator is within tolerance of a height.
| height | Reference height. |
| within | Tolerance. |
| wpi::cmd::Trigger yams::mechanisms::positional::Elevator::Lte | ( | wpi::units::meter_t | height | ) |
Trigger that fires while the elevator height is <= the given height.
| height | Reference height. |
|
overridevirtual |
Trigger that becomes true when the elevator is at or above its maximum configured height.
Implements yams::mechanisms::positional::SmartPositionalMechanism.
|
overridevirtual |
Trigger that becomes true when the elevator is at or below its minimum configured height.
Implements yams::mechanisms::positional::SmartPositionalMechanism.
| wpi::cmd::CommandPtr yams::mechanisms::positional::Elevator::Run | ( | std::function< wpi::units::meter_t()> | height | ) |
Set the height of the elevator via a supplier.
| height | Supplier returning the desired height each loop. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Elevator::Run | ( | wpi::units::meter_t | height | ) |
Set the height of the elevator.
| height | Height of the elevator to reach. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Elevator::RunTo | ( | std::function< wpi::units::meter_t()> | height, |
| wpi::units::meter_t | tolerance = wpi::units::meter_t{0.01} |
||
| ) |
Command the elevator to a height from a supplier, then end when within tolerance.
The supplier is evaluated once when the command is created.
| height | Supplier for the target height. |
| tolerance | Acceptable error. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Elevator::RunTo | ( | wpi::units::meter_t | height, |
| wpi::units::meter_t | tolerance = wpi::units::meter_t{0.01} |
||
| ) |
Command the elevator to a fixed height, then end when within tolerance.
| height | Target carriage height. |
| tolerance | Acceptable error. |
| void yams::mechanisms::positional::Elevator::SetHeight | ( | wpi::units::meter_t | height | ) |
Directly command the elevator to a height setpoint (non-command, for use in periodic).
| height | Desired carriage height. |
|
overridevirtual |
Advance the elevator's simulation by one loop iteration.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Publish elevator telemetry to NetworkTables / SmartDashboard.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Update the Mechanism2d ligament to reflect the current height.
Implements yams::mechanisms::SmartMechanism.