Skip to content

Commit

Permalink
fix: Updated cervical rhythm implmentation (#25)
Browse files Browse the repository at this point in the history
* Cleaned up text in thoracic example model

* Fixed issue with cervical rhythm link not beeing included in Rigid thoracic model.

The cervical link driver now connects the cervical rhythm to the entire spine motion. This way it will also work even though the rigid thorax is used.

This commit also modfies the links rhythm coefficients so they are no longer recalculated as as ratios, but instead uses the values of the coefficient from excel sheet directly. This makes it easier for us to see where the values come from

* Changed the lumber-thoracic link rhythm to only enable when the overall rhythm is enabled.

* Updated small stuff in the example
  • Loading branch information
melund authored Oct 3, 2024
1 parent 35347ad commit 2a1c023
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 57 deletions.
17 changes: 12 additions & 5 deletions Application/Examples/ThoracicModel/Thoracic.main.any
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,31 @@

Main = {

///////////////////////////////////////////////////
// Body Model Configuration.
// This would often be located in a seperate
// file (BodyModelConfig.any) in other examples
///////////////////////////////////////////////////

// New flexible thorax is enabled with:
// #define BM_TRUNK_THORACIC_MODEL _THORACIC_MODEL_RIGID_
#define BM_TRUNK_THORACIC_MODEL _THORACIC_MODEL_FLEXIBLE_
// #define BM_TRUNK_CAVITY_MODEL _CAVITY_MODEL_BUCKLE_

#define BM_LEG_MODEL OFF

#define BM_ARM_LEFT ON
#define BM_ARM_RIGHT ON

// Note: Model doesn't yet work without muscles
#define BM_TRUNK_MUSCLES ON


// The new thoracic model comes with a full set of
// ligaments all along the spine. They can be enabled
// with the following switch.
#define BM_TRUNK_LIGAMENTS OFF


// Remove default drivers so we can add custom fourier drivers
// to trunk in the this example
// This example comes with custom fourier drivers for the
// spine motion. So here we disable the default drivers
#define BM_MANNEQUIN_DRIVER_PELVIS_THORAX_EXTENSION OFF
#define BM_MANNEQUIN_DRIVER_PELVIS_THORAX_ROTATION OFF
#define BM_MANNEQUIN_DRIVER_PELVIS_THORAX_LATERAL_BENDING OFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@

// The lumbar and thoracic movements are linked so the move simultaneously. This switch is used to enable this link.
#ifndef BM_TRUNK_LUMBAR_THORACIC_LINK
#define BM_TRUNK_LUMBAR_THORACIC_LINK ON
#define BM_TRUNK_LUMBAR_THORACIC_LINK BM_TRUNK_RHYTHM
#endif

// A switch to control all the ligaments in the spine.
Expand Down
2 changes: 1 addition & 1 deletion Body/AAUHuman/Documentation/BodyModel.parameters.any
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@


// The lumbar and thoracic movements are linked so the move simultaneously. This switch is used to enable this link.
// #define BM_TRUNK_LUMBAR_THORACIC_LINK ON
// #define BM_TRUNK_LUMBAR_THORACIC_LINK BM_TRUNK_RHYTHM
// Possible values: ON, OFF,


Expand Down
40 changes: 40 additions & 0 deletions Body/AAUHuman/Trunk/JointsCervical.any
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,43 @@ AnyFolder Rotation = {

};//Rotation


#if BM_TRUNK_CERVICAL_THORACIC_LINK
// See the documentation for the rhythms/links for better understanding of the numbers
// used for the coefficients.
RhythmDriverLinear CervicalThroacicRotationLinkDriver(_REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.272+0.306, 0.102+0.32};
Measures.Input = {
AnyKinMeasure& SkullThoraxRotation_ref = ......Interface.Trunk.SkullThoraxRotation;
AnyKinMeasure& T12T1_Rot_ref = ......Interface.Trunk.PelvisThoraxRotation;
};

};


RhythmDriverLinear CervicalThroacicLatBendingLinkDriver(_REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.45, 0.275+0.275};
Measures.Input = {
AnyKinMeasure& SkullThoraxLateralBending_ref = ......Interface.Trunk.SkullThoraxLateralBending;
AnyKinMeasure& T12T1_latbend_ref = ......Interface.Trunk.PelvisThoraxLateralBending;
};
};


RhythmDriverBiLinear CervicalThroacicExtensionLinkDriver(NDIM=2, _REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.311+0.115, -1*(0.144+0.430)};
AnyFloat RhythmCoefficientsNegative ??= {0.383+0.142, -1*(0.217+0.258)};

// +/- 5 degree interval where rhythm transitions from one set of coefficients to the other
AnyFloat TransitionInterval ??= 5*pi/180;

Measures.Input = {
AnyKinMeasure& SkullThoraxFlexion_ref = ......Interface.Trunk.SkullThoraxFlexion;
AnyKinMeasure& T12T1_ext_ref = ......Interface.Trunk.PelvisThoraxExtension;
};
};
#endif

54 changes: 7 additions & 47 deletions Body/AAUHuman/Trunk/JointsThorax.any
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@


#if BM_TRUNK_THORACIC_RHYTHM != OFF


// See the documentation for the rhythms/links for better understanding of the numbers
// used for the coefficients.

RhythmDriverLinear LateralBendingRhythmDriver(RELATIVE_TO_DOF=10, _REDEFINE_VARIABLES=On) =
{
//The RhythmCoefficients represent the realative change of the different measures
Expand Down Expand Up @@ -131,8 +131,8 @@
#if BM_TRUNK_LUMBAR_THORACIC_LINK
RhythmDriverBiLinear LumbarThroacicExtensionLinkDriver(NDIM=2, _REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.54, 0.46};
AnyFloat RhythmCoefficientsNegative ??= {0.75, 0.25};
AnyVector RhythmCoefficients ??= {0.258, 0.217};
AnyFloat RhythmCoefficientsNegative ??= {0.43, 0.14};

// +/- 5 degree interval where rhythm transitions from one set of coefficients to the other
AnyFloat TransitionInterval ??= 5*pi/180;
Expand All @@ -146,7 +146,7 @@

RhythmDriverLinear LumbarThroacicLatBendingLinkDriver(_REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.5, 0.5};
AnyVector RhythmCoefficients ??= {0.275, 0.275};
Measures.Input = {
AnyKinMeasure& PelvisT12_Latbend_ref = ......Interface.Trunk.PelvisT12LateralBending;
AnyKinMeasure& T12T1_latbend_ref = ......Interface.Trunk.T12T1LateralBending;
Expand All @@ -155,54 +155,14 @@

RhythmDriverLinear LumbarThroacicRotationLinkDriver(_REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.24, 0.76};
AnyVector RhythmCoefficients ??= {0.102, 0.320};
Measures.Input = {
AnyKinMeasure& PelvisT12_Rot_ref = ......Interface.Trunk.PelvisT12Rotation;
AnyKinMeasure& T12T1_Rot_ref = ......Interface.Trunk.T12T1Rotation;
};
};
#endif


#if BM_TRUNK_CERVICAL_THORACIC_LINK
RhythmDriverLinear CervicalThroacicRotationLinkDriver(_REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.6, 0.4};
Measures.Input = {
AnyKinMeasure& SkullThoraxRotation_ref = ......Interface.Trunk.SkullThoraxRotation;
AnyKinMeasure& T12T1_Rot_ref = ......Interface.Trunk.T12T1Rotation;
};

};


RhythmDriverLinear CervicalThroacicLatBendingLinkDriver(_REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.6, 0.4};
Measures.Input = {
AnyKinMeasure& SkullThoraxLateralBending_ref = ......Interface.Trunk.SkullThoraxLateralBending;
AnyKinMeasure& T12T1_latbend_ref = ......Interface.Trunk.T12T1LateralBending;
};
};


RhythmDriverBiLinear CervicalThroacicExtensionLinkDriver(NDIM=2, _REDEFINE_VARIABLES=On) =
{
AnyVector RhythmCoefficients ??= {0.6, -0.4};
AnyFloat RhythmCoefficientsNegative ??= {0.7, -0.3};

// +/- 5 degree interval where rhythm transitions from one set of coefficients to the other
AnyFloat TransitionInterval ??= 5*pi/180;

Measures.Input = {
AnyKinMeasure& SkullThoraxFlexion_ref = ......Interface.Trunk.SkullThoraxFlexion;
AnyKinMeasure& T12T1_ext_ref = ......Interface.Trunk.T12T1Extension;
};
};
#endif



#endif

#endif
2 changes: 1 addition & 1 deletion Body/AAUHuman/bm-parameters.toml
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ descr = "The cervical and thoracic movements are linked so the move simultaneous
opt = [ "OFF", "ON"]

[parameters.BM_TRUNK_LUMBAR_THORACIC_LINK]
default = "ON"
default = "BM_TRUNK_RHYTHM"
valuetype = "integer"
nicename = "Lumbar-Thoracic link rhythm"
descr = "The lumbar and thoracic movements are linked so the move simultaneously. This switch is used to enable this link."
Expand Down
4 changes: 2 additions & 2 deletions Docs/bm_config/bm_statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@ The cervical and thoracic movements are linked so the move simultaneously. This
The lumbar and thoracic movements are linked so the move simultaneously. This switch is used to enable this link.
:Default: ON
:Example: `#define BM_TRUNK_LUMBAR_THORACIC_LINK ON`
:Default: {any}`BM_TRUNK_RHYTHM`
:Example: `#define BM_TRUNK_LUMBAR_THORACIC_LINK BM_TRUNK_RHYTHM`
:Options:
- {any}`ON` -> Switch ON
- {any}`OFF` -> Switch OFF
Expand Down

0 comments on commit 2a1c023

Please sign in to comment.