After using Moco simulation, how to extract the contact force between the sole of the foot and the ground?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Jingke Song
Posts: 34
Joined: Tue Oct 19, 2021 4:52 am

Re: After using Moco simulation, how to extract the contact force between the sole of the foot and the ground?

Post by Jingke Song » Mon Apr 03, 2023 11:30 pm

Hi Nick,

My bushingforce should have no errors, I have already conducted forward simulation verification on the Opensim GUI interface. In addition, when I set the stiffness and damping parameters of all bushingforce to 0, there will still be crashes, so I should rule out the situation where bushingforce is infinite and causes non convergence.When I switch to another computer for the same task, it still crashes.

Best,
Jingke

Tags:

User avatar
Nicholas Bianco
Posts: 992
Joined: Thu Oct 04, 2012 8:09 pm

Re: After using Moco simulation, how to extract the contact force between the sole of the foot and the ground?

Post by Nicholas Bianco » Fri Apr 07, 2023 2:00 pm

Hi Jingke,

It's possible during the optimization Moco finds an intermediate iterate for the joint configurations that leads to large bushing forces and subsequently a crash. I'm not sure about this though. I've used bushing forces in my simulations without issue in my simulations.

Could you provide more information about how the robot model is connected to the body (i.e., number of DOFs, types of joints, etc)?

-Nick

User avatar
Jingke Song
Posts: 34
Joined: Tue Oct 19, 2021 4:52 am

Re: After using Moco simulation, how to extract the contact force between the sole of the foot and the ground?

Post by Jingke Song » Sun Apr 09, 2023 8:14 am

Hi Nick,
I have now solved this problem by using ExpressionBasedBushingForce instead of BushingForce, but after repeated attempts, I still believe that there is a bug in Moco: when the exoskeleton is connected to the human body through BushingForce and there are no muscles in the model, using CoordinateActor to drive will cause a crash, and if muscle drive is used, no crash will occur.
Best,
Jingke

User avatar
Jingke Song
Posts: 34
Joined: Tue Oct 19, 2021 4:52 am

Re: After using Moco simulation, how to extract the contact force between the sole of the foot and the ground?

Post by Jingke Song » Mon Apr 10, 2023 8:19 am

Hi Nick,
Currently, I want to use the computeForce() command to calculate the amplitude of spring force SpringGeneralizedForce or CoordinateLimitForce in order to use it as the moco output goal, but the following error message occurred: The function or variable 'computeForce' is not recognized. I would like to inquire if the computeForce() command has been removed in the new version of OpenSim? If not, what is the correct way to use computeForce()? Or what other command can I use to calculate the magnitude of the force?

My program is shown below.

springForce = forceSet.get('springgeneralizedforce');
springForceObj = SpringGeneralizedForce.safeDownCast(springForce);
force = springForceObj.computeForce(State);

I look forward to your reply very much.


Best,
Jingke

User avatar
Nicholas Bianco
Posts: 992
Joined: Thu Oct 04, 2012 8:09 pm

Re: After using Moco simulation, how to extract the contact force between the sole of the foot and the ground?

Post by Nicholas Bianco » Mon Apr 10, 2023 5:02 pm

Hi Jingke,
I have now solved this problem by using ExpressionBasedBushingForce instead of BushingForce, but after repeated attempts, I still believe that there is a bug in Moco: when the exoskeleton is connected to the human body through BushingForce and there are no muscles in the model, using CoordinateActor to drive will cause a crash, and if muscle drive is used, no crash will occur.
I'm glad you found a temporary fix for this. I doubt this bug is related to Moco, but rather probably has something to do with the model itself. If you can create a reproducible example of the bug, feel free to post an issue to the opensim-core GitHub.
Currently, I want to use the computeForce() command to calculate the amplitude of spring force SpringGeneralizedForce or CoordinateLimitForce in order to use it as the moco output goal
All classes derived from Force can use "getRecordValues()" to compute forces. You can call "getRecordLabels()" to get the labels for each output in getRecordValues().

Best,
Nick

POST REPLY