Package yams.mechanisms.config
Class MechanismPositionConfig
java.lang.Object
yams.mechanisms.config.MechanismPositionConfig
A configuration class for specifying the position and visualization properties of a mechanism relative to a robot in
a 3D coordinate system. This class allows setting and retrieving details such as the mechanism's position relative to
the robot, the robot's maximum dimensions, and the plane in which the mechanism operates.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe planes that the mechanism could be on, used for position calculations. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe height of the robot in meters.The length of the robot in meters.protected MechanismPositionConfig.PlaneThe plane that the mechanism is on, used for position calculations.protected Optional<Translation3d>The translation from the robot to the mechanism (Optional) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMechanismX(Distance length) Converts a given distance in the x-direction to a x-coordinate appropriate for visualizing on a Mechanism2d.Gets the distance in the y-direction appropriate for visualizing on a Mechanism2d, defaults to the given distance.Get the plane that the mechanism is on.Get the relative position of the mechanism to the robot.getWindowXDimension(Distance length) Returns the x dimension of the window in the Mechanism2d for visualization, either the max robot length if set, or twice the given length.getWindowYDimension(Distance length) Returns the y dimension of the window in the Mechanism2d for visualization, either the max robot height if set, or twice the given length.withMaxRobotHeight(Distance robotHeight) Set the height of the robot for visualization purposes.withMaxRobotLength(Distance robotLength) Set the length of the robot for visualization purposes.Set the plane that the mechanism is on, used for position calculations.withRelativePosition(Translation3d robotToMechanism) Set the position of theSmartPositionalMechanismrelative to the robot.
-
Field Details
-
robotToMechanism
The translation from the robot to the mechanism (Optional) -
maxRobotLength
The length of the robot in meters. -
maxRobotHeight
The height of the robot in meters. -
plane
The plane that the mechanism is on, used for position calculations.
-
-
Constructor Details
-
MechanismPositionConfig
public MechanismPositionConfig()
-
-
Method Details
-
withRelativePosition
Set the position of theSmartPositionalMechanismrelative to the robot.- Parameters:
robotToMechanism-Pose3dof theSmartPositionalMechanismrelative to the robot.- Returns:
- The
SmartPositionalMechanism, for easy chaining.
-
withMaxRobotLength
Set the length of the robot for visualization purposes.- Parameters:
robotLength- Length of the robot in meters.- Returns:
- The
SmartPositionalMechanism, for easy chaining.
-
withMaxRobotHeight
Set the height of the robot for visualization purposes.- Parameters:
robotHeight- Height of the robot in meters.- Returns:
- The
SmartPositionalMechanism, for easy chaining.
-
withMovementPlane
Set the plane that the mechanism is on, used for position calculations.- Parameters:
plane- The plane that the mechanism is on. Default is X-Z plane.- Returns:
- The
SmartPositionalMechanism, for easy chaining.
-
getMechanismX
Converts a given distance in the x-direction to a x-coordinate appropriate for visualizing on a Mechanism2d.- Parameters:
length- the distance in the x-direction- Returns:
- the x-coordinate for visualizing on a Mechanism2d
-
getMechanismY
Gets the distance in the y-direction appropriate for visualizing on a Mechanism2d, defaults to the given distance.- Parameters:
y- the default distance in the y-direction- Returns:
- the y-coordinate for visualizing on a Mechanism2d
-
getWindowXDimension
Returns the x dimension of the window in the Mechanism2d for visualization, either the max robot length if set, or twice the given length.- Parameters:
length- the length of the mechanism- Returns:
- the x dimension of the window in the Mechanism2d
-
getWindowYDimension
Returns the y dimension of the window in the Mechanism2d for visualization, either the max robot height if set, or twice the given length.- Parameters:
length- the length of the mechanism- Returns:
- the y dimension of the window in the Mechanism2d
-
getRelativePosition
Get the relative position of the mechanism to the robot.- Returns:
Translation3drepresenting the relative position. Defaults to a zero translation if not set.
-
getMovementPlane
Get the plane that the mechanism is on.- Returns:
- The
MechanismPositionConfig.Planethat the mechanism is on.
-