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

#include <MechanismPositionConfig.hpp>

Public Types

enum class  Plane { XZ , YZ , XY }
 

Public Member Functions

 MechanismPositionConfig ()=default
 
MechanismPositionConfig & WithRelativePosition (const wpi::math::Translation3d &robotToMechanism)
 
MechanismPositionConfig & WithRelativePosition (const wpi::math::Transform3d &robotToMechanism)
 
MechanismPositionConfig & WithMovementPlane (Plane plane)
 
MechanismPositionConfig & WithParent (std::function< wpi::math::Pose3d()> parentPose)
 
std::optional< wpi::math::Translation3d > GetRelativePosition () const
 
Plane GetMovementPlane () const
 
wpi::math::Pose3d GetMountPose () const
 
wpi::math::Pose3d GetRotatedPose (wpi::units::radian_t angle) const
 
wpi::math::Pose3d GetTranslatedPose (wpi::units::meter_t distance, wpi::units::radian_t angle) const
 
wpi::math::Rotation3d RotationInPlane (wpi::units::radian_t angle) const
 

Detailed Description

Where a mechanism is on the robot, for each mechanism's GetPose3d(): where it is mounted, how it is turned there, the plane it moves in, and optionally the mechanism it is mounted on, such as an arm on an elevator's carriage.

position.WithRelativePosition(wpi::math::Translation3d{0.2_m, wpi::units::meter_t{0}, 0.3_m}) // 20 cm forward, 30 cm up
Definition MechanismPositionConfig.hpp:31
MechanismPositionConfig & WithRelativePosition(const wpi::math::Translation3d &robotToMechanism)
Definition MechanismPositionConfig.hpp:51
MechanismPositionConfig & WithMovementPlane(Plane plane)
Definition MechanismPositionConfig.hpp:76

Member Enumeration Documentation

◆ Plane

The planes that the mechanism could move in.

Enumerator
XZ 

X-Z plane: forward and up. The default.

YZ 

Y-Z plane: left and up.

XY 

X-Y plane: forward and left, such as a turret.

Constructor & Destructor Documentation

◆ MechanismPositionConfig()

yams::mechanisms::config::MechanismPositionConfig::MechanismPositionConfig ( )
default

Member Function Documentation

◆ GetMountPose()

wpi::math::Pose3d yams::mechanisms::config::MechanismPositionConfig::GetMountPose ( ) const
inline

Where the mechanism is mounted: its parent's pose, or the robot's origin, moved and turned by its relative position.

◆ GetMovementPlane()

Plane yams::mechanisms::config::MechanismPositionConfig::GetMovementPlane ( ) const
inline

Get the plane that the mechanism moves in.

◆ GetRelativePosition()

std::optional< wpi::math::Translation3d > yams::mechanisms::config::MechanismPositionConfig::GetRelativePosition ( ) const
inline

Get the translation from the robot, or from the parent, to the mechanism, if set.

◆ GetRotatedPose()

wpi::math::Pose3d yams::mechanisms::config::MechanismPositionConfig::GetRotatedPose ( wpi::units::radian_t  angle) const
inline

The pose of a part that turns about the axis normal to the movement plane, such as an arm or a pivot, at an angle. At 0 it points along +X in the XZ and XY planes, and along +Y in the YZ plane, and a positive angle turns it toward +Z in the XZ and YZ planes, and toward +Y in the XY plane.

Parameters
angleThe angle it is turned to.
Returns
Its pose: where it is mounted, turned by the angle.

◆ GetTranslatedPose()

wpi::math::Pose3d yams::mechanisms::config::MechanismPositionConfig::GetTranslatedPose ( wpi::units::meter_t  distance,
wpi::units::radian_t  angle 
) const
inline

The pose of a part that slides along the movement plane, such as an elevator's carriage.

Parameters
distanceHow far it has slid from where it is mounted.
angleThe direction it slides in, in the movement plane: 0 along +X (+Y in the YZ plane), 90 degrees along +Z (+Y in the XY plane).
Returns
Its pose: where it is mounted, moved by the distance, and not turned.

◆ RotationInPlane()

wpi::math::Rotation3d yams::mechanisms::config::MechanismPositionConfig::RotationInPlane ( wpi::units::radian_t  angle) const
inline

The rotation of a part turned by an angle about the axis normal to the movement plane.

Parameters
angleThe angle.
Returns
The rotation.

◆ WithMovementPlane()

MechanismPositionConfig & yams::mechanisms::config::MechanismPositionConfig::WithMovementPlane ( Plane  plane)
inline

Set the plane that the mechanism moves in.

Parameters
planeThe plane. Default is the X-Z plane.
Returns
*this for chaining.

◆ WithParent()

MechanismPositionConfig & yams::mechanisms::config::MechanismPositionConfig::WithParent ( std::function< wpi::math::Pose3d()>  parentPose)
inline

Mount the mechanism on another, such as an arm on an elevator's carriage, so it moves with it. The mechanism's relative position is then from the parent's pose, rather than from the robot.

Parameters
parentPoseThe pose the mechanism is mounted on, such as the elevator's GetPose3d().
Returns
*this for chaining.

◆ WithRelativePosition() [1/2]

MechanismPositionConfig & yams::mechanisms::config::MechanismPositionConfig::WithRelativePosition ( const wpi::math::Transform3d &  robotToMechanism)
inline

Set where the mechanism is mounted, relative to the robot, or to its parent, and how it is turned there. The mechanism's pose is worked out from here: an arm's or pivot's axis, an elevator's carriage at zero height, or a flywheel's axle.

Parameters
robotToMechanismTransform from the robot, or from its parent, to the mechanism.
Returns
*this for chaining.

◆ WithRelativePosition() [2/2]

MechanismPositionConfig & yams::mechanisms::config::MechanismPositionConfig::WithRelativePosition ( const wpi::math::Translation3d &  robotToMechanism)
inline

Set where the mechanism is mounted, relative to the robot, or to its parent.

Parameters
robotToMechanismTranslation from the robot, or from its parent, to the mechanism.
Returns
*this for chaining.

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