crowdAI is shutting down - please read our blog post for more information
Reinforcement learning environments with musculoskeletal models
By Stanford Neuromuscular Biomechanics Laboratory
almost 3 years ago
I am running simulations with the model you provided, but I’m working with it in a matlab-cpp framework since I had already a learning algorithm implemented in Matlab.
In some cases when I run a forward simulation the forward integration keeps running. I tried to investigate the cause of this and I found that something strange happens in the contact forces.
At a certain moment the contact force between ground and feet drops to zero and stays zero for some integration steps (at this moment there is clearly contact though). Because there is no force the foot sinks in the ground. A couple of integration steps further, the contact force peaks from zero to a huge value (because the foot sunk in the ground). This huge peak is probably the reason why the integration fails, but the cause for the force to have an interval where it is 0 is unknown to me.
almost 3 years ago |
Hi, that sounds very interesting. Can you please share some basic code, so that we can reproduce the error?
almost 3 years ago |
Just to give an idea how I am running the simulation: Below is the C++ code snippet that I use to do my forward integration(it is not truncated in 10ms intervals but it has a controller implemented). The “myPeriodicController” is an implementation of the abstract periodiceventhandler. It allows me to do one forward integration and adapt anything in the states (in our case the activations) every fixed “eventinterval” (10ms in our case).
I think it will be difficult to replicate exactly what I am having (since it will depend on the controller that I test, and in a lot of cases there is no problem). But you can reproduce the error by just running a forward simulation through the OpenSim GUI. If you open the model and drag it so that the pelvis_y coordinate is at its maximum (via the coordinate window) and next do a simulation by hitting the green button next to simulate, the model will fall down and sink a little bit in the ground. The integration will from now on proceed very slow (it will look like it does not continue). The cause is the sudden very high peak in contact force that tries to accelerate the system, that is overall governed by stiff differential equations.
If you don’t get it working immediately I can also send you .mot and .sto file with the forces acting on the system and the states of the system respectively.
If you have noticed that your forward integration is in some cases going extremely slow, this is the probable cause ;-).
// ******** SimBody**********//
Real eventinterval = 0.01;
MultibodySystem& system_ref = osimModel->updMultibodySystem();
MyPeriodicController myPeriodicController = new MyPeriodicController(eventinterval, osimModel, NN_structure);
// ******************** OpenSim***********************//
State& s = osimModel->initializeState();
initialTime = TimeVec; finalTime = TimeVec;
ForceReporter* reporter = new ForceReporter(osimModel);
Manager manager(*osimModel, integrator);
I am trying to find out in the source code of simbody why this happens. I am not sure of the cause but, I think it can be prevented that the model comes into this problematic state by increasing the stiffness of the contact.