Page 1 of 1
RRA Questions
Posted: Mon Jan 27, 2020 10:08 pm
by yangkaiwen
Hello,
I have some questions about RRA.
1. I am wondering why OpenSim (at least in 3.3) adjust model COM after RRA while only give recommended mass changes on each individual bodies? Should we adjust those masses manually? Why not make the modification along with COM?
2. After model COM and mass adjusted, is it a good practice to run RRA again by using adjusted model to track previous RRA kinematics result? I did this a couple of times and found that : if previous RRA recommend decreasing model mass, then the current RRA will increase model mass about the same amount.
Kaiwen Yang
Re: RRA Questions
Posted: Tue Jan 28, 2020 2:16 am
by mitkof6
1) RRA sometimes suggests large changes to the mass of the model. This can happen if we perform RRA out of the time interval when the ground reaction forces are applied. Visually the model might seem to fall in the ground and then goes up. In this situation, we will have large residual forces at the pelvis, therefore RRA will conclude that we will have to make large changes to the mass (e.g., 8kg). We can measure the total mass of the subject. If RRA is configured correctly and the experimental data are of high quality, then RRA should suggest very small changes to the mass of the model (e.g., 0.2kg). Therefore, it might be better for the user to decide whether to make the mass adjustment, because there might be errors caused by misconfiguration of the tool.
2) What is the suggested amount of mass change. If it is very large, then you should narrow the analysis interval to match the application of ground reaction forces.
In the work of Rajagopal et al. 2015, there is a Matlab script that automates the mass adjustment of the model. I have a similar version in Python:
Code: Select all
def adjust_model_mass(model_file, mass_change):
"""Given a required mass change adjust all body masses accordingly.
"""
rra_model = opensim.Model(model_file)
rra_model.setName('model_adjusted')
state = rra_model.initSystem()
current_mass = rra_model.getTotalMass(state)
new_mass = current_mass + mass_change
mass_scale_factor = new_mass / current_mass
for body in rra_model.updBodySet():
body.setMass(mass_scale_factor * body.getMass())
# save model with adjusted body masses
rra_model.printToXML(model_file)
Code: Select all
import re
import os
from subprocess import PIPE, run, call
os.chdir('residual_reduction_algorithm/')
rra_output = run(['opensim-cmd', 'run-tool', 'setup_rra.xml'],
stdout=PIPE, stderr=PIPE, universal_newlines=True)
print(rra_output.stdout)
# find mass change from RRA output
mass_change = float(re.findall('[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?',
re.search('Total mass change: .?[0-9]+[.][0-9]+',
rra_output.stdout).group(0))[0])
# load model and manually adjust body masses (RRA adjusts only CoM not body
# masses)
adjust_model_mass('model_adjusted.osim', mass_change)
Re: RRA Questions
Posted: Tue Jan 28, 2020 2:49 am
by yangkaiwen
Thanks, Dimitar for the reply. My time interval consists of a flight phase and a stance phase (with GRF recorded) which I think is valid as a RRA time interval.
RRA usually gives suggested mass changes around plus or minus 3-4kg among my iterative RRAs but I don't see a trend of convergence.
In supplementary material of paper " Muscle contributions to propulsion and support during running", they suggest iterative RRA using the scale tool, but I don't quite understand what they mean... What's the difference between using the scale tool with no marker adjustment and i guess scale factor 1 and adjusting the mass manually? Here is what they said:
"Residual reduction algorithm utilize CMC tool to generate a dynamically consistent torque driven simulation. To improve the dynamic consistency of the simulation RRA adjust the torso COM location and model kinematics and recommends a change to the model's total mass. To achieve optimal solution, multiple iterations of RRA wre necessary (especially for mass adjustment). At each iteration of RRA, the recommended mass adjustment were made to the adjusted model by running the scale tool with sugguested mass changes (no marker adjustment)."
Re: RRA Questions
Posted: Tue Jan 28, 2020 7:53 am
by mitkof6
3-4kg seems like a lot to me. Maybe you can further narrow the analysis interval, because in the beginning of the stance phase there is double support (assuming gait) and you might not have recording of the other leg touching the ground, resulting in large residual forces.
They probably use scaling to change the total mass of the model (new_mass = old_mass + rra_suggested_mass_change) of the subject, without repositioning the markers or adjusting the length scaling factors. This is the same as using the Python code that was provided in case that one uses scripting. In case one uses the GUI then this seems like a good workaround.
Re: RRA Questions
Posted: Tue Jan 28, 2020 7:57 pm
by yangkaiwen
Thank you Dimitar. I am analyzing a sprinting motion, so there is no double support. I think the high RRA mass changes may lie in scaling and IK error as well as large and noisy GRF data. I will redo scaling see if it gets better. Thank you for your help.