Biorbd
Actuator.cpp
1 #define BIORBD_API_EXPORTS
2 #include "Actuators/Actuator.h"
3 
4 #include "Utils/Error.h"
5 #include "Utils/String.h"
6 
8  m_type(std::make_shared<biorbd::actuator::TYPE>(biorbd::actuator::TYPE::NO_TYPE)),
9  m_direction(std::make_shared<int>(0)),
10  m_jointName(std::make_shared<biorbd::utils::String>("")),
11  m_dofIdx(std::make_shared<unsigned int>(-1))
12 {
13 
14 }
15 
17  const biorbd::actuator::Actuator &other) :
18  m_type(other.m_type),
19  m_direction(other.m_direction),
20  m_jointName(other.m_jointName),
21  m_dofIdx(other.m_dofIdx)
22 {
23 
24 }
25 
27  int direction,
28  unsigned int dofIdx) :
29  m_type(std::make_shared<biorbd::actuator::TYPE>(biorbd::actuator::TYPE::NO_TYPE)),
30  m_direction(std::make_shared<int>(direction)),
31  m_jointName(std::make_shared<biorbd::utils::String>("")),
32  m_dofIdx(std::make_shared<unsigned int>(dofIdx))
33 {
34 
35 }
36 
38  int direction,
39  unsigned int dofIdx,
40  const biorbd::utils::String &jointName) :
41  m_type(std::make_shared<biorbd::actuator::TYPE>(biorbd::actuator::TYPE::NO_TYPE)),
42  m_direction(std::make_shared<int>(direction)),
43  m_jointName(std::make_shared<biorbd::utils::String>(jointName)),
44  m_dofIdx(std::make_shared<unsigned int>(dofIdx))
45 {
47  "Direction should be -1 or 1");
48 }
49 
51 {
52 
53 }
54 
56 {
57  *m_type = *other.m_type;
58  *m_direction = *other.m_direction;
59  *m_jointName = *other.m_jointName;
60  *m_dofIdx = *other.m_dofIdx;
61 }
62 
64 {
65  return *m_dofIdx;
66 }
67 
69 {
70  return *m_direction;
71 }
72 
73 biorbd::actuator::TYPE biorbd::actuator::Actuator::type() const
74 {
75  return *m_type;
76 }
biorbd::actuator::Actuator::m_type
std::shared_ptr< biorbd::actuator::TYPE > m_type
The type of the actuator.
Definition: Actuator.h:97
biorbd::actuator::Actuator::type
biorbd::actuator::TYPE type() const
Return the type of the actuator.
Definition: Actuator.cpp:73
biorbd::actuator::Actuator
Class Actuator.
Definition: Actuator.h:20
biorbd::actuator::Actuator::m_jointName
std::shared_ptr< biorbd::utils::String > m_jointName
Name of the parent joint.
Definition: Actuator.h:100
biorbd::actuator::Actuator::~Actuator
virtual ~Actuator()
Destroy class properly.
Definition: Actuator.cpp:50
biorbd::actuator::Actuator::Actuator
Actuator()
Construct actuator.
Definition: Actuator.cpp:7
biorbd::actuator::Actuator::m_dofIdx
std::shared_ptr< unsigned int > m_dofIdx
Index of the DoF associated with the actuator.
Definition: Actuator.h:101
biorbd::actuator::Actuator::DeepCopy
void DeepCopy(const biorbd::actuator::Actuator &other)
Deep copy of actuator.
Definition: Actuator.cpp:55
biorbd::actuator::Actuator::direction
int direction() const
Return the direction of the actuator.
Definition: Actuator.cpp:68
biorbd::utils::String
Wrapper around the std::string class with augmented functionality.
Definition: String.h:17
biorbd::actuator::Actuator::index
unsigned int index() const
Return the index of the DoF associated with actuator.
Definition: Actuator.cpp:63
biorbd::utils::Error::check
static void check(bool cond, const biorbd::utils::String &message)
Assert that raises the error message if false.
Definition: Error.cpp:10
biorbd::actuator::Actuator::m_direction
std::shared_ptr< int > m_direction
The direction of the actuator (+1 or -1)
Definition: Actuator.h:98