Biorbd Release_1.13.0
Loading...
Searching...
No Matches
PassiveTorqueLinear.cpp
1#define BIORBD_API_EXPORTS
2
3#include "InternalForces/PassiveTorques/PassiveTorqueLinear.h"
4
5#include "RigidBody/GeneralizedCoordinates.h"
6#include "Utils/Error.h"
7
8using namespace BIORBD_NAMESPACE;
9
11 : internal_forces::passive_torques::PassiveTorque(),
12 m_m(std::make_shared<utils::Scalar>(0)),
13 m_b(std::make_shared<utils::Scalar>(0)) {
14 setType();
15}
16
24
26 const utils::Scalar& T0,
27 const utils::Scalar& slope,
28 size_t dofIdx)
29 : internal_forces::passive_torques::PassiveTorque(dofIdx),
30 m_m(std::make_shared<utils::Scalar>(slope)),
31 m_b(std::make_shared<utils::Scalar>(T0)) {
32 setType();
33}
34
36 const utils::Scalar& T0,
37 const utils::Scalar& slope,
38 size_t dofIdx,
39 const utils::String& jointName)
40 : internal_forces::passive_torques::PassiveTorque(dofIdx, jointName),
41 m_m(std::make_shared<utils::Scalar>(slope)),
42 m_b(std::make_shared<utils::Scalar>(T0)) {
43 setType();
44}
45
47
54
61
62utils::Scalar
65 "passiveTorque for PassiveTorqueLinear must be called with Q");
66}
67
68utils::Scalar
70 const rigidbody::GeneralizedCoordinates& Q) const {
71 return Q[static_cast<unsigned int>(*m_dofIdx)] * *m_m + *m_b;
72}
73
75 *m_type = internal_forces::passive_torques::TORQUE_TYPE::TORQUE_LINEAR;
76}
Class PassiveTorqueLinear is a joint passive torque type that linearly evolves Linear passive torque ...
PassiveTorqueLinear DeepCopy() const
Deep copy of the linear passive torque.
virtual utils::Scalar passiveTorque()
Return the passive torque (not available for this type, Q must be provided).
void DeepCopy(const PassiveTorque &other)
Deep copy of passive torque.
std::shared_ptr< TORQUE_TYPE > m_type
The type of the passive torque.
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