Biorbd Release_1.13.0
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
7using namespace BIORBD_NAMESPACE;
8
10 : Actuator(),
11 m_m(std::make_shared<utils::Scalar>(0)),
12 m_b(std::make_shared<utils::Scalar>(0)) {
13 setType();
14}
15
19
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
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
44
51
58
61 "torqueMax for ActuatorLinear must be called with Q and Qdot");
62}
63
65 const rigidbody::GeneralizedCoordinates& Q) const {
66 return (Q[static_cast<unsigned int>(*m_dofIdx)] * 180 / M_PI) * *m_m + *m_b;
67}
68
70 *m_type = internal_forces::actuator::TYPE::LINEAR;
71}
Class ActuatorLinear is a joint actuator type that linearly evolves.
std::shared_ptr< utils::Scalar > m_b
Torque at zero.
virtual utils::Scalar torqueMax()
Return the maximal torque (invalid).
ActuatorLinear DeepCopy() const
Deep copy of the linear actuator.
void DeepCopy(const Actuator &other)
Deep copy of actuator.
Definition Actuator.cpp:48
int direction() const
Return the direction of the actuator.
Definition Actuator.cpp:58
std::shared_ptr< TYPE > m_type
The type of the actuator.
Definition Actuator.h:90
std::shared_ptr< size_t > m_dofIdx
Index of the DoF associated with the actuator.
Definition Actuator.h:96
static void raise(const String &message)
Throw an error message.
Definition Error.cpp:6
Wrapper around the std::string class with augmented functionality.
Definition String.h:18