Class LoggedMechanismObject2d
java.lang.Object
org.littletonrobotics.junction.mechanism.LoggedMechanismObject2d
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
LoggedMechanismLigament2d
Common base class for all Mechanism2d node types.
To append another node, call append(LoggedMechanismObject2d). Objects that aren't
appended to a published Mechanism2d container are
nonfunctional.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate a new Mechanism node object. -
Method Summary
Modifier and TypeMethodDescriptionfinal <T extends LoggedMechanismObject2d>
Tappend(T object) Append a Mechanism object that is based on this one.voidclose()generate3dMechanism(Pose3d seed) Propogates the mechanism2d down the tree structure.abstract doublegetAngle()Abstract helper function.final StringgetName()Get the name of the object.abstract doubleAbstract helper function.protected abstract voidupdateEntries(NetworkTable table) Update all entries with new ones from a new table.
-
Constructor Details
-
LoggedMechanismObject2d
Create a new Mechanism node object.- Parameters:
name- the node's name, must be unique.
-
-
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.
-
updateEntries
Update all entries with new ones from a new table.- Parameters:
table- the new table.
-
getName
Get the name of the object.- Returns:
- The name of the object.
-
generate3dMechanism
Propogates the mechanism2d down the tree structure.- Parameters:
seed- position to start the calculations at- Returns:
- array list of all poses generated from this point in a depth-first pattern
-
getObject2dRange
public abstract double getObject2dRange()Abstract helper function. A proxy for getLength() with Ligament2d, but would be something else like getRadius() for circular parts if they were to be implemented.- Returns:
- distance in meters
-
getAngle
public abstract double getAngle()Abstract helper function. Should be common to all 2d parts, and assumes a normal xy or xz positive direction of left or up, respectively.- Returns:
- angle in degrees
-