Package org.robwork.sdurw
Class MovableFramePtr
- java.lang.Object
-
- org.robwork.sdurw.MovableFramePtr
-
public class MovableFramePtr extends java.lang.Object
Ptr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description MovableFramePtr()
Default constructor yielding a NULL-pointer.MovableFramePtr(long cPtr, boolean cMemoryOwn)
MovableFramePtr(MovableFrame ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MovableFrame
__ref__()
Dereferencing operator.void
attachTo(Frame parent, State state)
Move a frame within the tree.
The frame frame is detached from its parent and reattached to
parent.void
delete()
MovableFrame
deref()
The pointer stored in the object.boolean
equals(MovableFrame p)
Transform3Dd
fTf(Frame to, State state)
Get the transform of other frame relative to this frame.
StateCachePtr
getCache(State state)
Get the cache.FrameVector
getChildren(State state)
Iterator pair for all children of the frame.static long
getCPtr(MovableFramePtr obj)
Frame
getDafParent(State state)
The dynamically attached parent or NULL if the frame is not a
DAF.VectorDouble
getDataVector(State state)
An array of length size() containing the values for
the state data.
It is OK to call this method also for a StateData with zero size.
StateCachePtr
getDefaultCache()
Get default cache.MovableFrame
getDeref()
Member access operator.int
getDOF()
The number of degrees of freedom (dof) of the frame.
The dof is the number of joint values that are used for controlling
the frame.
Given a set joint values of type State, the getDof() number of joint
values for the frame can be read and written with State::getQ() and
State::setQ().
int
getID()
An integer ID for the StateData.
IDs are assigned to the state data upon insertion State.
StateData that are not in a State have an ID of -1.
StateData present in different trees may have identical IDs.
IDs are used for the efficient implementation of State.java.lang.String
getName()
The name of the state data.
Frame
getParent()
The parent of the frame or NULL if the frame is a DAF.Frame
getParent(State state)
Returns the parent of the frame
If no static parent exists it look for at DAF parent.PropertyMap
getPropertyMap()
Miscellaneous properties of the frame.
The property map of the frame is provided to let the user store
various settings for the frame.StateStructure
getStateStructure()
Get the state structure.Transform3Dd
getTransform(State state)
The transform of the frame relative to its parent.
The transform is calculated for the joint values of state.
The exact implementation of getTransform() depends on the type of
frame.boolean
hasCache()
Check is state data includes a cache.boolean
isDAF()
Test if this frame is a Dynamically Attachable Frame
boolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipvoid
moveTo(Transform3Dd transform, Frame refframe, State state)
Changes the transform in the state, such that the movable frame is located in the
transform which is described relative to refframevoid
moveTo(Transform3Dd transform, State state)
Changes the transform in the state, such that the movable frame is located in the
transform which is described relative to world.void
multiplyTransform(Transform3Dd parent, State state, Transform3Dd result)
Post-multiply the transform of the frame to the parent transform.
The transform is calculated for the joint values of state.
The exact implementation of getTransform() depends on the type of
frame.void
setCache(StateCachePtr cache, State state)
Set the cache values.void
setData(State state, double[] vals)
Assign for state data the size() of values of the array
vals.
The array vals must be of length at least size().
void
setTransform(Transform3Dd transform, State state)
Sets the transform in the state.int
size()
The number of doubles allocated by this StateData in
each State object.
Transform3Dd
wTf(State state)
Get the transform relative to world.
-
-
-
Constructor Detail
-
MovableFramePtr
public MovableFramePtr(long cPtr, boolean cMemoryOwn)
-
MovableFramePtr
public MovableFramePtr()
Default constructor yielding a NULL-pointer.
-
MovableFramePtr
public MovableFramePtr(MovableFrame ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(MovableFramePtr obj)
-
delete
public void delete()
-
deref
public MovableFrame deref()
The pointer stored in the object.
-
__ref__
public MovableFrame __ref__()
Dereferencing operator.
-
getDeref
public MovableFrame getDeref()
Member access operator.
-
equals
public boolean equals(MovableFrame p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
setTransform
public void setTransform(Transform3Dd transform, State state)
Sets the transform in the state. The transform is relative to the
MovableFrame's parent frame.- Parameters:
transform
- [in] transform to set. the transform is described relative to parent framestate
- [out] state into which to set the transform
-
moveTo
public void moveTo(Transform3Dd transform, State state)
Changes the transform in the state, such that the movable frame is located in the
transform which is described relative to world.- Parameters:
transform
- [in] transform to set. transform is described relative to world framestate
- [out] state into which to set the transform
-
moveTo
public void moveTo(Transform3Dd transform, Frame refframe, State state)
Changes the transform in the state, such that the movable frame is located in the
transform which is described relative to refframe- Parameters:
transform
- [in] transform to set. transform is described relative to refframerefframe
- [in] the reference frame.state
- [out] state into which to set the transform
-
multiplyTransform
public void multiplyTransform(Transform3Dd parent, State state, Transform3Dd result)
Post-multiply the transform of the frame to the parent transform.
The transform is calculated for the joint values of state.
The exact implementation of getTransform() depends on the type of
frame. See for example RevoluteJoint and PrismaticJoint.
- Parameters:
parent
- [in] The world transform of the parent frame.state
- [in] Joint values for the forward kinematics tree.result
- [in] The transform of the frame in the world frame.
-
getTransform
public Transform3Dd getTransform(State state)
The transform of the frame relative to its parent.
The transform is calculated for the joint values of state.
The exact implementation of getTransform() depends on the type of
frame. See for example RevoluteJoint and PrismaticJoint.
- Parameters:
state
- [in] Joint values for the forward kinematics tree.
- Returns:
- The transform of the frame relative to its parent.
-
getPropertyMap
public PropertyMap getPropertyMap()
Miscellaneous properties of the frame.
The property map of the frame is provided to let the user store
various settings for the frame. The settings are typically loaded
from setup files.
The low-level manipulations of the property map can be cumbersome. To
ease these manipulations, the PropertyAccessor utility class has been
provided. Instances of this class are provided for a number of common
settings, however it is undecided if these properties are a public
part of RobWork.
- Returns:
- The property map of the frame.
-
getDOF
public int getDOF()
The number of degrees of freedom (dof) of the frame.
The dof is the number of joint values that are used for controlling
the frame.
Given a set joint values of type State, the getDof() number of joint
values for the frame can be read and written with State::getQ() and
State::setQ().
- Returns:
- The number of degrees of freedom of the frame.
-
getParent
public Frame getParent()
The parent of the frame or NULL if the frame is a DAF.
-
getParent
public Frame getParent(State state)
Returns the parent of the frame
If no static parent exists it look for at DAF parent. If such
does not exists either it returns NULL.
- Parameters:
state
- [in] the state to consider- Returns:
- the parent
-
getDafParent
public Frame getDafParent(State state)
The dynamically attached parent or NULL if the frame is not a
DAF.
-
attachTo
public void attachTo(Frame parent, State state)
Move a frame within the tree.
The frame frame is detached from its parent and reattached to
parent. The frames frame and parent must both belong to the
same kinematics tree.
Only frames with no static parent (see getParent()) can be moved.
- Parameters:
parent
- [in] The frame to attach frame to.state
- [inout] The state to which the attachment is written.
-
isDAF
public boolean isDAF()
Test if this frame is a Dynamically Attachable Frame
- Returns:
- true if this frame is a DAF, false otherwise
-
wTf
public Transform3Dd wTf(State state)
Get the transform relative to world.
- Parameters:
state
- [in] the state.- Returns:
- transform relative to world.
-
fTf
public Transform3Dd fTf(Frame to, State state)
Get the transform of other frame relative to this frame.
- Parameters:
to
- [in] the other framestate
- [in] the state.- Returns:
- transform of frame to relative to this frame.
-
getChildren
public FrameVector getChildren(State state)
Iterator pair for all children of the frame.
-
getID
public int getID()
An integer ID for the StateData.
IDs are assigned to the state data upon insertion State.
StateData that are not in a State have an ID of -1.
StateData present in different trees may have identical IDs.
IDs are used for the efficient implementation of State. Normally,
you should not make use of StateData IDs yourself.
- Returns:
- An integer ID for the frame.
-
getName
public java.lang.String getName()
The name of the state data.
- Returns:
- The name of the state data.
-
size
public int size()
The number of doubles allocated by this StateData in
each State object.
- Returns:
- The number of doubles allocated by the StateData
-
getDataVector
public VectorDouble getDataVector(State state)
An array of length size() containing the values for
the state data.
It is OK to call this method also for a StateData with zero size.
- Parameters:
state
- [in] The state containing the StateData values.
- Returns:
- The values for the frame.
-
setData
public void setData(State state, double[] vals)
Assign for state data the size() of values of the array
vals.
The array vals must be of length at least size().
- Parameters:
state
- [inout] The state to which vals are written.
vals
- [in] The joint values to assign.
setData() and getData() are related as follows:
data.setData(state, q_in); const double* q_out = data.getData(state); for (int i = 0; i data.getDOF(); i++) q_in[i] == q_out[i];
-
hasCache
public boolean hasCache()
Check is state data includes a cache.- Returns:
- true if cache, false otherwise.
-
getCache
public StateCachePtr getCache(State state)
Get the cache.- Parameters:
state
- [in] the state.- Returns:
- the cache.
-
getDefaultCache
public StateCachePtr getDefaultCache()
Get default cache.- Returns:
- the cache.
-
setCache
public void setCache(StateCachePtr cache, State state)
Set the cache values.- Parameters:
cache
- [in] the cache.state
- [in/out] state updated with new cache.
-
getStateStructure
public StateStructure getStateStructure()
Get the state structure.- Returns:
- the state structure.
-
-