This PR moves the muscle stiffness computation of all derived muscle classes to the base class: Muscle.
This is a cleanup of the MuscleDynamicsInfo, which contains fields that are cheap to compute, but are still cached. It also serves to unify the computation of the outputs across all muscles.
Note on stiffness calculations
The muscle stiffness calculation differed slightly between the different muscles.
In Millard2012EquilibriumMuscle the calculation included the following checks:
computed stiffness is nonnegative
prevent division by zero
check if tendon is rigid
For the other muscles some of these checks were missing, but it seems that they should have been added for all muscles. Therefore I used the implementation from Millard2012EquilibriumMuscle for all Muscles.
For the RigidTendonMuscle and the muscle in testMuscleMetabolicsProbes.cpp the stiffness was always zero. This PR does not change that result for these muscles.
Brief summary of changes
Added calcMuscleStiffness to Muscle.h using implementation from Millard2012EquilibriumMuscle
Removed muscleStiffness field from MuscleDynamicsInfo
Testing I've completed
Unit tests passing.
Looking for feedback on...
@nickbianco the method calcMuscleStiffness(...) in DeGrooteFregley2016Muscle was used for the computation for MuscleDynamicsInfo.muscleStiffness, but is no longer needed. It is however a public function, and it is used in the unit test.
What would you recommend doing here? Leave as is? Remove from class, and move to unit test? Flag as deprecated?
This PR moves the muscle stiffness computation of all derived muscle classes to the base class: Muscle.
This is a cleanup of the MuscleDynamicsInfo, which contains fields that are cheap to compute, but are still cached. It also serves to unify the computation of the outputs across all muscles.
Note on stiffness calculations
The muscle stiffness calculation differed slightly between the different muscles. In
Millard2012EquilibriumMuscle
the calculation included the following checks:Millard2012EquilibriumMuscle
for all Muscles.For the
RigidTendonMuscle
and the muscle intestMuscleMetabolicsProbes.cpp
the stiffness was always zero. This PR does not change that result for these muscles.Brief summary of changes
calcMuscleStiffness
toMuscle.h
using implementation fromMillard2012EquilibriumMuscle
muscleStiffness
field fromMuscleDynamicsInfo
Testing I've completed
Unit tests passing.
Looking for feedback on...
@nickbianco the method
calcMuscleStiffness(...)
inDeGrooteFregley2016Muscle
was used for the computation forMuscleDynamicsInfo.muscleStiffness
, but is no longer needed. It is however a public function, and it is used in the unit test. What would you recommend doing here? Leave as is? Remove from class, and move to unit test? Flag as deprecated?https://github.com/opensim-org/opensim-core/blob/98c70b1fd5bc74da63e69a52e860c742840a9a16/OpenSim/Actuators/DeGrooteFregly2016Muscle.h#L605
CHANGELOG.md (choose one)
This change is