Skip to content

raisim::CompliantLengthConstraint ​

class · #include <raisim/constraints/CompliantLengthConstraint.hpp>

Inherits: raisim::LengthConstraint

A length constraint that acts as a linear spring (created by World::addCompliantWire()).

Constructors & destructor ​

CompliantLengthConstraint ​

cpp
CompliantLengthConstraint(
    Object *obj1,
    int localIdx1,
    Vec<3> pos1_b,
    Object *obj2,
    int localIdx2,
    Vec<3> pos2_b,
    double length,
    double stiffness)

Use World::addCompliantWire() instead of constructing it directly.

Parameters

ParameterDescription
obj1 (in)first object
localIdx1 (in)local body index on obj1 (nonnegative)
pos1_b (in)mount position in obj1's body frame
obj2 (in)second object
localIdx2 (in)local body index on obj2 (nonnegative)
pos2_b (in)mount position in obj2's body frame
length (in)rest length (m)
stiffness (in)spring stiffness (N/m), finite and nonnegative. Negative local indices throw std::invalid_argument.

~CompliantLengthConstraint ​

cpp
~CompliantLengthConstraint() override = default

Public member functions ​

getStiffness ​

cpp
double getStiffness() const

Returns Spring stiffness (N/m).

getPotentialEnergy ​

cpp
double getPotentialEnergy() const

Returns Stored spring potential energy (J).

getTension ​

cpp
const Vec<3> &getTension() const

Returns Current tension vector in world frame.

Inherited members ​

From raisim::LengthConstraint: getBody1, getBody2, getDistance, getLength, getLocalIdx1, getLocalIdx2, getName, getNorm, getOb1MountPos, getOb2MountPos, getP1, getP2, getStretch, getStretchType, getTendon, getVisualizationWidth, getWireType, isActive, setName, setStretchType, setVisualizationWidth, StretchType, update, WireType

From raisim::Constraints: getColor, lock, lockMutex, setColor, try_lock, unlock, unlockMutex

RaiSim — physics for robotics and AI.