Biorbd Release_1.13.0
Loading...
Searching...
No Matches
LigamentConstant.cpp
1#define BIORBD_API_EXPORTS
2
3#include "InternalForces/Ligaments/LigamentConstant.h"
4
5#include "InternalForces/Compound.h"
6#include "InternalForces/Geometry.h"
7#include "InternalForces/Ligaments/LigamentCharacteristics.h"
8#include "InternalForces/Ligaments/LigamentsEnums.h"
9#include "InternalForces/PathModifiers.h"
10#include "RigidBody/GeneralizedCoordinates.h"
11#include "RigidBody/GeneralizedVelocity.h"
12#include "RigidBody/Joints.h"
13#include "Utils/Error.h"
14
15using namespace BIORBD_NAMESPACE;
17 : internal_forces::ligaments::Ligament(),
18 m_force(std::make_shared<utils::Scalar>()) {
19 setType();
20}
21
23 const utils::Scalar &force,
24 const utils::String &name,
27 : internal_forces::ligaments::Ligament(name, position, characteristics),
28 m_force(std::make_shared<utils::Scalar>(force)) {
29 setType();
30}
31
33 const utils::Scalar &force,
34 const utils::String &name,
37 const internal_forces::PathModifiers &pathModifiers)
38 : internal_forces::ligaments::Ligament(
39 name,
42 pathModifiers),
43 m_force(std::make_shared<utils::Scalar>(force)) {
44 setType();
45}
46
48 const std::shared_ptr<Ligament> other)
49 : internal_forces::ligaments::Ligament(other) {
50 const std::shared_ptr<internal_forces::ligaments::LigamentConstant>
51 ligament_tp(
52 std::dynamic_pointer_cast<
55 ligament_tp != nullptr, "ligament must be of a constant Type");
56 m_force = ligament_tp->m_force;
57}
58
61 : internal_forces::ligaments::Ligament(other) {
64 other));
65 m_force = ligament_tp.m_force;
66}
67
74
80
82
84 *m_type = internal_forces::ligaments::LIGAMENT_TYPE::LIGAMENT_CONSTANT;
85}
86
const utils::String & name() const
Return the name of the muscle.
Definition Compound.cpp:48
Class Geometry of the muscle.
Definition Geometry.h:31
Holder of all the path modifiers of a muscle.
std::shared_ptr< utils::Scalar > m_force
Force of the ligament applied when l>l0.
LigamentConstant DeepCopy() const
Deep copy of a ligament constant.
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
void DeepCopy(const Ligament &other)
Deep copy of a ligament in new ligament.
Definition Ligament.cpp:93
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
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
static void check(bool cond, const String &message)
Assert that raises the error message if false.
Definition Error.cpp:10
Wrapper around the std::string class with augmented functionality.
Definition String.h:18