Class MechanismRoot2d
java.lang.Object
edu.wpi.first.wpilibj.smartdashboard.MechanismRoot2d
- All Implemented Interfaces:
AutoCloseable
public final class MechanismRoot2d extends Object implements 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(MechanismObject2d)
.
-
Method Summary
Modifier and Type Method Description <T extends MechanismObject2d>
Tappend(T object)
Append a Mechanism object that is based on this one.void
close()
String
getName()
void
setPosition(double x, double y)
Set the root's position.
-
Method Details
-
close
- Specified by:
close
in 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
Set the root's position.- Parameters:
x
- new x coordinatey
- new y coordinate
-
getName
-