Biorbd
Release_1.13.0
Toggle main menu visibility
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
15
using namespace
BIORBD_NAMESPACE;
16
internal_forces::ligaments::LigamentConstant::LigamentConstant
()
17
: internal_forces::ligaments::
Ligament
(),
18
m_force
(std::make_shared<utils::Scalar>()) {
19
setType
();
20
}
21
22
internal_forces::ligaments::LigamentConstant::LigamentConstant
(
23
const
utils::Scalar &
force
,
24
const
utils::String
&
name
,
25
const
internal_forces::Geometry
&
position
,
26
const
internal_forces::ligaments::LigamentCharacteristics
&
characteristics
)
27
: internal_forces::ligaments::
Ligament
(
name
,
position
,
characteristics
),
28
m_force
(std::make_shared<utils::Scalar>(
force
)) {
29
setType
();
30
}
31
32
internal_forces::ligaments::LigamentConstant::LigamentConstant
(
33
const
utils::Scalar &
force
,
34
const
utils::String
&
name
,
35
const
internal_forces::Geometry
&
position
,
36
const
internal_forces::ligaments::LigamentCharacteristics
&
characteristics
,
37
const
internal_forces::PathModifiers
&pathModifiers)
38
: internal_forces::ligaments::
Ligament
(
39
name
,
40
position
,
41
characteristics
,
42
pathModifiers),
43
m_force
(std::make_shared<utils::Scalar>(
force
)) {
44
setType
();
45
}
46
47
internal_forces::ligaments::LigamentConstant::LigamentConstant
(
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<
53
internal_forces::ligaments::LigamentConstant
>(other));
54
utils::Error::check
(
55
ligament_tp !=
nullptr
,
"ligament must be of a constant Type"
);
56
m_force
= ligament_tp->m_force;
57
}
58
59
internal_forces::ligaments::LigamentConstant::LigamentConstant
(
60
const
internal_forces::ligaments::Ligament
&other)
61
: internal_forces::ligaments::
Ligament
(other) {
62
const
internal_forces::ligaments::LigamentConstant
&ligament_tp(
63
dynamic_cast<
const
internal_forces::ligaments::LigamentConstant
&
>
(
64
other));
65
m_force
= ligament_tp.
m_force
;
66
}
67
68
internal_forces::ligaments::LigamentConstant
69
internal_forces::ligaments::LigamentConstant::DeepCopy
()
const
{
70
internal_forces::ligaments::LigamentConstant
copy;
71
copy.
DeepCopy
(*
this
);
72
return
copy;
73
}
74
75
void
internal_forces::ligaments::LigamentConstant::DeepCopy
(
76
const
internal_forces::ligaments::LigamentConstant
&other) {
77
internal_forces::ligaments::Ligament::DeepCopy
(other);
78
*
m_force
= *other.
m_force
;
79
}
80
81
internal_forces::ligaments::LigamentConstant::~LigamentConstant
() {}
82
83
void
internal_forces::ligaments::LigamentConstant::setType
() {
84
*
m_type
= internal_forces::ligaments::LIGAMENT_TYPE::LIGAMENT_CONSTANT;
85
}
86
87
void
internal_forces::ligaments::LigamentConstant::computeFl
() {
88
*
m_Fl
= *
m_force
;
89
}
BIORBD_NAMESPACE::internal_forces::Compound::name
const utils::String & name() const
Return the name of the muscle.
Definition
Compound.cpp:48
BIORBD_NAMESPACE::internal_forces::Geometry
Class Geometry of the muscle.
Definition
Geometry.h:31
BIORBD_NAMESPACE::internal_forces::PathModifiers
Holder of all the path modifiers of a muscle.
Definition
PathModifiers.h:18
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentCharacteristics
Class Holds that ligament characteristics.
Definition
LigamentCharacteristics.h:19
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentConstant
Base class for ligament constant.
Definition
LigamentConstant.h:16
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentConstant::m_force
std::shared_ptr< utils::Scalar > m_force
Force of the ligament applied when l>l0.
Definition
LigamentConstant.h:92
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentConstant::DeepCopy
LigamentConstant DeepCopy() const
Deep copy of a ligament constant.
Definition
LigamentConstant.cpp:69
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentConstant::setType
virtual void setType()
Set type to Hill.
Definition
LigamentConstant.cpp:83
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentConstant::~LigamentConstant
virtual ~LigamentConstant()
Destroy class properly.
Definition
LigamentConstant.cpp:81
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentConstant::LigamentConstant
LigamentConstant()
Contruct a constant ligament.
Definition
LigamentConstant.cpp:16
BIORBD_NAMESPACE::internal_forces::ligaments::LigamentConstant::computeFl
virtual void computeFl()
Compute the Force-length.
Definition
LigamentConstant.cpp:87
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament
Base class of all ligament.
Definition
Ligament.h:26
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament::position
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
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament::DeepCopy
void DeepCopy(const Ligament &other)
Deep copy of a ligament in new ligament.
Definition
Ligament.cpp:93
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament::characteristics
const LigamentCharacteristics & characteristics() const
Return the ligament characteristics.
Definition
Ligament.cpp:237
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament::m_Fl
std::shared_ptr< utils::Scalar > m_Fl
Force-Length.
Definition
Ligament.h:292
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament::force
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
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament::Ligament
Ligament()
Construct a ligament.
Definition
Ligament.cpp:20
BIORBD_NAMESPACE::internal_forces::ligaments::Ligament::m_type
std::shared_ptr< LIGAMENT_TYPE > m_type
The type of the ligament.
Definition
Ligament.h:274
BIORBD_NAMESPACE::utils::Error::check
static void check(bool cond, const String &message)
Assert that raises the error message if false.
Definition
Error.cpp:10
BIORBD_NAMESPACE::utils::String
Wrapper around the std::string class with augmented functionality.
Definition
String.h:18
src
InternalForces
Ligaments
LigamentConstant.cpp
Generated by
1.18.0