java.lang.Object
com.marginallyclever.ro3.node.Node
com.marginallyclever.ro3.node.nodes.marlinrobotarm.MarlinRobotArm

public class MarlinRobotArm extends Node

MarlinRobotArm converts the state of a robot arm into GCode and back.

In order to work it requires references to:

  • a Limb of no more than six Motors, whose names match those in Marlin;
  • a LimbSolver to calculate the inverse kinematics;
  • an optional Motor for the tool on arm.
  • Field Details

  • Constructor Details

    • MarlinRobotArm

      public MarlinRobotArm()
    • MarlinRobotArm

      public MarlinRobotArm(String name)
  • Method Details

    • toJSON

      public org.json.JSONObject toJSON()
      Description copied from class: Node
      Serialize this node and its children to a JSON object and its children. Classes that override this method should call super.toJSON() first, then add to the object returned.
      Overrides:
      toJSON in class Node
      Returns:
      the JSON object.
    • fromJSON

      public void fromJSON(org.json.JSONObject from)
      Description copied from class: Node
      Deserialize this node and its children from a JSON object and its children. Classes that override this method should call super.fromJSON(). When they do it will trigger the creation of child nodes. The child nodes will then call their own fromJSON() methods.
      Overrides:
      fromJSON in class Node
      Parameters:
      from - the JSON object to read from.
    • getComponents

      public void getComponents(List<JPanel> list)
      Description copied from class: Node
      Build a Swing Component that represents this Node.
      Overrides:
      getComponents in class Node
      Parameters:
      list - the list to add components to.
    • getLimb

      public NodePath<Limb> getLimb()
    • getSolver

      public NodePath<LimbSolver> getSolver()
    • sendGCode

      public void sendGCode(String gcode)

      Send a single gcode command to the robot arm. It will reply by firing a MarlinListener.messageFromMarlin(java.lang.String) event with the String response.

      Parameters:
      gcode - GCode command
    • getTarget

      public Pose getTarget()
      Returns:
      the target pose or null if not set.
    • addMarlinListener

      public void addMarlinListener(MarlinListener editorPanel)
    • removeMarlinListener

      public void removeMarlinListener(MarlinListener editorPanel)
    • setLimb

      public void setLimb(Limb limb)
      Set the limb to be controlled by this instance. limb must be in the same node tree as this instance.
      Parameters:
      limb - the limb to control
    • setSolver

      public void setSolver(LimbSolver solver)
      Set the solver to be used by this instance. solver must be in the same node tree as this instance.
      Parameters:
      solver - the solver to use
    • getReportInterval

      public double getReportInterval()
      Returns:
      the time between reports in seconds
    • setReportInterval

      public void setReportInterval(double seconds)
      Parameters:
      seconds - the time between reports in seconds. Must be >= 0.
    • getGripperMotor

      public NodePath<Motor> getGripperMotor()