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


Public Member Functions | |
| Arm (config::ArmConfig *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::ArmConfig & | 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 single-jointed arm.
Drives an arm joint using a SmartMotorController configured for mechanism-space (degree) closed-loop angular control.
| yams::mechanisms::positional::Arm::Arm | ( | config::ArmConfig * | config, |
| motorcontrollers::SmartMotorController * | smc | ||
| ) |
| wpi::cmd::Trigger yams::mechanisms::positional::Arm::Between | ( | wpi::units::degree_t | start, |
| wpi::units::degree_t | end | ||
| ) |
Trigger that fires while the arm angle is between start and end (inclusive).
| start | Lower bound. |
| end | Upper bound. |
| wpi::units::degree_t yams::mechanisms::positional::Arm::GetAngle | ( | ) | const |
Get the current joint angle from the motor encoder.
| const config::ArmConfig & yams::mechanisms::positional::Arm::GetConfig | ( | ) | const |
Get the configuration used to construct this arm.
|
overridevirtual |
Get the human-readable name of this arm.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Get the arm'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 arm's angle about the axis normal to its movement plane.
Implements yams::mechanisms::SmartMechanism.
| wpi::cmd::Trigger yams::mechanisms::positional::Arm::Gte | ( | wpi::units::degree_t | angle | ) |
Trigger that fires while the arm angle is >= the given angle.
| angle | Reference angle. |
| wpi::cmd::Trigger yams::mechanisms::positional::Arm::IsNear | ( | wpi::units::degree_t | angle, |
| wpi::units::degree_t | within = wpi::units::degree_t{1.0} |
||
| ) |
Trigger that fires while the arm is within tolerance of an angle.
| angle | Reference angle. |
| within | Tolerance. |
| wpi::cmd::Trigger yams::mechanisms::positional::Arm::Lte | ( | wpi::units::degree_t | angle | ) |
Trigger that fires while the arm angle is <= the given angle.
| angle | Reference angle. |
|
overridevirtual |
Trigger that becomes true when the arm is at or past its maximum configured angle.
Implements yams::mechanisms::positional::SmartPositionalMechanism.
|
overridevirtual |
Trigger that becomes true when the arm is at or past its minimum configured angle.
Implements yams::mechanisms::positional::SmartPositionalMechanism.
| wpi::cmd::CommandPtr yams::mechanisms::positional::Arm::Run | ( | std::function< wpi::units::degree_t()> | angle | ) |
Set the arm to the given angle via a supplier.
| angle | Supplier returning the desired arm angle each loop. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Arm::Run | ( | wpi::units::degree_t | angle | ) |
Set the arm to the given angle.
| angle | Arm angle to go to. |
| wpi::cmd::CommandPtr yams::mechanisms::positional::Arm::RunTo | ( | std::function< wpi::units::degree_t()> | angle, |
| wpi::units::degree_t | tolerance = wpi::units::degree_t{1.0} |
||
| ) |
Command the arm 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::Arm::RunTo | ( | wpi::units::degree_t | angle, |
| wpi::units::degree_t | tolerance = wpi::units::degree_t{1.0} |
||
| ) |
Command the arm to a fixed angle, then end when within tolerance.
| angle | Target joint angle. |
| tolerance | Acceptable error. |
| void yams::mechanisms::positional::Arm::SetAngle | ( | wpi::units::degree_t | angle | ) |
Directly command the arm to an angle setpoint (non-command, for use in periodic).
| angle | Desired joint angle. |
|
overridevirtual |
Advance the arm's simulation by one loop iteration.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Publish arm telemetry to NetworkTables / SmartDashboard.
Implements yams::mechanisms::SmartMechanism.
|
overridevirtual |
Update the Mechanism2d ligament to reflect the current angle.
Implements yams::mechanisms::SmartMechanism.