Construct spinal curvature in scoliosis

When I write

#define BM_TRUNK_LUMBAR_RHYTHM OFF

And then the program say that

NOTICE(OBJ.MODELDEF1) :   BodyModel.MannequinDrivers.any(21)  :   DefaultMannequinDrivers.LumbarSpineMannequinDrivers  :  Please note that BM_SPINE_RHYTHM is set to OFF; No default mannequin drivers are used to drive lumbar spine joints.
Linking identifiers...

Are there any differences between cervical and lumbar vertebrae? I disabled the rhythm of the cervical vertebrae in the Thoracic.main.any file and then wrote a driver to allow cervical vertebrae to bend, which eventually worked fine. However, the same code doesn't work for lumbar vertebrae.
The structure of the JointsCervical.any file and the JointsLumbar.any file appears to be similar. I hope someone can help resolve my confusion.

Hello Zyax,

First of all, the NOTICE that you see here is not an error. It just trying to notice you that you do not have the rhythms ON.

And it is supposed to be the same for whole spine. So you can exclude the lumbar rhythms and add joint drivers yourself.

Here is the code:
after adding this:
#define BM_TRUNK_LUMBAR_RHYTHM OFF

You can add the following in your study and the lumbar spine is driven to zero. You can change the AnyKinEq with AnyKinEqSimpleDriver to be able to drive the lumbar with your angle values.
AnyKinEq SacrumPelvisDriver = {AnyKinMeasure &mes = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.SacrumPelvis;};
AnyKinEq L5SacrumDriver = {AnyKinMeasure &mes = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L5Sacrum;};
AnyKinEq L4L5Driver = {AnyKinMeasure &mes = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L4L5;};
AnyKinEq L3L4Driver = {AnyKinMeasure &mes = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L3L4;};
AnyKinEq L2L3Driver = {AnyKinMeasure &mes = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L2L3;};
AnyKinEq L1L2Driver = {AnyKinMeasure &mes = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L1L2;};

Hamed

Dear Hamed,
Thank you very much for your response.
Here is the code I wrote:

#define BM_TRUNK_LUMBAR_RHYTHM OFF

AnyFolder lumbar_move = 
{
  //------------腰椎-------------------
  
  
  AnyFolder Flexion = 
  {
    AnyKinEqSimpleDriver rhythmL1L5 = 
    {
      AnyKinMeasure &ref1 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.SacrumPelvis;
      AnyKinMeasure &ref2 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L5Sacrum;
      AnyKinMeasure &ref3 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L4L5;
      AnyKinMeasure &ref4 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L3L4;
      AnyKinMeasure &ref5 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L2L3;
      AnyKinMeasure &ref6 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L1L2;
      AnyKinMeasure &ref7 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.T12L1;
      MeasureOrganizer = iarr(0, 3, 18)+2;
      DriverPos = pi/180 * {0,0,0,0,0,0,0};
      DriverVel = pi/180 * {0,0,0,0,0,0,0};
    };           
    
    
  };
  
  AnyFolder LateralBending = 
  {
    AnyKinEqSimpleDriver rhythmL1L5 = 
    {
      AnyKinMeasure &ref1 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.SacrumPelvis;
      AnyKinMeasure &ref2 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L5Sacrum;
      AnyKinMeasure &ref3 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L4L5;
      AnyKinMeasure &ref4 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L3L4;
      AnyKinMeasure &ref5 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L2L3;
      AnyKinMeasure &ref6 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L1L2;
      AnyKinMeasure &ref7 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.T12L1;
      
      MeasureOrganizer = iarr(0, 3, 18)+0;
      DriverPos = pi/180 * {2,2,2,-2,-2,-2,0};
      DriverVel = pi/180 * {0,0,0,0,0,0,0};
    };
    
    
  };
  AnyFolder Rotation = 
  {
    AnyKinEqSimpleDriver rhythmL1L5 = 
    {
      AnyKinMeasure &ref1 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.SacrumPelvis;
      AnyKinMeasure &ref2 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L5Sacrum;
      AnyKinMeasure &ref3 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L4L5;
      AnyKinMeasure &ref4 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L3L4;
      AnyKinMeasure &ref5 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L2L3;
      AnyKinMeasure &ref6 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.L1L2;
      AnyKinMeasure &ref7 = Main.HumanModel.BodyModel.Trunk.Joints.Lumbar.T12L1;
      
      MeasureOrganizer = iarr(0, 3, 18)+0;
      DriverPos = pi/180 * {0,0,0,0,0,0,0};
      DriverVel = pi/180 * {0,0,0,0,0,0,0};
    };
       
    
    
    
    
  };
};


I exclude the lumbar rhythms and add joint drivers,but it displays

Model is kinematically indeterminate

I checked that the required degrees of freedom are 666, and currently there are 666 constraints too.
The code I used to drive the cervical spine is also written similarly, but it runs perfectly on the cervical spine. So I'm puzzled as to where the problem might be.
Here is the output:

Constraint #98 is above tolerance 1e-06, error = 0.013777, constr. #0 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #99 is above tolerance 1e-06, error = 0.013825, constr. #1 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #100 is above tolerance 1e-06, error = 0.013328, constr. #2 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #101 is above tolerance 1e-06, error = 0.012093, constr. #3 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #102 is above tolerance 1e-06, error = 0.010179, constr. #4 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #103 is above tolerance 1e-06, error = 0.008107, constr. #5 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #104 is above tolerance 1e-06, error = 0.005084, constr. #6 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #105 is above tolerance 1e-06, error = 0.001724, constr. #7 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #106 is above tolerance 1e-06, error = 0.000655, constr. #8 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #107 is above tolerance 1e-06, error = 0.000959, constr. #9 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.ExtensionRhythmDriver'.
Constraint #108 is above tolerance 1e-06, error = 0.003771, constr. #0 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.LumbarThroacicExtensionLinkDriver'.
Constraint #113 is above tolerance 1e-06, error = 0.001731, constr. #0 in 'Main.HumanModel.BodyModel.Trunk.Joints.Thorax.CervicalThroacicExtensionLinkDriver'.
Constraint #297 is above tolerance 1e-06, error = 0.000003, constr. #1 in 'Main.HumanModel.BodyModel.Trunk.Abdominal.Diaphragm.Joints.CavitySegConstraint'.
Constraint #303 is above tolerance 1e-06, error = 0.000003, constr. #1 in 'Main.HumanModel.BodyModel.Trunk.Abdominal.Diaphragm.Joints.BaseSegInferiorConstraint'.
Constraint #436 is above tolerance 1e-06, error = 0.000003, constr. #0 in 'Main.HumanModel.BodyModel.Trunk.Abdominal.Layer_Constraints_RectusLine.LayerDrivers'.
Constraint #437 is above tolerance 1e-06, error = 0.000002, constr. #1 in 'Main.HumanModel.BodyModel.Trunk.Abdominal.Layer_Constraints_RectusLine.LayerDrivers'.
Constraint #438 is above tolerance 1e-06, error = 0.000001, constr. #2 in 'Main.HumanModel.BodyModel.Trunk.Abdominal.Layer_Constraints_RectusLine.LayerDrivers'.
Constraint #462 is above tolerance 1e-06, error = 0.000001, constr. #0 in 'Main.HumanModel.BodyModel.Trunk.Abdominal.Layer_Pelvic_Constraints_RectusLine.LayerDrivers'.
Constraint #464 is above tolerance 1e-06, error = 0.000005, constr. #2 in 'Main.HumanModel.BodyModel.Trunk.Abdominal.Layer_Pelvic_Constraints_RectusLine.LayerDrivers'.
Constraint #465 is above tolerance 1e-06, error = 0.000002, constr. #0 in 'Main.HumanModel.BodyModel.Trunk.ThoracicCavity.Inertia.constraint'.
Constraint #466 is above tolerance 1e-06, error = 0.000007, constr. #1 in 'Main.HumanModel.BodyModel.Trunk.ThoracicCavity.Inertia.constraint'.
Constraint #470 is above tolerance 1e-06, error = 0.000001, constr. #5 in 'Main.HumanModel.BodyModel.Trunk.ThoracicCavity.Inertia.constraint'.
Constraint #505 is above tolerance 1e-06, error = 0.028187, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Mus.Pectoralis_minor1_cyl.Cylinder.DirectionDriver'.
Constraint #506 is above tolerance 1e-06, error = 0.019159, constr. #1 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Mus.Pectoralis_minor1_cyl.Cylinder.DirectionDriver'.
Constraint #517 is above tolerance 1e-06, error = 0.008000, constr. #1 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.HumeroUlnarJoint.Constraints'.
Constraint #518 is above tolerance 1e-06, error = 0.000001, constr. #2 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.HumeroUlnarJoint.Constraints'.
Constraint #521 is above tolerance 1e-06, error = 0.008753, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.HumeroRadialJoint.Constraints'.
Constraint #522 is above tolerance 1e-06, error = 0.006212, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.ProximalRadioUlnarJoint.Constraints'.
Constraint #523 is above tolerance 1e-06, error = 0.003221, constr. #1 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.ProximalRadioUlnarJoint.Constraints'.
Constraint #524 is above tolerance 1e-06, error = 0.003239, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.DistalRadioUlnarJoint.Constraints'.
Constraint #525 is above tolerance 1e-06, error = 0.011390, constr. #1 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.DistalRadioUlnarJoint.Constraints'.
Constraint #536 is above tolerance 1e-06, error = 0.013420, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.ScapulaAIThoraxNodeDriver'.
Constraint #538 is above tolerance 1e-06, error = 0.014308, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.ScapulaTSThoraxNodeDriver'.
Constraint #539 is above tolerance 1e-06, error = 0.000068, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.ConoideumLigamentDrv'.
Constraint #540 is above tolerance 1e-06, error = 0.003908, constr. #0 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.HandGloveLinDrv'.
Constraint #541 is above tolerance 1e-06, error = 0.006412, constr. #1 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.HandGloveLinDrv'.
Constraint #542 is above tolerance 1e-06, error = 0.000784, constr. #2 in 'Main.HumanModel.BodyModel.Right.ShoulderArm.Jnt.HandGloveLinDrv'.
Constraint #580 is above tolerance 1e-06, error = 0.028187, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Mus.Pectoralis_minor1_cyl.Cylinder.DirectionDriver'.
Constraint #581 is above tolerance 1e-06, error = 0.019159, constr. #1 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Mus.Pectoralis_minor1_cyl.Cylinder.DirectionDriver'.
Constraint #592 is above tolerance 1e-06, error = 0.008000, constr. #1 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.HumeroUlnarJoint.Constraints'.
Constraint #593 is above tolerance 1e-06, error = 0.000001, constr. #2 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.HumeroUlnarJoint.Constraints'.
Constraint #596 is above tolerance 1e-06, error = 0.008753, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.HumeroRadialJoint.Constraints'.
Constraint #597 is above tolerance 1e-06, error = 0.006212, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.ProximalRadioUlnarJoint.Constraints'.
Constraint #598 is above tolerance 1e-06, error = 0.003221, constr. #1 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.ProximalRadioUlnarJoint.Constraints'.
Constraint #599 is above tolerance 1e-06, error = 0.003239, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.DistalRadioUlnarJoint.Constraints'.
Constraint #600 is above tolerance 1e-06, error = 0.011390, constr. #1 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.DistalRadioUlnarJoint.Constraints'.
Constraint #611 is above tolerance 1e-06, error = 0.013420, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.ScapulaAIThoraxNodeDriver'.
Constraint #613 is above tolerance 1e-06, error = 0.014308, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.ScapulaTSThoraxNodeDriver'.
Constraint #614 is above tolerance 1e-06, error = 0.000068, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.ConoideumLigamentDrv'.
Constraint #615 is above tolerance 1e-06, error = 0.003908, constr. #0 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.HandGloveLinDrv'.
Constraint #616 is above tolerance 1e-06, error = 0.006412, constr. #1 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.HandGloveLinDrv'.
Constraint #617 is above tolerance 1e-06, error = 0.000784, constr. #2 in 'Main.HumanModel.BodyModel.Left.ShoulderArm.Jnt.HandGloveLinDrv'.
Constraint #652 is above tolerance 1e-06, error = 0.034907, constr. #0 in 'Main.lumbar_move.LateralBending.rhythmL1L5'.
Constraint #653 is above tolerance 1e-06, error = 0.034907, constr. #1 in 'Main.lumbar_move.LateralBending.rhythmL1L5'.
Constraint #654 is above tolerance 1e-06, error = 0.034907, constr. #2 in 'Main.lumbar_move.LateralBending.rhythmL1L5'.
Constraint #655 is above tolerance 1e-06, error = 0.034907, constr. #3 in 'Main.lumbar_move.LateralBending.rhythmL1L5'.
Constraint #656 is above tolerance 1e-06, error = 0.034907, constr. #4 in 'Main.lumbar_move.LateralBending.rhythmL1L5'.
Constraint #657 is above tolerance 1e-06, error = 0.034907, constr. #5 in 'Main.lumbar_move.LateralBending.rhythmL1L5'.
ERROR(OBJ.MCH.KIN1) :   Thoracic.main.any(96)  :   Study.InitialConditions  :  Model is kinematically indeterminate :  

Upon further investigation, I found that the constraints after removing the rhythm and adding the driver are exactly the same as before removing the rhythm. I can't understand why it's not running.

Hello Zyax,

Usually when you have same number of DoFs and constraints, it should work, unless you miss a constraint somewhere and added extra one somewhere else.

I can see in your code that you have T12L1 drivers (3 rotational DoFs) as well :slight_smile: But in the code I wrote above, I excluded these ones.
So you should remove those, or remove the FourierDrivers in the Thoracic.main. And hopefully the kinematics should work :slight_smile:

Best regards,
Hamed

Dear Hamed,
Thank you again for your patient response. The program suddenly started working inexplicably.:face_with_spiral_eyes:

Good to hear that it works :slight_smile:
Good luck,
Hamed