YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
Public Member Functions | List of all members
yams::mechanisms::config::ElevatorConfig Class Reference

#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
 

Detailed Description

Configuration class for an Elevator mechanism.

Uses a fluent builder pattern; all With* methods return *this for chaining.

Constructor & Destructor Documentation

◆ ElevatorConfig()

yams::mechanisms::config::ElevatorConfig::ElevatorConfig ( )
default

Member Function Documentation

◆ GetAngle()

wpi::units::degree_t yams::mechanisms::config::ElevatorConfig::GetAngle ( ) const

Get the Mechanism2d ligament angle (default: 90°).

◆ GetCarriageMass()

std::optional< wpi::units::kilogram_t > yams::mechanisms::config::ElevatorConfig::GetCarriageMass ( ) const

Get the optional carriage mass.

◆ GetMaxHeight()

std::optional< wpi::units::meter_t > yams::mechanisms::config::ElevatorConfig::GetMaxHeight ( ) const

Get the maximum height, or the stage heights' total without one.

◆ GetMechanismPositionConfig()

const MechanismPositionConfig & yams::mechanisms::config::ElevatorConfig::GetMechanismPositionConfig ( ) const
inline

Get where the mechanism is on the robot.

◆ GetMinHeight()

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.

◆ GetSimColor()

wpi::util::Color8Bit yams::mechanisms::config::ElevatorConfig::GetSimColor ( ) const

Get the Mechanism2d simulation colour.

◆ GetStageHeights()

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.

◆ GetStageHeightTotal()

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.

◆ GetStages()

std::optional< int > yams::mechanisms::config::ElevatorConfig::GetStages ( ) const

Get the number of stages that move, counting the carriage as the last, if set.

◆ GetTelemetryName()

std::string yams::mechanisms::config::ElevatorConfig::GetTelemetryName ( ) const

Get the telemetry name.

◆ IsHorizontal()

bool yams::mechanisms::config::ElevatorConfig::IsHorizontal ( ) const

Returns true when the elevator is configured as horizontal (gravity disabled).

◆ WithAngle()

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).

Parameters
angleLigament angle.
Returns
*this for chaining.

◆ WithCarriageMass()

ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithCarriageMass ( wpi::units::kilogram_t  mass)

Set the carriage mass (required for simulation).

Parameters
massCarriage mass in kg.
Returns
*this for chaining.

◆ WithIsHorizontal()

ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithIsHorizontal ( bool  horizontal)

Mark the elevator as horizontal (disables gravity simulation).

Parameters
horizontalTrue to treat the elevator as horizontal.
Returns
*this for chaining.

◆ WithMaximumHeight()

ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithMaximumHeight ( wpi::units::meter_t  height)

Set the maximum (upper hard) height for simulation and soft-limit purposes.

Parameters
heightMaximum height.
Returns
*this for chaining.

◆ WithMechanismPositionConfig()

ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithMechanismPositionConfig ( const MechanismPositionConfig &  mechanismPositionConfig)
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.

Parameters
mechanismPositionConfigThe mechanism's position.
Returns
*this for chaining.

◆ WithMinimumHeight()

ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithMinimumHeight ( wpi::units::meter_t  height)

Set the minimum (lower hard) height for simulation and soft-limit purposes.

Parameters
heightMinimum height.
Returns
*this for chaining.

◆ WithSimColor()

ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithSimColor ( const wpi::util::Color8Bit &  color)

Set the Mechanism2d simulation colour for the elevator ligament (default: orange).

Parameters
colorDesired colour.
Returns
*this for chaining.

◆ WithStages() [1/2]

template<typename... Heights>
requires (std::convertible_to<Heights, wpi::units::meter_t> && ...)
ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithStages ( Heights...  stageHeights)
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.

Parameters
stageHeightsHow 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).
Returns
*this for chaining.
Exceptions
std::invalid_argumentif no height is given, or a height is not positive.

◆ WithStages() [2/2]

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...).

Parameters
stageHeightsHow far each moving stage travels relative to the stage below it, from the stage nearest the fixed stage to the carriage.
Returns
*this for chaining.
Exceptions
std::invalid_argumentif no height is given, or a height is not positive.

◆ WithTelemetryName()

ElevatorConfig & yams::mechanisms::config::ElevatorConfig::WithTelemetryName ( const std::string &  name)

Set the NetworkTables / SmartDashboard name for telemetry.

Parameters
nameTelemetry name string.
Returns
*this for chaining.

The documentation for this class was generated from the following file: