Go Back   Forums > Self-Supported Forum > Debug model


Thread Tools Display Modes
Old 03-14-2014, 04:33 PM
matthiasverstraete matthiasverstraete is offline
Junior Member
Join Date: Mar 2014
Posts: 5
Default Squat model

Being new to AnyBody, I am trying to program a simple squat model for validation of the experiments we are running on our Oxford Knee rig. Therefore, I thought the "Demo.SliderCrank2D" would do the job. Though, I needed/wanted to modify the model on two points:

1. instead of using all types of joints, I assumed the model should do the job when only considering joints of the type "AnyRevoluteJoint". However, this overconstrains my model (21 constraints - 18 DOF).

Though, I assumed some contraints would be overlapping (e.g. with respect to the out of plane motion, x in this case). Can anyone please explain why this is not the case and AnyBody fails to solve the initial kinematics in this case?

As an alternative, I replaced (on a trial and error base) some of the "AnyRevoluteJoint" 's by a spherical joint and a CylindricalJoint. Theoretically this balances my DOF with the constraints, the model also converges: I get a solution. Though, I don't really understand why... The combination of the spherical joint (Knee) and cylindrical joint (Ball) to my opinion allows the Coupler segment to move out of the YZ-plane (which for some reason however does not happen, but I don't see any theoretical constraint to this).

2. To improve the comparability between my experiments and simulations, I would have liked to replace the rotational driver on the shaft by a linear driver on the slider. By doing so, the kinematic analysis however fails. This time, I can understand why this happens as I assume the system has at least two valid solutions for every position of the slider ('Knee' could move towards either the positive or the negative z-axis).

Therefore, I was wondering if someone could tell me if it is possible to apply additional boundary conditions to this movement (e.g. specifying a range for the knee angle, 0 - 180° for instance)?

Thanks for your comments!

Attached Files
File Type: any Demo.SliderCrank2D_V03.any (4.5 KB, 10 views)
Reply With Quote
Old 03-18-2014, 02:13 PM
mkjung9980's Avatar
mkjung9980 mkjung9980 is offline
Senior Member
Join Date: Aug 2009
Posts: 860

Dear Matthias,

1) You already had the setting for kinematically over-determinate solver as you did:
  AnyMechStudy MechStudy = {
    AnyFolder& Model = Main.SliderCrank;
    InitialConditions.SolverType = KinSolOverDeterminate;
    Kinematics.SolverType = KinSolOverDeterminate;
    Gravity = {0,0,-1}*9.81;
But if you want to make this concept working, some of the constraints in your model should be defined as 'soft' constraints.
If all the constraints are defined as 'hard' constraints, then number of DOFs(degrees of freedom ) should be as same as the number of constraints in your model always.

Regarding the movement of the coupler segments in your model:
       AnySphericalJoint Knee = {
         //Axis = x;
         AnyRefNode &CrankNode   = Main.SliderCrank.Segs.Crank.Tip;
         AnyRefNode &CouplerNode = Main.SliderCrank.Segs.Coupler.CrankNode;
       AnyCylindricalJoint Ball = {
       // I believe this should be a Spherical Joint though it refuses if this joint is set this way
         Axis = x;
         AnyRefNode &CouplerNode = Main.SliderCrank.Segs.Coupler.SliderNode;
         AnyRefNode &SliderNode  = Main.SliderCrank.Segs.Slider.SliderNode;
Coupler has relatively 3 DOFs w.r.t. the crank segment due to the spherical joint. And the coupler segment is connected to the Slider segment using cylindrical joint.
Cylidrical joint means that the rotational axes of those two segments should be always parallel. So the x axes of the 'Couplder.SliderNode' and the 'Slider.SliderNode' should be parallel.
Because of this spherical joint and the cylidrical joint, this Couplder segment should stay in the YZ-plane.

2) Regarding your second question, AnyBody tries to find the solution of the kinematics from the r0 and Axes0 values of all segments. But when I looked your model, the segments are aligned linearly.
So if you want to drive your model using the linear driver, then AnyBody may not know which solution it has to take as you pointed out('Knee' could move towards either the positive or the negative z-axis).
If you can search the keywords 'kinematics bifurcation' in google, then you may be able to find some related articles.
If you can try to change either 'r0' or 'Axes0' value of the Coupler segment then you may be able to use the linear driver instead.

3) Regarding the boundary condition of a joint, we are developing the concept of the range of the motion of any kind of kinematic measures. If that will be implemented and released in future, then you can use that.

By the way, I tried to modify you model into several different versions. For your interests.

I hope this answer may be helpful to you.

Best regards,

Moon Ki Jung, Ph.D, Application Engineer, AnyBody Technology A/S.

※ AnyScript™ Reference Manual is the bible.
※ AnyScript™ wiki page is the best supplementary information(
※ When you would upload your models, please write information about your AMS and AMMR versions.
※ If you want to get more intensive support, please update your information(profile, organization and signature).
Reply With Quote
Old 03-28-2014, 01:37 PM
matthiasverstraete matthiasverstraete is offline
Junior Member
Join Date: Mar 2014
Posts: 5

Dear Moonki

Thanks for your reply, your suggestions appeared really helpfull to me. Unfortunately, as I got through the kinematic analysis, I encountered new errors...

For the squatting motion, we experimentally apply a load from the ankle to the hip (named "AnkleLoad" in the script). This load is essentially balanced by applying a force to the quadriceps. I tried to model this by creating two sites where the quadriceps muscle is attached: one on the femur (crank, named "Q_forceApplied") and one on the tibia (coupler, named "Tuberositas"). Additionally, I set the driver in passive mode (Reaction.Type = {Off}). Unfortunately, the inverse dynamics analysis no longer run in this case, I get an error stating that the model is kinetically indeterminate. Does anyone has a suggestion here?

In an attempt to solve this issue, I tried to attach flexion/extension muscles to every joint (in the second script, V02). However, still I got the same error message so I really don't see the issue here... I got one active driver, I tried to replace this driver by one active muscle but it seems not to be that straightforward...

thanks in advance for any suggestion!

Reply With Quote
Old 04-24-2014, 11:16 AM
matthiasverstraete matthiasverstraete is offline
Junior Member
Join Date: Mar 2014
Posts: 5

Does anyone have a suggestion on these errors?

Reply With Quote
Old 04-24-2014, 03:07 PM
aalmunajjed aalmunajjed is offline
Senior Member
Join Date: Mar 2011
Posts: 633

Hi Matthias,

sorry for taking so long. This demo model uses a AnyMechStudy which requires a certain configuration of constraints and forces (You can read more about that in the reference manual.). If you switch to the AnyBodyStudy it will run. Basically, just replace AnyMechStudy with AnyBodyStudy.
Best regards, Amir

Amir Al-Munajjed, AnyBody Support

Please provide AMMR and AMS version numbers in case you send a debug model. The folder structure should follow the standard in the AMMR. This makes it a lot easier for us to answer your questions faster.

Consider to subscribe to a forum, click the 'ForumTools' link above the list of threads then select 'Subscribe to Forum'.
Reply With Quote

constraints, driver, knee, squating

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 08:38 AM.