Biorbd Release_1.13.0
Loading...
Searching...
No Matches
BIORBD_NAMESPACE::internal_forces::muscles::Muscles Class Reference

Muscle group holder. More...

#include <Muscles.h>

Public Member Functions

 Muscles ()
 Construct muscles.
 Muscles (const Muscles &other)
 Construct muscles from other muscles.
virtual ~Muscles ()
 Destroy class properly.
Muscles DeepCopy () const
 Deep copy of muscles.
void DeepCopy (const Muscles &other)
 Deep copy of muscles into another mucles.
void addMuscleGroup (const utils::String &name, const utils::String &originName, const utils::String &insertionName)
 Add a muscle group to the set.
int getMuscleGroupId (const utils::String &name) const
 Return the group ID.
std::vector< std::shared_ptr< Muscle > > muscles () const
 Returns all the muscles. It sorts the muscles by group.
Muscle & muscle (size_t idx) const
 Returns a specific muscle sorted by muscles().
std::vector< utils::String > muscleNames () const
 muscleNames Return the names for all the muscle ordered by their respective group name
std::vector< MuscleGroup > & muscleGroups ()
 Return the muscle groups.
const std::vector< MuscleGroup > & muscleGroups () const
 Return the muscle groups.
MuscleGroup & muscleGroup (size_t idx)
 Return the muscle group of specific index.
const MuscleGroup & muscleGroup (size_t idx) const
 Return the muscle group of specific index.
const MuscleGroup & muscleGroup (const utils::String &name) const
 Return the muscle group of specific name.
void updateMuscles (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q)
 Update all the muscles (positions, jacobian, etc.).
void updateMuscles (const rigidbody::GeneralizedCoordinates &Q, bool updateKin=true)
 Update all the muscles (positions, jacobian, etc.).
void updateMuscles (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot)
 Update all the muscles (positions, jacobian, etc.).
void updateMuscles (const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, bool updateKin=true)
 Update all the muscles (positions, jacobian, etc.).
void updateMuscles (std::vector< std::vector< utils::Vector3d > > &musclePointsInGlobal, std::vector< utils::Matrix > &jacoPointsInGlobal)
 Update by hand all the muscles (positions, jacobian, velocity, etc.).
void updateMuscles (std::vector< std::vector< utils::Vector3d > > &musclePointsInGlobal, std::vector< utils::Matrix > &jacoPointsInGlobal, const rigidbody::GeneralizedVelocity &Qdot)
 Update by hand all the muscles (positions, jacobian, velocity, etc.).
std::vector< std::shared_ptr< State > > stateSet ()
 Get the vector of state that must be used to update states.
rigidbody::GeneralizedTorque muscularJointTorque (const utils::Vector &F)
 Compute the muscular joint torque.
rigidbody::GeneralizedTorque muscularJointTorque (const utils::Vector &F, rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, bool updateMuscleParameters=true)
 Compute the muscular joint torque.
rigidbody::GeneralizedTorque muscularJointTorque (const utils::Vector &F, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, int updateKin=2)
 Compute the muscular joint torque.
rigidbody::GeneralizedTorque muscularJointTorque (const std::vector< std::shared_ptr< State > > &emg)
 Compute the muscular joint torque.
rigidbody::GeneralizedTorque muscularJointTorque (rigidbody::Joints &updatedModel, const std::vector< std::shared_ptr< State > > &emg, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, bool updateMuscleParameters=true)
 Compute the muscular joint torque.
rigidbody::GeneralizedTorque muscularJointTorque (const std::vector< std::shared_ptr< State > > &emg, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, int updateKin=2)
 Compute the muscular joint torque.
utils::Vector activationDot (const std::vector< std::shared_ptr< State > > &states, bool areadyNormalized=true)
 Interface that returns in a vector all the activations dot.
utils::Matrix musclesLengthJacobian ()
 Return the previously computed muscle length jacobian.
utils::Matrix musclesLengthJacobian (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, bool updateMuscleParameters=true)
 Compute and return the muscle length Jacobian.
utils::Matrix musclesLengthJacobian (const rigidbody::GeneralizedCoordinates &Q, int updateKin=2)
 Compute and return the muscle length Jacobian.
utils::Vector muscleForces (const std::vector< std::shared_ptr< State > > &emg)
 Compute and return the muscle forces.
utils::Vector muscleForces (rigidbody::Joints &updatedModel, const std::vector< std::shared_ptr< State > > &emg, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, bool updateMuscleParameters=true)
 Compute and return the muscle forces.
utils::Vector muscleForces (const std::vector< std::shared_ptr< State > > &emg, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, int updateKin=2)
 Compute and return the muscle forces.
size_t nbMuscleGroups () const
 Return the total number of muscle groups.
size_t nbMuscleTotal () const
 Return the total number of muscle.
size_t nbMuscles () const
 Return the total number of muscle.

Protected Member Functions

utils::Matrix computeMusclesLengthJacobian (const rigidbody::Joints &model)
 Assemble the muscle length jacobian using the provided model.

Protected Attributes

std::shared_ptr< std::vector< MuscleGroup > > m_mus
 Holder for muscle groups.

Detailed Description

Muscle group holder.

Definition at line 34 of file Muscles.h.

Constructor & Destructor Documentation

◆ Muscles() [1/2]

internal_forces::muscles::Muscles::Muscles ( )

Construct muscles.

Definition at line 16 of file Muscles.cpp.

◆ Muscles() [2/2]

internal_forces::muscles::Muscles::Muscles ( const Muscles & other)

Construct muscles from other muscles.

Parameters
otherThe other muscles

Definition at line 21 of file Muscles.cpp.

◆ ~Muscles()

internal_forces::muscles::Muscles::~Muscles ( )
virtual

Destroy class properly.

Definition at line 25 of file Muscles.cpp.

Member Function Documentation

◆ activationDot()

utils::Vector internal_forces::muscles::Muscles::activationDot ( const std::vector< std::shared_ptr< State > > & states,
bool areadyNormalized = true )

Interface that returns in a vector all the activations dot.

Parameters
statesThe state of the muscle
areadyNormalizedIf the states are already normalized
Returns
All the activations dot

Definition at line 195 of file Muscles.cpp.

◆ addMuscleGroup()

void internal_forces::muscles::Muscles::addMuscleGroup ( const utils::String & name,
const utils::String & originName,
const utils::String & insertionName )

Add a muscle group to the set.

Parameters
nameThe name of the muscle group
originNameThe origin segment name where the origin lies
insertionNameThe insertion segment name where the origin lies

Definition at line 42 of file Muscles.cpp.

◆ computeMusclesLengthJacobian()

utils::Matrix internal_forces::muscles::Muscles::computeMusclesLengthJacobian ( const rigidbody::Joints & model)
protected

Assemble the muscle length jacobian using the provided model.

Parameters
modelThe joint model updated to the proper kinematics level
Returns
The muscle length jacobian

Definition at line 260 of file Muscles.cpp.

◆ DeepCopy() [1/2]

internal_forces::muscles::Muscles internal_forces::muscles::Muscles::DeepCopy ( ) const

Deep copy of muscles.

Returns
A deep copy of muscles

Definition at line 27 of file Muscles.cpp.

◆ DeepCopy() [2/2]

void internal_forces::muscles::Muscles::DeepCopy ( const Muscles & other)

Deep copy of muscles into another mucles.

Parameters
otherThe muscles to copy

Definition at line 34 of file Muscles.cpp.

◆ getMuscleGroupId()

int internal_forces::muscles::Muscles::getMuscleGroupId ( const utils::String & name) const

Return the group ID.

Parameters
nameThe name of the muscle group
Returns
The group ID (returns -1 if not found)

Definition at line 55 of file Muscles.cpp.

◆ muscle()

internal_forces::muscles::Muscle & internal_forces::muscles::Muscles::muscle ( size_t idx) const

Returns a specific muscle sorted by muscles().

Parameters
idxThe muscle index
Returns
The muscle

Definition at line 75 of file Muscles.cpp.

◆ muscleForces() [1/3]

utils::Vector internal_forces::muscles::Muscles::muscleForces ( const std::vector< std::shared_ptr< State > > & emg)

Compute and return the muscle forces.

Parameters
emgThe dynamic state
Returns
The muscle forces

Warning: This function assumes that muscles are already updated (via updateMuscles)

Definition at line 212 of file Muscles.cpp.

◆ muscleForces() [2/3]

utils::Vector internal_forces::muscles::Muscles::muscleForces ( const std::vector< std::shared_ptr< State > > & emg,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
int updateKin = 2 )

Compute and return the muscle forces.

Parameters
emgThe dynamic state
QThe generalized coordinates
QdotThe generalized velocities
updateKinUpdate kinematics (0: don't update, 1:only muscles, [2: both kinematics and muscles])
Returns
The muscle forces

Definition at line 241 of file Muscles.cpp.

◆ muscleForces() [3/3]

utils::Vector internal_forces::muscles::Muscles::muscleForces ( rigidbody::Joints & updatedModel,
const std::vector< std::shared_ptr< State > > & emg,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
bool updateMuscleParameters = true )

Compute and return the muscle forces.

Parameters
updatedModelThe model previously updated to proper kinematic level
emgThe dynamic state
QThe generalized coordinates
QdotThe generalized velocities
updateMuscleParametersUpdate the kinematic related parameters of the muscles
Returns
The muscle forces

Definition at line 230 of file Muscles.cpp.

◆ muscleGroup() [1/3]

const internal_forces::muscles::MuscleGroup & internal_forces::muscles::Muscles::muscleGroup ( const utils::String & name) const

Return the muscle group of specific name.

Parameters
nameThe name of the muscle group to return
Returns
A muscle group

Definition at line 124 of file Muscles.cpp.

◆ muscleGroup() [2/3]

internal_forces::muscles::MuscleGroup & internal_forces::muscles::Muscles::muscleGroup ( size_t idx)

Return the muscle group of specific index.

Parameters
idxThe index of the muscle group to return
Returns
A muscle group

Definition at line 109 of file Muscles.cpp.

◆ muscleGroup() [3/3]

const internal_forces::muscles::MuscleGroup & internal_forces::muscles::Muscles::muscleGroup ( size_t idx) const

Return the muscle group of specific index.

Parameters
idxThe index of the muscle group to return
Returns
A muscle group

Definition at line 117 of file Muscles.cpp.

◆ muscleGroups() [1/2]

std::vector< internal_forces::muscles::MuscleGroup > & internal_forces::muscles::Muscles::muscleGroups ( )

Return the muscle groups.

Returns
The muscle groups

Definition at line 99 of file Muscles.cpp.

◆ muscleGroups() [2/2]

const std::vector< internal_forces::muscles::MuscleGroup > & internal_forces::muscles::Muscles::muscleGroups ( ) const

Return the muscle groups.

Returns
The muscle groups

Definition at line 104 of file Muscles.cpp.

◆ muscleNames()

std::vector< utils::String > internal_forces::muscles::Muscles::muscleNames ( ) const

muscleNames Return the names for all the muscle ordered by their respective group name

Returns
All the muscle names

Definition at line 87 of file Muscles.cpp.

◆ muscles()

std::vector< std::shared_ptr< internal_forces::muscles::Muscle > > internal_forces::muscles::Muscles::muscles ( ) const

Returns all the muscles. It sorts the muscles by group.

Returns
All the muscle

Definition at line 65 of file Muscles.cpp.

◆ musclesLengthJacobian() [1/3]

utils::Matrix internal_forces::muscles::Muscles::musclesLengthJacobian ( )

Return the previously computed muscle length jacobian.

Returns
The muscle length jacobian

Definition at line 255 of file Muscles.cpp.

◆ musclesLengthJacobian() [2/3]

utils::Matrix internal_forces::muscles::Muscles::musclesLengthJacobian ( const rigidbody::GeneralizedCoordinates & Q,
int updateKin = 2 )

Compute and return the muscle length Jacobian.

Parameters
QThe generalized coordinates
updateKinUpdate kinematics (0: don't update, 1:only muscles, [2: both kinematics and muscles])
Returns
The muscle length Jacobian

Definition at line 286 of file Muscles.cpp.

◆ musclesLengthJacobian() [3/3]

utils::Matrix internal_forces::muscles::Muscles::musclesLengthJacobian ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
bool updateMuscleParameters = true )

Compute and return the muscle length Jacobian.

Parameters
updatedModelThe model previously updated to proper kinematic level
QThe generalized coordinates
updateMuscleParametersUpdate the kinematic related parameters of the muscles
Returns
The muscle length Jacobian

Definition at line 277 of file Muscles.cpp.

◆ muscularJointTorque() [1/6]

rigidbody::GeneralizedTorque internal_forces::muscles::Muscles::muscularJointTorque ( const std::vector< std::shared_ptr< State > > & emg)

Compute the muscular joint torque.

Parameters
emgThe dynamic state to compute the force vector
Returns
The muscular joint torque

This functions converts muscle activations into muscle forces and then performs the computation for the muscular joint torque is done from virtual power:

i.e. \(-J \times F\)

where \(J\) is the muscle lengths jacobian and \(F\) is the force vector of all the muscles

Warning: This function assumes that muscles are already updated (via updateMuscles)

Definition at line 168 of file Muscles.cpp.

◆ muscularJointTorque() [2/6]

rigidbody::GeneralizedTorque internal_forces::muscles::Muscles::muscularJointTorque ( const std::vector< std::shared_ptr< State > > & emg,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
int updateKin = 2 )

Compute the muscular joint torque.

Parameters
emgThe dynamic state to compute the force vector
QThe generalized coordinates (not needed if updateKin is 0)
QdotThe generalized velocities (not needed if updateKin is 0)
updateKinUpdate kinematics (0: don't update, 1:only muscles, [2: both kinematics and muscles])
Returns
The muscular joint torque

The computation for the muscular joint torque is done from virtual power:

i.e. \(-J \times F\)

where \(J\) is the muscle lengths jacobian and \(F\) is the force vector of all the muscles

Definition at line 187 of file Muscles.cpp.

◆ muscularJointTorque() [3/6]

rigidbody::GeneralizedTorque internal_forces::muscles::Muscles::muscularJointTorque ( const utils::Vector & F)

Compute the muscular joint torque.

Parameters
FThe force vector of all the muscles
Returns
The muscular joint torque

The computation for the muscular joint torque is done from virtual power:

i.e. \(-J \times F\)

where \(J\) is the muscle lengths jacobian and \(F\) is the force vector of all the muscles

Warning: This function assumes that muscles are already updated (via updateMuscles)

Definition at line 133 of file Muscles.cpp.

◆ muscularJointTorque() [4/6]

rigidbody::GeneralizedTorque internal_forces::muscles::Muscles::muscularJointTorque ( const utils::Vector & F,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
int updateKin = 2 )

Compute the muscular joint torque.

Parameters
FThe force vector of all the muscles
QThe generalized coordinates
QdotThe generalized velocities
updateKinUpdate kinematics (0: don't update, 1:only muscles, [2: both kinematics and muscles])
Returns
The muscular joint torque

This function updates the muscles and then performs the computation for the muscular joint torque is done from virtual power:

i.e. \(-J \times F\)

where \(J\) is the muscle lengths jacobian and \(F\) is the force vector of all the muscles

Definition at line 156 of file Muscles.cpp.

◆ muscularJointTorque() [5/6]

rigidbody::GeneralizedTorque internal_forces::muscles::Muscles::muscularJointTorque ( const utils::Vector & F,
rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
bool updateMuscleParameters = true )

Compute the muscular joint torque.

Parameters
FThe force vector of all the muscles
updatedModelThe model previously updated to proper kinematic level
QThe generalized coordinates
QdotThe generalized velocities
updateMuscleParametersUpdate the kinematic related parameters of the muscles
Returns
The muscular joint torque

This function updates the muscles and then performs the computation for the muscular joint torque is done from virtual power:

i.e. \(-J \times F\)

where \(J\) is the muscle lengths jacobian and \(F\) is the force vector of all the muscles

Definition at line 143 of file Muscles.cpp.

◆ muscularJointTorque() [6/6]

rigidbody::GeneralizedTorque internal_forces::muscles::Muscles::muscularJointTorque ( rigidbody::Joints & updatedModel,
const std::vector< std::shared_ptr< State > > & emg,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
bool updateMuscleParameters = true )

Compute the muscular joint torque.

Parameters
updatedModelThe model previously updated to proper kinematic level
emgThe dynamic state to compute the force vector
QThe generalized coordinates (not needed if updateMuscleParameters is false)
QdotThe generalized velocities (not needed if updateMuscleParameters is false)
updateMuscleParametersUpdate the kinematic related parameters of the muscles
Returns
The muscular joint torque

The computation for the muscular joint torque is done from virtual power:

i.e. \(-J \times F\)

where \(J\) is the muscle lengths jacobian and \(F\) is the force vector of all the muscles

Definition at line 175 of file Muscles.cpp.

◆ nbMuscleGroups()

size_t internal_forces::muscles::Muscles::nbMuscleGroups ( ) const

Return the total number of muscle groups.

Returns
The total number of muscle groups

Definition at line 251 of file Muscles.cpp.

◆ nbMuscles()

size_t internal_forces::muscles::Muscles::nbMuscles ( ) const

Return the total number of muscle.

Returns
The total number of muscles

Definition at line 314 of file Muscles.cpp.

◆ nbMuscleTotal()

size_t internal_forces::muscles::Muscles::nbMuscleTotal ( ) const

Return the total number of muscle.

Returns
The total number of muscles

Definition at line 310 of file Muscles.cpp.

◆ stateSet()

std::vector< std::shared_ptr< internal_forces::muscles::State > > internal_forces::muscles::Muscles::stateSet ( )

Get the vector of state that must be used to update states.

Returns
The vector of state

Note: creating your own vector of state is possible. However, it will override the state type that is associated with the muscle

Definition at line 403 of file Muscles.cpp.

◆ updateMuscles() [1/6]

void internal_forces::muscles::Muscles::updateMuscles ( const rigidbody::GeneralizedCoordinates & Q,
bool updateKin = true )

Update all the muscles (positions, jacobian, etc.).

Parameters
QThe generalized coordinates
updateKinIf the joint model should be updated

Definition at line 333 of file Muscles.cpp.

◆ updateMuscles() [2/6]

void internal_forces::muscles::Muscles::updateMuscles ( const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
bool updateKin = true )

Update all the muscles (positions, jacobian, etc.).

Parameters
QThe generalized coordinates
QdotThe generalized velocities
updateKinIf the joint model should be updated

Definition at line 366 of file Muscles.cpp.

◆ updateMuscles() [3/6]

void internal_forces::muscles::Muscles::updateMuscles ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q )

Update all the muscles (positions, jacobian, etc.).

Parameters
updatedModelThe model previously updated to proper kinematic level
QThe generalized coordinates

Definition at line 322 of file Muscles.cpp.

◆ updateMuscles() [4/6]

void internal_forces::muscles::Muscles::updateMuscles ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot )

Update all the muscles (positions, jacobian, etc.).

Parameters
updatedModelThe model previously updated to proper kinematic level
QThe generalized coordinates
QdotThe generalized velocities

Definition at line 354 of file Muscles.cpp.

◆ updateMuscles() [5/6]

void internal_forces::muscles::Muscles::updateMuscles ( std::vector< std::vector< utils::Vector3d > > & musclePointsInGlobal,
std::vector< utils::Matrix > & jacoPointsInGlobal )

Update by hand all the muscles (positions, jacobian, velocity, etc.).

Parameters
musclePointsInGlobalThe muscle points in global reference frame
jacoPointsInGlobalThe jacobian points in global reference frame

Definition at line 411 of file Muscles.cpp.

◆ updateMuscles() [6/6]

void internal_forces::muscles::Muscles::updateMuscles ( std::vector< std::vector< utils::Vector3d > > & musclePointsInGlobal,
std::vector< utils::Matrix > & jacoPointsInGlobal,
const rigidbody::GeneralizedVelocity & Qdot )

Update by hand all the muscles (positions, jacobian, velocity, etc.).

Parameters
musclePointsInGlobalThe muscle points in global reference frame
jacoPointsInGlobalThe jacobian points in global reference frame
QdotThe generalized velocities

Definition at line 389 of file Muscles.cpp.

Member Data Documentation

◆ m_mus

std::shared_ptr<std::vector<MuscleGroup> > BIORBD_NAMESPACE::internal_forces::muscles::Muscles::m_mus
protected

Holder for muscle groups.

Definition at line 448 of file Muscles.h.


The documentation for this class was generated from the following files: