We're experimenting with a simple arm model, based on build_and_simulate_simple_arm.m which comes with the OpenSim installation.
A TableReporter is used to report some variables, and the plots have some strange glitches in the muscle variables. This happens for both muscle models we tried; DeGrooteFregly2016 (figure 1) and Millard2012Equilibrium (figure 2). Sometimes the glitches are very large.
The glitches are very short and I suspect that the simulation is still accurate. But it makes the output look ugly, and real muscles can never produce such output, of course.
Is there a way to avoid this?
I experimented with manager.setIntegratorMaximumStepSize but that did not make a difference.
Ton van den Bogert
blips in simulated muscle variables
- Ton van den Bogert
- Posts: 164
- Joined: Thu Apr 27, 2006 11:37 am
- Ayman Habib
- Posts: 2238
- Joined: Fri Apr 01, 2005 12:24 pm
Re: blips in simulated muscle variables
Thanks for reporting, Ton.
Can you provide the modified code to get/plot the data from the TableReporter so we can reproduce (since the provided script uses a console reporter with a sparse reporting interval).
Thank you,
-Ayman
Can you provide the modified code to get/plot the data from the TableReporter so we can reproduce (since the provided script uses a console reporter with a sparse reporting interval).
Thank you,
-Ayman
- Ton van den Bogert
- Posts: 164
- Joined: Thu Apr 27, 2006 11:37 am
Re: blips in simulated muscle variables
Thanks, Ayman.
To keep the issue as simple as possible, I went back to the original simple arm example, removed the ConsoleReporter, and added the TableReporter and plotting code. See attached build_and_simulate_simple_arm_modified.m. I had to rename to .txt because the forum did not accept a .m file.
The blips are smaller but they are definitely there (see Figure below). Could it be that the reporter picks up some data from the ODE solver iterations that were not accepted as successful time steps?
Our altered model had different mass properties, muscle properties, and had wrapping cylinders, which may have increased the problem, but fundamentally I think it was already there in the original model. If anyone wants to try the altered model, I have attached those files also. Just run test.m, which calls makemodel.m. In OpenSim 4.3, this produces the plots I reported earlier. Today I tried this for the first time in OpenSim 4.4. The same code now produces the following error message:
Maybe this is a clue that the solver has difficulties.
By the way, I never saw any output from the original ConsoleReporter. I expected this to appear in the Command window, but nothing appeared. I assumed that this only works outside of Matlab.
Ton
To keep the issue as simple as possible, I went back to the original simple arm example, removed the ConsoleReporter, and added the TableReporter and plotting code. See attached build_and_simulate_simple_arm_modified.m. I had to rename to .txt because the forum did not accept a .m file.
The blips are smaller but they are definitely there (see Figure below). Could it be that the reporter picks up some data from the ODE solver iterations that were not accepted as successful time steps?
Our altered model had different mass properties, muscle properties, and had wrapping cylinders, which may have increased the problem, but fundamentally I think it was already there in the original model. If anyone wants to try the altered model, I have attached those files also. Just run test.m, which calls makemodel.m. In OpenSim 4.3, this produces the plots I reported earlier. Today I tried this for the first time in OpenSim 4.4. The same code now produces the following error message:
Code: Select all
Error detected by Simbody method AbstractIntegrator::takeOneStep(): Unable to advance time past 0.618081.
By the way, I never saw any output from the original ConsoleReporter. I expected this to appear in the Command window, but nothing appeared. I assumed that this only works outside of Matlab.
Ton
- Attachments
-
- test.txt
- (4.38 KiB) Downloaded 27 times
-
- makemodel.txt
- (6.96 KiB) Downloaded 25 times
-
- build_and_simulate_simple_arm_modified.txt
- (6.46 KiB) Downloaded 31 times