I am trying to send Ground Reaction Force data to my external Python code for a separate calculation. I am using the code as shown in the attached image. However, I am getting an error which I also attached here as an image.
If I replace the GRFR in the code with a number, then the model loads successfully. It seems like GRFR is not ready when it is required for the first time. Is there a work around for this issue?
Any advice to overcome this problem is highly appreciate.
What you are trying to do will not be possible. You want to define F in AnyForce using Assistance function that should use the predicted GRF value (which is also an output of the simulation). That is, F = f(GRF). Since, GRF is a simulation output, it won't be available until the current step of the inverse dynamics analysis is completed. Whereas, the external force, F must be ready before the computation of the current step.
What you can do is use the value of GRF from the previous step. I suppose you are writing the GRF values in some file? You should be able to take the value from the previous time step from that file.