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


Public Member Functions | |
| SmartMechanism () | |
| virtual | ~SmartMechanism ()=default |
| virtual void | SimIterate ()=0 |
| virtual void | UpdateTelemetry ()=0 |
| virtual void | VisualizationUpdate ()=0 |
| virtual std::string | GetName () const =0 |
| virtual wpi::math::Pose3d | GetPose3d () const =0 |
| 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 () |
Protected Attributes | |
| wpi::cmd::SubsystemBase * | m_subsystem {nullptr} |
| motorcontrollers::SmartMotorController * | m_smc {nullptr} |
| std::optional< wpi::Mechanism2d > | m_mechanismWindow |
Abstract base class for all YAMS smart mechanisms.
Provides common open-loop command factories and setpoint helpers that delegate to the underlying SmartMotorController.
|
inline |
|
virtualdefault |
| std::optional< wpi::units::meter_t > yams::mechanisms::SmartMechanism::GetMeasurementSetpoint | ( | ) |
Get the current setpoint as a distance: the mechanism setpoint converted with the mechanism circumference.
| std::optional< wpi::units::turn_t > yams::mechanisms::SmartMechanism::GetMechanismSetpoint | ( | ) |
Get the current mechanism angle setpoint if one has been set.
| wpi::Mechanism2d * yams::mechanisms::SmartMechanism::GetMechanismWindow | ( | ) |
Get a pointer to the Mechanism2d window, or nullptr if not initialised.
| motorcontrollers::SmartMotorController * yams::mechanisms::SmartMechanism::GetMotorController | ( | ) |
Get the underlying SmartMotorController.
|
pure virtual |
Get the human-readable name of this mechanism.
Implemented in yams::mechanisms::positional::Arm, yams::mechanisms::positional::Elevator, yams::mechanisms::positional::Pivot, and yams::mechanisms::velocity::FlyWheel.
|
pure virtual |
Get the mechanism's pose relative to the robot, worked out from its motor's position and where it is mounted, as set in its MechanismPositionConfig. Publish it as a component of an AdvantageScope robot model, whose part is modeled at the mechanism's zero position about its mount.
Implemented in yams::mechanisms::positional::Arm, yams::mechanisms::positional::Elevator, yams::mechanisms::positional::Pivot, and yams::mechanisms::velocity::FlyWheel.
| wpi::cmd::CommandPtr yams::mechanisms::SmartMechanism::Set | ( | double | dutycycle | ) |
Run the motor at a fixed duty-cycle. Stops the closed-loop controller while the command is running and restarts it on finish.
| dutycycle | [-1, 1] duty cycle to apply. |
| wpi::cmd::CommandPtr yams::mechanisms::SmartMechanism::Set | ( | std::function< double()> | dutycycle | ) |
Run the motor at a supplier-provided duty-cycle.
| dutycycle | Supplier returning a [-1, 1] value each loop. |
| void yams::mechanisms::SmartMechanism::SetDutyCycleSetpoint | ( | double | dutycycle | ) |
Stop the closed-loop controller and apply a duty cycle immediately.
| dutycycle | [-1, 1] duty cycle. |
| void yams::mechanisms::SmartMechanism::SetMeasurementPositionSetpoint | ( | wpi::units::meter_t | distance | ) |
Start closed-loop control and set a linear measurement position setpoint.
| void yams::mechanisms::SmartMechanism::SetMeasurementVelocitySetpoint | ( | wpi::units::meters_per_second_t | velocity | ) |
Start closed-loop control and set a linear measurement velocity setpoint.
| void yams::mechanisms::SmartMechanism::SetMechanismPositionSetpoint | ( | wpi::units::turn_t | angle | ) |
Start closed-loop control and set a mechanism angle setpoint.
| void yams::mechanisms::SmartMechanism::SetMechanismVelocitySetpoint | ( | wpi::units::turns_per_second_t | velocity | ) |
Start closed-loop control and set a mechanism angular velocity setpoint.
| wpi::cmd::CommandPtr yams::mechanisms::SmartMechanism::SetVoltage | ( | std::function< wpi::units::volt_t()> | volts | ) |
Run the motor at a supplier-provided voltage.
| volts | Supplier returning a voltage each loop. |
| wpi::cmd::CommandPtr yams::mechanisms::SmartMechanism::SetVoltage | ( | wpi::units::volt_t | volts | ) |
Run the motor at a fixed voltage.
| volts | Voltage to apply. |
| void yams::mechanisms::SmartMechanism::SetVoltageSetpoint | ( | wpi::units::volt_t | voltage | ) |
Stop the closed-loop controller and apply a voltage immediately.
| voltage | Voltage to apply. |
|
pure virtual |
Advance the mechanism's simulation by one loop iteration.
Implemented in yams::mechanisms::positional::Arm, yams::mechanisms::positional::Elevator, yams::mechanisms::positional::Pivot, and yams::mechanisms::velocity::FlyWheel.
|
pure virtual |
Publish telemetry to NetworkTables / SmartDashboard.
Implemented in yams::mechanisms::positional::Arm, yams::mechanisms::positional::Elevator, yams::mechanisms::positional::Pivot, and yams::mechanisms::velocity::FlyWheel.
|
pure virtual |
Update the Mechanism2d visualization state.
Implemented in yams::mechanisms::positional::Arm, yams::mechanisms::positional::Elevator, yams::mechanisms::positional::Pivot, and yams::mechanisms::velocity::FlyWheel.
|
protected |
Optional 2D visualisation window published to SmartDashboard.
|
protected |
Motor controller driving this mechanism.
|
protected |
Subsystem that this mechanism belongs to (provides command requirements).