public class Limb extends Pose

Limb is a linear chain of bones, joints, and muscles. Bones are represented by Poses. Joints are represented by HingeJoints. Muscles are represented by Motors. The end of the chain is a Pose called the end effector.

Limbs only perform Forward Kinematics - given the angle of each joint, they calculate the world space position of the end effector. For more sophisticated behavior, use a LimbSolver.

Limb is designed to handle six joints or less.

  • Field Details

  • Constructor Details

    • Limb

      public Limb()
    • Limb

      public Limb(String name)
  • Method Details

    • getEndEffector

      public NodePath<Pose> getEndEffector()
      Returns:
      the end effector pose or null if not set.
    • getMotors

      public List<NodePath<Motor>> getMotors()
    • getNumJoints

      public int getNumJoints()
    • getJoint

      public Motor getJoint(int index)
      Get the motor at the given index.
      Parameters:
      index - the index of the motor to get.
      Returns:
      the motor at the given index.
      Throws:
      IndexOutOfBoundsException - if the index is out of range.
    • getAllJointAngles

      public double[] getAllJointAngles()
    • setJoint

      public void setJoint(int index, Motor newValue)
      Get the motor at the given index.
      Parameters:
      index - the index of the motor to get.
      newValue - the new motor to set.
      Throws:
      IndexOutOfBoundsException - if the index is out of range.
    • setAllJointAngles

      public void setAllJointAngles(double[] values)
    • setAllJointVelocities

      public void setAllJointVelocities(double[] values)
    • 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 Pose
      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 Pose
      Parameters:
      from - the JSON object to read from.
    • getComponents

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