[context below]
My question is: How could I program in cpp a custom Force component where the force applied is a weighted sum of for example SmoothSphereHalfSpaceForce and ExternalForces? Do I need to redo the SmoothSphereHalfSpaceForce computation in Opensim, or is there a way to get the value of the computed force from SimTK?
My first guess is to reprogram the smoothForce in the computeForce method, but maybe I can spare that.
Context for those interested:
I wrote a custom program that can get me (reaction) forces from a FEM simulation that is controlled by a movement in Opensim.
I try to simulate the effect of changing shoe/ground condition to a runner/walker.
My aim would be to use the FEM simulation combined with Moco. As creating a new force component that runs a FEM simulation each time Moco wants to know the force is computationally extremely expensive, my idea would be to run an out-of-the-loop simulation where the reaction forces applied on the foot are a sum of something like SimTK::SmoothSphereHalfSpaceForce and ExternalForces that would be exported from the FEM simulation and the proportion of the external forces is slowly increased until they represent 100%.
The scheme could look like that (very wimplified):
1. Moco simulation with 100%*SimTK::SmoothSphereHalfSpaceForce+0%ExternalForces
-> use calculated movement to run an FEM simulation and get updated ExternalForces
2. Moco simulation with 90%*SimTK::SmoothSphereHalfSpaceForce+10%ExternalForces
-> use calculated movement to run an FEM simulation and get updated ExternalForces
...
(N-1). Moco simulation with 10%*SimTK::SmoothSphereHalfSpaceForce+90%ExternalForces
-> use calculated movement to run an FEM simulation and get updated ExternalForces
N. Moco simulation with 0%*SimTK::SmoothSphereHalfSpaceForce+100%ExternalForces
Optional question if you understand what I try to do: do you have maybe other ideas how to couple Moco with a FEM simulation?
![Smile :-)](./images/smilies/icon_e_smile.gif)
Thank you,
Robin