Biorbd
Release_1.13.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Actuator.cpp
1
#define BIORBD_API_EXPORTS
2
#include "InternalForces/Actuators/Actuator.h"
3
4
#include "Utils/Error.h"
5
#include "Utils/String.h"
6
7
using namespace
BIORBD_NAMESPACE;
8
9
internal_forces::actuator::Actuator::Actuator
()
10
:
m_type
(
11
std::make_shared<internal_forces::actuator::TYPE>(
12
internal_forces::actuator::TYPE::NO_TYPE)),
13
m_direction
(std::make_shared<int>(0)),
14
m_jointName
(std::make_shared<utils::String>(
""
)),
15
m_dofIdx
(std::make_shared<size_t>(-1)) {}
16
17
internal_forces::actuator::Actuator::Actuator
(
18
const
internal_forces::actuator::Actuator
&other)
19
:
m_type
(other.
m_type
),
20
m_direction
(other.
m_direction
),
21
m_jointName
(other.
m_jointName
),
22
m_dofIdx
(other.
m_dofIdx
) {}
23
24
internal_forces::actuator::Actuator::Actuator
(
int
direction
,
size_t
dofIdx)
25
:
m_type
(
26
std::make_shared<internal_forces::actuator::TYPE>(
27
internal_forces::actuator::TYPE::NO_TYPE)),
28
m_direction
(std::make_shared<int>(
direction
)),
29
m_jointName
(std::make_shared<utils::String>(
""
)),
30
m_dofIdx
(std::make_shared<size_t>(dofIdx)) {}
31
32
internal_forces::actuator::Actuator::Actuator
(
33
int
direction
,
34
size_t
dofIdx,
35
const
utils::String
&jointName)
36
:
m_type
(
37
std::make_shared<internal_forces::actuator::TYPE>(
38
internal_forces::actuator::TYPE::NO_TYPE)),
39
m_direction
(std::make_shared<int>(
direction
)),
40
m_jointName
(std::make_shared<utils::String>(jointName)),
41
m_dofIdx
(std::make_shared<size_t>(dofIdx)) {
42
utils::Error::check
(
43
*
m_direction
== -1 || *
m_direction
== 1,
"Direction should be -1 or 1"
);
44
}
45
46
internal_forces::actuator::Actuator::~Actuator
() {}
47
48
void
internal_forces::actuator::Actuator::DeepCopy
(
49
const
internal_forces::actuator::Actuator
&other) {
50
*
m_type
= *other.
m_type
;
51
*
m_direction
= *other.
m_direction
;
52
*
m_jointName
= *other.
m_jointName
;
53
*
m_dofIdx
= *other.
m_dofIdx
;
54
}
55
56
size_t
internal_forces::actuator::Actuator::index
()
const
{
return
*
m_dofIdx
; }
57
58
int
internal_forces::actuator::Actuator::direction
()
const
{
59
return
*
m_direction
;
60
}
61
62
internal_forces::actuator::TYPE
internal_forces::actuator::Actuator::type
()
63
const
{
64
return
*
m_type
;
65
}
BIORBD_NAMESPACE::internal_forces::actuator::Actuator
Class Actuator.
Definition
Actuator.h:21
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::m_jointName
std::shared_ptr< utils::String > m_jointName
Name of the parent joint.
Definition
Actuator.h:94
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::DeepCopy
void DeepCopy(const Actuator &other)
Deep copy of actuator.
Definition
Actuator.cpp:48
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::m_direction
std::shared_ptr< int > m_direction
The direction of the actuator (+1 or -1).
Definition
Actuator.h:92
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::type
TYPE type() const
Return the type of the actuator.
Definition
Actuator.cpp:62
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::direction
int direction() const
Return the direction of the actuator.
Definition
Actuator.cpp:58
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::~Actuator
virtual ~Actuator()
Destroy class properly.
Definition
Actuator.cpp:46
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::m_type
std::shared_ptr< TYPE > m_type
The type of the actuator.
Definition
Actuator.h:90
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::index
size_t index() const
Return the index of the DoF associated with actuator.
Definition
Actuator.cpp:56
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::m_dofIdx
std::shared_ptr< size_t > m_dofIdx
Index of the DoF associated with the actuator.
Definition
Actuator.h:96
BIORBD_NAMESPACE::internal_forces::actuator::Actuator::Actuator
Actuator()
Construct actuator.
Definition
Actuator.cpp:9
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
Actuators
Actuator.cpp
Generated by
1.18.0