Class SpringDamper#
Defined in File SpringDamper.h
Inheritance Relationships#
Base Type#
public Karana::Models::KModel< SpringDamper, SpringDamperParams >(Template Class KModel)
Class Documentation#
-
class SpringDamper : public Karana::Models::KModel<SpringDamper, SpringDamperParams>#
Adds a spring-damper between two nodes.
Public Functions
-
SpringDamper(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::Node> nd1, const kc::ks_ptr<kd::Node> nd2)#
Constructor. The SpringDamper model applies an equal and opposing force to two nodes based on their current distance apart.
- Parameters:
name – The name of the model.
sp – The StatePropagator to register this model with.
nd1 – The first node in the spring damper model.
nd2 – The second node in the spring damper model.
-
~SpringDamper()#
Destructor for SpringDamper.
-
void preDeriv(const km::Ktime &t, const km::Vec &x)#
Calculate and apply the spring/damper force.
- Parameters:
t – Current time. Not used.
x – Current state. Not used.
-
std::vector<kc::id_t> getNodeIds()#
Get node IDs for DataStruct.
This method retrieves the IDs of the two nodes. This is designed primarily for use with the SpringDamperDS DataStruct.
- Returns:
Nodes’ IDs.
-
double getPositionError() const#
Get the signed length offset from unsprung length.
- Returns:
The error
-
const km::Vec3 &getVelocityError() const#
Get the relative linear velocity.
- Returns:
The relative velocity
-
double getStiffnessForce() const#
Get the signed scalar force due to stiffness.
- Returns:
The force
-
const km::Vec3 &getDampingForce() const#
Get the linear force due to damping.
- Returns:
The force
-
const km::Vec3 &getTotalForce() const#
Get the overall spring force.
- Returns:
The force
-
const kc::ks_ptr<kd::Node> &sourceNode() const#
Get the first node of the spring-damper.
- Returns:
The node
-
const kc::ks_ptr<kd::Node> &targetNode() const#
Get the second node of the spring-damper.
- Returns:
The node
Public Static Functions
-
static kc::ks_ptr<SpringDamper> create(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::Node> nd1, const kc::ks_ptr<kd::Node> nd2)#
Constructor. The SpringDamper model applies an equal and opposing force to two nodes based on their current distance apart.
- Parameters:
name – The name of the model.
sp – The StatePropagator to register this model with.
nd1 – The first node in the spring damper model.
nd2 – The second node in the spring damper model.
- Returns:
A ks_ptr to the newly created instance of the SpringDamper model.
-
SpringDamper(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::Node> nd1, const kc::ks_ptr<kd::Node> nd2)#