Indeterminacy when simulating foot movement between pedals

Dear Anybody Team,

I’m Da Fan from Jilin University, mainland China.

Recently, I was trying to simulate the driver’s right foot moving from gas pedal to brake pedal. The model was modified from a well-worked pedaling model based on seatedhuman model. Two pedals were added and four trajectory markers were also added which was referred to the Egress model in the demo. The code is seen as below. The model is attached as well.

AnyFolder FootRestFootJnt = {

AnyFolder Right = {      
  
  AnyKinLinear FootRestFootLinMeasure = {
    AnyRefFrame &FootRestRef = ...RefP.Seg.FootRest.FootRestFootJntNodeRight;
    AnyRefFrame &FootRef = ...RefH.Right.Leg.Seg.Foot.FootFootRestJntNode;
    Ref = 0;
  };
  
  AnyFixedRefFrame p1={
    Origin={0.8, -1.25, 0.1};
  AnySurfSphere sphere={Radius =.015; 
AnyDrawParamSurf drw={
  RGB =Main.DrawSettings.Colors.AnyBodyBlue;
};

};
};

  AnyFixedRefFrame p2={
    Origin={0.85,-1.2,0.15};
  AnySurfSphere sphere={Radius =.015; 
AnyDrawParamSurf drw={
  RGB =Main.DrawSettings.Colors.AnyBodyBlue;
};

};
};

  AnyFixedRefFrame p3={
    Origin={0.85,-1.2,0.2};
  AnySurfSphere sphere={Radius =.015; 
AnyDrawParamSurf drw={
  RGB =Main.DrawSettings.Colors.AnyBodyBlue;
};

};
};
AnyFixedRefFrame p4={
Origin={0.8,-1.25,0.25};
AnySurfSphere sphere={Radius =.015;
AnyDrawParamSurf drw={
RGB =Main.DrawSettings.Colors.AnyBodyBlue;
};
};
};
AnyKinPLine RightPLine ={
AnyFixedRefFrame &ref1=.p1;
AnyFixedRefFrame &ref2=.p2;
AnyFixedRefFrame &ref3=.p3;
AnyFixedRefFrame &ref4=.p4;

AnyDrawPLine drw={
Thickness=.005;
RGB =Main.DrawSettings.Colors.AnyBodyBlue;
};
};
AnyKinEqInterPolDriver FoodDriver={
AnyKinLinear &GroundJoint = .FootRestFootLinMeasure;

Type=Bspline;
BsplineOrder = 4; // This provides smooth accelerations

T = Main.Study.tEnd*{0,0.33,0.66,1.01};
Data={
{.p1.Origin[0],.p2.Origin[0],.p3.Origin[0],.p4.Origin[0]},
{.p1.Origin[1],.p2.Origin[1],.p3.Origin[1],.p4.Origin[1]},
{.p1.Origin[2],.p2.Origin[2],.p3.Origin[2],.p4.Origin[2]}
};
Reaction.Type={Off,Off,Off};
};
AnySphericalJoint FootPedal=
{
AnyRefNode &Pedal=Main.Model.EnvironmentModel.Pedal.FootNode;
AnyRefNode &Foot=Main.HumanModel.BodyModel.Right.Leg.Seg.Foot.FootBall;
}; //Right

However, errors occurred when setting initial conditions. Constrains were less than the unknowns (968 to 976). And I tried to change the constrains of ankle and knee joints, but both constrains and the unknowns decreased simultaneously. So I had no idea of how to solve this problem.
I wonder if someone could help me solve it.

Best Regards!

Da Fan

Dear Da Fan,

First, I would recommend you to use our latest version of AMMR and AMS if possible.

I could have a look on your model and tried to understand the intention of your model.

The left foot of your model would be fixed, and the right foot would move according to the path that you have defined.

But there are some conflicts in your drivers such as:
AnyKinEqInterPolDriver FoodDriver={
AnyKinLinear &GroundJoint = .FootRestFootLinMeasure;

Type=Bspline;
BsplineOrder = 4; // This provides smooth accelerations

T = Main.Study.tEnd*{0,0.33,0.66,1.01};
Data={
{.p1.Origin[0],.p2.Origin[0],.p3.Origin[0],.p4.Origin[0]},
{.p1.Origin[1],.p2.Origin[1],.p3.Origin[1],.p4.Origin[1]},
{.p1.Origin[2],.p2.Origin[2],.p3.Origin[2],.p4.Origin[2]}
};
Reaction.Type={Off,Off,Off};
};
AnySphericalJoint FootPedal=
{
AnyRefNode &Pedal=Main.Model.EnvironmentModel.Pedal.FootNo de;
AnyRefNode &Foot=Main.HumanModel.BodyModel.Right.Leg.Seg.Foot .FootBall;
}; //Right

So you try to control a point on the right foot by the path you have defined.
But you also defined a spherical joint between the pedal and the foot.

This may not work if you don’t define these drivers very carefully.

You may have to fix the ‘heel’ of your right foot somewhere.
And I would control the ‘big toe’ of the right foot instead of the ground joint.

Or, instead of using the spherical joint, you can control the ‘orientation’ of the right foot.

Please try these concepts.

Best regards,
Moonki

Dear Moonki Jung,

Many thanks to your reply. And I intended to control the ‘orientation’ of the right foot to accomplish this simulation.

However, another error occurred before that. As I mentioned in the last post, this model was based on a well-worked model in which the driver’ pedaling was simulated. When I added another pedal in this model along with its hinge joint with the ground and the driver, error occurred in inverse dynamics simulation: Muscle recruitment solver : solver aborted due to singular KKT matrix.
I tried to add force or change the reaction type but nothing worked. I really don’t know how to do with it. Could you help me solve it?

Below is the code of the pedal that I added in the model.

AnySeg AcceleratedPedal =
{
r0 = Main.Model.EnvironmentModel.GlobalRef.AcceleratedPedalNode.sRel;
Axes0 = RotMat(Main.PedalParameters.NeutralAngle, z);
Mass = 2;
Jii = {0.05, 0.001, 0.05};
AnyDrawSTL DrwSTL={
FileName=“Pedal.stl”;
ScaleXYZ = 0.01*{1, 1, 1};
};
};

AnyRevoluteJoint AcceleratedHingeJoint =
{
Axis = z;
AnyRefFrame &Ground = Main.Model.EnvironmentModel.GlobalRef.AcceleratedPedalNode;
/AnyRefFrame & Ground= Main.Model.EnvironmentModel.GlobalRef;
AnyRefNode &AcceleratedPedal = .AcceleratedPedal.AcceleratedHinge;
};

   AnyKinEqSimpleDriver AcceleratedPedal = 
  
  {
     AnyRevoluteJoint &AcceleratedHinge = Main.Model.EnvironmentModel.AcceleratedHingeJoint;
     DriverPos = {Main.PedalParameters.NeutralAngle};
     DriverVel = {0};
     Reaction.Type={Off};
  };

Dear Da Fan

If i have understood your model right it looks like you have defined a new pedal segment “AcceleratorPedal” but i did not see the code which connected the foot to this pedal?

The spherical joint is between foot and “EnvironmentModel.Pedal.FootNo de”

This means that there is nothing in the model which can carry the pedal which has a revoulte joint with a driver and no reactions.

You will need to create a joint between the pedal and foot

Best regards
Søren

Dear Soren,

Thanks for your reply.

But maybe I haven’t explained my question clearly. What I was going to do is to add an acceleration pedal in my original model. In my original model, the driver was able to depress the brake pedal. So I intended to add this acceleration pedal in order to make the model look more similar to a real car and the driver would not depress this new pedal.

However, when I only add a segment of the new pedal, the model is kinematically undetermined. So I add a hinge joint between the pedal and the ground, and add a driver to the pedal. Then the DOFs problem was fixed. But when I ran inverse dynamics, problem occured again: Muscle recruitment solver : solver aborted due to singular KKT matrix.

Maybe this is a silly question but it really bothers me for a long time. So I wonder how to solve this problem.

Regards

Da Fan

Dear Da fan,

Ok i understand…

i think you are missing a reaction force on the driver for the new pedal.

Looking at the code it says


AnyKinEqSimpleDriver AcceleratedPedal = 

{
AnyRevoluteJoint &AcceleratedHinge = Main.Model.EnvironmentModel.AcceleratedHingeJoint;
DriverPos = {Main.PedalParameters.NeutralAngle};
DriverVel = {0};
Reaction.Type={Off};
};

it should be


AnyKinEqSimpleDriver AcceleratedPedal = 
....
Reaction.Type={On};
};

otherwise you have a driver with no reaction on… and since the foot is not connected to the foot there is nothing to carry the new pedal

Best regards
Søren

Dear Søren,

Thanks for your reply.

I changed the reaction type to On, but the KKT matrix problem still occurred.

So how can I solve it?

Best Regards

Da Fan

Dear Da Fan,

I am unsure why you get this error,

Please try the following:

[ol]
[li] exclude the pedal, joint and driver for the acc pedal
[/li][li] Make sure it now runs?
[/li][li] Add it back in and rerun
[/li][/ol]

I have noticed one strange thing with your script it says

“r0 = Main.Model.EnvironmentModel.GlobalRef.AcceleratedP edalNode.sRel;”

and

“AnyRefFrame &Ground = Main.Model.EnvironmentModel.GlobalRef.AcceleratedP edalNode;”

Initially though of this to be a typo having a space would make it not loadable.

So if you still have these lines with the extra spaces, i think you code is not part of the model and are not being loaded?

Best regards
Søren