Class Node#
Defined in File Node.h
Inheritance Relationships#
Base Type#
public Karana::Frame::Frame(Class Frame)
Derived Types#
public Karana::Dynamics::ConstraintNode(Class ConstraintNode)public Karana::Dynamics::HingeNode(Class HingeNode)
Class Documentation#
-
class Node : public Karana::Frame::Frame#
Represents the body node base class.
This class is for nodes attached to PhysicalBody instances. See
Body nodes section for more information on the Node class.
Subclassed by Karana::Dynamics::ConstraintNode, Karana::Dynamics::HingeNode
Public Functions
-
virtual void detach()#
Method to detach the node from the current parent body.
Once detached, the node is put in the pool of detached nodes for possible reuse when new nodes are needed.
-
Node(std::string_view name, const kc::ks_ptr<PhysicalBody> &bd)#
Constructs a Node.
-
inline virtual const std::string &typeString() const noexcept override#
Returns the type string of the SubTree.
- Returns:
The type string.
-
inline const kc::ks_ptr<PhysicalBody> &parentBody() const#
Return the PhysicalBody parent body for the node.
- Returns:
the parent PhysicalBody instance
-
virtual bool isFinalized() const override#
Checks is the params for the object have been initialized.
- Returns:
True if the params have set up.
-
void setBodyToNodeTransform(const km::HomTran &t)#
Set the node’s transform wrt the parent PhysicalBody’s body frame.
This transform defines the Node’s location for an undeformed PhysicalBody parent body. Use Karana::Frame::Frame2Frame queries to find the actual location of a Node after body deformation.
- Parameters:
t – the offset transform
-
km::HomTran getBodyToNodeTransform() const#
Return the node’s transform wrt the parent PhysicalBody’s body frame.
This transform defines the Node’s location for an undeformed PhysicalBody parent body. Use Karana::Frame::Frame2Frame queries to find the actual location of a Node after body deformation.
- Returns:
the node’s offset transform
-
bool isExternalForceNode() const#
Check whether the Node is a force node.
A force node is one that has been designated as one that can apply forces on the body. See Body nodes section for more on force nodes.
- Returns:
true if the node is a force node
-
km::SpatialVector nodeObservedSpatialAccel() const#
Return the node frame observed spatial acceleration of the node wrt the Newtonian frame.
This is the spatial acceleration of the node wrt the Newtonian Karana::Frame::Frame, as observed from and represented in the node frame. Note that this is not and should not be confused with newtoninan_frame.frame2Frame(node).relSpAccel() which returns the Newtoninan frame observed acceleration of the node with respect to the Newtonian frame!
- Returns:
the spatial acceleration vector
-
inline const km::SpatialVector &getSpForce() const#
Get the external spatial force at the node represented in the node frame.
- Returns:
the spatial force vector
-
virtual void setExternalSpForce(const km::SpatialVector &spforce, const kc::ks_ptr<kf::Frame> &ref_frame = nullptr)#
Set the external spatial force at the node represented in the specfied Karana::Frame::Frame frame.
This method resets the specified spatial force to the currenly set spatial force in the node. If no frame is specified, then the spatial force is assumed to be represented in the local node frame. Note that most algorithms will check this node for a spatial force only it has been registered as a force node - so make sure that this has been done.
- Parameters:
spforce – The spatial force value
ref_frame – The reference Karana::Frame::Frame frame for the spatial force values
-
virtual void accumExternalSpForce(const km::SpatialVector &spforce, const kc::ks_ptr<kf::Frame> &ref_frame = nullptr)#
Accumulate the specified external spatial force at the node represented in the specfied Karana::Frame::Frame frame.
Accumulate the external spatial force at the node represented in the specfied frame. This method adds the specified spatial force to the currenly set spatial force in the node. If no frame is specified, then the spatial force is assumed to be represented in the local node frame. Note that most algorithms will check this node for a spatial force only it has been registered as a force node - so make sure that this has been done.
- Parameters:
spforce – The spatial force value
ref_frame – The reference frame for the spatial force values
-
inline const kc::ks_ptr<NodeDeformationProvider> &deformationProvider() const#
Return the <NodeDeformationProvider deformation provider for the node.
- Returns:
the NodeDeformationProvider instance
-
virtual std::string dumpString(const std::string &prefix, const Karana::Core::Base::dumpOptions *options) const override#
Return information about the object.
- Parameters:
prefix – A string to use as prefix for each output line
options – Struct with options to tailor the output
- Returns:
String with the information about the object.
-
kc::ks_ptr<kf::OrientedChainedFrame2Frame> newtonian2NodeF2F() const#
Return the Karana::Frame::Frame2Frame from the Newtonian frame to the body frame.
- Returns:
the Karana::Frame::Frame2Frame instance
Public Static Functions
-
static kc::ks_ptr<Node> lookupOrCreate(kc::ks_ptr<PhysicalBody> bd, const std::string &name, bool force_node = false)#
Factory method to create a Node instance.
This method first checks if a detached node is available for use. If not, the method creates a new Node for the body.
- Parameters:
bd – the physical parent body
name – the name for the node
force_node – if true, the node is marked as one that can apply forces
- Returns:
a Node instance
-
static kc::ks_ptr<Node> lookupOrCreateContact(const kc::ks_ptr<PhysicalBody> &bd, const km::HomTran &T, std::string_view name = "")#
Factory method to create a Node instance that is used for contact forces.
A contact force node is one whose forces will only apply for for one dynamics calculation. Whenever the externals are cleared, these nodes will become inactive. These nodes are always force nodes. If no name is provided, one will be given to them automatically.
This method first checks if a detached node is available for use. If not, the method creates a new Node for the body.
- Parameters:
bd – The physical parent body
T – The transform of the node relative to the body.
- Returns:
a Node instance
Protected Functions
-
void _clearExternals()#
Zero out the external spatial force at the node.
-
void _discard(kc::ks_ptr<kc::Base> &base) override#
Discard a node.
- Parameters:
base – - A base pointer to the node to discard.
Protected Attributes
-
kc::ks_ptr<PhysicalBody> _parent_body = nullptr#
-
km::SpatialVector _node_frame_spforce#
external force being applied in the node frame
-
kc::ks_ptr<kc::DataCache<km::SpatialVector>> _external_force_cache = nullptr#
-
kc::ks_ptr<kf::OrientedChainedFrame2Frame> _newtonian2node_f2f = nullptr#
f2f from the Newtonian frame to this node
-
kc::ks_ptr<kf::OrientedChainedFrame2Frame> _pnode2node_f2f = nullptr#
f2f from the parent body’s pnode to this node
-
kc::ks_ptr<NodeDeformationProvider> _deformation_provider = nullptr#
-
virtual void detach()#