Biorbd Release_1.13.0
Loading...
Searching...
No Matches
Ligament.h
1#ifndef BIORBD_LIGAMENTS_LIGAMENT_H
2#define BIORBD_LIGAMENTS_LIGAMENT_H
3
4#include "biorbdConfig.h"
5
6#include "InternalForces/Compound.h"
7#include "InternalForces/Geometry.h"
8#include "InternalForces/Ligaments/LigamentsEnums.h"
9#include "Utils/Scalar.h"
10
11namespace BIORBD_NAMESPACE {
12namespace utils {
13class Matrix;
14class Vector3d;
15} // namespace utils
16
17namespace internal_forces {
18class Compound;
19namespace ligaments {
21class Ligaments;
22
26class BIORBD_API Ligament : public Compound {
27 friend Ligaments;
28
29 public:
33 Ligament();
34
42 const utils::String& name,
45
54 const utils::String& name,
57 const internal_forces::PathModifiers& pathModifiers);
58
63 Ligament(const Ligament& other);
64
69 Ligament(const std::shared_ptr<Ligament> other);
70
74 virtual ~Ligament();
75
80 void DeepCopy(const Ligament& other);
81
82 // Get and set
83
92 const utils::Scalar& length(
93 rigidbody::Joints& updatedModel,
95 bool updateLigamentKinematics = true);
96
106 const utils::Scalar& velocity(
107 rigidbody::Joints& updatedModel,
110 bool updateLigamentKinematics = true);
111
119 rigidbody::Joints& updatedModel,
121
130 rigidbody::Joints& updatedModel,
133
141 std::vector<utils::Vector3d>& ligamentPointsInGlobal,
142 utils::Matrix& jacoPointsInGlobal);
143
152 std::vector<utils::Vector3d>& ligamentPointsInGlobal,
153 utils::Matrix& jacoPointsInGlobal,
155
161 void setPosition(const internal_forces::Geometry& positions);
162
168 const internal_forces::Geometry& position() const;
169
175
181
190 const std::vector<utils::Vector3d>& ligamentsPointsInGlobal(
191 rigidbody::Joints& updatedModel,
193 bool updateLigamentKinematics = true);
194
200 const std::vector<utils::Vector3d>& ligamentsPointsInGlobal() const;
201
211 virtual const utils::Scalar& force(
212 rigidbody::Joints& updatedModel,
215 bool updateLigamentKinematics = true);
216
225 virtual const utils::Scalar& force(
226 rigidbody::Joints& updatedModel,
228 bool updateLigamentKinematics = true);
229
235 virtual const utils::Scalar& force();
236
241 LIGAMENT_TYPE type() const;
242
247 const utils::Scalar& Fl();
248
253 const utils::Scalar& damping();
254
258 void computeDamping();
259
260 protected:
264 virtual void computeForce();
265
269 virtual void setType();
270
271 std::shared_ptr<internal_forces::Geometry>
274 std::shared_ptr<LIGAMENT_TYPE> m_type;
275 std::shared_ptr<LigamentCharacteristics>
277 std::shared_ptr<utils::Scalar> m_damping;
278
284 virtual utils::Scalar getForce();
285
289 virtual void computeFl() = 0;
290
291 // Attributs intermédiaires lors du calcul de la force
292 std::shared_ptr<utils::Scalar> m_Fl;
293};
294
295} // namespace ligaments
296} // namespace internal_forces
297} // namespace BIORBD_NAMESPACE
298
299#endif // BIORBD_LIGAMENTS_LIGAMENT_H
Class compound is a very generic definition of what a muscle is. It should be the base class of every...
Definition Compound.h:29
const utils::String & name() const
Return the name of the muscle.
Definition Compound.cpp:48
Compound()
Construct muscle compound.
Definition Compound.cpp:11
Class Geometry of the muscle.
Definition Geometry.h:31
Holder of all the path modifiers of a muscle.
void setCharacteristics(const LigamentCharacteristics &characteristics)
Set the ligament characteristics.
Definition Ligament.cpp:230
const utils::Scalar & velocity(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, bool updateLigamentKinematics=true)
Return the velocity of the ligament.
Definition Ligament.cpp:161
const std::vector< utils::Vector3d > & ligamentsPointsInGlobal(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, bool updateLigamentKinematics=true)
Return the ligament points in global reference frame.
Definition Ligament.cpp:216
std::shared_ptr< internal_forces::Geometry > m_position
Definition Ligament.h:272
const internal_forces::Geometry & position() const
Return the position of all the points attached to the ligament (0 being the origin).
Definition Ligament.cpp:148
virtual void computeFl()=0
Compute the Force-length.
std::shared_ptr< utils::Scalar > m_damping
The ligament damping term.
Definition Ligament.h:277
const utils::Scalar & length(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, bool updateLigamentKinematics=true)
Get the length of the ligament.
Definition Ligament.cpp:152
void computeDamping()
Compute the ligament damping.
Definition Ligament.cpp:251
const utils::Scalar & Fl()
Return the Force-Length of the passive element.
Definition Ligament.cpp:241
void DeepCopy(const Ligament &other)
Deep copy of a ligament in new ligament.
Definition Ligament.cpp:93
virtual utils::Scalar getForce()
Function allowing modification of the way the force is computed in computeForce().
Definition Ligament.cpp:211
const LigamentCharacteristics & characteristics() const
Return the ligament characteristics.
Definition Ligament.cpp:237
std::shared_ptr< utils::Scalar > m_Fl
Force-Length.
Definition Ligament.h:292
void updateOrientations(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q)
Update the position of the origin and insertion positions of the ligament.
Definition Ligament.cpp:112
LIGAMENT_TYPE type() const
Return the type of the ligament.
Definition Ligament.cpp:104
virtual void computeForce()
Compute the force of the ligament.
Definition Ligament.cpp:207
void setPosition(const internal_forces::Geometry &positions)
Set the position of all the points attached to the ligament (0 being the origin).
Definition Ligament.cpp:143
const utils::Scalar & damping()
Return the ligament damping (spring force).
Definition Ligament.cpp:246
std::shared_ptr< LigamentCharacteristics > m_characteristics
The ligament characteristics.
Definition Ligament.h:276
virtual const utils::Scalar & force(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, bool updateLigamentKinematics=true)
Return the computed force norm.
Definition Ligament.cpp:173
std::shared_ptr< LIGAMENT_TYPE > m_type
The type of the ligament.
Definition Ligament.h:274
virtual void setType()
Set the type of ligament.
Definition Ligament.cpp:108
This is the core of the musculoskeletal model in biorbd.
Definition Joints.h:48
A wrapper for the Eigen::MatrixXd.
Definition Matrix.h:18
Wrapper around the std::string class with augmented functionality.
Definition String.h:18
Wrapper around Eigen Vector3d and attach it to a parent.
Definition Vector3d.h:27