Class LoggedMechanismRoot2d
java.lang.Object
org.littletonrobotics.junction.mechanism.LoggedMechanismRoot2d
- All Implemented Interfaces:
AutoCloseable
Root Mechanism2d node.
A root is the anchor point of other nodes (such as ligaments).
Do not create objects of this class directly! Obtain instances from the Mechanism2d.getRoot(String, double, double) factory method.
Append other nodes by using append(LoggedMechanismObject2d).
-
Method Summary
Modifier and TypeMethodDescription<T extends LoggedMechanismObject2d>
Tappend(T object) Append a Mechanism object that is based on this one.voidclose()Converts the Mechanism2d into a series of Pose3d objects.getName()Get the name of the root.voidsetPosition(double x, double y) Set the root's position.
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
append
Append a Mechanism object that is based on this one.- Type Parameters:
T- The object type.- Parameters:
object- the object to add.- Returns:
- the object given as a parameter, useful for variable assignments and call chaining.
- Throws:
UnsupportedOperationException- if the object's name is already used - object names must be unique.
-
setPosition
public void setPosition(double x, double y) Set the root's position.- Parameters:
x- new x coordinatey- new y coordinate
-
getName
Get the name of the root.- Returns:
- The name of the root.
-
generate3dMechanism
Converts the Mechanism2d into a series of Pose3d objects. Poses are generated with standard coordinate frame (+x forward, +y left, +z up) and each pivot point is assumed to be at the origin of the model.The order of the poses returned is based on the order of insertion. The first root inserted into the Mechanism2d goes first, and processed in a depth-first manner.
- Returns:
- list of poses for starting from the root point
-