Biorbd
Release_1.13.0
Toggle main menu visibility
Loading...
Searching...
No Matches
PassiveTorqueLinear.cpp
1
#define BIORBD_API_EXPORTS
2
3
#include "InternalForces/PassiveTorques/PassiveTorqueLinear.h"
4
5
#include "RigidBody/GeneralizedCoordinates.h"
6
#include "Utils/Error.h"
7
8
using namespace
BIORBD_NAMESPACE;
9
10
internal_forces::passive_torques::PassiveTorqueLinear::PassiveTorqueLinear
()
11
: internal_forces::passive_torques::
PassiveTorque
(),
12
m_m
(std::make_shared<utils::Scalar>(0)),
13
m_b
(std::make_shared<utils::Scalar>(0)) {
14
setType
();
15
}
16
17
internal_forces::passive_torques::PassiveTorqueLinear::PassiveTorqueLinear
(
18
const
internal_forces::passive_torques::PassiveTorqueLinear
& other)
19
: internal_forces::passive_torques::
PassiveTorque
(other),
20
m_m
(other.
m_m
),
21
m_b
(other.
m_b
) {
22
setType
();
23
}
24
25
internal_forces::passive_torques::PassiveTorqueLinear::PassiveTorqueLinear
(
26
const
utils::Scalar& T0,
27
const
utils::Scalar& slope,
28
size_t
dofIdx)
29
: internal_forces::passive_torques::
PassiveTorque
(dofIdx),
30
m_m
(std::make_shared<utils::Scalar>(slope)),
31
m_b
(std::make_shared<utils::Scalar>(T0)) {
32
setType
();
33
}
34
35
internal_forces::passive_torques::PassiveTorqueLinear::PassiveTorqueLinear
(
36
const
utils::Scalar& T0,
37
const
utils::Scalar& slope,
38
size_t
dofIdx,
39
const
utils::String
& jointName)
40
: internal_forces::passive_torques::
PassiveTorque
(dofIdx, jointName),
41
m_m
(std::make_shared<utils::Scalar>(slope)),
42
m_b
(std::make_shared<utils::Scalar>(T0)) {
43
setType
();
44
}
45
46
internal_forces::passive_torques::PassiveTorqueLinear::~PassiveTorqueLinear
() {}
47
48
internal_forces::passive_torques::PassiveTorqueLinear
49
internal_forces::passive_torques::PassiveTorqueLinear::DeepCopy
()
const
{
50
internal_forces::passive_torques::PassiveTorqueLinear
copy;
51
copy.
DeepCopy
(*
this
);
52
return
copy;
53
}
54
55
void
internal_forces::passive_torques::PassiveTorqueLinear::DeepCopy
(
56
const
internal_forces::passive_torques::PassiveTorqueLinear
& other) {
57
internal_forces::passive_torques::PassiveTorque::DeepCopy
(other);
58
*
m_m
= *other.
m_m
;
59
*
m_b
= *other.
m_b
;
60
}
61
62
utils::Scalar
63
internal_forces::passive_torques::PassiveTorqueLinear::passiveTorque
() {
64
utils::Error::raise
(
65
"passiveTorque for PassiveTorqueLinear must be called with Q"
);
66
}
67
68
utils::Scalar
69
internal_forces::passive_torques::PassiveTorqueLinear::passiveTorque
(
70
const
rigidbody::GeneralizedCoordinates
& Q)
const
{
71
return
Q[
static_cast<
unsigned
int
>
(*m_dofIdx)] * *
m_m
+ *
m_b
;
72
}
73
74
void
internal_forces::passive_torques::PassiveTorqueLinear::setType
() {
75
*
m_type
= internal_forces::passive_torques::TORQUE_TYPE::TORQUE_LINEAR;
76
}
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear
Class PassiveTorqueLinear is a joint passive torque type that linearly evolves Linear passive torque ...
Definition
PassiveTorqueLinear.h:19
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear::DeepCopy
PassiveTorqueLinear DeepCopy() const
Deep copy of the linear passive torque.
Definition
PassiveTorqueLinear.cpp:49
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear::~PassiveTorqueLinear
virtual ~PassiveTorqueLinear()
Destroy the class properly.
Definition
PassiveTorqueLinear.cpp:46
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear::PassiveTorqueLinear
PassiveTorqueLinear()
Construct a linear passive torque.
Definition
PassiveTorqueLinear.cpp:10
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear::setType
virtual void setType()
Set the type of passive torque.
Definition
PassiveTorqueLinear.cpp:74
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear::m_m
std::shared_ptr< utils::Scalar > m_m
Slope.
Definition
PassiveTorqueLinear.h:96
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear::m_b
std::shared_ptr< utils::Scalar > m_b
Torque at zero.
Definition
PassiveTorqueLinear.h:97
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorqueLinear::passiveTorque
virtual utils::Scalar passiveTorque()
Return the passive torque (not available for this type, Q must be provided).
Definition
PassiveTorqueLinear.cpp:63
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorque::DeepCopy
void DeepCopy(const PassiveTorque &other)
Deep copy of passive torque.
Definition
PassiveTorque.cpp:44
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorque::m_type
std::shared_ptr< TORQUE_TYPE > m_type
The type of the passive torque.
Definition
PassiveTorque.h:88
BIORBD_NAMESPACE::internal_forces::passive_torques::PassiveTorque::PassiveTorque
PassiveTorque()
Construct passive torque.
Definition
PassiveTorque.cpp:8
BIORBD_NAMESPACE::rigidbody::GeneralizedCoordinates
Class GeneralizedCoordinates.
Definition
GeneralizedCoordinates.h:15
BIORBD_NAMESPACE::utils::Error::raise
static void raise(const String &message)
Throw an error message.
Definition
Error.cpp:6
BIORBD_NAMESPACE::utils::String
Wrapper around the std::string class with augmented functionality.
Definition
String.h:18
src
InternalForces
PassiveTorques
PassiveTorqueLinear.cpp
Generated by
1.18.0