@ThreadSafe public class Link extends LinkageNode
Link node in the MSim model.
See additional description in header doc for Linkage
.
Copyright (C) 2008 Marsette A. Vona, III
Modifier and Type | Class and Description |
---|---|
protected class |
Link.UserSubFrame
Collects properties for a user-added subframe.
|
LinkageNode.ApplyingNodeHandler, LinkageNode.NodeHandler, LinkageNode.SubFrame
Modifier and Type | Field and Description |
---|---|
static float |
AXES_RADIUS_FACTOR
AxesWidget radii relative to LinkageNode.widgetLength |
Joint |
breadcrumb
used in
Controller.analyze() |
protected double[] |
centerOfMass
link or subtree center of mass in link frame, default (0, 0, 0)
|
protected java.util.Set<Joint> |
chainClosures
The chain closure
Joint s whose child is this Link, if any. |
protected java.util.Map<java.lang.String,Joint> |
childJoints
Immediate descendents of this Link in the model tree.
|
static vona.color.ColorScheme |
COM_COLOR_SCHEME
Color scheme for link and subtree CoM
Widget s. |
static float |
COM_WIDGET_ALPHA
alpha for center of mass widgets
|
protected float |
comWidgetRadiusScaleFactor
Scale factor taking mass units to units of
LinkageNode.widgetLength for
the purpose of setting the radii of the center-of-mass widgets. |
private static java.lang.String |
cvsid |
static float |
DEF_COM_WIDGET_RADIUS_SCALE_FACTOR
default for
comWidgetRadiusScaleFactor |
protected boolean |
linkCoMWidgetEnabled
enables for the link and subtree center of mass widgets
|
static java.lang.String |
LW_AXES
WP_LINK values |
static java.lang.String |
LW_LABEL
WP_LINK values |
static java.lang.String |
LW_LINK_COM
WP_LINK values |
static java.lang.String |
LW_SUBFRAME_ROUTES
WP_LINK values |
static java.lang.String |
LW_SUBTREE_COM
WP_LINK values |
protected double |
mass
link or subtree mass, NaN if unset (default)
|
protected Joint |
parentJoint
The tree
Joint leading to this Link. |
protected RootJoint |
rootJoint
The
RootJoint associated with this Link. |
static java.lang.String |
SF_LINK
link frame
|
static float |
SUBFRAME_AXES_RADIUS_FACTOR
AxesWidget radii relative to LinkageNode.widgetLength |
protected double[] |
subtreeCenterOfMass
link or subtree center of mass in link frame, default (0, 0, 0)
|
protected boolean |
subtreeCoMWidgetEnabled
enables for the link and subtree center of mass widgets
|
protected double |
subtreeMass
link or subtree mass, NaN if unset (default)
|
protected vona.math.RX |
tempRX
workspace
|
protected double[] |
tempV3
workspace
|
protected float[] |
tempV3f
workspace
|
protected java.util.Set<Joint> |
unmodifiableChainClosures
unmodifiable view of
chainClosures |
protected java.util.Collection<Joint> |
unmodifiableChildJoints
unmodifiable view of
childJoints |
protected java.util.Set<java.lang.String> |
unmodifiableUserSubFrameNames
unmodifiable view of the key set of
userSubFrames |
protected java.util.Map<java.lang.String,Link.UserSubFrame> |
userSubFrames
Current set of
Link.UserSubFrame s, indexed by name. |
static java.lang.String |
WN_LINK_AXES
Link
Widget names |
static java.lang.String |
WN_LINK_COM
Link
Widget names |
static java.lang.String |
WN_LINK_LABEL
Link
Widget names |
static java.lang.String |
WN_SUBTREE_COM
Link
Widget names |
static java.lang.String |
WP_LINK
Widget property identifying a Link widget |
autoNamed, cmt, DEF_WIDGET_LENGTH, depth, entityClass, explicitlyHidden, explicitlyHighlighted, explicitlyMasked, explicitlyVisible, linkage, name, nextAnonymousWidgetNumber, nodeWidgets, numUserWidgets, propertyMap, SF_CANONICAL, TM_JOINT_TYPE_START, TM_NUM_CLOSURE_JOINTS, TM_NUM_CONSTRAINED_CLOSURE_JOINTS, TM_NUM_DANGLING_JOINTS, TM_NUM_JOINT_WIDGETS, TM_NUM_JOINTS, TM_NUM_LINK_WIDGETS, TM_NUM_LINKAGES, TM_NUM_LINKS, TM_NUM_LOCKED_LINKS, TM_NUM_NODES, TM_NUM_SUPPORTING_TREE_JOINTS, TM_NUM_TREE_JOINTS, TM_NUM_UNCONSTRAINED_CLOSURE_JOINTS, TM_NUM_UNLOCKED_TREE_JOINTS, TM_NUM_WIDGETS, TM_SIZE, unmodifiableWidgets, widgetLength, widgetMap, widgets, widgetsDirty, WP_CACHED_SUBFRAME, WP_EXPLICIT_HIDDEN, WP_EXPLICIT_HIGHLIGHT, WP_EXPLICIT_MASK, WP_EXPLICIT_VISIBLE, WP_FRAME, WP_NAME, WP_NODE, WP_USER_SUBFRAME
Constructor and Description |
---|
Link(Linkage linkage)
covers
Link(Linkage, String) , always auto-named |
Link(Linkage linkage,
java.lang.String name)
Constructs a new Link and adds it to linkage.
|
Modifier and Type | Method and Description |
---|---|
int |
addConnectableJointTypes(java.lang.String name,
Joint.Type... types)
Add one or more entries to the
Link.UserSubFrame.connectableJointTypes set for the indicated user
subframe, consing it if initially null. |
int |
addConnectableSubFrameTypes(java.lang.String name,
java.lang.String... types)
Add one or more entries to the
Link.UserSubFrame.connectableSubFrameTypes set for the indicated user
subframe, consing it if initially null. |
void |
addUserSubFrame(java.lang.String name,
vona.math.RX rx)
Add a user subframe.
|
boolean |
checkName(java.lang.String name)
Extends superclass impl to verify corresp
RootJoint name
unique. |
int |
cullDanglingChainClosures()
cull all chain closures on this Link that have no no parent
|
int |
cullDanglingChildJoints()
cull all child Joints with no children of their own
|
int |
cullDanglingJoints()
|
void |
dumpSubFrames(java.io.PrintStream s)
Dump all available subframes.
|
protected void |
dumpTree(java.lang.String prefix,
java.io.PrintStream s)
|
void |
dumpUserSubFrame(java.lang.String name)
dumpUserSubFrame(String, PrintStream) to System.out |
void |
dumpUserSubFrame(java.lang.String name,
java.io.PrintStream s)
dump details of a user subframe
|
void |
dumpUserSubFrames()
dumpUserSubFrames(PrintStream) to System.out |
void |
dumpUserSubFrames(java.io.PrintStream s)
dump all available user subframes
|
void |
enableLinkCoMWidget(boolean enable)
enable the link center of mass widget
|
void |
enableLinkCoMWidgetRecursively(boolean enable)
enableLinkCoMWidget(boolean) in recursive DFS pre-order from this
node. |
void |
enableSubtreeCoMWidget(boolean enable)
enable the subtree center of mass widget
|
void |
enableSubtreeCoMWidgetRecursively(boolean enable)
enableSubtreeCoMWidget(boolean) in recursive DFS pre-order from this
node. |
double[] |
getCenterOfMass()
covers
getCenterOfMass(double[]) , conses |
double[] |
getCenterOfMass(double[] centerOfMass)
get the location of the center of mass in link frame, default (0,0,0)
|
java.util.Set<Joint> |
getChainClosures()
returns an unmodifiable view of
chainClosures |
LinkageNode |
getChild(java.lang.String name)
this impl covers
getChildJoint(java.lang.String) |
Joint |
getChildJoint(java.lang.String name)
Get the named immediate descendent of this Link, or null if not
found.
|
java.util.Collection<Joint> |
getChildJoints()
returns an unmodifiable view of
childJoints |
java.util.Collection<? extends LinkageNode> |
getChildren()
this impl returns an unmodifiable view of
childJoints |
float |
getCoMWidgetRadiusScaleFactor()
|
Joint.Type[] |
getConnectableJointTypes(java.lang.String name)
Get a copy of the current set of connectable Joint types for the
indicated user subframe name, empty if none, null if
unrestricted.
|
java.lang.String[] |
getConnectableSubFrameTypes(java.lang.String name)
Get a copy of the current set of connectable subframe types for the
indicated user subframe frame, empty if none, null if
unrestricted.
|
Joint |
getJointAttachedToUserSubFrame(java.lang.String name)
Get the
Joint attached to the named user subframe, or null if
none. |
double |
getMass()
get the current link mass or NaN if unset
|
protected java.lang.String |
getNodeWidgetProperty()
Return the
Widget property name that indicates an internal
(i.e. |
LinkageNode |
getParent()
this impl returns
parentJoint |
Joint |
getParentJoint()
returns
parentJoint |
vona.math.RX |
getPose()
getPose(RX) , conses |
vona.math.RX |
getPose(vona.math.RX rx)
Get the pose of this Link relative to the
Linkage.groundLink . |
RootJoint |
getRootJoint()
get a reference to this Link's
RootJoint |
LinkageNode.SubFrame |
getSubFrame(java.lang.String name)
Hook to get or cons the indicated
LinkageNode.SubFrame of this
LinkageNode. |
vona.math.RX |
getSubFrameRX(java.lang.String name,
vona.math.RX rx)
Get the transform taking coordinates in a sub-frame to the canonical
(i.e.
|
double[] |
getSubtreeCenterOfMass()
covers
getSubtreeCenterOfMass(double[]) , conses |
double[] |
getSubtreeCenterOfMass(double[] centerOfMass)
Get the location of the subtree center of mass in link frame, default
(0,0,0).
|
double |
getSubtreeMass()
get
subtreeMass |
java.util.Set<java.lang.String> |
getUserSubFrameNames()
Get a live but unmodifiable view of the set of names of all user
subframes of this link.
|
java.lang.String |
getUserSubFrameType(java.lang.String name)
Get the current
Link.UserSubFrame.type for the indicated user
subframe name. |
boolean |
hasChildren()
check whether this node has any children
|
boolean |
hasSubFrame(java.lang.String name)
Check if the named subframe is present.
|
boolean |
hasTargetPose()
check if a target pose is currently set (see
setTargetPose(vona.math.RX) ) |
boolean |
hasUserSubFrame(java.lang.String name)
check if the named user subname is present
|
java.lang.String |
isConnectableToJoint(java.lang.String name,
Joint joint)
isConnectableToJoint(String, Joint, Link) , no replacing |
java.lang.String |
isConnectableToJoint(java.lang.String name,
Joint joint,
Link replacing)
Check if the user subframe name on this Link is connectable to
the given joint.
|
boolean |
isConnectableToJointType(java.lang.String name,
Joint.Type type)
Check if the user subframe name on this Link is connectable to
a joint with the given type.
|
boolean |
isConnectableToSubFrameType(java.lang.String name,
java.lang.String type)
Check if the user subframe name on this Link is connectable to
a subframe with the given type.
|
boolean |
isGroundLink()
check if this is the
Linkage.groundLink in LinkageNode.linkage |
boolean |
isInternalFrame(java.lang.String name)
Check if frame is an internal (i.e.
|
boolean |
isLinkCoMWidgetEnabled()
check if the link center of mass widget is enabled
|
boolean |
isLocked()
check if this node is locked
|
boolean |
isMassSet()
check if the current link mass is not NaN
|
boolean |
isRootLink()
check if this Link's
parentJoint is its rootJoint |
boolean |
isSubtreeCoMWidgetEnabled()
check if the subtree center of mass widget is enabled
|
boolean |
isSubtreeMassSet()
check if
subtreeMass is not NaN |
boolean |
isUltimateGroundLink()
check if
isGroundLink() and rootJoint has no parent |
boolean |
isUserSubFrameAttached(java.lang.String name)
Check if the indicated user subframe is currently attached to any
Joint.
|
Link |
makeGroundLink()
Ensure this is the
LinkageNode.linkage Linkage.groundLink . |
Link |
makeRootLink()
Ensure that this Link is a root, i.e., that it's
parentJoint
is its rootJoint . |
protected java.lang.String |
makeUniqueChildName(java.lang.String tryName)
Make a unique name for a child
Joint . |
void |
remove()
Remove this node from the
Linkage tree. |
int |
removeConnectableJointTypes(java.lang.String name,
Joint.Type... types)
Remove one or more entries from the
Link.UserSubFrame.connectableJointTypes set for the indicated user
subframe. |
int |
removeConnectableSubFrameTypes(java.lang.String name,
java.lang.String... types)
Remove one or more entries from the
Link.UserSubFrame.connectableSubFrameTypes set for the indicated user
subframe. |
vona.math.RX |
removeUserSubFrame(java.lang.String name)
Remove a user subframe.
|
boolean |
setCenterOfMass(double... centerOfMass)
Set the location of the center of mass in link frame.
|
void |
setCoMWidgetRadiusScaleFactor(float scaleFactor)
|
void |
setCoMWidgetRadiusScaleFactorRecursively(float scaleFactor)
setCoMWidgetRadiusScaleFactor(float) in recursive DFS pre-order from
this node. |
LinkageNode |
setLocked(boolean locked)
lock the state of this node
|
double |
setMass(double mass)
Set the link mass.
|
java.lang.String |
setName(java.lang.String name)
Set the name of this Link.
|
Link |
setPose(Joint joint)
Set the pose of this link as if it were the child of joint.
|
Link |
setPose(Link link)
Set the pose of this Link to be the same as that of link.
|
Link |
setPose(vona.math.RX rx)
Set the pose of this Link relative to the
Linkage.groundLink . |
Link |
setTargetPose(vona.math.RX rx)
Set the target pose of this Link relative to the
Linkage.groundLink . |
void |
setUserSubFrameRX(java.lang.String name,
vona.math.RX rx)
Update the subframe transform of a user subframe.
|
java.lang.String |
setUserSubFrameType(java.lang.String name,
java.lang.String type)
Set the current
Link.UserSubFrame.type for the indicated user
subframe name. |
Joint |
split()
Insert a new
Joint and Link in the model tree between this Link
and its current parent Joint. |
java.lang.String |
toString(boolean details)
returns a short human-readable identifying string for this Link
|
void |
unrestrictConnectableJointTypes(java.lang.String name)
Set
Link.UserSubFrame.connectableJointTypes to null for the
indicated user subframe name, which means unrestricted. |
void |
unrestrictConnectableSubFrameTypes(java.lang.String name)
Set
Link.UserSubFrame.connectableSubFrameTypes to null for the
indicated user subframe name, which means unrestricted. |
double |
unsetMass()
setMass(double) NaN |
Link |
unsetTargetPose()
setTargetPose(vona.math.RX) to null |
void |
updateCMTs()
Update this node's
LinkageNode.cmt based on its parent's LinkageNode.cmt . |
void |
updateCMTsRecursively()
LinkageNode.updateCMTs() in recursive tree DFS pre-order from this node |
protected void |
updateCoMWidget(java.lang.String name,
java.lang.String id,
double mass,
double[] center,
java.awt.Color color)
Called by
updateWidgetsImpl() to handle the link and subtree
center of mass widgets. |
void |
updateSubtreeCoM()
Update
subtreeCenterOfMass and subtreeMass based on
those of this Link's grandchildren (i.e. |
void |
updateSubtreeCoMsRecursively()
updateSubtreeCoM() in recursive tree DFS post-order from this
node. |
protected void |
updateWidgetsImpl()
Hook for lazy
LinkageNode.widgetMap update. |
addWidget, addWidget, addWidget, addWidget, addWidget, addWidget, checkNamePattern, collectTreeMetrics, collectTreeMetrics, compareTo, dump, dump, dumpSubFrames, dumpTree, dumpTree, dumpTreeMetrics, dumpTreeMetrics, enableDBGNormals, enableDBGNormalsRecursively, enableDBGSpheres, enableDBGSpheresRecursively, findImpl, findJoint, findJoint, findJoints, findJoints, findLink, findLink, findLinks, findLinks, findMultipleImpl, findNode, findNode, findNodes, findNodes, getCMT, getCMT, getDepth, getName, getNumUserWidgets, getNumWidgets, getProperty, getSubFrame, getSubFrameCMT, getSubFrameCMT, getSubFrameCMT, getSubFrameCMT, getSubFrameName, getSubFrameRX, getSubFrameRX, getSubFrameRX, getWidget, getWidgetLength, getWidgets, hasDescendant, hasProperty, hasWidgets, isAutoNamed, isExplicitlyHidden, isExplicitlyHighlighted, isExplicitlyMasked, isExplicitlyVisible, isLive, isTreeLeaf, isUserWidget, lock, removeAllWidgets, removeProperty, removeWidget, removeWidget, renameWidget, reparentUserWidgets, reparentUserWidgets, reparentWidget, reparentWidget, reparentWidgetImpl, reparentWidgets, reparentWidgets, setAllTreeJointsToGoal, setAllTreeJointsToHighestPrioritySoftGoal, setAllTreeJointsToPosture, setAllTreeJointsToTarget, setExplicitlyHidden, setExplicitlyHighlighted, setExplicitlyMasked, setExplicitlyVisible, setLockedRecursively, setProperty, setProperty, setWidgetLength, setWidgetLength, setWidgetLengthRecursively, setWidgetLengthRecursively, suppressTreeDump, toString, traverseTree, unlock, updateWidgets, updateWidgetsRecursively
private static final java.lang.String cvsid
public static final java.lang.String WP_LINK
Widget
property identifying a Link widgetpublic static final java.lang.String LW_AXES
WP_LINK
valuespublic static final java.lang.String LW_LABEL
WP_LINK
valuespublic static final java.lang.String LW_LINK_COM
WP_LINK
valuespublic static final java.lang.String LW_SUBTREE_COM
WP_LINK
valuespublic static final java.lang.String LW_SUBFRAME_ROUTES
WP_LINK
valuespublic static final java.lang.String WN_LINK_AXES
Widget
namespublic static final java.lang.String WN_LINK_LABEL
Widget
namespublic static final java.lang.String WN_LINK_COM
Widget
namespublic static final java.lang.String WN_SUBTREE_COM
Widget
namespublic static final float AXES_RADIUS_FACTOR
AxesWidget
radii relative to LinkageNode.widgetLength
public static final float SUBFRAME_AXES_RADIUS_FACTOR
AxesWidget
radii relative to LinkageNode.widgetLength
public static final float DEF_COM_WIDGET_RADIUS_SCALE_FACTOR
comWidgetRadiusScaleFactor
public static final java.lang.String SF_LINK
public static final vona.color.ColorScheme COM_COLOR_SCHEME
Color scheme for link and subtree CoM Widget
s.
public static final float COM_WIDGET_ALPHA
protected Joint parentJoint
The tree Joint
leading to this Link.
Except for the Linkage.groundLink
, Links always have a parent.
Links that are not otherwise parented are automatically re-parented to the
Linkage.groundLink
by their rootJoint
.
See Linkage
class header doc for additional info.
protected java.util.Map<java.lang.String,Joint> childJoints
Immediate descendents of this Link in the model tree.
protected final java.util.Collection<Joint> unmodifiableChildJoints
childJoints
protected java.util.Set<Joint> chainClosures
The chain closure Joint
s whose child is this Link, if any.
Chain closures whose parent is this Link are included in childJoints
.
protected java.util.Set<Joint> unmodifiableChainClosures
chainClosures
protected double mass
protected double subtreeMass
protected double[] centerOfMass
protected double[] subtreeCenterOfMass
protected double[] tempV3
protected float[] tempV3f
protected vona.math.RX tempRX
public Joint breadcrumb
Controller.analyze()
protected float comWidgetRadiusScaleFactor
Scale factor taking mass units to units of LinkageNode.widgetLength
for
the purpose of setting the radii of the center-of-mass widgets.
Initially set from the corresponding value on the LinkageNode.linkage
ground link, which itself defaults to DEF_COM_WIDGET_RADIUS_SCALE_FACTOR
.
protected boolean linkCoMWidgetEnabled
protected boolean subtreeCoMWidgetEnabled
protected java.util.Map<java.lang.String,Link.UserSubFrame> userSubFrames
Current set of Link.UserSubFrame
s, indexed by name.
protected final java.util.Set<java.lang.String> unmodifiableUserSubFrameNames
userSubFrames
public Link(Linkage linkage, java.lang.String name)
Constructs a new Link and adds it to linkage.
The new Link is initially attached to the Linkage.groundLink
through its rootJoint
.
name
- Link name or null to auto-namejava.lang.IllegalArgumentException
- if name is non-null and fails
checkName(java.lang.String)
, in this case the new Link is not added to
linkagepublic Link(Linkage linkage)
Link(Linkage, String)
, always auto-namedpublic java.lang.String setName(java.lang.String name)
Set the name of this Link.
Has no effect if the new name equals the old.
Also sets a corresponding name on rootJoint
(see RootJoint.makeRootJointName(java.lang.String)
).
setName
in class LinkageNode
name
- Link name or null to auto-namejava.lang.IllegalArgumentException
- if name fails checkName(java.lang.String)
,
in this case the name is not changedpublic boolean checkName(java.lang.String name)
Extends superclass impl to verify corresp RootJoint
name
unique.
checkName
in class LinkageNode
public LinkageNode getParent()
parentJoint
getParent
in class LinkageNode
public LinkageNode getChild(java.lang.String name)
getChildJoint(java.lang.String)
getChild
in class LinkageNode
public java.util.Collection<? extends LinkageNode> getChildren()
childJoints
getChildren
in class LinkageNode
public boolean hasChildren()
This impl checks if childJoints
is not empty.
hasChildren
in class LinkageNode
public void updateCMTs()
Update this node's LinkageNode.cmt
based on its parent's LinkageNode.cmt
.
Implementations may also compute and cache other CMT-related state in this call, such as CMTs for sub-frames.
For details on the semantics of CMTs see the Linkage
class
header doc.
updateCMTs
in class LinkageNode
public void updateCMTsRecursively()
LinkageNode.updateCMTs()
in recursive tree DFS pre-order from this node
This impl also {Joint#updateCMTs} on any attached chainClosures
with no parent.
updateCMTsRecursively
in class LinkageNode
public void remove()
Remove this node from the Linkage
tree.
All adjacent Joint endpoints are dangled.
Once a node has been removed it cannot be re-added.
All connected child tree Joint
s must first be disconnected or
converted to chain closures. Any attached dangling Joints are culled, and
any attached connected Joints are dangled.
Removing a ground link other than the ultimate ground is equivalent to
removing its Linkage
.
remove
in class LinkageNode
java.lang.IllegalStateException
- if isUltimateGroundLink()
or if
there are any connected tree child jointspublic int cullDanglingChildJoints()
public int cullDanglingChainClosures()
public int cullDanglingJoints()
public Joint split()
Insert a new Joint
and Link in the model tree between this Link
and its current parent Joint.
The model topology changes from
parent Joint <- this Linkto
parent Joint <- new Link <- new Joint <- this LinkWith the exception that if this was a root link then the new Link is also a root link (which means that its parent Joint will be a different
RootJoint
than the original parent Joint of this Link; otherwise the
parent Joint of the new Link will always be the previous parent Joint of
this Link).
The new Joint is initially locked and Joint.Type.GENERAL
with
identity joint transform, which means that the new Link is initially
coincident with this Link, and that this Link does not change its global
pose.
This Link always retains its current set of child Joints, chain closure Joints, and user widgets.
If this Link was locked then it is unlocked and the new Link is locked instead.
See also Joint.merge(boolean, boolean)
.
java.lang.IllegalStateException
- if isGroundLink()
public boolean isRootLink()
parentJoint
is its rootJoint
public boolean isGroundLink()
Linkage.groundLink
in LinkageNode.linkage
public boolean isUltimateGroundLink()
isGroundLink()
and rootJoint
has no parentpublic Joint getParentJoint()
parentJoint
public Joint getChildJoint(java.lang.String name)
Get the named immediate descendent of this Link, or null if not found.
public java.util.Collection<Joint> getChildJoints()
childJoints
public java.util.Set<Joint> getChainClosures()
chainClosures
public Link makeRootLink()
Ensure that this Link is a root, i.e., that it's parentJoint
is its rootJoint
.
This is very different from makeGroundLink()
.
Has no effect if this Link is already a root. Otherwise, any existing parent joint is made a closure and the root joint is made a tree joint.
The link always holds its absolute pose.
public Link makeGroundLink()
Ensure this is the LinkageNode.linkage
Linkage.groundLink
.
This is very different from makeRootLink()
.
Has no effect if this Link is already the ground link. Otherwise the
behavior depends on whether this is a root link. If not, chains to Joint.invert()
on parentJoint
. If so,
rootJoint
is set to the parent of the root
joint of the prior ground link, which will either be the ground link of
the superlinkage or null if the prior ground link was the ultimate
ground.RootJoint
s that were previously children of the
prior ground link are re-parented to this linkAll links always hold absolute pose.
public Link setTargetPose(vona.math.RX rx)
Set the target pose of this Link relative to the Linkage.groundLink
.
Defers to Joint.setSoftGoal(int, vona.math.RX)
on rootJoint
.
rx
- the target pose, or null to un-setpublic Link unsetTargetPose()
setTargetPose(vona.math.RX)
to nullpublic boolean hasTargetPose()
setTargetPose(vona.math.RX)
)public Link setPose(vona.math.RX rx)
Set the pose of this Link relative to the Linkage.groundLink
.
Defers to Joint.setMobility(vona.math.RX)
on rootJoint
.
public vona.math.RX getPose(vona.math.RX rx)
Get the pose of this Link relative to the Linkage.groundLink
.
Defers to Joint.getMobility(vona.math.RX)
on rootJoint
.
public vona.math.RX getPose()
getPose(RX)
, consespublic Link setPose(Joint joint)
Set the pose of this link as if it were the child of joint.
Defers to Joint.setMobility(vona.math.RX)
on rootJoint
.
public Link setPose(Link link)
Set the pose of this Link to be the same as that of link.
Defers to Joint.setMobility(vona.math.RX)
on rootJoint
.
public LinkageNode setLocked(boolean locked)
This impl sets the state of parentJoint
.
setLocked
in class LinkageNode
public boolean isLocked()
This impl checks the state of parentJoint
.
isLocked
in class LinkageNode
public double setMass(double mass)
Set the link mass.
NaN is equivalent to unsetMass()
.
java.lang.IllegalArgumentException
- if mass is negativepublic double unsetMass()
setMass(double)
NaNpublic double getMass()
public boolean isMassSet()
public boolean setCenterOfMass(double... centerOfMass)
Set the location of the center of mass in link frame.
public double[] getCenterOfMass(double[] centerOfMass)
public double[] getCenterOfMass()
getCenterOfMass(double[])
, consespublic void updateSubtreeCoM()
Update subtreeCenterOfMass
and subtreeMass
based on
those of this Link's grandchildren (i.e. its nearest descendant Links).
public void updateSubtreeCoMsRecursively()
updateSubtreeCoM()
in recursive tree DFS post-order from this
node.
public double[] getSubtreeCenterOfMass(double[] centerOfMass)
Get the location of the subtree center of mass in link frame, default (0,0,0).
public double[] getSubtreeCenterOfMass()
getSubtreeCenterOfMass(double[])
, consespublic double getSubtreeMass()
subtreeMass
public boolean isSubtreeMassSet()
subtreeMass
is not NaNprotected java.lang.String makeUniqueChildName(java.lang.String tryName)
Make a unique name for a child Joint
.
tryName
- the first name to try, or null to generate oneprotected void dumpTree(java.lang.String prefix, java.io.PrintStream s)
LinkageNode.dumpTree(PrintStream)
This impl overrides generic impl to also dump any orphan joints which have this link as their child.
dumpTree
in class LinkageNode
public java.lang.String toString(boolean details)
toString
in class LinkageNode
protected java.lang.String getNodeWidgetProperty()
Return the Widget
property name that indicates an internal
(i.e. non-user) Widget.
This impl returns WP_LINK
.
getNodeWidgetProperty
in class LinkageNode
protected void updateWidgetsImpl()
Hook for lazy LinkageNode.widgetMap
update.
Default impl updates all widgets to current LinkageNode.widgetLength
, sets
their EntityClass.WP_ENTITY_CLASS
, and updates existing dbg
geometry iff enabled.
This impl adds AxesWidget
s for the link and any user subframes,
and link and subtree CoM widgets as necessary.
updateWidgetsImpl
in class LinkageNode
protected void updateCoMWidget(java.lang.String name, java.lang.String id, double mass, double[] center, java.awt.Color color)
Called by updateWidgetsImpl()
to handle the link and subtree
center of mass widgets.
public void setCoMWidgetRadiusScaleFactor(float scaleFactor)
public void setCoMWidgetRadiusScaleFactorRecursively(float scaleFactor)
setCoMWidgetRadiusScaleFactor(float)
in recursive DFS pre-order from
this node.
public float getCoMWidgetRadiusScaleFactor()
public void enableLinkCoMWidget(boolean enable)
public boolean isLinkCoMWidgetEnabled()
public void enableLinkCoMWidgetRecursively(boolean enable)
enableLinkCoMWidget(boolean)
in recursive DFS pre-order from this
node.
public void enableSubtreeCoMWidget(boolean enable)
public boolean isSubtreeCoMWidgetEnabled()
public void enableSubtreeCoMWidgetRecursively(boolean enable)
enableSubtreeCoMWidget(boolean)
in recursive DFS pre-order from this
node.
public void addUserSubFrame(java.lang.String name, vona.math.RX rx)
Add a user subframe.
name
- the name of the user subframe, must be unique in this Linkrx
- the initial transform taking subframe coordinates to link frame
coordinatesjava.lang.IllegalArgumentException
- if name is not uniquepublic vona.math.RX removeUserSubFrame(java.lang.String name)
Remove a user subframe.
java.lang.IllegalStateException
- if any widgets or joints are still
referencing namepublic boolean hasUserSubFrame(java.lang.String name)
public java.util.Set<java.lang.String> getUserSubFrameNames()
Get a live but unmodifiable view of the set of names of all user subframes of this link.
The set is synchronized by Controller.LOCK
.
public void setUserSubFrameRX(java.lang.String name, vona.math.RX rx)
Update the subframe transform of a user subframe.
public Joint getJointAttachedToUserSubFrame(java.lang.String name)
Get the Joint
attached to the named user subframe, or null if
none.
public boolean isUserSubFrameAttached(java.lang.String name)
Check if the indicated user subframe is currently attached to any Joint.
public java.lang.String setUserSubFrameType(java.lang.String name, java.lang.String type)
Set the current Link.UserSubFrame.type
for the indicated user
subframe name.
type
- the new type, must satisfy LinkageNode.checkNamePattern(java.lang.String)
java.lang.IllegalStateException
- if name is currently attached
(see isUserSubFrameAttached(java.lang.String)
)public java.lang.String getUserSubFrameType(java.lang.String name)
Get the current Link.UserSubFrame.type
for the indicated user
subframe name.
public int addConnectableSubFrameTypes(java.lang.String name, java.lang.String... types)
Add one or more entries to the Link.UserSubFrame.connectableSubFrameTypes
set for the indicated user
subframe, consing it if initially null.
types
- the types to add (each may or may not initially be present),
each must satisfy LinkageNode.checkNamePattern(java.lang.String)
java.lang.IllegalStateException
- if name is currently attached
(see isUserSubFrameAttached(java.lang.String)
)public int addConnectableJointTypes(java.lang.String name, Joint.Type... types)
Add one or more entries to the Link.UserSubFrame.connectableJointTypes
set for the indicated user
subframe, consing it if initially null.
types
- the types to add (each may or may not initially be present)java.lang.IllegalStateException
- if name is currently attached
(see isUserSubFrameAttached(java.lang.String)
)public int removeConnectableSubFrameTypes(java.lang.String name, java.lang.String... types)
Remove one or more entries from the Link.UserSubFrame.connectableSubFrameTypes
set for the indicated user
subframe.
Note that if removing all types does not null the set (and make
connection unrestricted), for that see unrestrictConnectableSubFrameTypes(java.lang.String)
.
types
- the types to remove (each may or may not initially be present)java.lang.IllegalStateException
- if name is currently attached
(see isUserSubFrameAttached(java.lang.String)
)public int removeConnectableJointTypes(java.lang.String name, Joint.Type... types)
Remove one or more entries from the Link.UserSubFrame.connectableJointTypes
set for the indicated user
subframe.
Note that if removing all types does not null the set (and make
connection unrestricted), for that see unrestrictConnectableJointTypes(java.lang.String)
.
types
- the types to remove (each may or may not initially be present)java.lang.IllegalStateException
- if name is currently attached
(see isUserSubFrameAttached(java.lang.String)
)public void unrestrictConnectableSubFrameTypes(java.lang.String name)
Set Link.UserSubFrame.connectableSubFrameTypes
to null for the
indicated user subframe name, which means unrestricted.
java.lang.IllegalStateException
- if name is currently attached
(see isUserSubFrameAttached(java.lang.String)
)public void unrestrictConnectableJointTypes(java.lang.String name)
Set Link.UserSubFrame.connectableJointTypes
to null for the
indicated user subframe name, which means unrestricted.
java.lang.IllegalStateException
- if frame is currently attached
(see isUserSubFrameAttached(java.lang.String)
)public java.lang.String[] getConnectableSubFrameTypes(java.lang.String name)
Get a copy of the current set of connectable subframe types for the indicated user subframe frame, empty if none, null if unrestricted.
public Joint.Type[] getConnectableJointTypes(java.lang.String name)
Get a copy of the current set of connectable Joint types for the indicated user subframe name, empty if none, null if unrestricted.
public boolean isConnectableToSubFrameType(java.lang.String name, java.lang.String type)
Check if the user subframe name on this Link is connectable to a subframe with the given type.
public boolean isConnectableToJointType(java.lang.String name, Joint.Type type)
Check if the user subframe name on this Link is connectable to a joint with the given type.
name
- the name of the user subframe on this Link, or null to
indicate connection directly to the link (no subframe)public java.lang.String isConnectableToJoint(java.lang.String name, Joint joint, Link replacing)
Check if the user subframe name on this Link is connectable to the given joint.
This takes into account both the type of joint and its current connection status. Specifically:
Link.UserSubFrame.connectableJointTypes
and that set does not contain the
current type of jointLink.UserSubFrame.connectableJointTypes
.Link.UserSubFrame.type
of each is found
within the Link.UserSubFrame.connectableSubFrameTypes
of the
other (if that set is null then the test also passes).name
- the name of the user subframe on this Link, or null to
indicate connection directly to the link (no subframe)joint
- the joint to check, not nullreplacing
- the link that this link would replace. If specified,
replacing must be currently connected to joint. If
replacing is null then the opposite joint endpoint will be
automatically determined iff joint currently has exactly one
endpointpublic java.lang.String isConnectableToJoint(java.lang.String name, Joint joint)
isConnectableToJoint(String, Joint, Link)
, no replacingpublic void dumpUserSubFrame(java.lang.String name, java.io.PrintStream s)
public void dumpUserSubFrame(java.lang.String name)
dumpUserSubFrame(String, PrintStream)
to System.outpublic void dumpUserSubFrames(java.io.PrintStream s)
public void dumpUserSubFrames()
dumpUserSubFrames(PrintStream)
to System.outpublic vona.math.RX getSubFrameRX(java.lang.String name, vona.math.RX rx)
Get the transform taking coordinates in a sub-frame to the canonical
(i.e. LinkageNode.cmt
) frame of this LinkageNode.
This impl adds handling for user subframes.
getSubFrameRX
in class LinkageNode
name
- the sub-frame or null to imply LinkageNode.SF_CANONICAL
rx
- the transform is written here on return, consing if nullpublic boolean hasSubFrame(java.lang.String name)
Check if the named subframe is present.
Default impl just checks for LinkageNode.SF_CANONICAL
.
This impl checks for SF_LINK
and hasUserSubFrame(java.lang.String)
.
hasSubFrame
in class LinkageNode
public void dumpSubFrames(java.io.PrintStream s)
Dump all available subframes.
Default impl just dumps LinkageNode.SF_CANONICAL
.
This dumps SF_LINK
and user subframes.
dumpSubFrames
in class LinkageNode
public boolean isInternalFrame(java.lang.String name)
Check if frame is an internal (i.e. non-user) subframe.
Default impl checks LinkageNode.SF_CANONICAL
.
This impl extends superclass to also check SF_LINK
.
isInternalFrame
in class LinkageNode
public LinkageNode.SubFrame getSubFrame(java.lang.String name)
Hook to get or cons the indicated LinkageNode.SubFrame
of this
LinkageNode.
Extends superclass impl to handle user subframes.
getSubFrame
in class LinkageNode