raisim::Tendon
class · #include <raisim/constraints/Tendon.hpp>
A scalar transmission: routed spatial length or a weighted sum of scalar joints. Positive tension shortens the tendon; positive actuation force lengthens it. Geometry is massless. Optional armature adds inertia only along tendon length. World owns tendons and removes them when a referenced object is removed.
Nested classes
structDrive — Actuator acting along the tendon.structJointGradient — Length gradient with respect to one joint of a fixed tendon.structJointTerm — One term of a fixed tendon: length += coefficient * q(joint). Only revolute and prismatic joints are supported.structPathElement — One element of a spatial tendon route. Create elements with the static factory functions.structPointGradient — Length gradient with respect to one world-space application point.structProperties — Passive and limit parameters of a tendon. Forces are in tendon coordinates (N for spatial tendons). Validated by setProperties().structSite — An attachment point on a body (or in the world frame) used by spatial tendon paths.structVisualSegment — A straight piece of the routed tendon in world coordinates.
Public types
Type
enum class TypeSpatial: routed through sites/obstacles (World::addSpatialTendon()). Fixed: weighted sum of joint coordinates (World::addFixedTendon()).
| Enumerator |
|---|
Spatial |
Fixed |
Constructors & destructor
~Tendon
~Tendon()Tendon
Tendon(const Tendon &) = deletePublic member functions
operator=
Tendon &operator=(const Tendon &) = deletegetType
Type getType() constReturns whether this is a spatial or a fixed tendon.
getName
const std::string &getName() constReturns the tendon's unique name.
setName
void setName(const std::string &name)Rename the tendon.
Parameters
| Parameter | Description |
|---|---|
name (in) | new name; must be non-empty and unique among the world's tendons (throws std::invalid_argument otherwise). |
getProperties
const Properties &getProperties() constReturns the current properties. NaN spring bounds are replaced by the reference length.
setProperties
void setProperties(const Properties &properties)Replace the tendon properties and wake the attached bodies.
Parameters
| Parameter | Description |
|---|---|
properties (in) | new properties. Throws std::invalid_argument if invalid. NaN/NaN spring bounds use getReferenceLength(). |
getDrive
const Drive &getDrive() constReturns the current drive settings.
setDrive
void setDrive(const Drive &drive)Replace the drive settings and wake the attached bodies.
Parameters
| Parameter | Description |
|---|---|
drive (in) | must have finite force/targets and nonnegative gains/activation time (throws std::invalid_argument otherwise). |
setTension
void setTension(double tension)Set the feedforward drive force to -tension (positive tension shortens the tendon).
Parameters
| Parameter | Description |
|---|---|
tension (in) | tension (N for spatial tendons), finite |
setActuationForce
void setActuationForce(double force)Set the feedforward drive force (Drive::force); positive lengthens the tendon.
Parameters
| Parameter | Description |
|---|---|
force (in) | force (N for spatial tendons), finite |
setEnabled
void setEnabled(bool enabled)Enable or disable the tendon. A disabled tendon applies no force.
Parameters
| Parameter | Description |
|---|---|
enabled (in) | true to enable |
isEnabled
bool isEnabled() constReturns true if the tendon is enabled.
updateGeometry
void updateGeometry(bool visuals=false)Refresh length, velocity, gradients and (on request) visual segments at current state. Simulation-side: mutates the tendon, so call it only from the thread that steps the world.
Parameters
| Parameter | Description |
|---|---|
visuals (in) | also refresh getVisualSegments() |
computeVisualSegments
void computeVisualSegments(std::vector<VisualSegment> &segments) constRoute segments at the current object poses, written to a caller-owned buffer. Does not touch the tendon's own length, gradients or visual cache; safe for renderers.
Parameters
| Parameter | Description |
|---|---|
segments (out) | cleared and filled with the route segments |
getLength
double getLength() constReturns the tendon length at the last geometry update (m for spatial tendons).
getVelocity
double getVelocity() constReturns the rate of change of the tendon length.
getReferenceLength
double getReferenceLength() constReturns the length when the tendon was created.
getForce
double getForce() constReturns the sum of all tendon force contributions in the last step; positive lengthens the tendon. Last-step signed total tendon force.
getTension
double getTension() constReturns -getForce(); positive when the tendon pulls.
getActuationForce
double getActuationForce() constReturns the drive's contribution to the last-step force.
getLimitForce
double getLimitForce() constReturns the length limits' contribution to the last-step force.
getFrictionForce
double getFrictionForce() constReturns the friction loss's contribution to the last-step force.
getPotentialEnergy
double getPotentialEnergy() constReturns spring energy 0.5*stiffness*e^2, where e is the length's distance outside [springLower, springUpper] (J).
getKineticEnergy
double getKineticEnergy() constReturns armature kinetic energy 0.5*armature*velocity^2 (J).
getPath
const std::vector<PathElement> &getPath() constReturns the route of a spatial tendon (empty for fixed tendons).
getJoints
const std::vector<JointTerm> &getJoints() constReturns the joint terms of a fixed tendon (empty for spatial tendons).
getPointGradients
const std::vector<PointGradient> &getPointGradients() constReturns the length gradients w.r.t. application points from the last geometry update.
getJointGradients
const std::vector<JointGradient> &getJointGradients() constReturns the length gradients w.r.t. the joints of a fixed tendon.
getVisualSegments
const std::vector<VisualSegment> &getVisualSegments() constReturns the segments cached by the last updateGeometry(true) call.