1#define BIORBD_API_EXPORTS
2#include "InternalForces/Muscles/StateDynamics.h"
4#include "InternalForces/Muscles/Characteristics.h"
5#include "Utils/Error.h"
6#include "Utils/String.h"
8#ifdef USE_SMOOTH_IF_ELSE
9#include "Utils/CasadiExpand.h"
12using namespace BIORBD_NAMESPACE;
26 : internal_forces::muscles::
State(other) {
58 bool alreadyNormalized) {
68 bool alreadyNormalized) {
77 bool alreadyNormalized) {
81#ifdef BIORBD_USE_CASADI_MATH
106 if (alreadyNormalized) {
114#ifdef BIORBD_USE_CASADI_MATH
115 denom = IF_ELSE_NAMESPACE::if_else(
116 IF_ELSE_NAMESPACE::gt(num, 0),
136 const utils::Scalar& val,
137 bool turnOffWarnings) {
148 const utils::Scalar& val,
149 bool turnOffWarnings) {
160 *
m_stateType = internal_forces::muscles::STATE_TYPE::DYNAMIC;
Class Holds that muscle characteristics.
const utils::Scalar & torqueActivation() const
Return the time activation constant.
const utils::Scalar & minActivation() const
Return the minimal activation of the muscle.
const utils::Scalar & torqueDeactivation() const
Return the time deactivation constant.
const State & stateMax() const
Return the maximal excitation and activation of the muscle.
EMG with the capability to compute the time derivative.
virtual const utils::Scalar & timeDerivativeActivation()
Return the previously computed activation time derivative.
virtual void setActivation(const utils::Scalar &val, bool turnOffWarnings=false)
Set the muscle activation.
const utils::Scalar & previousActivation() const
Return the previous activation.
std::shared_ptr< utils::Scalar > m_activationDot
The activation velocity.
std::shared_ptr< utils::Scalar > m_previousActivation
The previous activation.
virtual void setType()
Set the type to simple_state.
StateDynamics DeepCopy() const
Deep copy of state dynamics.
virtual const utils::Scalar & timeDerivativeActivation(const utils::Scalar &excitation, const utils::Scalar &activation, const Characteristics &characteristics, bool alreadyNormalized=false)
Compute and return the activation time derivative from the excitation and activation.
virtual ~StateDynamics()
Destroy class properly.
std::shared_ptr< utils::Scalar > m_previousExcitation
The previous excitation.
const utils::Scalar & previousExcitation() const
Return the previous activation.
virtual void setExcitation(const utils::Scalar &val, bool turnOffWarnings=false)
Set the muscle excitation.
StateDynamics(const utils::Scalar &excitation=0, const utils::Scalar &activation=0)
Construct the state dynamics.
EMG holder to interact with the muscle.
State DeepCopy() const
Deep copy of state.
std::shared_ptr< STATE_TYPE > m_stateType
The state type.
virtual void setActivation(const utils::Scalar &val, bool turnOffWarnings=false)
Set the muscle activation.
virtual void setExcitation(const utils::Scalar &val, bool turnOffWarnings=false)
Set the muscle excitation.
std::shared_ptr< utils::Scalar > m_activation
The muscle activation.
const utils::Scalar & excitation() const
Return the muscle excitation.
std::shared_ptr< utils::Scalar > m_excitationNorm
The normalized excitation.
const utils::Scalar & normalizeExcitation(const State &emgMax, bool turnOffWarnings=false)
Compute and return the normalized excitation.
std::shared_ptr< utils::Scalar > m_excitation
The muscle excitation.
const utils::Scalar & activation() const
Return the muscle activation.
State(const utils::Scalar &excitation=0, const utils::Scalar &activation=0)
Construct a state.