A driver for the feet to remain on the ground in Plug-in-gait_MultiTrial

Hi,
I'm using Plug-in-gait_MultiTrial. I have simulated a reaching task in which both feet of the subject are statically on the ground without losing contact with the ground. There is a problem with the ankles, and I don't know how to solve it. Despite other parts of the body, the ankles are twisted and are not on the ground. I think the marker placement of the foot was not precisely at the same place with the sRelOpt of the markers, and this problem occurs because optimization in most of the directions of the foot markers is Off.
I want to know whether a predefined driver exists that keeps the feet on the ground (Something like the driver that StandingModel has). If there is not such a driver, please help me make this driver and modify my model in a way that would solve this problem. If I add this driver, how many more directions can I add to optimize the feet markers?
Here I attach a picture of the problem.

Best regards,
Mohammad reza

Hi Mohammad Reza,

You can create a constraint between a node on the foot that defines the plane and the global ref. frame that fixes the rotation of the foot:

AnyKinEq FixAnkleRot = {
AnyKinRotational FootRot = {
AnyRefFrame &ref_frame_on_foot = ...;
AnyRefFrame &global_ref_frame = ...;
... settings here ...
};
};

This will overwrite the marker-driven motion.

Another way is to add a default mannequin driver for ankle eversion to fix it using BM #define statements.
#define BM_MANNEQUIN_DRIVER_ANKLE_EVERSION_LEFT ON
This will make sure that ankle eversion is 0 (if set so in Mannequin file), but it may result in other problems. See BM defines here:
https://anyscript.org/ammr-doc/bm_config/mannequin.html

Kind regards,
Pavel

1 Like

Hi Pavel,
Thanks for your reply.
I have some questions about the piece of code you attached.
First, the problem is not only about rotational errors but also translational inaccuracy. I want to write a driver that ensures the foot will be on the ground.
Second, would you please specify the name of the nodes that I need to use? I think choosing the correct node is essential for the translational driver, and I'm not familiar with them.
Third, would you mind if I ask you to help me write the drivers more precisely? Because I'm not very familiar with these concepts yet.

Best regards,
Mohammad reza

Hi Mohammadreza,

I would have loved to help you out, but I know your problem only superficially to construct the right set of drivers. I only know the need to keep the foot on the ground, but not sure what dofs are free to move in this particular motion. And, secondly, kinematic measures and drivers are basic entities - it is best if you learn how to use them as soon as possible :slight_smile:

Basically what you want is to construct a kinematic measure to represent the dof that is supposed to be fixed or measured:
https://anyscript.org/tutorials/The_mechanical_elements/lesson4.html
And then you want to constrain this particular dof to be moving in a particular way or be fixed (see the same tutorial example). It is a good idea to browse through the tutorials, because it contains most of the examples that you need.

So, please decide which dofs are free to move and which need to be constrained. It is not necessary correct to fix the foot completely - this may or may not create problems with the kinematics of the entire body - the body may need to rotate about global Z axis (see your image). In the previous text, I made an example with a rotation to have the foot aligned with the ground, allowing the foot to slide, but you will need to add a linear measure to the same driver to constrain necessary translation.

Here is an example of a measure, where you can control degrees of freedom.

AnyKinMeasureOrg FixationMeasure ={
AnyKinLinear lin ={
AnyRefFrame &ref1=...; // insert full object name to represent global ref. frame
AnyRefFrame &ref2=...; // insert full object name for the node to be fixed
};
AnyKinRotational rot ={
AnyRefFrame &ref1=...; // insert full object name to represent global ref. frame
AnyRefFrame &ref2=...; // insert full object name for the node to be fixed
};
//
// add as many measures as needed
//
MeasureOrganizer ={2}; // translation: xyz, + rotation: zyx -> this measure reduces to the Z dof
// MeasureOrganizer ={0,1,2,3,4,5}; // full measure -> translation: xyz, + rotation: zyx (default)
};

I hope this helps. Please give it a try.

Kind regards,
Pavel

1 Like

Hi Pavel,
Thank you very much. I really appreciate your kind reply. That helped me a lot.
I had read the whole tutorial before I started to use Mocap Models. So I'm familiar with Kinematic Measures and Drivers, and I completely understand the code you sent. I had some problems implementing the Rotational Kinematic Measure, such as choosing the Type of the rotational kinematic measure and some rotation matrices that you must use to align two vectors on each other. Consequently, I tried to use three points of the foot to be constrained with the ground. With this method, both the translational and rotational misalignment vanished.
Your idea and your code helped me a lot to overcome this issue after about one month.

Best regards,
Mohammad reza

That sounds great! Good luck with the next steps!

1 Like

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.