Biorbd
Release_1.13.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ActuatorLinear.cpp
1
#define BIORBD_API_EXPORTS
2
#include "InternalForces/Actuators/ActuatorLinear.h"
3
4
#include "RigidBody/GeneralizedCoordinates.h"
5
#include "Utils/Error.h"
6
7
using namespace
BIORBD_NAMESPACE;
8
9
internal_forces::actuator::ActuatorLinear::ActuatorLinear
()
10
:
Actuator
(),
11
m_m
(std::make_shared<utils::Scalar>(0)),
12
m_b
(std::make_shared<utils::Scalar>(0)) {
13
setType
();
14
}
15
16
internal_forces::actuator::ActuatorLinear::ActuatorLinear
(
17
const
internal_forces::actuator::ActuatorLinear
& other)
18
:
Actuator
(other),
m_m
(other.
m_m
),
m_b
(other.
m_b
) {}
19
20
internal_forces::actuator::ActuatorLinear::ActuatorLinear
(
21
int
direction
,
22
const
utils::Scalar& T0,
23
const
utils::Scalar& slope,
24
size_t
dofIdx)
25
:
Actuator
(
direction
, dofIdx),
26
m_m
(std::make_shared<utils::Scalar>(slope)),
27
m_b
(std::make_shared<utils::Scalar>(T0)) {
28
setType
();
29
}
30
31
internal_forces::actuator::ActuatorLinear::ActuatorLinear
(
32
int
direction
,
33
const
utils::Scalar& T0,
34
const
utils::Scalar& slope,
35
size_t
dofIdx,
36
const
utils::String
& jointName)
37
:
Actuator
(
direction
, dofIdx, jointName),
38
m_m
(std::make_shared<utils::Scalar>(slope)),
39
m_b
(std::make_shared<utils::Scalar>(T0)) {
40
setType
();
41
}
42
43
internal_forces::actuator::ActuatorLinear::~ActuatorLinear
() {}
44
45
internal_forces::actuator::ActuatorLinear
46
internal_forces::actuator::ActuatorLinear::DeepCopy
()
const
{
47
internal_forces::actuator::ActuatorLinear
copy;
48
copy.
DeepCopy
(*
this
);
49
return
copy;
50
}
51
52
void
internal_forces::actuator::ActuatorLinear::DeepCopy
(
53
const
internal_forces::actuator::ActuatorLinear
& other) {
54
internal_forces::actuator::Actuator::DeepCopy
(other);
55
*
m_m
= *other.
m_m
;
56
*
m_b
= *other.
m_b
;
57
}
58
59
utils::Scalar
internal_forces::actuator::ActuatorLinear::torqueMax
() {
60
utils::Error::raise
(
61
"torqueMax for ActuatorLinear must be called with Q and Qdot"
);
62
}
63
64
utils::Scalar
internal_forces::actuator::ActuatorLinear::torqueMax
(
65
const
rigidbody::GeneralizedCoordinates
& Q)
const
{
66
return
(Q[
static_cast<
unsigned
int
>
(*
m_dofIdx
)] * 180 / M_PI) * *
m_m
+ *
m_b
;
67
}
68
69
void
internal_forces::actuator::ActuatorLinear::setType
() {
70
*
m_type
= internal_forces::actuator::TYPE::LINEAR;
71
}
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear
Class ActuatorLinear is a joint actuator type that linearly evolves.
Definition
ActuatorLinear.h:19
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear::setType
virtual void setType()
Set the type of actuator.
Definition
ActuatorLinear.cpp:69
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear::~ActuatorLinear
virtual ~ActuatorLinear()
Destroy the class properly.
Definition
ActuatorLinear.cpp:43
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear::ActuatorLinear
ActuatorLinear()
Construct a linear actuator.
Definition
ActuatorLinear.cpp:9
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear::m_m
std::shared_ptr< utils::Scalar > m_m
Slope.
Definition
ActuatorLinear.h:100
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear::m_b
std::shared_ptr< utils::Scalar > m_b
Torque at zero.
Definition
ActuatorLinear.h:101
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear::torqueMax
virtual utils::Scalar torqueMax()
Return the maximal torque (invalid).
Definition
ActuatorLinear.cpp:59
BIORBD_NAMESPACE::internal_forces::actuator::ActuatorLinear::DeepCopy
ActuatorLinear DeepCopy() const
Deep copy of the linear actuator.
Definition
ActuatorLinear.cpp:46
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::direction
int direction() const
Return the direction of the actuator.
Definition
Actuator.cpp:58
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::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::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
Actuators
ActuatorLinear.cpp
Generated by
1.18.0