Class ConstraintNode#

Inheritance Relationships#

Base Type#

Class Documentation#

class ConstraintNode : public Karana::Dynamics::Node#

This class is used by LoopConstraintBase loop constraints as attachment body nodes.

ConstraintNodes are always force nodes, but do not allow the accumulation of forces. The node constraint forces are computed automatically by dynamics algorithms such as Karana::Dynamics::Algorithms::evalForwardDynamics(). See the

hinge_loop_constraints_sec section for more on constraint nodes.

Public Functions

inline ConstraintNode(std::string_view name, kc::ks_ptr<PhysicalBody> bd)#

Constructor.

This method first checks if a detached constraint node is available for use. If not, the method creates a new ConstraintNode for the body.

Parameters:
  • name – the name for the node

  • bd – the physical parent body

kc::ks_ptr<LoopConstraintBase> loopConstraint() const#

Return the loop constraint using this constraint node.

Returns:

the loop constraint using this node.

Public Static Functions

static kc::ks_ptr<ConstraintNode> lookupOrCreate(std::string_view name, kc::ks_ptr<PhysicalBody> bd)#

Factory method to create a ConstraintNode instance.

This method first checks if a detached constraint node is available for use. If not, the method creates a new ConstraintNode for the body.

Parameters:
  • bd – the physical parent body

  • name – the name for the node

Returns:

a ConstraintNode instance

Protected Functions

virtual void detach() override#

detach the node from the current parent body, and put in the pool of detached nodes for possible reuse

virtual void setExternalSpForce(const km::SpatialVector &spforce, const kc::ks_ptr<kf::Frame> &ref_frame = nullptr) override#

Method to directly set the external force at the node.

Making this method protected since the constraint forces at the nodes are computed algorithmically by methods such as Karana::Dynamics::Algorithms::evalForwardDynamics()

Parameters:
  • spforce – the external force value

  • ref_frame – the frame in which the spforce is represented

void _discard(kc::ks_ptr<kc::Base> &base) override#

Discard a constraint node.

Parameters:

base – - A base pointer to the constraint node to discard.

Protected Attributes

kc::ks_ptr<LoopConstraintBase> _loop_constraint = nullptr#

loop constraint that this constraint node is being used by