|
YAMS
Yet Another Mechanism System
|
#include <ElevatorConfig.hpp>
Public Member Functions | |
| ElevatorConfig ()=default | |
| ElevatorConfig & | WithTelemetryName (const std::string &name) |
| ElevatorConfig & | WithMinimumHeight (wpi::units::meter_t height) |
| ElevatorConfig & | WithMaximumHeight (wpi::units::meter_t height) |
| ElevatorConfig & | WithCarriageMass (wpi::units::kilogram_t mass) |
| ElevatorConfig & | WithIsHorizontal (bool horizontal) |
| ElevatorConfig & | WithSimColor (const wpi::util::Color8Bit &color) |
| ElevatorConfig & | WithAngle (wpi::units::degree_t angle) |
| template<typename... Heights> requires (std::convertible_to<Heights, wpi::units::meter_t> && ...) | |
| ElevatorConfig & | WithStages (Heights... stageHeights) |
| ElevatorConfig & | WithStages (std::vector< wpi::units::meter_t > stageHeights) |
| ElevatorConfig & | WithMechanismPositionConfig (const MechanismPositionConfig &mechanismPositionConfig) |
| std::string | GetTelemetryName () const |
| std::optional< wpi::units::meter_t > | GetMinHeight () const |
| std::optional< wpi::units::meter_t > | GetMaxHeight () const |
| std::optional< wpi::units::kilogram_t > | GetCarriageMass () const |
| bool | IsHorizontal () const |
| wpi::util::Color8Bit | GetSimColor () const |
| wpi::units::degree_t | GetAngle () const |
| std::optional< int > | GetStages () const |
| const std::vector< wpi::units::meter_t > & | GetStageHeights () const |
| std::optional< wpi::units::meter_t > | GetStageHeightTotal () const |
| const MechanismPositionConfig & | GetMechanismPositionConfig () const |
Configuration class for an Elevator mechanism.
Uses a fluent builder pattern; all With* methods return *this for chaining.
|
default |
| wpi::units::degree_t yams::mechanisms::config::ElevatorConfig::GetAngle | ( | ) | const |
Get the Mechanism2d ligament angle (default: 90°).
| std::optional< wpi::units::kilogram_t > yams::mechanisms::config::ElevatorConfig::GetCarriageMass | ( | ) | const |
Get the optional carriage mass.
| std::optional< wpi::units::meter_t > yams::mechanisms::config::ElevatorConfig::GetMaxHeight | ( | ) | const |
Get the maximum height, or the stage heights' total without one.
|
inline |
Get where the mechanism is on the robot.
| std::optional< wpi::units::meter_t > yams::mechanisms::config::ElevatorConfig::GetMinHeight | ( | ) | const |
Get the minimum height, or 0 without one when the stages are set.
| wpi::util::Color8Bit yams::mechanisms::config::ElevatorConfig::GetSimColor | ( | ) | const |
Get the Mechanism2d simulation colour.
| const std::vector< wpi::units::meter_t > & yams::mechanisms::config::ElevatorConfig::GetStageHeights | ( | ) | const |
Get how far each moving stage travels relative to the stage below it, from the stage nearest the fixed stage to the carriage. Empty if WithStages() was not called.
| std::optional< wpi::units::meter_t > yams::mechanisms::config::ElevatorConfig::GetStageHeightTotal | ( | ) | const |
Get how far the stages travel together, the sum of the stage heights, if set.
| std::optional< int > yams::mechanisms::config::ElevatorConfig::GetStages | ( | ) | const |
Get the number of stages that move, counting the carriage as the last, if set.
| std::string yams::mechanisms::config::ElevatorConfig::GetTelemetryName | ( | ) | const |
Get the telemetry name.
| bool yams::mechanisms::config::ElevatorConfig::IsHorizontal | ( | ) | const |
Returns true when the elevator is configured as horizontal (gravity disabled).
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithAngle | ( | wpi::units::degree_t | angle | ) |
Set the angle of the elevator ligament in the Mechanism2d window (default: 90°/vertical).
| angle | Ligament angle. |
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithCarriageMass | ( | wpi::units::kilogram_t | mass | ) |
Set the carriage mass (required for simulation).
| mass | Carriage mass in kg. |
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithIsHorizontal | ( | bool | horizontal | ) |
Mark the elevator as horizontal (disables gravity simulation).
| horizontal | True to treat the elevator as horizontal. |
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithMaximumHeight | ( | wpi::units::meter_t | height | ) |
Set the maximum (upper hard) height for simulation and soft-limit purposes.
| height | Maximum height. |
|
inline |
Set where the mechanism is on the robot, for GetPose3d(): where it is mounted, how it is turned there, the plane it moves in, and the mechanism it is mounted on, if any.
| mechanismPositionConfig | The mechanism's position. |
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithMinimumHeight | ( | wpi::units::meter_t | height | ) |
Set the minimum (lower hard) height for simulation and soft-limit purposes.
| height | Minimum height. |
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithSimColor | ( | const wpi::util::Color8Bit & | color | ) |
Set the Mechanism2d simulation colour for the elevator ligament (default: orange).
| color | Desired colour. |
|
inline |
Set the elevator's moving stages, for the pose of each stage from Elevator::GetCascadePose3d() or Elevator::GetContinuousPose3d(bool).
The stage heights must add up to the elevator's maximum height: the Elevator throws if they do not. Without a minimum and maximum height, the elevator's height is from 0 to the stage heights' total.
| stageHeights | How far each moving stage travels relative to the stage below it, from the stage nearest the fixed stage to the carriage, which is the last. One for each stage that moves, such as WithStages(0.6_m, 0.6_m, 0.5_m). |
| std::invalid_argument | if no height is given, or a height is not positive. |
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithStages | ( | std::vector< wpi::units::meter_t > | stageHeights | ) |
Set the elevator's moving stages from a list of stage heights. See WithStages(Heights...).
| stageHeights | How far each moving stage travels relative to the stage below it, from the stage nearest the fixed stage to the carriage. |
| std::invalid_argument | if no height is given, or a height is not positive. |
| ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithTelemetryName | ( | const std::string & | name | ) |
Set the NetworkTables / SmartDashboard name for telemetry.
| name | Telemetry name string. |