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 Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • append

      public <T extends MechanismObject2d> T append​(T object)
      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 coordinate
      y - new y coordinate
    • getName

      public String getName()