Class Limb
java.lang.Object
com.marginallyclever.ro3.node.Node
com.marginallyclever.ro3.node.nodes.pose.Pose
com.marginallyclever.ro3.node.nodes.pose.Limb
Limb
is a linear chain of bones, joints, and muscles. Bones are represented by Pose
s. Joints are
represented by HingeJoint
s. Muscles are represented by Motor
s. The end of the chain is a
Pose
called the end effector.
Limb
s 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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fromJSON
(org.json.JSONObject from) Deserialize this node and its children from a JSON object and its children.double[]
void
getComponents
(List<JPanel> list) Build a Swing Component that represents this Node.getJoint
(int index) Get the motor at the given index.int
void
setAllJointAngles
(double[] values) void
setAllJointVelocities
(double[] values) void
Get the motor at the given index.org.json.JSONObject
toJSON()
Serialize this node and its children to a JSON object and its children.Methods inherited from class com.marginallyclever.ro3.node.nodes.pose.Pose
getLocal, getPosition, getRotationEuler, getRotationIndex, getWorld, setLocal, setPosition, setRotationEuler, setRotationIndex, setWorld
Methods inherited from class com.marginallyclever.ro3.node.Node
addAttachListener, addChild, addChild, addDetachListener, addReadyListener, addRenameListener, findByPath, findChild, findChild, findFirstChild, findFirstSibling, findNodeByID, findParent, findParent, getAbsolutePath, getChildren, getName, getParent, getRootNode, getUniqueID, hasParent, isNameUsedBySibling, removeAttachListener, removeChild, removeDetachListener, removeReadyListener, removeRenameListener, setName, update, witnessProtection
-
Field Details
-
MAX_JOINTS
public static final int MAX_JOINTS- See Also:
-
-
Constructor Details
-
Limb
public Limb() -
Limb
-
-
Method Details
-
getEndEffector
- Returns:
- the end effector pose or null if not set.
-
getMotors
-
getNumJoints
public int getNumJoints() -
getJoint
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
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. -
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. -
getComponents
Description copied from class:Pose
Build a Swing Component that represents this Node.- Overrides:
getComponents
in classPose
- Parameters:
list
- the list to add components to.
-