Biorbd
ActuatorConstant.cpp
1 #define BIORBD_API_EXPORTS
2 #include "Actuators/ActuatorConstant.h"
3 
4 #include "Utils/String.h"
5 #include "RigidBody/GeneralizedCoordinates.h"
6 
8  Actuator(),
9  m_Tmax(std::make_shared<biorbd::utils::Scalar>(0))
10 {
11  setType();
12 }
13 
16  Actuator(other),
17  m_Tmax(other.m_Tmax)
18 {
19 
20 }
21 
23  int direction,
24  const biorbd::utils::Scalar& Tmax,
25  unsigned int dofIdx) :
26  Actuator(direction, dofIdx),
27  m_Tmax(std::make_shared<biorbd::utils::Scalar>(Tmax))
28 {
29  setType();
30 }
31 
33  int direction,
34  const biorbd::utils::Scalar& Tmax,
35  unsigned int dofIdx,
36  const biorbd::utils::String &jointName) :
37  Actuator(direction, dofIdx, jointName),
38  m_Tmax(std::make_shared<biorbd::utils::Scalar>(Tmax))
39 {
40  setType();
41 }
42 
44 {
46  copy.DeepCopy(*this);
47  return copy;
48 }
49 
51 {
53  *m_Tmax = *other.m_Tmax;
54 }
55 
57  return *m_Tmax;
58 }
59 
61 {
62  *m_type = biorbd::actuator::TYPE::CONSTANT;
63 }
biorbd::actuator::Actuator
Class Actuator.
Definition: Actuator.h:20
biorbd::actuator::ActuatorConstant::m_Tmax
std::shared_ptr< biorbd::utils::Scalar > m_Tmax
Maximal torque that can be done.
Definition: ActuatorConstant.h:76
biorbd::actuator::ActuatorConstant
Class ActuatorConstant is a joint actuator type which maximum is contant.
Definition: ActuatorConstant.h:14
biorbd::actuator::ActuatorConstant::setType
virtual void setType()
Set the type of the constant actuator.
Definition: ActuatorConstant.cpp:60
biorbd::actuator::ActuatorConstant::ActuatorConstant
ActuatorConstant()
Construct a constant actuator.
Definition: ActuatorConstant.cpp:7
biorbd::actuator::ActuatorConstant::DeepCopy
biorbd::actuator::ActuatorConstant DeepCopy() const
Deep copy of the constant actuator.
Definition: ActuatorConstant.cpp:43
biorbd::actuator::Actuator::DeepCopy
void DeepCopy(const biorbd::actuator::Actuator &other)
Deep copy of actuator.
Definition: Actuator.cpp:55
biorbd::actuator::ActuatorConstant::torqueMax
virtual biorbd::utils::Scalar torqueMax()
Return the maximal torque.
Definition: ActuatorConstant.cpp:56
biorbd::utils::String
Wrapper around the std::string class with augmented functionality.
Definition: String.h:17