Class MechanismObject2d
java.lang.Object
edu.wpi.first.wpilibj.smartdashboard.MechanismObject2d
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
MechanismLigament2d
public abstract class MechanismObject2d extends Object implements AutoCloseable
Common base class for all Mechanism2d node types.
To append another node, call append(MechanismObject2d)
. Objects that aren't appended
to a published Mechanism2d
container are nonfunctional.
- See Also:
Mechanism2d
-
Constructor Summary
Constructors Modifier Constructor Description protected
MechanismObject2d(String name)
Create a new Mechanism node object. -
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()
protected abstract void
updateEntries(NetworkTable table)
Update all entries with new ones from a new table.
-
Constructor Details
-
MechanismObject2d
Create a new Mechanism node object.- Parameters:
name
- the node's name, must be unique.
-
-
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.
-
updateEntries
Update all entries with new ones from a new table.- Parameters:
table
- the new table.
-
getName
-